diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2010-01-08 17:56:19 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-03-02 22:54:08 (GMT) |
commit | 62e299e61a6ffe8131fa85a984c3058b68586f5d (patch) | |
tree | d10709c5b5e6d280e1329c7ed4f30f990246893e /drivers/usb/core/driver.c | |
parent | 0f3dda9f7ff2db8dbf4d6fbab4d4438251446002 (diff) | |
download | linux-fsl-qoriq-62e299e61a6ffe8131fa85a984c3058b68586f5d.tar.xz |
USB: change locking for device-level autosuspend
This patch (as1323) changes the locking requirements for
usb_autosuspend_device(), usb_autoresume_device(), and
usb_try_autosuspend_device(). This isn't a very important change;
mainly it's meant to make the locking more uniform.
The most tricky part of the patch involves changes to usbdev_open().
To avoid an ABBA locking problem, it was necessary to reduce the
region protected by usbfs_mutex. Since that mutex now protects only
against simultaneous open and remove, this posed no difficulty -- its
scope was larger than necessary.
And it turns out that usbfs_mutex is no longer needed in
usbdev_release() at all. The list of usbfs "ps" structures is now
protected by the device lock instead of by usbfs_mutex.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/core/driver.c')
-rw-r--r-- | drivers/usb/core/driver.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index fcafb2d..2b39583 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c @@ -1478,8 +1478,7 @@ void usb_autoresume_work(struct work_struct *work) * driver requires remote-wakeup capability during autosuspend but remote * wakeup is disabled, the autosuspend will fail. * - * Often the caller will hold @udev's device lock, but this is not - * necessary. + * The caller must hold @udev's device lock. * * This routine can run only in process context. */ @@ -1503,6 +1502,8 @@ void usb_autosuspend_device(struct usb_device *udev) * for an active interface is greater than 0, or autosuspend is not allowed * for any other reason, no autosuspend request will be queued. * + * The caller must hold @udev's device lock. + * * This routine can run only in process context. */ void usb_try_autosuspend_device(struct usb_device *udev) @@ -1526,8 +1527,7 @@ void usb_try_autosuspend_device(struct usb_device *udev) * @udev's usage counter is incremented to prevent subsequent autosuspends. * However if the autoresume fails then the usage counter is re-decremented. * - * Often the caller will hold @udev's device lock, but this is not - * necessary (and attempting it might cause deadlock). + * The caller must hold @udev's device lock. * * This routine can run only in process context. */ |