svn commit: r269917 - stable/10/sys/dev/usb

Hans Petter Selasky hselasky at FreeBSD.org
Wed Aug 13 07:02:24 UTC 2014


Author: hselasky
Date: Wed Aug 13 07:02:23 2014
New Revision: 269917
URL: http://svnweb.freebsd.org/changeset/base/269917

Log:
  MFC r269566:
  Fix for deadlock in USB device side mode.

Modified:
  stable/10/sys/dev/usb/usb_device.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/usb/usb_device.c
==============================================================================
--- stable/10/sys/dev/usb/usb_device.c	Wed Aug 13 06:59:40 2014	(r269916)
+++ stable/10/sys/dev/usb/usb_device.c	Wed Aug 13 07:02:23 2014	(r269917)
@@ -451,6 +451,17 @@ usb_endpoint_foreach(struct usb_device *
 	return (NULL);
 }
 
+#if USB_HAVE_UGEN
+static uint16_t
+usb_get_refcount(struct usb_device *udev)
+{
+	if (usb_proc_is_called_from(USB_BUS_EXPLORE_PROC(udev->bus)) ||
+	    usb_proc_is_called_from(USB_BUS_CONTROL_XFER_PROC(udev->bus)))
+		return (1);
+	return (2);
+}
+#endif
+
 /*------------------------------------------------------------------------*
  *	usb_wait_pending_ref_locked
  *
@@ -463,9 +474,7 @@ static void
 usb_wait_pending_ref_locked(struct usb_device *udev)
 {
 #if USB_HAVE_UGEN
-	const uint16_t refcount =
-	    usb_proc_is_called_from(
-	    USB_BUS_EXPLORE_PROC(udev->bus)) ? 1 : 2;
+	const uint16_t refcount = usb_get_refcount(udev);
 
 	DPRINTF("Refcount = %d\n", (int)refcount); 
 
@@ -496,9 +505,7 @@ static void
 usb_ref_restore_locked(struct usb_device *udev)
 {
 #if USB_HAVE_UGEN
-	const uint16_t refcount =
-	    usb_proc_is_called_from(
-	    USB_BUS_EXPLORE_PROC(udev->bus)) ? 1 : 2;
+	const uint16_t refcount = usb_get_refcount(udev);
 
 	DPRINTF("Refcount = %d\n", (int)refcount); 
 


More information about the svn-src-stable-10 mailing list