]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/usb/storage/usb.c
Merge git://git.linux-nfs.org/pub/linux/nfs-2.6
[linux-2.6-omap-h63xx.git] / drivers / usb / storage / usb.c
index dd108634348e3f12d299b320dc119430d700d8b8..e232c7c8990910a285d1f1dad8fcc9acf84b4c0b 100644 (file)
@@ -220,6 +220,37 @@ static int storage_resume(struct usb_interface *iface)
 
 #endif /* CONFIG_PM */
 
+/*
+ * The next two routines get called just before and just after
+ * a USB port reset, whether from this driver or a different one.
+ */
+
+static void storage_pre_reset(struct usb_interface *iface)
+{
+       struct us_data *us = usb_get_intfdata(iface);
+
+       US_DEBUGP("%s\n", __FUNCTION__);
+
+       /* Make sure no command runs during the reset */
+       mutex_lock(&us->dev_mutex);
+}
+
+static void storage_post_reset(struct usb_interface *iface)
+{
+       struct us_data *us = usb_get_intfdata(iface);
+
+       US_DEBUGP("%s\n", __FUNCTION__);
+
+       /* Report the reset to the SCSI core */
+       scsi_lock(us_to_host(us));
+       usb_stor_report_bus_reset(us);
+       scsi_unlock(us_to_host(us));
+
+       /* FIXME: Notify the subdrivers that they need to reinitialize
+        * the device */
+       mutex_unlock(&us->dev_mutex);
+}
+
 /*
  * fill_inquiry_response takes an unsigned char array (which must
  * be at least 36 characters) and populates the vendor name,
@@ -593,6 +624,15 @@ static int get_transport(struct us_data *us)
                break;
 #endif
 
+#ifdef CONFIG_USB_STORAGE_ALAUDA
+       case US_PR_ALAUDA:
+               us->transport_name  = "Alauda Control/Bulk";
+               us->transport = alauda_transport;
+               us->transport_reset = usb_stor_Bulk_reset;
+               us->max_lun = 1;
+               break;
+#endif
+
        default:
                return -EIO;
        }
@@ -648,15 +688,6 @@ static int get_protocol(struct us_data *us)
                break;
 #endif
 
-#ifdef CONFIG_USB_STORAGE_ALAUDA
-       case US_PR_ALAUDA:
-               us->transport_name  = "Alauda Control/Bulk";
-               us->transport = alauda_transport;
-               us->transport_reset = usb_stor_Bulk_reset;
-               us->max_lun = 1;
-               break;
-#endif
-
        default:
                return -EIO;
        }
@@ -1002,6 +1033,8 @@ static struct usb_driver usb_storage_driver = {
        .suspend =      storage_suspend,
        .resume =       storage_resume,
 #endif
+       .pre_reset =    storage_pre_reset,
+       .post_reset =   storage_post_reset,
        .id_table =     storage_usb_ids,
 };