Source-Changes-HG archive

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

[src/isaki-audio2]: src/sys Remove simple flags that indicate whether the dev...



details:   https://anonhg.NetBSD.org/src/rev/c1b7f15d86a8
branches:  isaki-audio2
changeset: 451018:c1b7f15d86a8
user:      isaki <isaki%NetBSD.org@localhost>
date:      Sat May 04 04:51:20 2019 +0000

description:
Remove simple flags that indicate whether the device is opened.
These are handled in the upper layer now.

diffstat:

 sys/arch/amiga/dev/aucc.c                 |  13 ++-----------
 sys/arch/evbarm/mini2440/audio_mini2440.c |  14 +-------------
 sys/arch/hppa/gsc/harmony.c               |  17 +----------------
 sys/arch/hppa/gsc/harmonyvar.h            |   3 +--
 sys/dev/ic/arcofi.c                       |  17 ++---------------
 sys/dev/ic/arcofivar.h                    |   3 +--
 6 files changed, 8 insertions(+), 59 deletions(-)

diffs (243 lines):

diff -r 29250b8b729d -r c1b7f15d86a8 sys/arch/amiga/dev/aucc.c
--- a/sys/arch/amiga/dev/aucc.c Sat May 04 04:44:03 2019 +0000
+++ b/sys/arch/amiga/dev/aucc.c Sat May 04 04:51:20 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: aucc.c,v 1.44.2.1 2019/04/21 09:33:54 isaki Exp $ */
+/*     $NetBSD: aucc.c,v 1.44.2.2 2019/05/04 04:51:20 isaki Exp $ */
 
 /*
  * Copyright (c) 1999 Bernardo Innocenti
@@ -46,7 +46,7 @@
 #if NAUCC > 0
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: aucc.c,v 1.44.2.1 2019/04/21 09:33:54 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aucc.c,v 1.44.2.2 2019/05/04 04:51:20 isaki Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -98,7 +98,6 @@
  * Software state.
  */
 struct aucc_softc {
-       int     sc_open;                /* single use device */
        aucc_data_t sc_channel[4];      /* per channel freq, ... */
        u_int   sc_encoding;            /* encoding AUDIO_ENCODING_.*/
        int     sc_channels;            /* # of channels used */
@@ -312,9 +311,6 @@
        sc = addr;
        DPRINTF(("sa_open: unit %p\n",sc));
 
-       if (sc->sc_open)
-               return EBUSY;
-       sc->sc_open = 1;
        for (i = 0; i < AUCC_MAXINT; i++) {
                sc->sc_channel[i].nd_intr = NULL;
                sc->sc_channel[i].nd_intrdata = NULL;
@@ -330,11 +326,6 @@
 void
 aucc_close(void *addr)
 {
-       struct aucc_softc *sc;
-
-       sc = addr;
-       DPRINTF(("sa_close: sc=%p\n", sc));
-       sc->sc_open = 0;
 
        DPRINTF(("sa_close: closed.\n"));
 }
diff -r 29250b8b729d -r c1b7f15d86a8 sys/arch/evbarm/mini2440/audio_mini2440.c
--- a/sys/arch/evbarm/mini2440/audio_mini2440.c Sat May 04 04:44:03 2019 +0000
+++ b/sys/arch/evbarm/mini2440/audio_mini2440.c Sat May 04 04:51:20 2019 +0000
@@ -66,8 +66,6 @@
        s3c2440_i2s_buf_t       sc_rec_buf;
 
        void                    *sc_i2s_handle;
-
-       bool                    sc_open;
 };
 
 int    uda_ssio_open(void *, int);
@@ -161,7 +159,6 @@
 
        sc->sc_play_buf = NULL;
        sc->sc_i2s_handle = aa->i2sa_handle;
-       sc->sc_open = false;
 
        mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_NONE);
        mutex_init(&sc->sc_intr_lock, MUTEX_DEFAULT, IPL_SCHED);
@@ -211,15 +208,10 @@
 int
 uda_ssio_open(void *handle, int flags)
 {
-       struct uda1341_softc *uc = handle;
-       struct uda_softc *sc = uc->parent;
        int retval;
 
        DPRINTF(("%s\n", __func__));
 
-       if (sc->sc_open)
-               return EBUSY;
-
        /* We only support write operations */
        if (!(flags & FREAD) && !(flags & FWRITE))
                return EINVAL;
@@ -233,20 +225,16 @@
                return retval;
        }
 
-       sc->sc_open = true;
-
        return 0; /* SUCCESS */
 }
 
 void
 uda_ssio_close(void *handle)
 {
-       struct uda1341_softc *uc = handle;
-       struct uda_softc *sc = uc->parent;
+
        DPRINTF(("%s\n", __func__));
 
        uda1341_close(handle);
-       sc->sc_open = false;
 }
 
 int
diff -r 29250b8b729d -r c1b7f15d86a8 sys/arch/hppa/gsc/harmony.c
--- a/sys/arch/hppa/gsc/harmony.c       Sat May 04 04:44:03 2019 +0000
+++ b/sys/arch/hppa/gsc/harmony.c       Sat May 04 04:51:20 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: harmony.c,v 1.5.2.1 2019/04/21 10:11:44 isaki Exp $    */
+/*     $NetBSD: harmony.c,v 1.5.2.2 2019/05/04 04:51:20 isaki Exp $    */
 
 /*     $OpenBSD: harmony.c,v 1.23 2004/02/13 21:28:19 mickey Exp $     */
 
@@ -89,7 +89,6 @@
 #include <hppa/gsc/harmonyreg.h>
 #include <hppa/gsc/harmonyvar.h>
 
-int    harmony_open(void *, int);
 void   harmony_close(void *);
 int    harmony_query_format(void *, audio_format_query_t *);
 int    harmony_set_format(void *, int,
@@ -117,7 +116,6 @@
 void   harmony_get_locks(void *, kmutex_t **, kmutex_t **);
 
 const struct audio_hw_if harmony_sa_hw_if = {
-       .open                   = harmony_open,
        .close                  = harmony_close,
        .query_format           = harmony_query_format,
        .set_format             = harmony_set_format,
@@ -420,18 +418,6 @@
        SYNC_REG(sc, HARMONY_DSTATUS, BUS_SPACE_BARRIER_WRITE);
 }
 
-int
-harmony_open(void *vsc, int flags)
-{
-       struct harmony_softc *sc;
-
-       sc = vsc;
-       if (sc->sc_open)
-               return EBUSY;
-       sc->sc_open = 1;
-       return 0;
-}
-
 void
 harmony_close(void *vsc)
 {
@@ -439,7 +425,6 @@
 
        sc = vsc;
        harmony_intr_disable(sc);
-       sc->sc_open = 0;
 }
 
 int
diff -r 29250b8b729d -r c1b7f15d86a8 sys/arch/hppa/gsc/harmonyvar.h
--- a/sys/arch/hppa/gsc/harmonyvar.h    Sat May 04 04:44:03 2019 +0000
+++ b/sys/arch/hppa/gsc/harmonyvar.h    Sat May 04 04:51:20 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: harmonyvar.h,v 1.1.38.1 2019/04/21 10:11:44 isaki Exp $        */
+/*     $NetBSD: harmonyvar.h,v 1.1.38.2 2019/05/04 04:51:20 isaki Exp $        */
 
 /*     $OpenBSD: harmonyvar.h,v 1.8 2003/08/15 13:25:53 mickey Exp $   */
 
@@ -87,7 +87,6 @@
        bus_dma_tag_t sc_dmat;
        bus_space_tag_t sc_bt;
        bus_space_handle_t sc_bh;
-       int sc_open;
        uint32_t sc_cntlbits;
        int sc_need_commit;
        int sc_playback_empty;
diff -r 29250b8b729d -r c1b7f15d86a8 sys/dev/ic/arcofi.c
--- a/sys/dev/ic/arcofi.c       Sat May 04 04:44:03 2019 +0000
+++ b/sys/dev/ic/arcofi.c       Sat May 04 04:51:20 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: arcofi.c,v 1.1.28.4 2019/05/04 04:13:24 isaki Exp $    */
+/*     $NetBSD: arcofi.c,v 1.1.28.5 2019/05/04 04:51:20 isaki Exp $    */
 /*     $OpenBSD: arcofi.c,v 1.6 2013/05/15 08:29:24 ratchov Exp $      */
 
 /*
@@ -199,7 +199,6 @@
 static int     arcofi_xmit_data(struct arcofi_softc *);
 
 static int     arcofi_open(void *, int);
-static void    arcofi_close(void *);
 static int     arcofi_query_format(void *, audio_format_query_t *);
 static int     arcofi_set_format(void *, int,
                    const audio_params_t *, const audio_params_t *,
@@ -222,7 +221,6 @@
 
 static const struct audio_hw_if arcofi_hw_if = {
        .open             = arcofi_open,
-       .close            = arcofi_close,
        .query_format     = arcofi_query_format,
        .set_format       = arcofi_set_format,
        .round_blocksize  = arcofi_round_blocksize,
@@ -318,24 +316,13 @@
 static int
 arcofi_open(void *v, int flags)
 {
-       struct arcofi_softc *sc = (struct arcofi_softc *)v;
+       struct arcofi_softc *sc __diagused = (struct arcofi_softc *)v;
 
-       if (sc->sc_open)
-               return EBUSY;
-       sc->sc_open = 1;
        KASSERT(sc->sc_mode == 0);
 
        return 0;
 }
 
-static void
-arcofi_close(void *v)
-{
-       struct arcofi_softc *sc = (struct arcofi_softc *)v;
-
-       sc->sc_open = 0;
-}
-
 static int
 arcofi_query_format(void *v, audio_format_query_t *afp)
 {
diff -r 29250b8b729d -r c1b7f15d86a8 sys/dev/ic/arcofivar.h
--- a/sys/dev/ic/arcofivar.h    Sat May 04 04:44:03 2019 +0000
+++ b/sys/dev/ic/arcofivar.h    Sat May 04 04:51:20 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: arcofivar.h,v 1.1.28.1 2019/04/21 06:55:34 isaki Exp $ */
+/*     $NetBSD: arcofivar.h,v 1.1.28.2 2019/05/04 04:51:20 isaki Exp $ */
 /*     $OpenBSD: arcofivar.h,v 1.2 2011/12/25 00:07:27 miod Exp $      */
 
 /*
@@ -27,7 +27,6 @@
 
        struct audio_device     sc_audio_device;
 
-       int                     sc_open;
        int                     sc_mode;
 
        struct {



Home | Main Index | Thread Index | Old Index