diff options
Diffstat (limited to 'drivers/usb/storage')
-rw-r--r-- | drivers/usb/storage/scsiglue.c | 8 | ||||
-rw-r--r-- | drivers/usb/storage/usb.c | 28 |
2 files changed, 26 insertions, 10 deletions
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c index e227f64d5641..1ba19eaa1970 100644 --- a/drivers/usb/storage/scsiglue.c +++ b/drivers/usb/storage/scsiglue.c | |||
@@ -321,10 +321,14 @@ void usb_stor_report_device_reset(struct us_data *us) | |||
321 | 321 | ||
322 | /* Report a driver-initiated bus reset to the SCSI layer. | 322 | /* Report a driver-initiated bus reset to the SCSI layer. |
323 | * Calling this for a SCSI-initiated reset is unnecessary but harmless. | 323 | * Calling this for a SCSI-initiated reset is unnecessary but harmless. |
324 | * The caller must own the SCSI host lock. */ | 324 | * The caller must not own the SCSI host lock. */ |
325 | void usb_stor_report_bus_reset(struct us_data *us) | 325 | void usb_stor_report_bus_reset(struct us_data *us) |
326 | { | 326 | { |
327 | scsi_report_bus_reset(us_to_host(us), 0); | 327 | struct Scsi_Host *host = us_to_host(us); |
328 | |||
329 | scsi_lock(host); | ||
330 | scsi_report_bus_reset(host, 0); | ||
331 | scsi_unlock(host); | ||
328 | } | 332 | } |
329 | 333 | ||
330 | /*********************************************************************** | 334 | /*********************************************************************** |
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index be4cd8fe4ce6..00521f1d6a6b 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c | |||
@@ -219,6 +219,20 @@ static int storage_resume(struct usb_interface *iface) | |||
219 | return 0; | 219 | return 0; |
220 | } | 220 | } |
221 | 221 | ||
222 | static int storage_reset_resume(struct usb_interface *iface) | ||
223 | { | ||
224 | struct us_data *us = usb_get_intfdata(iface); | ||
225 | |||
226 | US_DEBUGP("%s\n", __FUNCTION__); | ||
227 | |||
228 | /* Report the reset to the SCSI core */ | ||
229 | usb_stor_report_bus_reset(us); | ||
230 | |||
231 | /* FIXME: Notify the subdrivers that they need to reinitialize | ||
232 | * the device */ | ||
233 | return 0; | ||
234 | } | ||
235 | |||
222 | #endif /* CONFIG_PM */ | 236 | #endif /* CONFIG_PM */ |
223 | 237 | ||
224 | /* | 238 | /* |
@@ -226,7 +240,7 @@ static int storage_resume(struct usb_interface *iface) | |||
226 | * a USB port reset, whether from this driver or a different one. | 240 | * a USB port reset, whether from this driver or a different one. |
227 | */ | 241 | */ |
228 | 242 | ||
229 | static void storage_pre_reset(struct usb_interface *iface) | 243 | static int storage_pre_reset(struct usb_interface *iface) |
230 | { | 244 | { |
231 | struct us_data *us = usb_get_intfdata(iface); | 245 | struct us_data *us = usb_get_intfdata(iface); |
232 | 246 | ||
@@ -234,26 +248,23 @@ static void storage_pre_reset(struct usb_interface *iface) | |||
234 | 248 | ||
235 | /* Make sure no command runs during the reset */ | 249 | /* Make sure no command runs during the reset */ |
236 | mutex_lock(&us->dev_mutex); | 250 | mutex_lock(&us->dev_mutex); |
251 | return 0; | ||
237 | } | 252 | } |
238 | 253 | ||
239 | static void storage_post_reset(struct usb_interface *iface, int reset_resume) | 254 | static int storage_post_reset(struct usb_interface *iface) |
240 | { | 255 | { |
241 | struct us_data *us = usb_get_intfdata(iface); | 256 | struct us_data *us = usb_get_intfdata(iface); |
242 | 257 | ||
243 | US_DEBUGP("%s\n", __FUNCTION__); | 258 | US_DEBUGP("%s\n", __FUNCTION__); |
244 | 259 | ||
245 | /* Report the reset to the SCSI core */ | 260 | /* Report the reset to the SCSI core */ |
246 | scsi_lock(us_to_host(us)); | ||
247 | usb_stor_report_bus_reset(us); | 261 | usb_stor_report_bus_reset(us); |
248 | scsi_unlock(us_to_host(us)); | ||
249 | 262 | ||
250 | /* FIXME: Notify the subdrivers that they need to reinitialize | 263 | /* FIXME: Notify the subdrivers that they need to reinitialize |
251 | * the device */ | 264 | * the device */ |
252 | 265 | ||
253 | /* If this is a reset-resume then the pre_reset routine wasn't | 266 | mutex_unlock(&us->dev_mutex); |
254 | * called, so we don't need to unlock the mutex. */ | 267 | return 0; |
255 | if (!reset_resume) | ||
256 | mutex_unlock(&us->dev_mutex); | ||
257 | } | 268 | } |
258 | 269 | ||
259 | /* | 270 | /* |
@@ -1061,6 +1072,7 @@ static struct usb_driver usb_storage_driver = { | |||
1061 | #ifdef CONFIG_PM | 1072 | #ifdef CONFIG_PM |
1062 | .suspend = storage_suspend, | 1073 | .suspend = storage_suspend, |
1063 | .resume = storage_resume, | 1074 | .resume = storage_resume, |
1075 | .reset_resume = storage_reset_resume, | ||
1064 | #endif | 1076 | #endif |
1065 | .pre_reset = storage_pre_reset, | 1077 | .pre_reset = storage_pre_reset, |
1066 | .post_reset = storage_post_reset, | 1078 | .post_reset = storage_post_reset, |