attach:pcimio_attach,
detach:pcimio_detach,
};
-static int ni_pcimio_pci_probe(struct pci_dev *dev,
- const struct pci_device_id *ent);
-static void ni_pcimio_pci_remove(struct pci_dev *dev);
-static struct pci_driver ni_pcimio_pci_driver =
-{
- .name = DRV_NAME,
- .id_table = ni_pci_table,
- .probe = &ni_pcimio_pci_probe,
- .remove = __devexit_p(&ni_pcimio_pci_remove)
-};
-
-MODULE_AUTHOR("Comedi http://www.comedi.org");
-MODULE_DESCRIPTION("Comedi driver for National Instruments E-series, M-series, and related boards");
-MODULE_LICENSE("GPL");
-static int __init driver_pcimio_init_module(void)
-{
- int retval;
-
- retval = comedi_driver_register(&driver_pcimio);
- if(retval < 0) return retval;
- return pci_register_driver(&ni_pcimio_pci_driver);
-}
-static void __exit driver_pcimio_cleanup_module(void)
-{
- pci_unregister_driver(&ni_pcimio_pci_driver);
- comedi_driver_unregister(&driver_pcimio);
-}
-module_init(driver_pcimio_init_module);
-module_exit(driver_pcimio_cleanup_module);
+COMEDI_PCI_INITCLEANUP(driver_pcimio, ni_pci_table)
typedef struct {
NI_PRIVATE_COMMON} ni_private;
return 0;
}
-
-// pci_driver functions
-
-static int __devinit ni_pcimio_pci_probe(struct pci_dev *dev,
- const struct pci_device_id *ent)
-{
- return comedi_pci_auto_config(DRV_NAME, dev);
-}
-
-static void __devexit ni_pcimio_pci_remove(struct pci_dev *dev)
-{
- comedi_pci_auto_unconfig(dev);
-}
module_init(x ## _init_module); \
module_exit(x ## _cleanup_module); \
-#define COMEDI_INITCLEANUP(x) \
- MODULE_AUTHOR("David A. Schleef <ds@schleef.org>"); \
+#define COMEDI_MODULE_MACROS \
+ MODULE_AUTHOR("Comedi http://www.comedi.org"); \
MODULE_DESCRIPTION("Comedi low-level driver"); \
MODULE_LICENSE("GPL"); \
+
+#define COMEDI_INITCLEANUP(x) \
+ COMEDI_MODULE_MACROS \
static int __init x ## _init_module(void) \
{return comedi_driver_register(&(x));} \
static void __exit x ## _cleanup_module(void) \
module_init(x ## _init_module); \
module_exit(x ## _cleanup_module); \
+#define COMEDI_PCI_INITCLEANUP(comedi_driver, pci_id_table) \
+ COMEDI_MODULE_MACROS \
+ static int __devinit comedi_driver ## _pci_probe(struct pci_dev *dev, \
+ const struct pci_device_id *ent) \
+ { \
+ return comedi_pci_auto_config(dev, comedi_driver.driver_name); \
+ } \
+ static void __devexit comedi_driver ## _pci_remove(struct pci_dev *dev) \
+ { \
+ comedi_pci_auto_unconfig(dev); \
+ } \
+ static struct pci_driver comedi_driver ## _pci = \
+ { \
+ .id_table = pci_id_table, \
+ .probe = & comedi_driver ## _pci_probe, \
+ .remove = __devexit_p(& comedi_driver ## _pci_remove) \
+ }; \
+ static int __init comedi_driver ## _init_module(void) \
+ { \
+ int retval; \
+ retval = comedi_driver_register(& comedi_driver); \
+ if(retval < 0) return retval; \
+ comedi_driver ## _pci.name = (char*)comedi_driver.driver_name; \
+ return pci_register_driver(& comedi_driver ## _pci); \
+ } \
+ static void __exit comedi_driver ## _cleanup_module(void) \
+ { \
+ pci_unregister_driver(& comedi_driver ## _pci); \
+ comedi_driver_unregister(& comedi_driver); \
+ } \
+ module_init(comedi_driver ## _init_module); \
+ module_exit(comedi_driver ## _cleanup_module);
#define PCI_VENDOR_ID_INOVA 0x104c
#define PCI_VENDOR_ID_NATINST 0x1093
void comedi_free_board_minor(unsigned minor);
int comedi_alloc_subdevice_minor(comedi_device *dev, comedi_subdevice *s);
void comedi_free_subdevice_minor(comedi_subdevice *s);
-int comedi_pci_auto_config(const char *board_name, struct pci_dev *pcidev);
+int comedi_pci_auto_config(struct pci_dev *pcidev, const char *board_name);
void comedi_pci_auto_unconfig(struct pci_dev *pcidev);
//#ifdef CONFIG_COMEDI_RT