diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2008-11-04 11:29:27 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-01-07 12:59:52 -0500 |
commit | 011b15df465745474e3ec85482633685933ed5a7 (patch) | |
tree | 97df5cb516672f0a6fae5b993840beb667c76bd0 /drivers/usb/image | |
parent | 857cc4dfb6420ec0a67b3cda559aaa7c429ddce7 (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/image')
-rw-r--r-- | drivers/usb/image/microtek.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/usb/image/microtek.c b/drivers/usb/image/microtek.c index 885867a86de8..4541dfcea88f 100644 --- a/drivers/usb/image/microtek.c +++ b/drivers/usb/image/microtek.c | |||
@@ -350,17 +350,16 @@ static int mts_scsi_abort(struct scsi_cmnd *srb) | |||
350 | static int mts_scsi_host_reset(struct scsi_cmnd *srb) | 350 | static int mts_scsi_host_reset(struct scsi_cmnd *srb) |
351 | { | 351 | { |
352 | struct mts_desc* desc = (struct mts_desc*)(srb->device->host->hostdata[0]); | 352 | struct mts_desc* desc = (struct mts_desc*)(srb->device->host->hostdata[0]); |
353 | int result, rc; | 353 | int result; |
354 | 354 | ||
355 | MTS_DEBUG_GOT_HERE(); | 355 | MTS_DEBUG_GOT_HERE(); |
356 | mts_debug_dump(desc); | 356 | mts_debug_dump(desc); |
357 | 357 | ||
358 | rc = usb_lock_device_for_reset(desc->usb_dev, desc->usb_intf); | 358 | result = usb_lock_device_for_reset(desc->usb_dev, desc->usb_intf); |
359 | if (rc < 0) | 359 | if (result == 0) { |
360 | return FAILED; | 360 | result = usb_reset_device(desc->usb_dev); |
361 | result = usb_reset_device(desc->usb_dev); | ||
362 | if (rc) | ||
363 | usb_unlock_device(desc->usb_dev); | 361 | usb_unlock_device(desc->usb_dev); |
362 | } | ||
364 | return result ? FAILED : SUCCESS; | 363 | return result ? FAILED : SUCCESS; |
365 | } | 364 | } |
366 | 365 | ||