Author: hselasky
Date: Wed Aug 13 07:08:03 2014
New Revision: 269918
URL: http://svnweb.freebsd.org/changeset/base/269918

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

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

Modified: stable/9/sys/dev/usb/usb_device.c
==============================================================================
--- stable/9/sys/dev/usb/usb_device.c   Wed Aug 13 07:02:23 2014        
(r269917)
+++ stable/9/sys/dev/usb/usb_device.c   Wed Aug 13 07:08:03 2014        
(r269918)
@@ -430,6 +430,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(&udev->bus->explore_proc) ||
+           usb_proc_is_called_from(&udev->bus->control_xfer_proc))
+               return (1);
+       return (2);
+}
+#endif
+
 /*------------------------------------------------------------------------*
  *     usb_wait_pending_ref_locked
  *
@@ -442,9 +453,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(
-           &udev->bus->explore_proc) ? 1 : 2;
+       const uint16_t refcount = usb_get_refcount(udev);
 
        DPRINTF("Refcount = %d\n", (int)refcount); 
 
@@ -475,9 +484,7 @@ static void
 usb_ref_restore_locked(struct usb_device *udev)
 {
 #if USB_HAVE_UGEN
-       const uint16_t refcount =
-           usb_proc_is_called_from(
-           &udev->bus->explore_proc) ? 1 : 2;
+       const uint16_t refcount = usb_get_refcount(udev);
 
        DPRINTF("Refcount = %d\n", (int)refcount); 
 
_______________________________________________
svn-src-stable-9@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9
To unsubscribe, send any mail to "svn-src-stable-9-unsubscr...@freebsd.org"

Reply via email to