Commit f601a8a6 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

USB: changed usb_match_id to not need the usb_device pointer.

parent 16dc2073
...@@ -206,7 +206,7 @@ usb_bind_driver (struct usb_driver *driver, struct usb_interface *interface) ...@@ -206,7 +206,7 @@ usb_bind_driver (struct usb_driver *driver, struct usb_interface *interface)
if (id) { if (id) {
for (i = 0; i < interface->num_altsetting; i++) { for (i = 0; i < interface->num_altsetting; i++) {
interface->act_altsetting = i; interface->act_altsetting = i;
id = usb_match_id(dev, interface, id); id = usb_match_id(interface, id);
if (id) { if (id) {
down(&driver->serialize); down(&driver->serialize);
private = driver->probe(dev,ifnum,id); private = driver->probe(dev,ifnum,id);
...@@ -466,7 +466,6 @@ void usb_driver_release_interface(struct usb_driver *driver, struct usb_interfac ...@@ -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 * 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 * @interface: the interface of interest
* @id: array of usb_device_id structures, terminated by zero entry * @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 ...@@ -528,15 +527,18 @@ void usb_driver_release_interface(struct usb_driver *driver, struct usb_interfac
* its associated class and subclass. * its associated class and subclass.
*/ */
const struct usb_device_id * const struct usb_device_id *
usb_match_id(struct usb_device *dev, struct usb_interface *interface, usb_match_id(struct usb_interface *interface, const struct usb_device_id *id)
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. */ /* proc_connectinfo in devio.c may call us with id == NULL. */
if (id == NULL) if (id == NULL)
return 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, /* It is important to check that id->driver_info is nonzero,
since an entry that is all zeroes except for a nonzero since an entry that is all zeroes except for a nonzero
id->driver_info is the way to create an entry that 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, ...@@ -575,19 +577,17 @@ usb_match_id(struct usb_device *dev, struct usb_interface *interface,
(id->bDeviceProtocol != dev->descriptor.bDeviceProtocol)) (id->bDeviceProtocol != dev->descriptor.bDeviceProtocol))
continue; continue;
intf = &interface->altsetting [interface->act_altsetting];
if ((id->match_flags & USB_DEVICE_ID_MATCH_INT_CLASS) && if ((id->match_flags & USB_DEVICE_ID_MATCH_INT_CLASS) &&
(id->bInterfaceClass != intf->bInterfaceClass)) (id->bInterfaceClass != intf->bInterfaceClass))
continue; continue;
if ((id->match_flags & USB_DEVICE_ID_MATCH_INT_SUBCLASS) && if ((id->match_flags & USB_DEVICE_ID_MATCH_INT_SUBCLASS) &&
(id->bInterfaceSubClass != intf->bInterfaceSubClass)) (id->bInterfaceSubClass != intf->bInterfaceSubClass))
continue; continue;
if ((id->match_flags & USB_DEVICE_ID_MATCH_INT_PROTOCOL) && if ((id->match_flags & USB_DEVICE_ID_MATCH_INT_PROTOCOL) &&
(id->bInterfaceProtocol != intf->bInterfaceProtocol)) (id->bInterfaceProtocol != intf->bInterfaceProtocol))
continue; continue;
return id; return id;
} }
......
...@@ -1193,7 +1193,7 @@ static void * usb_serial_probe(struct usb_device *dev, unsigned int ifnum, ...@@ -1193,7 +1193,7 @@ static void * usb_serial_probe(struct usb_device *dev, unsigned int ifnum,
interface = &dev->actconfig->interface[ifnum]; interface = &dev->actconfig->interface[ifnum];
list_for_each (tmp, &usb_serial_driver_list) { list_for_each (tmp, &usb_serial_driver_list) {
type = list_entry(tmp, struct usb_serial_device_type, 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) { if (id_pattern != NULL) {
dbg("descriptor matches"); dbg("descriptor matches");
found = 1; found = 1;
......
...@@ -265,7 +265,7 @@ static int bus_reset( Scsi_Cmnd *srb ) ...@@ -265,7 +265,7 @@ static int bus_reset( Scsi_Cmnd *srb )
US_DEBUGPX("simulating disconnect/reconnect.\n"); US_DEBUGPX("simulating disconnect/reconnect.\n");
down(&intf->driver->serialize); down(&intf->driver->serialize);
intf->driver->disconnect(pusb_dev_save, intf->private_data); 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); intf->driver->probe(pusb_dev_save, i, id);
up(&intf->driver->serialize); up(&intf->driver->serialize);
} }
......
...@@ -443,8 +443,7 @@ extern void usb_driver_claim_interface(struct usb_driver *driver, ...@@ -443,8 +443,7 @@ extern void usb_driver_claim_interface(struct usb_driver *driver,
extern int usb_interface_claimed(struct usb_interface *iface); extern int usb_interface_claimed(struct usb_interface *iface);
extern void usb_driver_release_interface(struct usb_driver *driver, extern void usb_driver_release_interface(struct usb_driver *driver,
struct usb_interface *iface); struct usb_interface *iface);
const struct usb_device_id *usb_match_id(struct usb_device *dev, const struct usb_device_id *usb_match_id(struct usb_interface *interface,
struct usb_interface *interface,
const struct usb_device_id *id); const struct usb_device_id *id);
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment