diff options
author | Pete Zaitcev <zaitcev@redhat.com> | 2005-12-21 20:24:54 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-01-04 16:51:44 -0500 |
commit | f5691d70d4aeec0ac9cff11f0cabb7d5a1735705 (patch) | |
tree | 124e1d04ab52425be1417e71387ae7036e03152c /drivers/usb | |
parent | a9714c845c0681a203a9ae22aa5165ec72c51d33 (diff) |
[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: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/core/usb.c | 23 |
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 | } |
195 | struct find_interface_arg { | ||
196 | int minor; | ||
197 | struct usb_interface *interface; | ||
198 | }; | ||
195 | 199 | ||
196 | static int __find_interface(struct device * dev, void * data) | 200 | static 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 | */ |
223 | struct usb_interface *usb_find_interface(struct usb_driver *drv, int minor) | 226 | struct 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 |