async->events = 0;
}
-int comedi_pci_auto_config(const char *board_name, struct pci_dev *pcidev)
+int comedi_auto_config(struct device *hardware_device, const char *board_name, const int *options, unsigned num_options)
{
comedi_devconfig it;
int minor;
struct comedi_device_file_info *dev_file_info;
int retval;
- minor = comedi_alloc_board_minor(&pcidev->dev);
+ minor = comedi_alloc_board_minor(hardware_device);
if(minor < 0) return minor;
- pci_set_drvdata(pcidev, (void*)minor);
+ dev_set_drvdata(hardware_device, (void*)minor);
dev_file_info = comedi_get_device_file_info(minor);
memset(&it, 0, sizeof(it));
strncpy(it.board_name, board_name, COMEDI_NAMELEN);
it.board_name[COMEDI_NAMELEN - 1] = '\0';
- // pci bus
- it.options[0] = pcidev->bus->number;
- // pci slot
- it.options[1] = PCI_SLOT(pcidev->devfn);
+ BUG_ON(num_options > COMEDI_NDEVCONFOPTS);
+ memcpy(it.options, options, num_options * sizeof(int));
mutex_lock(&dev_file_info->device->mutex);
retval = comedi_device_attach(dev_file_info->device, &it);
return retval;
}
-void comedi_pci_auto_unconfig(struct pci_dev *pcidev)
+void comedi_auto_unconfig(struct device *hardware_device)
{
- unsigned long minor = (unsigned long)pci_get_drvdata(pcidev);
+ unsigned long minor = (unsigned long)dev_get_drvdata(hardware_device);
BUG_ON(minor >= COMEDI_NUM_BOARD_MINORS);
comedi_free_board_minor(minor);
}
+
+int comedi_pci_auto_config(struct pci_dev *pcidev, const char *board_name)
+{
+ int options[2];
+
+ // pci bus
+ options[0] = pcidev->bus->number;
+ // pci slot
+ options[1] = PCI_SLOT(pcidev->devfn);
+
+ return comedi_auto_config(&pcidev->dev, board_name, options, sizeof(options) / sizeof(options[0]));
+}
+
+void comedi_pci_auto_unconfig(struct pci_dev *pcidev)
+{
+ comedi_auto_unconfig(&pcidev->dev);
+}