summaryrefslogtreecommitdiff
path: root/drivers/staging/comedi/drivers.c
diff options
context:
space:
mode:
authorIan Abbott <abbotti@mev.co.uk>2012-10-27 20:44:15 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-10-29 22:02:08 (GMT)
commitd5121914a22c22d849abb57d086fe408c9ca2c0c (patch)
treec2ea3ae26e292f7faaae75fc300e46115397f17f /drivers/staging/comedi/drivers.c
parent8ed705aff0652fdbd2c6b406155d7d480e1aabe0 (diff)
downloadlinux-fsl-qoriq-d5121914a22c22d849abb57d086fe408c9ca2c0c.tar.xz
staging: comedi: support auto_attach() for PCI and USB
Allow `comedi_pci_auto_config()` and `comedi_usb_auto_config()` to use the new `auto_attach()` hook in the low-level driver's `struct comedi_driver` if it is set and the `attach_pci()` or `attach_usb()` hook (for PCI or USB respectively) is `NULL`. Eventually, the `auto_attach()` hook will be the only way of auto-configuring hardware devices as comedi devices and the bus-type specific `attach_pci()` and `attach_usb()` hooks will be removed. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/comedi/drivers.c')
-rw-r--r--drivers/staging/comedi/drivers.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c
index d60fa55..adae256 100644
--- a/drivers/staging/comedi/drivers.c
+++ b/drivers/staging/comedi/drivers.c
@@ -1023,6 +1023,8 @@ int comedi_pci_auto_config(struct pci_dev *pcidev, struct comedi_driver *driver)
if (driver->attach_pci)
return comedi_new_pci_auto_config(pcidev, driver);
+ else if (driver->auto_attach)
+ return comedi_auto_config(&pcidev->dev, driver, 0);
else
return comedi_old_pci_auto_config(pcidev, driver);
}
@@ -1093,6 +1095,8 @@ int comedi_usb_auto_config(struct usb_interface *intf,
BUG_ON(intf == NULL);
if (driver->attach_usb)
return comedi_new_usb_auto_config(intf, driver);
+ else if (driver->auto_attach)
+ return comedi_auto_config(&intf->dev, driver, 0);
else
return comedi_old_usb_auto_config(intf, driver);
}