staging: comedi: introduce comedi_to_usb_dev()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Mon, 20 May 2013 21:20:02 +0000 (14:20 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 21 May 2013 17:59:10 +0000 (10:59 -0700)
Introduce a helper function to get a usb_device pointer from a
comedi_device pointer.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/comedi_usb.c
drivers/staging/comedi/comedidev.h

index b72da79108086a1b1518299d54348c953375d826..13f18bef60916ab07c5145269373ecf550aacc89 100644 (file)
@@ -30,6 +30,18 @@ struct usb_interface *comedi_to_usb_interface(struct comedi_device *dev)
 }
 EXPORT_SYMBOL_GPL(comedi_to_usb_interface);
 
+/**
+ * comedi_to_usb_dev() - comedi_device pointer to usb_device pointer.
+ * @dev: comedi_device struct
+ */
+struct usb_device *comedi_to_usb_dev(struct comedi_device *dev)
+{
+       struct usb_interface *intf = comedi_to_usb_interface(dev);
+
+       return intf ? interface_to_usbdev(intf) : NULL;
+}
+EXPORT_SYMBOL_GPL(comedi_to_usb_dev);
+
 /**
  * comedi_usb_auto_config() - Configure/probe a comedi USB driver.
  * @intf: usb_interface struct
index a31915f1af65c899b2adeb2924f8fa7a06250b2b..ab926a6654ef5062837c317e46cabf73f4911c06 100644 (file)
@@ -491,6 +491,7 @@ struct usb_driver;
 struct usb_interface;
 
 struct usb_interface *comedi_to_usb_interface(struct comedi_device *);
+struct usb_device *comedi_to_usb_dev(struct comedi_device *);
 
 int comedi_usb_auto_config(struct usb_interface *, struct comedi_driver *,
                           unsigned long context);