aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/usb/core/usb.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 6ee2b5359a83..56a3520863a9 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -192,20 +192,23 @@ void usb_driver_release_interface(struct usb_driver *driver,
192 iface->condition = USB_INTERFACE_UNBOUND; 192 iface->condition = USB_INTERFACE_UNBOUND;
193 mark_quiesced(iface); 193 mark_quiesced(iface);
194} 194}
195struct find_interface_arg {
196 int minor;
197 struct usb_interface *interface;
198};
195 199
196static int __find_interface(struct device * dev, void * data) 200static int __find_interface(struct device * dev, void * data)
197{ 201{
198 struct usb_interface ** ret = (struct usb_interface **)data; 202 struct find_interface_arg *arg = data;
199 struct usb_interface * intf = *ret; 203 struct usb_interface *intf;
200 int *minor = (int *)data;
201 204
202 /* can't look at usb devices, only interfaces */ 205 /* can't look at usb devices, only interfaces */
203 if (dev->driver == &usb_generic_driver) 206 if (dev->driver == &usb_generic_driver)
204 return 0; 207 return 0;
205 208
206 intf = to_usb_interface(dev); 209 intf = to_usb_interface(dev);
207 if (intf->minor != -1 && intf->minor == *minor) { 210 if (intf->minor != -1 && intf->minor == arg->minor) {
208 *ret = intf; 211 arg->interface = intf;
209 return 1; 212 return 1;
210 } 213 }
211 return 0; 214 return 0;
@@ -222,12 +225,12 @@ static int __find_interface(struct device * dev, void * data)
222 */ 225 */
223struct usb_interface *usb_find_interface(struct usb_driver *drv, int minor) 226struct usb_interface *usb_find_interface(struct usb_driver *drv, int minor)
224{ 227{
225 struct usb_interface *intf = (struct usb_interface *)(long)minor; 228 struct find_interface_arg argb;
226 int ret;
227
228 ret = driver_for_each_device(&drv->driver, NULL, &intf, __find_interface);
229 229
230 return ret ? intf : NULL; 230 argb.minor = minor;
231 argb.interface = NULL;
232 driver_for_each_device(&drv->driver, NULL, &argb, __find_interface);
233 return argb.interface;
231} 234}
232 235
233#ifdef CONFIG_HOTPLUG 236#ifdef CONFIG_HOTPLUG