Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177862248
D47459.1795456086.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D47459.1795456086.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
@@ -74,8 +74,6 @@
struct dummy_chan *ch;
int i = 0;
- snd_mtxlock(sc->lock);
-
for (i = 0; i < sc->chnum; i++) {
ch = &sc->chans[i];
if (!ch->run)
@@ -89,8 +87,6 @@
snd_mtxlock(sc->lock);
}
callout_schedule(&sc->callout, 1);
-
- snd_mtxunlock(sc->lock);
}
static int
@@ -179,16 +175,14 @@
switch (go) {
case PCMTRIG_START:
- if (!callout_active(&sc->callout))
- callout_reset(&sc->callout, 1, dummy_chan_io, sc);
+ callout_reset(&sc->callout, 1, dummy_chan_io, sc);
ch->ptr = 0;
ch->run = 1;
break;
case PCMTRIG_STOP:
case PCMTRIG_ABORT:
ch->run = 0;
- if (callout_active(&sc->callout))
- callout_stop(&sc->callout);
+ callout_stop(&sc->callout);
default:
break;
}
@@ -292,6 +286,7 @@
sc = device_get_softc(dev);
sc->dev = dev;
sc->lock = snd_mtxcreate(device_get_nameunit(dev), "snd_dummy softc");
+ callout_init_mtx(&sc->callout, sc->lock, 0);
sc->cap_fmts[0] = SND_FORMAT(AFMT_S32_LE, 2, 0);
sc->cap_fmts[1] = SND_FORMAT(AFMT_S24_LE, 2, 0);
@@ -316,7 +311,6 @@
if (pcm_register(dev, status))
return (ENXIO);
mixer_init(dev, &dummy_mixer_class, sc);
- callout_init(&sc->callout, 1);
return (0);
}
@@ -327,6 +321,9 @@
struct dummy_softc *sc = device_get_softc(dev);
int err;
+ snd_mtxlock(sc->lock);
+ callout_stop(&sc->callout);
+ snd_mtxunlock(sc->lock);
callout_drain(&sc->callout);
err = pcm_unregister(dev);
snd_mtxfree(sc->lock);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 23, 5:48 PM (23 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41936165
Default Alt Text
D47459.1795456086.diff (1 KB)
Attached To
Mode
D47459: snd_dummy: Fix callout(9) races
Attached
Detach File
Event Timeline