# This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.585 -> 1.586 # drivers/usb/storage/usb.c 1.39 -> 1.40 # drivers/usb/storage/scsiglue.c 1.30 -> 1.31 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 02/09/16 greg@kroah.com 1.586 # USB: convert the drivers/usb/storage files to the new USB driver model. # -------------------------------------------- # diff -Nru a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c --- a/drivers/usb/storage/scsiglue.c Mon Sep 16 15:00:17 2002 +++ b/drivers/usb/storage/scsiglue.c Mon Sep 16 15:00:17 2002 @@ -252,7 +252,6 @@ for (i = 0; i < pusb_dev_save->actconfig->bNumInterfaces; i++) { struct usb_interface *intf = &pusb_dev_save->actconfig->interface[i]; - const struct usb_device_id *id; /* if this is an unclaimed interface, skip it */ if (!intf->driver) { @@ -263,11 +262,8 @@ /* simulate a disconnect and reconnect for all interfaces */ US_DEBUGPX("simulating disconnect/reconnect.\n"); - down(&intf->driver->serialize); - intf->driver->disconnect(pusb_dev_save, intf->private_data); - id = usb_match_id(intf, intf->driver->id_table); - intf->driver->probe(pusb_dev_save, i, id); - up(&intf->driver->serialize); + usb_device_remove (&intf->dev); + usb_device_probe (&intf->dev); } US_DEBUGP("bus_reset() complete\n"); scsi_lock(srb->host); diff -Nru a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c --- a/drivers/usb/storage/usb.c Mon Sep 16 15:00:17 2002 +++ b/drivers/usb/storage/usb.c Mon Sep 16 15:00:17 2002 @@ -103,10 +103,10 @@ struct us_data *us_list; struct semaphore us_list_semaphore; -static void * storage_probe(struct usb_device *dev, unsigned int ifnum, - const struct usb_device_id *id); +static int storage_probe(struct usb_interface *iface, + const struct usb_device_id *id); -static void storage_disconnect(struct usb_device *dev, void *ptr); +static void storage_disconnect(struct usb_interface *iface); /* The entries in this table, except for final ones here * (USB_MASS_STORAGE_CLASS and the empty entry), correspond, @@ -623,9 +623,11 @@ } /* Probe to see if a new device is actually a SCSI device */ -static void * storage_probe(struct usb_device *dev, unsigned int ifnum, - const struct usb_device_id *id) +static int storage_probe(struct usb_interface *intf, + const struct usb_device_id *id) { + struct usb_device *dev = interface_to_usbdev(intf); + int ifnum = intf->altsetting->bInterfaceNumber; int i; const int id_index = id - storage_usb_ids; char mf[USB_STOR_STRING_LEN]; /* manufacturer */ @@ -650,7 +652,6 @@ /* the altsetting on the interface we're probing that matched our * usb_match_id table */ - struct usb_interface *intf = dev->actconfig->interface; struct usb_interface_descriptor *altsetting = intf[ifnum].altsetting + intf[ifnum].act_altsetting; US_DEBUGP("act_altsetting is %d\n", intf[ifnum].act_altsetting); @@ -680,7 +681,7 @@ US_DEBUGP("Product: %s\n", unusual_dev->productName); } else /* no, we can't support it */ - return NULL; + return -EIO; /* At this point, we know we've got a live one */ US_DEBUGP("USB Mass Storage device detected\n"); @@ -728,7 +729,7 @@ } else if (result != 0) { /* it's not a stall, but another error -- time to bail */ US_DEBUGP("-- Unknown error. Rejecting device\n"); - return NULL; + return -EIO; } } #endif @@ -736,7 +737,7 @@ /* Do some basic sanity checks, and bail if we find a problem */ if (!ep_in || !ep_out || (protocol == US_PR_CBI && !ep_int)) { US_DEBUGP("Endpoint sanity check failed! Rejecting dev.\n"); - return NULL; + return -EIO; } /* At this point, we've decided to try to use the device */ @@ -815,7 +816,7 @@ GFP_KERNEL)) == NULL) { printk(KERN_WARNING USB_STORAGE "Out of memory\n"); usb_put_dev(dev); - return NULL; + return -ENOMEM; } memset(ss, 0, sizeof(struct us_data)); new_device = 1; @@ -1091,8 +1092,9 @@ printk(KERN_DEBUG "USB Mass Storage device found at %d\n", dev->devnum); - /* return a pointer for the disconnect function */ - return ss; + /* save a pointer to our structure */ + dev_set_drvdata (&intf->dev, ss); + return 0; /* we come here if there are any problems */ /* ss->dev_semaphore must be locked */ @@ -1102,15 +1104,17 @@ up(&ss->dev_semaphore); if (new_device) kfree(ss); - return NULL; + return -EIO; } /* Handle a disconnect event from the USB core */ -static void storage_disconnect(struct usb_device *dev, void *ptr) +static void storage_disconnect(struct usb_interface *intf) { - struct us_data *ss = ptr; + struct us_data *ss = dev_get_drvdata (&intf->dev); US_DEBUGP("storage_disconnect() called\n"); + + dev_set_drvdata (&intf->dev, NULL); /* this is the odd case -- we disconnected but weren't using it */ if (!ss) {