diff options
| author | isaki <isaki@NetBSD.org> | 2017-09-30 05:37:55 +0000 |
|---|---|---|
| committer | isaki <isaki@NetBSD.org> | 2017-09-30 05:37:55 +0000 |
| commit | 7b243ec09ced9d0ec91fc5b2a3c3faed33ac9f85 (patch) | |
| tree | 3db58abea1106ce9b77d479b7b3669bd52f25339 /sys/dev | |
| parent | 881631c33c5185c1bc57f9f2d2820b762433417d (diff) | |
Improve logic in audio_initbufs(). No functional changes intended.
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/audio.c | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/sys/dev/audio.c b/sys/dev/audio.c index 22b7fdae6d6..f7e1973ec01 100644 --- a/sys/dev/audio.c +++ b/sys/dev/audio.c @@ -1,4 +1,4 @@ -/* $NetBSD: audio.c,v 1.408 2017/09/26 04:34:59 nat Exp $ */ +/* $NetBSD: audio.c,v 1.409 2017/09/30 05:37:55 isaki Exp $ */ /*- * Copyright (c) 2016 Nathanial Sloss <nathanialsloss@yahoo.com.au> @@ -148,7 +148,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.408 2017/09/26 04:34:59 nat Exp $"); +__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.409 2017/09/30 05:37:55 isaki Exp $"); #ifdef _KERNEL_OPT #include "audio.h" @@ -2027,12 +2027,14 @@ audio_initbufs(struct audio_softc *sc, struct virtual_channel *vc) ((vc->sc_open & AUOPEN_READ) || vc == sc->sc_hwvc)) { audio_init_ringbuffer(sc, &vc->sc_mrr, AUMODE_RECORD); - if (sc->sc_opens == 0 && hw->init_input && - (vc->sc_mode & AUMODE_RECORD)) { - error = hw->init_input(sc->hw_hdl, vc->sc_mrr.s.start, - vc->sc_mrr.s.end - vc->sc_mrr.s.start); - if (error) - return error; + if (sc->sc_opens == 0 && (vc->sc_mode & AUMODE_RECORD)) { + if (hw->init_input) { + error = hw->init_input(sc->hw_hdl, + vc->sc_mrr.s.start, + vc->sc_mrr.s.end - vc->sc_mrr.s.start); + if (error) + return error; + } } } @@ -2041,12 +2043,14 @@ audio_initbufs(struct audio_softc *sc, struct virtual_channel *vc) audio_init_ringbuffer(sc, &vc->sc_mpr, AUMODE_PLAY); vc->sc_sil_count = 0; - if (sc->sc_opens == 0 && hw->init_output && - (vc->sc_mode & AUMODE_PLAY)) { - error = hw->init_output(sc->hw_hdl, vc->sc_mpr.s.start, - vc->sc_mpr.s.end - vc->sc_mpr.s.start); - if (error) - return error; + if (sc->sc_opens == 0 && (vc->sc_mode & AUMODE_PLAY)) { + if (hw->init_output) { + error = hw->init_output(sc->hw_hdl, + vc->sc_mpr.s.start, + vc->sc_mpr.s.end - vc->sc_mpr.s.start); + if (error) + return error; + } } } |
