Module Name: src Committed By: isaki Date: Sat Feb 15 02:47:00 UTC 2020
Modified Files: src/sys/dev/audio: audio.c Log Message: Remove incorrect KASSERT(!mutex_owned()). Pointed out by riastradh@. To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/sys/dev/audio/audio.c 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/audio/audio.c diff -u src/sys/dev/audio/audio.c:1.41 src/sys/dev/audio/audio.c:1.42 --- src/sys/dev/audio/audio.c:1.41 Sat Jan 11 04:53:10 2020 +++ src/sys/dev/audio/audio.c Sat Feb 15 02:47:00 2020 @@ -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 @@ audio_attach_mi(const struct audio_hw_if /* * 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 @@ bad1: } /* - * 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_close(struct audio_softc *sc, audi 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 @@ audio_close(struct audio_softc *sc, audi 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_read(struct audio_softc *sc, struc 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_file_clear(struct audio_softc *sc, 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_write(struct audio_softc *sc, stru audio_ring_t *outbuf; int error; - KASSERT(!mutex_owned(sc->sc_lock)); - track = file->ptrack; KASSERT(track); @@ -2455,6 +2454,9 @@ abort: 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 @@ audio_ioctl(dev_t dev, struct audio_soft int index; int error; - KASSERT(!mutex_owned(sc->sc_lock)); - #if defined(AUDIO_DEBUG) const char *ioctlnames[] = { " AUDIO_GETINFO", /* 21 */ @@ -2763,6 +2763,9 @@ audio_track_readablebytes(const audio_tr 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 @@ audio_poll(struct audio_softc *sc, int e 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 @@ filt_audiowrite_event(struct knote *kn, 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 @@ audio_kqfilter(struct audio_softc *sc, a 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 @@ audio_mmap(struct audio_softc *sc, off_t 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 @@ mixer_close(struct audio_softc *sc, audi 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_ioctl(struct audio_softc *sc, u_lo 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;