staging: comedi: export comedi_set_hw_dev()
authorIan Abbott <abbotti@mev.co.uk>
Fri, 1 Feb 2013 13:23:19 +0000 (13:23 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 4 Feb 2013 01:44:19 +0000 (17:44 -0800)
Chnage the inline `comedi_set_hw_dev()` to an exported function and
change it's return type from `void` to `int` so we can impose some
restrictions (in a later patch) and return an error if necessary.

Only a few comedi drivers call this, although they don't need to if the
hardware device has been attached automatically via
`comedi_auto_config()` and the comedi driver's `auto_attach()` method.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/comedidev.h
drivers/staging/comedi/drivers.c

index 484321d546ddcf853a9ac6b4595a36ed01b74a66..1502fc4a85fc5b8a3bb7a9bc2f1fa330199a2b72 100644 (file)
@@ -324,14 +324,7 @@ static inline unsigned int bytes_per_sample(const struct comedi_subdevice *subd)
  * known bus type.  Set automatically for auto-configured devices.
  * Automatically set to NULL when detaching hardware device.
  */
-static inline void comedi_set_hw_dev(struct comedi_device *dev,
-                                    struct device *hw_dev)
-{
-       struct device *old_hw_dev = dev->hw_dev;
-
-       dev->hw_dev = get_device(hw_dev);
-       put_device(old_hw_dev);
-}
+int comedi_set_hw_dev(struct comedi_device *dev, struct device *hw_dev);
 
 unsigned int comedi_buf_write_alloc(struct comedi_async *, unsigned int);
 unsigned int comedi_buf_write_free(struct comedi_async *, unsigned int);
index cc6240aa57905f67065e3a680c5831816b1b551c..5adf9fc45de464bfebae22bc79bd12ce0406a256 100644 (file)
 
 struct comedi_driver *comedi_drivers;
 
+int comedi_set_hw_dev(struct comedi_device *dev, struct device *hw_dev)
+{
+       struct device *old_hw_dev = dev->hw_dev;
+
+       dev->hw_dev = get_device(hw_dev);
+       put_device(old_hw_dev);
+       return 0;
+}
+EXPORT_SYMBOL_GPL(comedi_set_hw_dev);
+
 int comedi_alloc_subdevices(struct comedi_device *dev, int num_subdevices)
 {
        struct comedi_subdevice *s;