You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07: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 <stern@rowland.harvard.edu> Cc: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
857cc4dfb6
commit
011b15df46
+5
-6
@@ -1579,7 +1579,7 @@ static void ub_reset_task(struct work_struct *work)
|
||||
struct ub_dev *sc = container_of(work, struct ub_dev, reset_work);
|
||||
unsigned long flags;
|
||||
struct ub_lun *lun;
|
||||
int lkr, rc;
|
||||
int rc;
|
||||
|
||||
if (!sc->reset) {
|
||||
printk(KERN_WARNING "%s: Running reset unrequested\n",
|
||||
@@ -1597,10 +1597,11 @@ static void ub_reset_task(struct work_struct *work)
|
||||
} else if (sc->dev->actconfig->desc.bNumInterfaces != 1) {
|
||||
;
|
||||
} else {
|
||||
if ((lkr = usb_lock_device_for_reset(sc->dev, sc->intf)) < 0) {
|
||||
rc = usb_lock_device_for_reset(sc->dev, sc->intf);
|
||||
if (rc < 0) {
|
||||
printk(KERN_NOTICE
|
||||
"%s: usb_lock_device_for_reset failed (%d)\n",
|
||||
sc->name, lkr);
|
||||
sc->name, rc);
|
||||
} else {
|
||||
rc = usb_reset_device(sc->dev);
|
||||
if (rc < 0) {
|
||||
@@ -1608,9 +1609,7 @@ static void ub_reset_task(struct work_struct *work)
|
||||
"usb_lock_device_for_reset failed (%d)\n",
|
||||
sc->name, rc);
|
||||
}
|
||||
|
||||
if (lkr)
|
||||
usb_unlock_device(sc->dev);
|
||||
usb_unlock_device(sc->dev);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user