diff options
Diffstat (limited to 'drivers/usb/storage/scsiglue.c')
-rw-r--r-- | drivers/usb/storage/scsiglue.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c index e227f64d5641..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 | } |
@@ -321,10 +326,14 @@ void usb_stor_report_device_reset(struct us_data *us) | |||
321 | 326 | ||
322 | /* Report a driver-initiated bus reset to the SCSI layer. | 327 | /* Report a driver-initiated bus reset to the SCSI layer. |
323 | * Calling this for a SCSI-initiated reset is unnecessary but harmless. | 328 | * Calling this for a SCSI-initiated reset is unnecessary but harmless. |
324 | * The caller must own the SCSI host lock. */ | 329 | * The caller must not own the SCSI host lock. */ |
325 | void usb_stor_report_bus_reset(struct us_data *us) | 330 | void usb_stor_report_bus_reset(struct us_data *us) |
326 | { | 331 | { |
327 | scsi_report_bus_reset(us_to_host(us), 0); | 332 | struct Scsi_Host *host = us_to_host(us); |
333 | |||
334 | scsi_lock(host); | ||
335 | scsi_report_bus_reset(host, 0); | ||
336 | scsi_unlock(host); | ||
328 | } | 337 | } |
329 | 338 | ||
330 | /*********************************************************************** | 339 | /*********************************************************************** |