Module Name:    src
Committed By:   skrll
Date:           Sun Nov 30 16:38:45 UTC 2014

Modified Files:
        src/sys/dev/usb [nick-nhusb]: ehci.c ohci.c uhci.c usbdi.c

Log Message:
Use ASSERT_SLEEPABLE.


To generate a diff of this commit:
cvs rdiff -u -r1.234.2.3 -r1.234.2.4 src/sys/dev/usb/ehci.c
cvs rdiff -u -r1.254.2.2 -r1.254.2.3 src/sys/dev/usb/ohci.c
cvs rdiff -u -r1.264.4.2 -r1.264.4.3 src/sys/dev/usb/uhci.c
cvs rdiff -u -r1.162.2.2 -r1.162.2.3 src/sys/dev/usb/usbdi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/ehci.c
diff -u src/sys/dev/usb/ehci.c:1.234.2.3 src/sys/dev/usb/ehci.c:1.234.2.4
--- src/sys/dev/usb/ehci.c:1.234.2.3	Sun Nov 30 13:46:00 2014
+++ src/sys/dev/usb/ehci.c	Sun Nov 30 16:38:45 2014
@@ -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 @@ ehci_abort_xfer(usbd_xfer_handle xfer, u
 	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 @@ ehci_abort_xfer(usbd_xfer_handle xfer, u
 		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.

Index: src/sys/dev/usb/ohci.c
diff -u src/sys/dev/usb/ohci.c:1.254.2.2 src/sys/dev/usb/ohci.c:1.254.2.3
--- src/sys/dev/usb/ohci.c:1.254.2.2	Sun Nov 30 13:14:11 2014
+++ src/sys/dev/usb/ohci.c	Sun Nov 30 16:38:45 2014
@@ -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 @@ ohci_abort_xfer(usbd_xfer_handle xfer, u
 	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 @@ ohci_abort_xfer(usbd_xfer_handle xfer, u
 		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.

Index: src/sys/dev/usb/uhci.c
diff -u src/sys/dev/usb/uhci.c:1.264.4.2 src/sys/dev/usb/uhci.c:1.264.4.3
--- src/sys/dev/usb/uhci.c:1.264.4.2	Sun Nov 30 13:14:11 2014
+++ src/sys/dev/usb/uhci.c	Sun Nov 30 16:38:45 2014
@@ -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 @@ uhci_abort_xfer(usbd_xfer_handle xfer, u
 	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 @@ uhci_abort_xfer(usbd_xfer_handle xfer, u
 		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.

Index: src/sys/dev/usb/usbdi.c
diff -u src/sys/dev/usb/usbdi.c:1.162.2.2 src/sys/dev/usb/usbdi.c:1.162.2.3
--- src/sys/dev/usb/usbdi.c:1.162.2.2	Sun Nov 30 13:14:11 2014
+++ src/sys/dev/usb/usbdi.c	Sun Nov 30 16:38:45 2014
@@ -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 @@ usbd_alloc_xfer(usbd_device_handle dev)
 
 	USBHIST_FUNC(); USBHIST_CALLED(usbdebug);
 
+	ASSERT_SLEEPABLE();
+
 	xfer = dev->bus->methods->allocx(dev->bus);
 	if (xfer == NULL)
 		return (NULL);
@@ -1053,12 +1055,7 @@ usbd_do_request_flags_pipe(usbd_device_h
 
 	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)

Reply via email to