Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-7]: src/sys/dev/usb Pull up following revision(s) (requested by s...



details:   https://anonhg.NetBSD.org/src/rev/2a7240f8414a
branches:  netbsd-7
changeset: 798239:2a7240f8414a
user:      riz <riz%NetBSD.org@localhost>
date:      Wed Aug 13 21:47:18 2014 +0000

description:
Pull up following revision(s) (requested by skrll in ticket #11):
        sys/dev/usb/xhci.c: revision 1.25
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 e4089a66fe12 -r 2a7240f8414a sys/dev/usb/xhci.c
--- a/sys/dev/usb/xhci.c        Tue Aug 12 19:02:55 2014 +0000
+++ b/sys/dev/usb/xhci.c        Wed Aug 13 21:47:18 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xhci.c,v 1.23.2.1 2014/08/11 15:36:45 martin Exp $     */
+/*     $NetBSD: xhci.c,v 1.23.2.2 2014/08/13 21:47:18 riz Exp $        */
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.23.2.1 2014/08/11 15:36:45 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.23.2.2 2014/08/13 21:47:18 riz 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