svn commit: r269566 - head/sys/dev/usb
Hans Petter Selasky
hselasky at FreeBSD.org
Tue Aug 5 06:38:21 UTC 2014
Author: hselasky
Date: Tue Aug 5 06:38:21 2014
New Revision: 269566
URL: http://svnweb.freebsd.org/changeset/base/269566
Log:
Fix for deadlock in USB device side mode.
MFC after: 3 days
Modified:
head/sys/dev/usb/usb_device.c
Modified: head/sys/dev/usb/usb_device.c
==============================================================================
--- head/sys/dev/usb/usb_device.c Tue Aug 5 06:37:07 2014 (r269565)
+++ head/sys/dev/usb/usb_device.c Tue Aug 5 06:38:21 2014 (r269566)
@@ -448,6 +448,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
*
@@ -460,9 +471,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);
@@ -493,9 +502,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-head
mailing list