aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/storage
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2008-11-04 11:29:27 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2009-01-07 12:59:52 -0500
commit011b15df465745474e3ec85482633685933ed5a7 (patch)
tree97df5cb516672f0a6fae5b993840beb667c76bd0 /drivers/usb/storage
parent857cc4dfb6420ec0a67b3cda559aaa7c429ddce7 (diff)
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>
Diffstat (limited to 'drivers/usb/storage')
-rw-r--r--drivers/usb/storage/transport.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
index 79108d5d3171..2058db41618c 100644
--- a/drivers/usb/storage/transport.c
+++ b/drivers/usb/storage/transport.c
@@ -1173,10 +1173,9 @@ int usb_stor_Bulk_reset(struct us_data *us)
1173 */ 1173 */
1174int usb_stor_port_reset(struct us_data *us) 1174int usb_stor_port_reset(struct us_data *us)
1175{ 1175{
1176 int result, rc_lock; 1176 int result;
1177 1177
1178 result = rc_lock = 1178 result = usb_lock_device_for_reset(us->pusb_dev, us->pusb_intf);
1179 usb_lock_device_for_reset(us->pusb_dev, us->pusb_intf);
1180 if (result < 0) 1179 if (result < 0)
1181 US_DEBUGP("unable to lock device for reset: %d\n", result); 1180 US_DEBUGP("unable to lock device for reset: %d\n", result);
1182 else { 1181 else {
@@ -1189,8 +1188,7 @@ int usb_stor_port_reset(struct us_data *us)
1189 US_DEBUGP("usb_reset_device returns %d\n", 1188 US_DEBUGP("usb_reset_device returns %d\n",
1190 result); 1189 result);
1191 } 1190 }
1192 if (rc_lock) 1191 usb_unlock_device(us->pusb_dev);
1193 usb_unlock_device(us->pusb_dev);
1194 } 1192 }
1195 return result; 1193 return result;
1196} 1194}