Commit b0af79be authored by Oliver Neukum's avatar Oliver Neukum Committed by Greg Kroah-Hartman

[PATCH] USB: locking reset/probe

  - mutual exclusion between reset() and probe()
parent 7ac1d67a
...@@ -1175,8 +1175,10 @@ void usb_hub_cleanup(void) ...@@ -1175,8 +1175,10 @@ void usb_hub_cleanup(void)
* *
* Take a look at proc_resetdevice in devio.c for some sample code to * Take a look at proc_resetdevice in devio.c for some sample code to
* do this. * do this.
* Use this only from within your probe function, otherwise use
* usb_reset_device() below, which ensure proper locking
*/ */
int usb_reset_device(struct usb_device *dev) int usb_physical_reset_device(struct usb_device *dev)
{ {
struct usb_device *parent = dev->parent; struct usb_device *parent = dev->parent;
struct usb_device_descriptor *descriptor; struct usb_device_descriptor *descriptor;
...@@ -1306,3 +1308,16 @@ int usb_reset_device(struct usb_device *dev) ...@@ -1306,3 +1308,16 @@ int usb_reset_device(struct usb_device *dev)
return 0; return 0;
} }
int usb_reset_device(struct usb_device *udev)
{
struct device *gdev = &udev->dev;
int r;
down_read(&gdev->bus->subsys.rwsem);
r = usb_physical_reset_device(udev);
up_read(&gdev->bus->subsys.rwsem);
return r;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment