summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <greg@kroah.com>2002-08-14 00:30:03 -0700
committerGreg Kroah-Hartman <greg@kroah.com>2002-08-14 00:30:03 -0700
commitf601a8a6374d5e1fdc2a9641dde46709b6dea6dc (patch)
treefd58a67374907da586336905d4375dae7563f30d
parent16dc2073cc61ce5ede5392cf23ebaeea8a988f4a (diff)
USB: changed usb_match_id to not need the usb_device pointer.
-rw-r--r--drivers/usb/core/usb.c18
-rw-r--r--drivers/usb/serial/usbserial.c2
-rw-r--r--drivers/usb/storage/scsiglue.c2
-rw-r--r--include/linux/usb.h3
4 files changed, 12 insertions, 13 deletions
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 718389719dc4..67548c9fe50a 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -206,7 +206,7 @@ usb_bind_driver (struct usb_driver *driver, struct usb_interface *interface)
if (id) {
for (i = 0; i < interface->num_altsetting; i++) {
interface->act_altsetting = i;
- id = usb_match_id(dev, interface, id);
+ id = usb_match_id(interface, id);
if (id) {
down(&driver->serialize);
private = driver->probe(dev,ifnum,id);
@@ -466,7 +466,6 @@ void usb_driver_release_interface(struct usb_driver *driver, struct usb_interfac
/**
* usb_match_id - find first usb_device_id matching device or interface
- * @dev: the device whose descriptors are considered when matching
* @interface: the interface of interest
* @id: array of usb_device_id structures, terminated by zero entry
*
@@ -528,15 +527,18 @@ void usb_driver_release_interface(struct usb_driver *driver, struct usb_interfac
* its associated class and subclass.
*/
const struct usb_device_id *
-usb_match_id(struct usb_device *dev, struct usb_interface *interface,
- const struct usb_device_id *id)
+usb_match_id(struct usb_interface *interface, const struct usb_device_id *id)
{
- struct usb_interface_descriptor *intf = 0;
+ struct usb_interface_descriptor *intf;
+ struct usb_device *dev;
/* proc_connectinfo in devio.c may call us with id == NULL. */
if (id == NULL)
return NULL;
+ intf = &interface->altsetting [interface->act_altsetting];
+ dev = interface_to_usbdev(interface);
+
/* It is important to check that id->driver_info is nonzero,
since an entry that is all zeroes except for a nonzero
id->driver_info is the way to create an entry that
@@ -575,19 +577,17 @@ usb_match_id(struct usb_device *dev, struct usb_interface *interface,
(id->bDeviceProtocol != dev->descriptor.bDeviceProtocol))
continue;
- intf = &interface->altsetting [interface->act_altsetting];
-
if ((id->match_flags & USB_DEVICE_ID_MATCH_INT_CLASS) &&
(id->bInterfaceClass != intf->bInterfaceClass))
continue;
if ((id->match_flags & USB_DEVICE_ID_MATCH_INT_SUBCLASS) &&
(id->bInterfaceSubClass != intf->bInterfaceSubClass))
- continue;
+ continue;
if ((id->match_flags & USB_DEVICE_ID_MATCH_INT_PROTOCOL) &&
(id->bInterfaceProtocol != intf->bInterfaceProtocol))
- continue;
+ continue;
return id;
}
diff --git a/drivers/usb/serial/usbserial.c b/drivers/usb/serial/usbserial.c
index c232a4ec3010..a5cc1450d24a 100644
--- a/drivers/usb/serial/usbserial.c
+++ b/drivers/usb/serial/usbserial.c
@@ -1193,7 +1193,7 @@ static void * usb_serial_probe(struct usb_device *dev, unsigned int ifnum,
interface = &dev->actconfig->interface[ifnum];
list_for_each (tmp, &usb_serial_driver_list) {
type = list_entry(tmp, struct usb_serial_device_type, driver_list);
- id_pattern = usb_match_id(dev, interface, type->id_table);
+ id_pattern = usb_match_id(interface, type->id_table);
if (id_pattern != NULL) {
dbg("descriptor matches");
found = 1;
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
index b223f089723e..c2cf254e5383 100644
--- a/drivers/usb/storage/scsiglue.c
+++ b/drivers/usb/storage/scsiglue.c
@@ -265,7 +265,7 @@ static int bus_reset( Scsi_Cmnd *srb )
US_DEBUGPX("simulating disconnect/reconnect.\n");
down(&intf->driver->serialize);
intf->driver->disconnect(pusb_dev_save, intf->private_data);
- id = usb_match_id(pusb_dev_save, intf, intf->driver->id_table);
+ id = usb_match_id(intf, intf->driver->id_table);
intf->driver->probe(pusb_dev_save, i, id);
up(&intf->driver->serialize);
}
diff --git a/include/linux/usb.h b/include/linux/usb.h
index cc7f1aa7520f..ad34a45f28c4 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -443,8 +443,7 @@ extern void usb_driver_claim_interface(struct usb_driver *driver,
extern int usb_interface_claimed(struct usb_interface *iface);
extern void usb_driver_release_interface(struct usb_driver *driver,
struct usb_interface *iface);
-const struct usb_device_id *usb_match_id(struct usb_device *dev,
- struct usb_interface *interface,
+const struct usb_device_id *usb_match_id(struct usb_interface *interface,
const struct usb_device_id *id);
/**