staging: comedi: add generic auto-config functions
authorIan Abbott <abbotti@mev.co.uk>
Sat, 27 Oct 2012 20:44:14 +0000 (21:44 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 29 Oct 2012 22:02:08 +0000 (15:02 -0700)
commit8ed705aff0652fdbd2c6b406155d7d480e1aabe0
tree565fd8ab2bb905f209e0a5e21a2c98a7621a1ab6
parent156096a0398fd5c42beeed87ad9b79134d890d22
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>
drivers/staging/comedi/comedidev.h
drivers/staging/comedi/drivers.c