Commit f5691d70 authored by Pete Zaitcev's avatar Pete Zaitcev Committed by Greg Kroah-Hartman

[PATCH] USB: fix usb_find_interface for ppc64

Fix usb_find_interface. You cannot case pointers to int and long on
a big-endian 64-bitter without consequences.
Signed-off-by: default avatarPete Zaitcev <zaitcev@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent a9714c84
...@@ -192,20 +192,23 @@ void usb_driver_release_interface(struct usb_driver *driver, ...@@ -192,20 +192,23 @@ void usb_driver_release_interface(struct usb_driver *driver,
iface->condition = USB_INTERFACE_UNBOUND; iface->condition = USB_INTERFACE_UNBOUND;
mark_quiesced(iface); mark_quiesced(iface);
} }
struct find_interface_arg {
int minor;
struct usb_interface *interface;
};
static int __find_interface(struct device * dev, void * data) static int __find_interface(struct device * dev, void * data)
{ {
struct usb_interface ** ret = (struct usb_interface **)data; struct find_interface_arg *arg = data;
struct usb_interface * intf = *ret; struct usb_interface *intf;
int *minor = (int *)data;
/* can't look at usb devices, only interfaces */ /* can't look at usb devices, only interfaces */
if (dev->driver == &usb_generic_driver) if (dev->driver == &usb_generic_driver)
return 0; return 0;
intf = to_usb_interface(dev); intf = to_usb_interface(dev);
if (intf->minor != -1 && intf->minor == *minor) { if (intf->minor != -1 && intf->minor == arg->minor) {
*ret = intf; arg->interface = intf;
return 1; return 1;
} }
return 0; return 0;
...@@ -222,12 +225,12 @@ static int __find_interface(struct device * dev, void * data) ...@@ -222,12 +225,12 @@ static int __find_interface(struct device * dev, void * data)
*/ */
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 usb_interface *intf = (struct usb_interface *)(long)minor; struct find_interface_arg argb;
int ret;
ret = driver_for_each_device(&drv->driver, NULL, &intf, __find_interface);
return ret ? intf : NULL; argb.minor = minor;
argb.interface = NULL;
driver_for_each_device(&drv->driver, NULL, &argb, __find_interface);
return argb.interface;
} }
#ifdef CONFIG_HOTPLUG #ifdef CONFIG_HOTPLUG
......
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