diff options
| author | isaki <isaki@NetBSD.org> | 2019-07-07 06:14:21 +0000 |
|---|---|---|
| committer | isaki <isaki@NetBSD.org> | 2019-07-07 06:14:21 +0000 |
| commit | a1790d6c3520e99bbee2e73c321bf542cb984367 (patch) | |
| tree | 979f2ff2cdba9828a9da2dd80a4d57df9f9ba9d7 /sys/dev/audio | |
| parent | 3c1162622d4f123e63e27ca0a52a84930743bcc0 (diff) | |
Rearrange some KASSERT and debug messages, to sync with others.
Diffstat (limited to 'sys/dev/audio')
| -rw-r--r-- | sys/dev/audio/audio.c | 19 |
1 files changed, 10 insertions, 9 deletions
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 <sys/cdefs.h> -__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; |
