Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb Serialise xhci_intr1 calls with sc_intr_lock. F...
details: https://anonhg.NetBSD.org/src/rev/5987a3a6b523
branches: trunk
changeset: 331501:5987a3a6b523
user: skrll <skrll%NetBSD.org@localhost>
date: Tue Aug 12 13:48:29 2014 +0000
description:
Serialise xhci_intr1 calls with sc_intr_lock. From Takahiro HAYASHI.
diffstat:
sys/dev/usb/xhci.c | 23 +++++++++++++++++------
1 files changed, 17 insertions(+), 6 deletions(-)
diffs (63 lines):
diff -r b7d15bcae4cc -r 5987a3a6b523 sys/dev/usb/xhci.c
--- a/sys/dev/usb/xhci.c Tue Aug 12 13:40:07 2014 +0000
+++ b/sys/dev/usb/xhci.c Tue Aug 12 13:48:29 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xhci.c,v 1.24 2014/08/11 10:37:59 skrll Exp $ */
+/* $NetBSD: xhci.c,v 1.25 2014/08/12 13:48:29 skrll Exp $ */
/*
* Copyright (c) 2013 Jonathan A. Kollasch
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.24 2014/08/11 10:37:59 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.25 2014/08/12 13:48:29 skrll Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -853,10 +853,16 @@
xhci_intr(void *v)
{
struct xhci_softc * const sc = v;
-
- if (sc == NULL || sc->sc_dying || !device_has_power(sc->sc_dev))
+ int ret = 0;
+
+ if (sc == NULL)
return 0;
+ mutex_spin_enter(&sc->sc_intr_lock);
+
+ if (sc->sc_dying || !device_has_power(sc->sc_dev))
+ goto done;
+
DPRINTF(("%s: %s\n", __func__, device_xname(sc->sc_dev)));
/* If we get an interrupt while polling, then just ignore it. */
@@ -864,10 +870,13 @@
#ifdef DIAGNOSTIC
DPRINTFN(16, ("xhci_intr: ignored interrupt while polling\n"));
#endif
- return 0;
+ goto done;
}
- return xhci_intr1(sc);
+ ret = xhci_intr1(sc);
+done:
+ mutex_spin_exit(&sc->sc_intr_lock);
+ return ret;
}
int
@@ -1314,7 +1323,9 @@
DPRINTF(("%s: %s\n", __func__, device_xname(sc->sc_dev)));
+ mutex_spin_enter(&sc->sc_intr_lock);
xhci_intr1(sc);
+ mutex_spin_exit(&sc->sc_intr_lock);
return;
}
Home |
Main Index |
Thread Index |
Old Index