Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev Improve logic in audio_initbufs(). No functional ch...



details:   https://anonhg.NetBSD.org/src/rev/9a926a16b5ab
branches:  trunk
changeset: 356500:9a926a16b5ab
user:      isaki <isaki%NetBSD.org@localhost>
date:      Sat Sep 30 05:37:55 2017 +0000

description:
Improve logic in audio_initbufs().  No functional changes intended.

diffstat:

 sys/dev/audio.c |  32 ++++++++++++++++++--------------
 1 files changed, 18 insertions(+), 14 deletions(-)

diffs (60 lines):

diff -r 2ff80a935cf9 -r 9a926a16b5ab sys/dev/audio.c
--- a/sys/dev/audio.c   Sat Sep 30 04:07:04 2017 +0000
+++ b/sys/dev/audio.c   Sat Sep 30 05:37:55 2017 +0000
@@ -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@localhost>
@@ -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 @@
                ((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_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;
+                       }
                }
        }
 



Home | Main Index | Thread Index | Old Index