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;
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);
(unsigned long)&it);
}
-static void comedi_auto_unconfig(struct device *hardware_device)
+static int comedi_auto_config_wrapper(struct comedi_device *dev,
+ unsigned long context)
+{
+ if (!dev->driver->auto_attach) {
+ dev_warn(dev->class_dev,
+ "BUG! driver '%s' has no auto_attach handler\n",
+ dev->driver->driver_name);
+ return -EINVAL;
+ }
+ return dev->driver->auto_attach(dev, context);
+}
+
+int comedi_auto_config(struct device *hardware_device,
+ struct comedi_driver *driver, unsigned long context)
+{
+ return comedi_auto_config_helper(hardware_device, driver,
+ comedi_auto_config_wrapper, context);
+}
+EXPORT_SYMBOL_GPL(comedi_auto_config);
+
+void comedi_auto_unconfig(struct device *hardware_device)
{
int minor;
BUG_ON(minor >= COMEDI_NUM_BOARD_MINORS);
comedi_free_board_minor(minor);
}
+EXPORT_SYMBOL_GPL(comedi_auto_unconfig);
/**
* comedi_pci_enable() - Enable the PCI device and request the regions.