Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/sbus use config_finalize_register() instead of confi...



details:   https://anonhg.NetBSD.org/src/rev/ea9f33762bd1
branches:  trunk
changeset: 760687:ea9f33762bd1
user:      macallan <macallan%NetBSD.org@localhost>
date:      Tue Jan 11 00:49:50 2011 +0000

description:
use config_finalize_register() instead of config_interrupts() to detect the
codec and attach audio. For some reason we run into a locking panic with
config_interrupts().
Tested on my SS20

diffstat:

 sys/dev/sbus/dbri.c    |  20 +++++++++++++-------
 sys/dev/sbus/dbrivar.h |   3 ++-
 2 files changed, 15 insertions(+), 8 deletions(-)

diffs (87 lines):

diff -r a1bb4086a230 -r ea9f33762bd1 sys/dev/sbus/dbri.c
--- a/sys/dev/sbus/dbri.c       Tue Jan 11 00:45:04 2011 +0000
+++ b/sys/dev/sbus/dbri.c       Tue Jan 11 00:49:50 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dbri.c,v 1.31 2010/02/24 22:38:08 dyoung Exp $ */
+/*     $NetBSD: dbri.c,v 1.32 2011/01/11 00:49:50 macallan Exp $       */
 
 /*
  * Copyright (C) 1997 Rudolf Koenig (rfkoenig%immd4.informatik.uni-erlangen.de@localhost)
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dbri.c,v 1.31 2010/02/24 22:38:08 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dbri.c,v 1.32 2011/01/11 00:49:50 macallan Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -96,7 +96,7 @@
 static void    dbri_attach_sbus(device_t, device_t, void *);
 static int     dbri_match_sbus(device_t, cfdata_t, void *);
 
-static void    dbri_config_interrupts(device_t);
+static int     dbri_config_interrupts(device_t);
 
 /* interrupt handler */
 static int     dbri_intr(void *);
@@ -378,7 +378,8 @@
        sc->sc_refcount = 0;
        sc->sc_playing = 0;
        sc->sc_recording = 0;
-       config_interrupts(self, &dbri_config_interrupts);
+       sc->sc_init_done = 0;
+       config_finalize_register(self, &dbri_config_interrupts);
 
        return;
 }
@@ -441,16 +442,21 @@
        mmcodec_setgain(sc, 0);
 }
 
-static void
+static int
 dbri_config_interrupts(device_t dev)
 {
        struct dbri_softc *sc = device_private(dev);
 
+       if (sc->sc_init_done != 0)
+               return 0;
+
+       sc->sc_init_done = 1;
+
        dbri_init(sc);
        if (mmcodec_init(sc) == -1) {
                printf("%s: no codec detected, aborting\n",
                    device_xname(dev));
-               return;
+               return 0;
        }
 
        /* Attach ourselves to the high level audio interface */
@@ -458,7 +464,7 @@
 
        /* power down until open() */
        dbri_set_power(sc, 0);
-       return;
+       return 0;
 }
 
 static int
diff -r a1bb4086a230 -r ea9f33762bd1 sys/dev/sbus/dbrivar.h
--- a/sys/dev/sbus/dbrivar.h    Tue Jan 11 00:45:04 2011 +0000
+++ b/sys/dev/sbus/dbrivar.h    Tue Jan 11 00:49:50 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dbrivar.h,v 1.11 2009/09/17 16:28:12 tsutsui Exp $     */
+/*     $NetBSD: dbrivar.h,v 1.12 2011/01/11 00:49:50 macallan Exp $    */
 
 /*
  * Copyright (C) 1997 Rudolf Koenig (rfkoenig%immd4.informatik.uni-erlangen.de@localhost)
@@ -124,6 +124,7 @@
        bus_dma_segment_t sc_dmaseg;
        
        int             sc_have_powerctl;
+       int             sc_init_done;
        int             sc_powerstate;  /* DBRI's powered up or not */
        int             sc_pmgrstate;   /* PWR_RESUME etc. */
        int             sc_burst;       /* DVMA burst size in effect */



Home | Main Index | Thread Index | Old Index