aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAriff Abdullah <ariff@FreeBSD.org>2007-06-17 15:53:11 +0000
committerAriff Abdullah <ariff@FreeBSD.org>2007-06-17 15:53:11 +0000
commitf3685841464b70256cd350a8287a28182df7a27a (patch)
tree4640d21dd225a7ddb43019db23b42261feecff03
parent846199b736cda42b20e2e195f72f0d8d867fc1e7 (diff)
Notes
-rw-r--r--sys/dev/sound/pcm/feeder.c2
-rw-r--r--sys/dev/sound/pcm/sound.c9
2 files changed, 8 insertions, 3 deletions
diff --git a/sys/dev/sound/pcm/feeder.c b/sys/dev/sound/pcm/feeder.c
index 5d3b7afa1f48f..18e509bbd4697 100644
--- a/sys/dev/sound/pcm/feeder.c
+++ b/sys/dev/sound/pcm/feeder.c
@@ -117,7 +117,7 @@ feeder_register(void *p)
/* initialize unit numbering */
snd_unit_init();
if (snd_unit < 0 || snd_unit > PCMMAXUNIT)
- snd_unit = 0;
+ snd_unit = -1;
if (snd_maxautovchans < 0 ||
snd_maxautovchans > SND_MAXVCHANS)
diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c
index 5e8924e19fb89..1b6b32f2cd76d 100644
--- a/sys/dev/sound/pcm/sound.c
+++ b/sys/dev/sound/pcm/sound.c
@@ -42,7 +42,7 @@ devclass_t pcm_devclass;
int pcm_veto_load = 1;
#ifdef USING_DEVFS
-int snd_unit = 0;
+int snd_unit = -1;
TUNABLE_INT("hw.snd.default_unit", &snd_unit);
#endif
@@ -801,6 +801,9 @@ pcm_setstatus(device_t dev, char *str)
pcm_unlock(d);
+ if (snd_unit < 0)
+ snd_unit = device_get_unit(dev);
+
return (0);
}
@@ -1199,8 +1202,10 @@ pcm_unregister(device_t dev)
if (snd_unit == device_get_unit(dev)) {
/*
- * Reassign default unit to the next available dev.
+ * Reassign default unit to the next available dev, but
+ * first, reset snd_unit to something ridiculous.
*/
+ snd_unit = -1;
for (i = 0; pcm_devclass != NULL &&
i < devclass_get_maxunit(pcm_devclass); i++) {
if (device_get_unit(dev) == i)