Page MenuHomeFreeBSD

D50386.diff
No OneTemporary

D50386.diff

diff --git a/sys/dev/sound/dummy.c b/sys/dev/sound/dummy.c
--- a/sys/dev/sound/dummy.c
+++ b/sys/dev/sound/dummy.c
@@ -65,6 +65,7 @@
struct dummy_chan chans[DUMMY_NCHAN];
struct callout callout;
struct mtx *lock;
+ bool stopped;
};
static bool
@@ -92,6 +93,9 @@
struct dummy_chan *ch;
int i = 0;
+ if (sc->stopped)
+ return;
+
/* Do not reschedule if no channel is running. */
if (!dummy_active(sc))
return;
@@ -108,7 +112,8 @@
chn_intr(ch->chan);
snd_mtxlock(sc->lock);
}
- callout_schedule(&sc->callout, 1);
+ if (!sc->stopped)
+ callout_schedule(&sc->callout, 1);
}
static int
@@ -195,6 +200,11 @@
snd_mtxlock(sc->lock);
+ if (sc->stopped) {
+ snd_mtxunlock(sc->lock);
+ return (0);
+ }
+
switch (go) {
case PCMTRIG_START:
ch->ptr = 0;
@@ -345,8 +355,11 @@
struct dummy_softc *sc = device_get_softc(dev);
int err;
- err = pcm_unregister(dev);
+ snd_mtxlock(sc->lock);
+ sc->stopped = true;
+ snd_mtxunlock(sc->lock);
callout_drain(&sc->callout);
+ err = pcm_unregister(dev);
snd_mtxfree(sc->lock);
return (err);

File Metadata

Mime Type
text/plain
Expires
Fri, Feb 13, 2:45 AM (2 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28672846
Default Alt Text
D50386.diff (1 KB)

Event Timeline