ChangeSet 1.1018.1.2, 2003/04/04 16:12:44-08:00, oliver@neukum.org [PATCH] USB: locking reset/probe - mutual exclusion between reset() and probe() drivers/usb/core/hub.c | 17 ++++++++++++++++- 1 files changed, 16 insertions(+), 1 deletion(-) diff -Nru a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c --- a/drivers/usb/core/hub.c Mon Apr 7 15:15:03 2003 +++ b/drivers/usb/core/hub.c Mon Apr 7 15:15:03 2003 @@ -1175,8 +1175,10 @@ * * Take a look at proc_resetdevice in devio.c for some sample code to * 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_descriptor *descriptor; @@ -1305,4 +1307,17 @@ 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; +} +