From a1790d6c3520e99bbee2e73c321bf542cb984367 Mon Sep 17 00:00:00 2001 From: isaki Date: Sun, 7 Jul 2019 06:14:21 +0000 Subject: Rearrange some KASSERT and debug messages, to sync with others. --- sys/dev/audio/audio.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/audio/audio.c b/sys/dev/audio/audio.c index 4baaac8dd95..1bb45671843 100644 --- a/sys/dev/audio/audio.c +++ b/sys/dev/audio/audio.c @@ -1,4 +1,4 @@ -/* $NetBSD: audio.c,v 1.24 2019/07/07 06:06:46 isaki Exp $ */ +/* $NetBSD: audio.c,v 1.25 2019/07/07 06:14:21 isaki Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -142,7 +142,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.24 2019/07/07 06:06:46 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.25 2019/07/07 06:14:21 isaki Exp $"); #ifdef _KERNEL_OPT #include "audio.h" @@ -2213,6 +2213,8 @@ audio_read(struct audio_softc *sc, struct uio *uio, int ioflag, 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 @@ -2223,8 +2225,6 @@ audio_read(struct audio_softc *sc, struct uio *uio, int ioflag, return EBADF; } - KASSERT(!mutex_owned(sc->sc_lock)); - /* I think it's better than EINVAL. */ if (track->mmapped) return EPERM; @@ -2340,18 +2340,19 @@ audio_write(struct audio_softc *sc, struct uio *uio, int ioflag, audio_ring_t *outbuf; int error; + KASSERT(!mutex_owned(sc->sc_lock)); + track = file->ptrack; KASSERT(track); - TRACET(2, track, "%sresid=%zd pid=%d.%d ioflag=0x%x", - audiodebug >= 3 ? "begin " : "", - uio->uio_resid, (int)curproc->p_pid, (int)curlwp->l_lid, ioflag); - - KASSERT(!mutex_owned(sc->sc_lock)); /* I think it's better than EINVAL. */ if (track->mmapped) return EPERM; + TRACET(2, track, "%sresid=%zd pid=%d.%d ioflag=0x%x", + audiodebug >= 3 ? "begin " : "", + uio->uio_resid, (int)curproc->p_pid, (int)curlwp->l_lid, ioflag); + if (uio->uio_resid == 0) { track->eofcounter++; return 0; -- cgit