mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
USB: change interface to usb_lock_device_for_reset()
This patch (as1161) changes the interface to usb_lock_device_for_reset(). The existing interface is apparently not very clear, judging from the fact that several of its callers don't use it correctly. The new interface always returns 0 for success and it always requires the caller to unlock the device afterward. The new routine will not return immediately if it is called while the driver's probe method is running. Instead it will wait until the probe is over and the device has been unlocked. This shouldn't cause any problems; I don't know of any cases where drivers call usb_lock_device_for_reset() during probe. Signed-off-by: Alan Stern <[email protected]> Cc: Pete Zaitcev <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
857cc4dfb6
commit
011b15df46
6 changed files with 25 additions and 39 deletions
|
|
@ -102,7 +102,7 @@ static void hid_reset(struct work_struct *work)
|
|||
struct usbhid_device *usbhid =
|
||||
container_of(work, struct usbhid_device, reset_work);
|
||||
struct hid_device *hid = usbhid->hid;
|
||||
int rc_lock, rc = 0;
|
||||
int rc = 0;
|
||||
|
||||
if (test_bit(HID_CLEAR_HALT, &usbhid->iofl)) {
|
||||
dev_dbg(&usbhid->intf->dev, "clear halt\n");
|
||||
|
|
@ -113,11 +113,10 @@ static void hid_reset(struct work_struct *work)
|
|||
|
||||
else if (test_bit(HID_RESET_PENDING, &usbhid->iofl)) {
|
||||
dev_dbg(&usbhid->intf->dev, "resetting device\n");
|
||||
rc = rc_lock = usb_lock_device_for_reset(hid_to_usb_dev(hid), usbhid->intf);
|
||||
if (rc_lock >= 0) {
|
||||
rc = usb_lock_device_for_reset(hid_to_usb_dev(hid), usbhid->intf);
|
||||
if (rc == 0) {
|
||||
rc = usb_reset_device(hid_to_usb_dev(hid));
|
||||
if (rc_lock)
|
||||
usb_unlock_device(hid_to_usb_dev(hid));
|
||||
usb_unlock_device(hid_to_usb_dev(hid));
|
||||
}
|
||||
clear_bit(HID_RESET_PENDING, &usbhid->iofl);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue