Loading drivers/usb/core/usb.c +23 −18 Original line number Original line Diff line number Diff line Loading @@ -462,6 +462,25 @@ usb_match_id(struct usb_interface *interface, const struct usb_device_id *id) return NULL; return NULL; } } static int __find_interface(struct device * dev, void * data) { struct usb_interface ** ret = (struct usb_interface **)data; struct usb_interface * intf = *ret; int *minor = (int *)data; /* can't look at usb devices, only interfaces */ if (dev->driver == &usb_generic_driver) return 0; intf = to_usb_interface(dev); if (intf->minor != -1 && intf->minor == *minor) { *ret = intf; return 1; } return 0; } /** /** * usb_find_interface - find usb_interface pointer for driver and device * usb_find_interface - find usb_interface pointer for driver and device * @drv: the driver whose current configuration is considered * @drv: the driver whose current configuration is considered Loading @@ -473,26 +492,12 @@ usb_match_id(struct usb_interface *interface, const struct usb_device_id *id) */ */ struct usb_interface *usb_find_interface(struct usb_driver *drv, int minor) struct usb_interface *usb_find_interface(struct usb_driver *drv, int minor) { { struct list_head *entry; struct usb_interface *intf = (struct usb_interface *)minor; struct device *dev; int ret; struct usb_interface *intf; list_for_each(entry, &drv->driver.devices) { dev = container_of(entry, struct device, driver_list); /* can't look at usb devices, only interfaces */ if (dev->driver == &usb_generic_driver) continue; intf = to_usb_interface(dev); ret = driver_for_each_device(&drv->driver, NULL, &intf, __find_interface); if (intf->minor == -1) continue; if (intf->minor == minor) return intf; } /* no device found that matches */ return ret ? intf : NULL; return NULL; } } static int usb_device_match (struct device *dev, struct device_driver *drv) static int usb_device_match (struct device *dev, struct device_driver *drv) Loading Loading
drivers/usb/core/usb.c +23 −18 Original line number Original line Diff line number Diff line Loading @@ -462,6 +462,25 @@ usb_match_id(struct usb_interface *interface, const struct usb_device_id *id) return NULL; return NULL; } } static int __find_interface(struct device * dev, void * data) { struct usb_interface ** ret = (struct usb_interface **)data; struct usb_interface * intf = *ret; int *minor = (int *)data; /* can't look at usb devices, only interfaces */ if (dev->driver == &usb_generic_driver) return 0; intf = to_usb_interface(dev); if (intf->minor != -1 && intf->minor == *minor) { *ret = intf; return 1; } return 0; } /** /** * usb_find_interface - find usb_interface pointer for driver and device * usb_find_interface - find usb_interface pointer for driver and device * @drv: the driver whose current configuration is considered * @drv: the driver whose current configuration is considered Loading @@ -473,26 +492,12 @@ usb_match_id(struct usb_interface *interface, const struct usb_device_id *id) */ */ struct usb_interface *usb_find_interface(struct usb_driver *drv, int minor) struct usb_interface *usb_find_interface(struct usb_driver *drv, int minor) { { struct list_head *entry; struct usb_interface *intf = (struct usb_interface *)minor; struct device *dev; int ret; struct usb_interface *intf; list_for_each(entry, &drv->driver.devices) { dev = container_of(entry, struct device, driver_list); /* can't look at usb devices, only interfaces */ if (dev->driver == &usb_generic_driver) continue; intf = to_usb_interface(dev); ret = driver_for_each_device(&drv->driver, NULL, &intf, __find_interface); if (intf->minor == -1) continue; if (intf->minor == minor) return intf; } /* no device found that matches */ return ret ? intf : NULL; return NULL; } } static int usb_device_match (struct device *dev, struct device_driver *drv) static int usb_device_match (struct device *dev, struct device_driver *drv) Loading