Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 176416
b: refs/heads/master
c: c2d284e
h: refs/heads/master
v: v3
  • Loading branch information
Russ Dill authored and Greg Kroah-Hartman committed Dec 15, 2009
1 parent ddbbeab commit 7561d7d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ab7cd8c76cb47f1bda0ad964d309b4efce81b5e9
refs/heads/master: c2d284ee04ab6f6718de2ddcf1b43160e046c41d
31 changes: 16 additions & 15 deletions trunk/drivers/usb/core/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ EXPORT_SYMBOL_GPL(usb_altnum_to_altsetting);

struct find_interface_arg {
int minor;
struct usb_interface *interface;
struct device_driver *drv;
};

static int __find_interface(struct device *dev, void *data)
Expand All @@ -180,34 +180,35 @@ static int __find_interface(struct device *dev, void *data)
if (!is_usb_interface(dev))
return 0;

if (dev->driver != arg->drv)
return 0;
intf = to_usb_interface(dev);
if (intf->minor != -1 && intf->minor == arg->minor) {
arg->interface = intf;
return 1;
}
return 0;
return intf->minor == arg->minor;
}

/**
* usb_find_interface - find usb_interface pointer for driver and device
* @drv: the driver whose current configuration is considered
* @minor: the minor number of the desired device
*
* This walks the driver device list and returns a pointer to the interface
* with the matching minor. Note, this only works for devices that share the
* USB major number.
* This walks the bus device list and returns a pointer to the interface
* with the matching minor and driver. Note, this only works for devices
* that share the USB major number.
*/
struct usb_interface *usb_find_interface(struct usb_driver *drv, int minor)
{
struct find_interface_arg argb;
int retval;
struct device *dev;

argb.minor = minor;
argb.interface = NULL;
/* eat the error, it will be in argb.interface */
retval = driver_for_each_device(&drv->drvwrap.driver, NULL, &argb,
__find_interface);
return argb.interface;
argb.drv = &drv->drvwrap.driver;

dev = bus_find_device(&usb_bus_type, NULL, &argb, __find_interface);

/* Drop reference count from bus_find_device */
put_device(dev);

return dev ? to_usb_interface(dev) : NULL;
}
EXPORT_SYMBOL_GPL(usb_find_interface);

Expand Down

0 comments on commit 7561d7d

Please sign in to comment.