Date: Tue, 5 Aug 2014 06:38:21 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269566 - head/sys/dev/usb Message-ID: <53e07bdd.5fbd.2b1c48bd@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?53e07bdd.5fbd.2b1c48bd>