diff options
author | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2017-11-23 06:07:56 +0000 |
---|---|---|
committer | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2017-11-23 06:07:56 +0000 |
commit | a83358249f75011738b4fd06af46b8ed0a969a08 (patch) | |
tree | 0d33a8f5cf8c328b79ce31ca19e81c84fcc283bf /sys/dev/audio.c | |
parent | 26dc4cfd0de33250dde073289b3beac6893c59a3 (diff) |
No need to grab the audio lock to call audio_canstart() as it checks
whether the device is started before using structures shared with the
interrupt handler. From Michael W. Bombardieri, tested by me.
Diffstat (limited to 'sys/dev/audio.c')
-rw-r--r-- | sys/dev/audio.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/sys/dev/audio.c b/sys/dev/audio.c index 079ce7a215d..f8a94bb414e 100644 --- a/sys/dev/audio.c +++ b/sys/dev/audio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: audio.c,v 1.165 2017/06/26 07:02:16 ratchov Exp $ */ +/* $OpenBSD: audio.c,v 1.166 2017/11/23 06:07:55 ratchov Exp $ */ /* * Copyright (c) 2015 Alexandre Ratchov <alex@caoua.org> * @@ -1358,15 +1358,14 @@ audio_read(struct audio_softc *sc, struct uio *uio, int ioflag) tsleep(&sc->quiesce, 0, "au_qrd", 0); /* start automatically if audio_ioc_start() was never called */ - mtx_enter(&audio_lock); if (audio_canstart(sc)) { - mtx_leave(&audio_lock); error = audio_start(sc); if (error) return error; - mtx_enter(&audio_lock); } + mtx_enter(&audio_lock); + /* if there is no data then sleep */ while (sc->rec.used == 0) { if (ioflag & IO_NDELAY) { |