Source-Changes-HG archive

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

[src/nick-nhusb]: src/sys/dev/usb Use ASSERT_SLEEPABLE.



details:   https://anonhg.NetBSD.org/src/rev/e103790ac7ba
branches:  nick-nhusb
changeset: 334054:e103790ac7ba
user:      skrll <skrll%NetBSD.org@localhost>
date:      Sun Nov 30 16:38:45 2014 +0000

description:
Use ASSERT_SLEEPABLE.

diffstat:

 sys/dev/usb/ehci.c  |   8 +++-----
 sys/dev/usb/ohci.c  |   8 +++-----
 sys/dev/usb/uhci.c  |   8 +++-----
 sys/dev/usb/usbdi.c |  13 +++++--------
 4 files changed, 14 insertions(+), 23 deletions(-)

diffs (149 lines):

diff -r a447fa3e083e -r e103790ac7ba sys/dev/usb/ehci.c
--- a/sys/dev/usb/ehci.c        Sun Nov 30 13:46:00 2014 +0000
+++ b/sys/dev/usb/ehci.c        Sun Nov 30 16:38:45 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ehci.c,v 1.234.2.3 2014/11/30 13:46:00 skrll Exp $ */
+/*     $NetBSD: ehci.c,v 1.234.2.4 2014/11/30 16:38:45 skrll Exp $ */
 
 /*
  * Copyright (c) 2004-2012 The NetBSD Foundation, Inc.
@@ -53,7 +53,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.234.2.3 2014/11/30 13:46:00 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.234.2.4 2014/11/30 16:38:45 skrll Exp $");
 
 #include "ohci.h"
 #include "uhci.h"
@@ -3401,6 +3401,7 @@
        USBHIST_LOG(ehcidebug, "xfer=%p pipe=%p", xfer, epipe, 0, 0);
 
        KASSERT(mutex_owned(&sc->sc_lock));
+       ASSERT_SLEEPABLE();
 
        if (sc->sc_dying) {
                /* If we're dying, just do the software part. */
@@ -3410,9 +3411,6 @@
                return;
        }
 
-       if (cpu_intr_p() || cpu_softintr_p())
-               panic("ehci_abort_xfer: not in process context");
-
        /*
         * If an abort is already in progress then just wait for it to
         * complete and return.
diff -r a447fa3e083e -r e103790ac7ba sys/dev/usb/ohci.c
--- a/sys/dev/usb/ohci.c        Sun Nov 30 13:46:00 2014 +0000
+++ b/sys/dev/usb/ohci.c        Sun Nov 30 16:38:45 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ohci.c,v 1.254.2.2 2014/11/30 13:14:11 skrll Exp $     */
+/*     $NetBSD: ohci.c,v 1.254.2.3 2014/11/30 16:38:45 skrll Exp $     */
 
 /*
  * Copyright (c) 1998, 2004, 2005, 2012 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.254.2.2 2014/11/30 13:14:11 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.254.2.3 2014/11/30 16:38:45 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -2300,6 +2300,7 @@
        DPRINTF(("ohci_abort_xfer: xfer=%p pipe=%p sed=%p\n", xfer, opipe,sed));
 
        KASSERT(mutex_owned(&sc->sc_lock));
+       ASSERT_SLEEPABLE();
 
        if (sc->sc_dying) {
                /* If we're dying, just do the software part. */
@@ -2309,9 +2310,6 @@
                return;
        }
 
-       if (cpu_intr_p() || cpu_softintr_p())
-               panic("ohci_abort_xfer: not in process context");
-
        /*
         * If an abort is already in progress then just wait for it to
         * complete and return.
diff -r a447fa3e083e -r e103790ac7ba sys/dev/usb/uhci.c
--- a/sys/dev/usb/uhci.c        Sun Nov 30 13:46:00 2014 +0000
+++ b/sys/dev/usb/uhci.c        Sun Nov 30 16:38:45 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uhci.c,v 1.264.4.2 2014/11/30 13:14:11 skrll Exp $     */
+/*     $NetBSD: uhci.c,v 1.264.4.3 2014/11/30 16:38:45 skrll Exp $     */
 
 /*
  * Copyright (c) 1998, 2004, 2011, 2012 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.264.4.2 2014/11/30 13:14:11 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.264.4.3 2014/11/30 16:38:45 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -2174,6 +2174,7 @@
        DPRINTFN(1,("uhci_abort_xfer: xfer=%p, status=%d\n", xfer, status));
 
        KASSERT(mutex_owned(&sc->sc_lock));
+       ASSERT_SLEEPABLE();
 
        if (sc->sc_dying) {
                /* If we're dying, just do the software part. */
@@ -2183,9 +2184,6 @@
                return;
        }
 
-       if (cpu_intr_p() || cpu_softintr_p())
-               panic("uhci_abort_xfer: not in process context");
-
        /*
         * If an abort is already in progress then just wait for it to
         * complete and return.
diff -r a447fa3e083e -r e103790ac7ba sys/dev/usb/usbdi.c
--- a/sys/dev/usb/usbdi.c       Sun Nov 30 13:46:00 2014 +0000
+++ b/sys/dev/usb/usbdi.c       Sun Nov 30 16:38:45 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usbdi.c,v 1.162.2.2 2014/11/30 13:14:11 skrll Exp $    */
+/*     $NetBSD: usbdi.c,v 1.162.2.3 2014/11/30 16:38:45 skrll Exp $    */
 
 /*
  * Copyright (c) 1998, 2012 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.162.2.2 2014/11/30 13:14:11 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.162.2.3 2014/11/30 16:38:45 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -430,6 +430,8 @@
 
        USBHIST_FUNC(); USBHIST_CALLED(usbdebug);
 
+       ASSERT_SLEEPABLE();
+
        xfer = dev->bus->methods->allocx(dev->bus);
        if (xfer == NULL)
                return (NULL);
@@ -1053,12 +1055,7 @@
 
        USBHIST_FUNC(); USBHIST_CALLED(usbdebug);
 
-#ifdef DIAGNOSTIC
-       if (cpu_intr_p() || cpu_softintr_p()) {
-               USBHIST_LOG(usbdebug, "not in process context", 0, 0, 0, 0);
-               return (USBD_INVAL);
-       }
-#endif
+       ASSERT_SLEEPABLE();
 
        xfer = usbd_alloc_xfer(dev);
        if (xfer == NULL)



Home | Main Index | Thread Index | Old Index