Module Name: src
Committed By: macallan
Date: Tue Jan 11 00:49:50 UTC 2011
Modified Files:
src/sys/dev/sbus: dbri.c dbrivar.h
Log Message:
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
To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/sbus/dbri.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/sbus/dbrivar.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/sbus/dbri.c
diff -u src/sys/dev/sbus/dbri.c:1.31 src/sys/dev/sbus/dbri.c:1.32
--- src/sys/dev/sbus/dbri.c:1.31 Wed Feb 24 22:38:08 2010
+++ src/sys/dev/sbus/dbri.c Tue Jan 11 00:49:50 2011
@@ -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 ([email protected])
@@ -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
Index: src/sys/dev/sbus/dbrivar.h
diff -u src/sys/dev/sbus/dbrivar.h:1.11 src/sys/dev/sbus/dbrivar.h:1.12
--- src/sys/dev/sbus/dbrivar.h:1.11 Thu Sep 17 16:28:12 2009
+++ src/sys/dev/sbus/dbrivar.h Tue Jan 11 00:49:50 2011
@@ -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 ([email protected])
@@ -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 */