aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/storage/usb.c
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2006-06-01 13:52:56 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-06-21 18:04:15 -0400
commit47104b0dd32cec467574822b0dc3517b3de3f0ad (patch)
tree7cc1a012b3351275249c15fbdfc608a1774762b4 /drivers/usb/storage/usb.c
parent7de18d8bf4b470752e799e219b38b6dff4b49993 (diff)
[PATCH] usb-storage: use usb_reset_composite_device
This patch (as701) modifies usb-storage to take advantage of the new usb_reset_composite_device() API. Now we will be able to safely request port resets even if other drivers are bound to a mass-storage device. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/storage/usb.c')
-rw-r--r--drivers/usb/storage/usb.c33
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
228static 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
238static 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