diff options
Diffstat (limited to 'drivers/usb/storage/usb.c')
-rw-r--r-- | drivers/usb/storage/usb.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index 0142fe82f6b8..e232c7c89909 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c | |||
@@ -221,6 +221,37 @@ static int storage_resume(struct usb_interface *iface) | |||
221 | #endif /* CONFIG_PM */ | 221 | #endif /* CONFIG_PM */ |
222 | 222 | ||
223 | /* | 223 | /* |
224 | * The next two routines get called just before and just after | ||
225 | * a USB port reset, whether from this driver or a different one. | ||
226 | */ | ||
227 | |||
228 | static void storage_pre_reset(struct usb_interface *iface) | ||
229 | { | ||
230 | struct us_data *us = usb_get_intfdata(iface); | ||
231 | |||
232 | US_DEBUGP("%s\n", __FUNCTION__); | ||
233 | |||
234 | /* Make sure no command runs during the reset */ | ||
235 | mutex_lock(&us->dev_mutex); | ||
236 | } | ||
237 | |||
238 | static void storage_post_reset(struct usb_interface *iface) | ||
239 | { | ||
240 | struct us_data *us = usb_get_intfdata(iface); | ||
241 | |||
242 | US_DEBUGP("%s\n", __FUNCTION__); | ||
243 | |||
244 | /* Report the reset to the SCSI core */ | ||
245 | scsi_lock(us_to_host(us)); | ||
246 | usb_stor_report_bus_reset(us); | ||
247 | scsi_unlock(us_to_host(us)); | ||
248 | |||
249 | /* FIXME: Notify the subdrivers that they need to reinitialize | ||
250 | * the device */ | ||
251 | mutex_unlock(&us->dev_mutex); | ||
252 | } | ||
253 | |||
254 | /* | ||
224 | * fill_inquiry_response takes an unsigned char array (which must | 255 | * fill_inquiry_response takes an unsigned char array (which must |
225 | * be at least 36 characters) and populates the vendor name, | 256 | * be at least 36 characters) and populates the vendor name, |
226 | * product name, and revision fields. Then the array is copied | 257 | * product name, and revision fields. Then the array is copied |
@@ -1002,6 +1033,8 @@ static struct usb_driver usb_storage_driver = { | |||
1002 | .suspend = storage_suspend, | 1033 | .suspend = storage_suspend, |
1003 | .resume = storage_resume, | 1034 | .resume = storage_resume, |
1004 | #endif | 1035 | #endif |
1036 | .pre_reset = storage_pre_reset, | ||
1037 | .post_reset = storage_post_reset, | ||
1005 | .id_table = storage_usb_ids, | 1038 | .id_table = storage_usb_ids, |
1006 | }; | 1039 | }; |
1007 | 1040 | ||