Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/audio Remove incorrect KASSERT(!mutex_owned()).



details:   https://anonhg.NetBSD.org/src/rev/2a30ba2867f9
branches:  trunk
changeset: 744869:2a30ba2867f9
user:      isaki <isaki%NetBSD.org@localhost>
date:      Sat Feb 15 02:47:00 2020 +0000

description:
Remove incorrect KASSERT(!mutex_owned()).
Pointed out by riastradh@.

diffstat:

 sys/dev/audio/audio.c |  46 +++++++++++++++++++++++++---------------------
 1 files changed, 25 insertions(+), 21 deletions(-)

diffs (183 lines):

diff -r 6fb060e418fa -r 2a30ba2867f9 sys/dev/audio/audio.c
--- a/sys/dev/audio/audio.c     Sat Feb 15 02:14:02 2020 +0000
+++ b/sys/dev/audio/audio.c     Sat Feb 15 02:47:00 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audio.c,v 1.41 2020/01/11 04:53:10 isaki Exp $ */
+/*     $NetBSD: audio.c,v 1.42 2020/02/15 02:47:00 isaki Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -142,7 +142,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.41 2020/01/11 04:53:10 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.42 2020/02/15 02:47:00 isaki Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -1363,14 +1363,13 @@
 /*
  * Acquire sc_lock and enter exlock critical section.
  * If successful, it returns 0.  Otherwise returns errno.
+ * Must be called without sc_lock held.
  */
 static int
 audio_enter_exclusive(struct audio_softc *sc)
 {
        int error;
 
-       KASSERT(!mutex_owned(sc->sc_lock));
-
        mutex_enter(sc->sc_lock);
        if (sc->sc_dying) {
                mutex_exit(sc->sc_lock);
@@ -2096,7 +2095,7 @@
 }
 
 /*
- * Must NOT called with sc_lock nor sc_exlock held.
+ * Must be called without sc_lock nor sc_exlock held.
  */
 int
 audio_close(struct audio_softc *sc, audio_file_t *file)
@@ -2104,8 +2103,6 @@
        audio_track_t *oldtrack;
        int error;
 
-       KASSERT(!mutex_owned(sc->sc_lock));
-
        TRACEF(1, file, "%spid=%d.%d po=%d ro=%d",
            (audiodebug >= 3) ? "start " : "",
            (int)curproc->p_pid, (int)curlwp->l_lid,
@@ -2206,6 +2203,9 @@
        return 0;
 }
 
+/*
+ * Must be called without sc_lock nor sc_exlock held.
+ */
 int
 audio_read(struct audio_softc *sc, struct uio *uio, int ioflag,
        audio_file_t *file)
@@ -2215,8 +2215,6 @@
        audio_ring_t *input;
        int error;
 
-       KASSERT(!mutex_owned(sc->sc_lock));
-
        /*
         * On half-duplex hardware, O_RDWR is treated as O_WRONLY.
         * However read() system call itself can be called because it's
@@ -2333,6 +2331,9 @@
                audio_track_clear(sc, file->rtrack);
 }
 
+/*
+ * Must be called without sc_lock nor sc_exlock held.
+ */
 int
 audio_write(struct audio_softc *sc, struct uio *uio, int ioflag,
        audio_file_t *file)
@@ -2342,8 +2343,6 @@
        audio_ring_t *outbuf;
        int error;
 
-       KASSERT(!mutex_owned(sc->sc_lock));
-
        track = file->ptrack;
        KASSERT(track);
 
@@ -2455,6 +2454,9 @@
        return error;
 }
 
+/*
+ * Must be called without sc_lock nor sc_exlock held.
+ */
 int
 audio_ioctl(dev_t dev, struct audio_softc *sc, u_long cmd, void *addr, int flag,
        struct lwp *l, audio_file_t *file)
@@ -2470,8 +2472,6 @@
        int index;
        int error;
 
-       KASSERT(!mutex_owned(sc->sc_lock));
-
 #if defined(AUDIO_DEBUG)
        const char *ioctlnames[] = {
                " AUDIO_GETINFO",       /* 21 */
@@ -2763,6 +2763,9 @@
        return bytes;
 }
 
+/*
+ * Must be called without sc_lock nor sc_exlock held.
+ */
 int
 audio_poll(struct audio_softc *sc, int events, struct lwp *l,
        audio_file_t *file)
@@ -2772,8 +2775,6 @@
        bool in_is_valid;
        bool out_is_valid;
 
-       KASSERT(!mutex_owned(sc->sc_lock));
-
 #if defined(AUDIO_DEBUG)
 #define POLLEV_BITMAP "\177\020" \
            "b\10WRBAND\0" \
@@ -2921,13 +2922,14 @@
        return (track->usrbuf.used < track->usrbuf_usedlow);
 }
 
+/*
+ * Must be called without sc_lock nor sc_exlock held.
+ */
 int
 audio_kqfilter(struct audio_softc *sc, audio_file_t *file, struct knote *kn)
 {
        struct klist *klist;
 
-       KASSERT(!mutex_owned(sc->sc_lock));
-
        TRACEF(3, file, "kn=%p kn_filter=%x", kn, (int)kn->kn_filter);
 
        switch (kn->kn_filter) {
@@ -2954,6 +2956,9 @@
        return 0;
 }
 
+/*
+ * Must be called without sc_lock nor sc_exlock held.
+ */
 int
 audio_mmap(struct audio_softc *sc, off_t *offp, size_t len, int prot,
        int *flagsp, int *advicep, struct uvm_object **uobjp, int *maxprotp,
@@ -2963,8 +2968,6 @@
        vsize_t vsize;
        int error;
 
-       KASSERT(!mutex_owned(sc->sc_lock));
-
        TRACEF(2, file, "off=%lld, prot=%d", (long long)(*offp), prot);
 
        if (*offp < 0)
@@ -7709,6 +7712,9 @@
        return 0;
 }
 
+/*
+ * Must be called without sc_lock nor sc_exlock held.
+ */
 int
 mixer_ioctl(struct audio_softc *sc, u_long cmd, void *addr, int flag,
        struct lwp *l)
@@ -7717,8 +7723,6 @@
        mixer_ctrl_t *mc;
        int error;
 
-       KASSERT(!mutex_owned(sc->sc_lock));
-
        TRACE(2, "(%lu,'%c',%lu)",
            IOCPARM_LEN(cmd), (char)IOCGROUP(cmd), cmd & 0xff);
        error = EINVAL;



Home | Main Index | Thread Index | Old Index