Module Name: src Committed By: isaki Date: Sat Feb 6 09:15:11 UTC 2021
Modified Files: src/sys/dev/sbus: dbri.c dbrivar.h Log Message: Remove something like counters. - Counting {open,close} is done by the MI audio layer. - trigger_* is not called again between trigger_* and halt_*. To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/sys/dev/sbus/dbri.c cvs rdiff -u -r1.16 -r1.17 src/sys/dev/sbus/dbrivar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/sbus/dbri.c diff -u src/sys/dev/sbus/dbri.c:1.43 src/sys/dev/sbus/dbri.c:1.44 --- src/sys/dev/sbus/dbri.c:1.43 Tue Aug 25 13:36:41 2020 +++ src/sys/dev/sbus/dbri.c Sat Feb 6 09:15:11 2021 @@ -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 (rfkoe...@immd4.informatik.uni-erlangen.de) @@ -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 @@ dbri_attach_sbus(device_t parent, device 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 @@ dbri_trigger_output(void *hdl, void *sta 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 @@ dbri_trigger_input(void *hdl, void *star 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 @@ dbri_open(void *cookie, int flags) { struct dbri_softc *sc = cookie; - DPRINTF("%s: %d\n", __func__, sc->sc_refcount); - - if (sc->sc_refcount == 0) { - dbri_bring_up(sc); - } - - sc->sc_refcount++; + DPRINTF("%s\n", __func__); + dbri_bring_up(sc); return 0; } @@ -2067,16 +2059,11 @@ dbri_close(void *cookie) { 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 @@ dbri_resume(device_t self, const pmf_qua 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; Index: src/sys/dev/sbus/dbrivar.h diff -u src/sys/dev/sbus/dbrivar.h:1.16 src/sys/dev/sbus/dbrivar.h:1.17 --- src/sys/dev/sbus/dbrivar.h:1.16 Wed May 8 13:40:19 2019 +++ src/sys/dev/sbus/dbrivar.h Sat Feb 6 09:15:11 2021 @@ -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 (rfkoe...@immd4.informatik.uni-erlangen.de) @@ -140,7 +140,6 @@ struct dbri_softc { int sc_waitseen; - int sc_refcount; int sc_playing; int sc_recording;