Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/sbus Remove something like counters.



details:   https://anonhg.NetBSD.org/src/rev/75229914a1e2
branches:  trunk
changeset: 959250:75229914a1e2
user:      isaki <isaki%NetBSD.org@localhost>
date:      Sat Feb 06 09:15:11 2021 +0000

description:
Remove something like counters.
- Counting {open,close} is done by the MI audio layer.
- trigger_* is not called again between trigger_* and halt_*.

diffstat:

 sys/dev/sbus/dbri.c    |  33 ++++++++++-----------------------
 sys/dev/sbus/dbrivar.h |   3 +--
 2 files changed, 11 insertions(+), 25 deletions(-)

diffs (109 lines):

diff -r 271846cba2ca -r 75229914a1e2 sys/dev/sbus/dbri.c
--- a/sys/dev/sbus/dbri.c       Sat Feb 06 09:14:03 2021 +0000
+++ b/sys/dev/sbus/dbri.c       Sat Feb 06 09:15:11 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dbri.c,v 1.43 2020/08/25 13:36:41 skrll Exp $  */
+/*     $NetBSD: dbri.c,v 1.44 2021/02/06 09:15:11 isaki Exp $  */
 
 /*
  * Copyright (C) 1997 Rudolf Koenig (rfkoenig%immd4.informatik.uni-erlangen.de@localhost)
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dbri.c,v 1.43 2020/08/25 13:36:41 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dbri.c,v 1.44 2021/02/06 09:15:11 isaki Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -368,7 +368,6 @@
 
        sc->sc_locked = 0;
        sc->sc_desc_used = 0;
-       sc->sc_refcount = 0;
        sc->sc_playing = 0;
        sc->sc_recording = 0;
        sc->sc_init_done = 0;
@@ -1894,8 +1893,7 @@
        struct dbri_softc *sc = hdl;
        unsigned long count, num;
 
-       if (sc->sc_playing)
-               return 0;
+       KASSERT(sc->sc_playing == 0);
 
        count = (unsigned long)(((char *)end - (char *)start));
        num = count / blksize;
@@ -1937,8 +1935,7 @@
        struct dbri_softc *sc = hdl;
        unsigned long count, num;
 
-       if (sc->sc_recording)
-               return 0;
+       KASSERT(sc->sc_recording == 0);
 
        count = (unsigned long)(((char *)end - (char *)start));
        num = count / blksize;
@@ -2051,14 +2048,9 @@
 {
        struct dbri_softc *sc = cookie;
 
-       DPRINTF("%s: %d\n", __func__, sc->sc_refcount);
+       DPRINTF("%s\n", __func__);
 
-       if (sc->sc_refcount == 0) {
-               dbri_bring_up(sc);
-       }
-
-       sc->sc_refcount++;
-
+       dbri_bring_up(sc);
        return 0;
 }
 
@@ -2067,16 +2059,11 @@
 {
        struct dbri_softc *sc = cookie;
 
-       DPRINTF("%s: %d\n", __func__, sc->sc_refcount);
-
-       sc->sc_refcount--;
-       KASSERT(sc->sc_refcount >= 0);
-       if (sc->sc_refcount > 0)
-               return;
+       DPRINTF("%s\n", __func__);
+       KASSERT(sc->sc_playing == 0);
+       KASSERT(sc->sc_recording == 0);
 
        dbri_set_power(sc, 0);
-       sc->sc_playing = 0;
-       sc->sc_recording = 0;
 }
 
 static bool
@@ -2097,7 +2084,7 @@
 
        if (sc->sc_powerstate != 0)
                return true;
-       aprint_verbose("resume: %d\n", sc->sc_refcount);
+       aprint_verbose("resume\n");
        if (sc->sc_playing) {
                volatile uint32_t *cmd;
 
diff -r 271846cba2ca -r 75229914a1e2 sys/dev/sbus/dbrivar.h
--- a/sys/dev/sbus/dbrivar.h    Sat Feb 06 09:14:03 2021 +0000
+++ b/sys/dev/sbus/dbrivar.h    Sat Feb 06 09:15:11 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dbrivar.h,v 1.16 2019/05/08 13:40:19 isaki Exp $       */
+/*     $NetBSD: dbrivar.h,v 1.17 2021/02/06 09:15:11 isaki Exp $       */
 
 /*
  * Copyright (C) 1997 Rudolf Koenig (rfkoenig%immd4.informatik.uni-erlangen.de@localhost)
@@ -140,7 +140,6 @@
 
        int             sc_waitseen;
 
-       int             sc_refcount;
        int             sc_playing;
        int             sc_recording;
 



Home | Main Index | Thread Index | Old Index