summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb
diff options
context:
space:
mode:
authorhselasky <hselasky@FreeBSD.org>2012-11-07 18:44:05 +0000
committerhselasky <hselasky@FreeBSD.org>2012-11-07 18:44:05 +0000
commitad9951241e4c373300263b13ff3674ce74530a71 (patch)
tree1c4a203ccd0bbcea9abe43cc107fc10b71b30ad3 /sys/dev/usb
parent144b70190ee8018085ca83ac2cc7b79d56dda2a6 (diff)
downloadFreeBSD-src-ad9951241e4c373300263b13ff3674ce74530a71.zip
FreeBSD-src-ad9951241e4c373300263b13ff3674ce74530a71.tar.gz
The tty_inwakeup callback appears to be called both locked and unlocked.
Handle the required locking automatically for now. MFC after: 1 weeks
Diffstat (limited to 'sys/dev/usb')
-rw-r--r--sys/dev/usb/serial/usb_serial.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/dev/usb/serial/usb_serial.c b/sys/dev/usb/serial/usb_serial.c
index 962ae5d..c3d2069 100644
--- a/sys/dev/usb/serial/usb_serial.c
+++ b/sys/dev/usb/serial/usb_serial.c
@@ -788,15 +788,20 @@ ucom_inwakeup(struct tty *tp)
{
struct ucom_softc *sc = tty_softc(tp);
uint16_t pos;
+ int locked;
if (sc == NULL)
return;
- tty_lock(tp);
+ locked = mtx_owned(sc->sc_mtx);
+
+ if (locked == 0)
+ tty_lock(tp);
if (ttydisc_can_bypass(tp) != 0 ||
(sc->sc_flag & UCOM_FLAG_HL_READY) == 0) {
- tty_unlock(tp);
+ if (locked == 0)
+ tty_unlock(tp);
return;
}
@@ -821,7 +826,8 @@ ucom_inwakeup(struct tty *tp)
(sc->sc_flag & UCOM_FLAG_RTS_IFLOW))
ucom_rts(sc, 0);
- tty_unlock(tp);
+ if (locked == 0)
+ tty_unlock(tp);
}
static int
OpenPOWER on IntegriCloud