diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2007-07-06 14:24:27 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-07-12 19:34:43 -0400 |
commit | 8dfe4b14869fd185ca25ee88b02ada58a3005eaf (patch) | |
tree | 0c0c8812f1d038706bd82ff0d7b3570d67645e68 /drivers/usb/storage/scsiglue.c | |
parent | b0e2a705bffbfb70d9bed8b5f9094901f28d9563 (diff) |
usb-storage: implement autosuspend
This patch (as930) implements autosuspend for usb-storage. It is
adapted from a patch by Oliver Neukum. Autosuspend is allowed except
during LUN scanning, resets, and command execution.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/storage/scsiglue.c')
-rw-r--r-- | drivers/usb/storage/scsiglue.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c index 1ba19eaa1970..47e56079925d 100644 --- a/drivers/usb/storage/scsiglue.c +++ b/drivers/usb/storage/scsiglue.c | |||
@@ -285,10 +285,15 @@ static int device_reset(struct scsi_cmnd *srb) | |||
285 | 285 | ||
286 | US_DEBUGP("%s called\n", __FUNCTION__); | 286 | US_DEBUGP("%s called\n", __FUNCTION__); |
287 | 287 | ||
288 | /* lock the device pointers and do the reset */ | 288 | result = usb_autopm_get_interface(us->pusb_intf); |
289 | mutex_lock(&(us->dev_mutex)); | 289 | if (result == 0) { |
290 | result = us->transport_reset(us); | 290 | |
291 | mutex_unlock(&us->dev_mutex); | 291 | /* lock the device pointers and do the reset */ |
292 | mutex_lock(&(us->dev_mutex)); | ||
293 | result = us->transport_reset(us); | ||
294 | mutex_unlock(&us->dev_mutex); | ||
295 | usb_autopm_put_interface(us->pusb_intf); | ||
296 | } | ||
292 | 297 | ||
293 | return result < 0 ? FAILED : SUCCESS; | 298 | return result < 0 ? FAILED : SUCCESS; |
294 | } | 299 | } |