aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wilcox <willy@linux.intel.com>2010-04-30 15:11:30 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-05-20 16:21:41 -0400
commit1e429018b646bdf903554e92ead1cda96cc552dc (patch)
treee57fdbc9e823d5b06659ceae6ce9850c6ab3be91
parentfe54b058de9d1df5fef9e2a559651f4b7c9f04b1 (diff)
USB: Turn interface_to_usbdev into an inline function
The stronger type-checking would have prevented a bug I had. Signed-off-by: Matthew Wilcox <willy@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--include/linux/usb.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/include/linux/usb.h b/include/linux/usb.h
index fd7d61e58198..cf3b289a87a2 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -184,8 +184,6 @@ struct usb_interface {
184 struct work_struct reset_ws; /* for resets in atomic context */ 184 struct work_struct reset_ws; /* for resets in atomic context */
185}; 185};
186#define to_usb_interface(d) container_of(d, struct usb_interface, dev) 186#define to_usb_interface(d) container_of(d, struct usb_interface, dev)
187#define interface_to_usbdev(intf) \
188 container_of(intf->dev.parent, struct usb_device, dev)
189 187
190static inline void *usb_get_intfdata(struct usb_interface *intf) 188static inline void *usb_get_intfdata(struct usb_interface *intf)
191{ 189{
@@ -493,6 +491,11 @@ struct usb_device {
493}; 491};
494#define to_usb_device(d) container_of(d, struct usb_device, dev) 492#define to_usb_device(d) container_of(d, struct usb_device, dev)
495 493
494static inline struct usb_device *interface_to_usbdev(struct usb_interface *intf)
495{
496 return to_usb_device(intf->dev.parent);
497}
498
496extern struct usb_device *usb_get_dev(struct usb_device *dev); 499extern struct usb_device *usb_get_dev(struct usb_device *dev);
497extern void usb_put_dev(struct usb_device *dev); 500extern void usb_put_dev(struct usb_device *dev);
498 501