Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Aug 2014 07:02:23 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r269917 - stable/10/sys/dev/usb
Message-ID:  <201408130702.s7D72Nbe046018@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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); 
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201408130702.s7D72Nbe046018>