summaryrefslogtreecommitdiff
path: root/drivers/staging/comedi/comedidev.h
diff options
context:
space:
mode:
authorIan Abbott <abbotti@mev.co.uk>2012-10-27 20:44:14 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-10-29 22:02:08 (GMT)
commit8ed705aff0652fdbd2c6b406155d7d480e1aabe0 (patch)
tree565fd8ab2bb905f209e0a5e21a2c98a7621a1ab6 /drivers/staging/comedi/comedidev.h
parent156096a0398fd5c42beeed87ad9b79134d890d22 (diff)
downloadlinux-fsl-qoriq-8ed705aff0652fdbd2c6b406155d7d480e1aabe0.tar.xz
staging: comedi: add generic auto-config functions
Add (and export) generic auto-config function `comedi_auto_config()` to allow hardware devices on arbitrary bus types (e.g. platform devices, spi devices, etc.) to be auto-configured as comedi devices. This uses a new `auto_attach()` hook in the `struct comedi_driver`. This new hook will eventually replace the bus-specific `attach_pci()` and `attach_usb()` hooks in the low-level comedi drivers. When the `auto_attach()` hook is called in the low-level driver, the `hw_dev` member of the `struct comedi_device` will have already been set to the hardware device passed to `comedi_auto_config()`. The low-level driver can convert this to some bus-device wrapper structure pointer, possibly with the help of the `context` parameter that is passed unchanged from the `comedi_auto_config()` call. Also export the existing `comedi_auto_unconfig()` function as the matching call to `comedi_auto_config()`. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/comedi/comedidev.h')
-rw-r--r--drivers/staging/comedi/comedidev.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h
index d9f2b8b..2b884a6 100644
--- a/drivers/staging/comedi/comedidev.h
+++ b/drivers/staging/comedi/comedidev.h
@@ -204,6 +204,7 @@ struct comedi_driver {
void (*detach) (struct comedi_device *);
int (*attach_pci) (struct comedi_device *, struct pci_dev *);
int (*attach_usb) (struct comedi_device *, struct usb_interface *);
+ int (*auto_attach) (struct comedi_device *, unsigned long);
/* number of elements in board_name and board_id arrays */
unsigned int num_names;
@@ -510,6 +511,9 @@ static inline void *comedi_aux_data(int options[], int n)
int comedi_alloc_subdevice_minor(struct comedi_device *dev,
struct comedi_subdevice *s);
void comedi_free_subdevice_minor(struct comedi_subdevice *s);
+int comedi_auto_config(struct device *hardware_device,
+ struct comedi_driver *driver, unsigned long context);
+void comedi_auto_unconfig(struct device *hardware_device);
int comedi_pci_auto_config(struct pci_dev *pcidev,
struct comedi_driver *driver);
void comedi_pci_auto_unconfig(struct pci_dev *pcidev);