Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144749465
D50386.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D50386.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D50386: snd_dummy: Make callout stopping more robust
Attached
Detach File
Event Timeline
Log In to Comment