Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 174934
b: refs/heads/master
c: a2582bd
h: refs/heads/master
v: v3
  • Loading branch information
Russ Dill authored and Greg Kroah-Hartman committed Dec 11, 2009
1 parent 075a944 commit bfc745b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 19 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: 22a627ba81e0f75b994d37adb68761a9b9ef7186
refs/heads/master: a2582bd478c13c574d4c16ef1209d333f2a25935
28 changes: 10 additions & 18 deletions trunk/drivers/usb/core/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,24 +130,17 @@ struct usb_host_interface *usb_altnum_to_altsetting(
}
EXPORT_SYMBOL_GPL(usb_altnum_to_altsetting);

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

static int __find_interface(struct device *dev, void *data)
{
struct find_interface_arg *arg = data;
int *minor = data;
struct usb_interface *intf;

if (!is_usb_interface(dev))
return 0;

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

Expand All @@ -156,21 +149,20 @@ static int __find_interface(struct device *dev, void *data)
* @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
* This walks the bus 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.
*/
struct usb_interface *usb_find_interface(struct usb_driver *drv, int minor)
{
struct find_interface_arg argb;
int retval;
struct device *dev;

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

/* Drop reference count from bus_find_device */
put_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;
return dev ? to_usb_interface(dev) : NULL;
}
EXPORT_SYMBOL_GPL(usb_find_interface);

Expand Down

0 comments on commit bfc745b

Please sign in to comment.