Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb Fix locking around calls to [p/r]int with a patc...
details: https://anonhg.NetBSD.org/src/rev/a366df9f6efd
branches: trunk
changeset: 353725:a366df9f6efd
user: nat <nat%NetBSD.org@localhost>
date: Fri May 19 09:58:28 2017 +0000
description:
Fix locking around calls to [p/r]int with a patch from skrll@.
diffstat:
sys/dev/usb/uaudio.c | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
diffs (57 lines):
diff -r 35e203af1de9 -r a366df9f6efd sys/dev/usb/uaudio.c
--- a/sys/dev/usb/uaudio.c Fri May 19 08:53:51 2017 +0000
+++ b/sys/dev/usb/uaudio.c Fri May 19 09:58:28 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uaudio.c,v 1.150 2017/05/19 04:20:45 nat Exp $ */
+/* $NetBSD: uaudio.c,v 1.151 2017/05/19 09:58:28 nat Exp $ */
/*
* Copyright (c) 1999, 2012 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.150 2017/05/19 04:20:45 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.151 2017/05/19 09:58:28 nat Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -2888,15 +2888,17 @@
}
#endif
+ mutex_enter(&ch->sc->sc_intr_lock);
ch->transferred += cb->size;
/* Call back to upper layer */
while (ch->transferred >= ch->blksize) {
- mutex_enter(&ch->sc->sc_intr_lock);
ch->transferred -= ch->blksize;
DPRINTFN(5, "call %p(%p)\n", ch->intr, ch->arg);
+ mutex_exit(&ch->sc->sc_intr_lock);
ch->intr(ch->arg);
- mutex_exit(&ch->sc->sc_intr_lock);
+ mutex_enter(&ch->sc->sc_intr_lock);
}
+ mutex_exit(&ch->sc->sc_intr_lock);
/* start next transfer */
uaudio_chan_ptransfer(ch);
@@ -2990,14 +2992,16 @@
}
/* Call back to upper layer */
+ mutex_enter(&ch->sc->sc_intr_lock);
ch->transferred += count;
while (ch->transferred >= ch->blksize) {
- mutex_enter(&ch->sc->sc_intr_lock);
ch->transferred -= ch->blksize;
DPRINTFN(5, "call %p(%p)\n", ch->intr, ch->arg);
+ mutex_exit(&ch->sc->sc_intr_lock);
ch->intr(ch->arg);
- mutex_exit(&ch->sc->sc_intr_lock);
+ mutex_enter(&ch->sc->sc_intr_lock);
}
+ mutex_exit(&ch->sc->sc_intr_lock);
/* start next transfer */
uaudio_chan_rtransfer(ch);
Home |
Main Index |
Thread Index |
Old Index