Date: Wed, 13 Aug 2014 07:11:37 +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-8@freebsd.org Subject: svn commit: r269919 - stable/8/sys/dev/usb Message-ID: <201408130711.s7D7BbJu050277@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Wed Aug 13 07:11:37 2014 New Revision: 269919 URL: http://svnweb.freebsd.org/changeset/base/269919 Log: MFC r269566: Fix for deadlock in USB device side mode. Modified: stable/8/sys/dev/usb/usb_device.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/usb/ (props changed) Modified: stable/8/sys/dev/usb/usb_device.c ============================================================================== --- stable/8/sys/dev/usb/usb_device.c Wed Aug 13 07:08:03 2014 (r269918) +++ stable/8/sys/dev/usb/usb_device.c Wed Aug 13 07:11:37 2014 (r269919) @@ -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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201408130711.s7D7BbJu050277>