staging: comedi: comedidev.h: introduce comedi_to_pci_dev() helper
authorH Hartley Sweeten <hartleys@visionengravers.com>
Thu, 19 Jul 2012 17:39:33 +0000 (10:39 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 19 Jul 2012 23:19:39 +0000 (16:19 -0700)
Introduce a wrapper for to_pci_dev() to allow the comedi_pci_drivers
to store the pci_dev pointer in the comedi_device hw_dev variable and
retrieve it easily.

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

index de8c99c34070ac9b1a5bf40b3b46b7ae275bbde3..f713783ef6246a1a72af55c728269a97b27d700a 100644 (file)
@@ -446,6 +446,11 @@ static inline void comedi_set_hw_dev(struct comedi_device *dev,
        }
 }
 
+static inline struct pci_dev *comedi_to_pci_dev(struct comedi_device *dev)
+{
+       return dev->hw_dev ? to_pci_dev(dev->hw_dev) : NULL;
+}
+
 int comedi_buf_put(struct comedi_async *async, short x);
 int comedi_buf_get(struct comedi_async *async, short *x);