Pull the module init code out of addi_common.c and add it to each addi-data driver. Rename the data and functions so they have namespace associated with the drivers. Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx> Cc: Ian Abbott <abbotti@xxxxxxxxx> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- .../staging/comedi/drivers/addi-data/addi_common.c | 30 ----------------- drivers/staging/comedi/drivers/addi_apci_035.c | 38 ++++++++++++++++++---- drivers/staging/comedi/drivers/addi_apci_1032.c | 38 ++++++++++++++++++---- drivers/staging/comedi/drivers/addi_apci_1500.c | 38 ++++++++++++++++++---- drivers/staging/comedi/drivers/addi_apci_1516.c | 38 ++++++++++++++++++---- drivers/staging/comedi/drivers/addi_apci_1564.c | 38 ++++++++++++++++++---- drivers/staging/comedi/drivers/addi_apci_16xx.c | 38 ++++++++++++++++++---- drivers/staging/comedi/drivers/addi_apci_1710.c | 38 ++++++++++++++++++---- drivers/staging/comedi/drivers/addi_apci_2016.c | 38 ++++++++++++++++++---- drivers/staging/comedi/drivers/addi_apci_2032.c | 38 ++++++++++++++++++---- drivers/staging/comedi/drivers/addi_apci_2200.c | 38 ++++++++++++++++++---- drivers/staging/comedi/drivers/addi_apci_3001.c | 38 ++++++++++++++++++---- drivers/staging/comedi/drivers/addi_apci_3120.c | 38 ++++++++++++++++++---- drivers/staging/comedi/drivers/addi_apci_3200.c | 38 ++++++++++++++++++---- drivers/staging/comedi/drivers/addi_apci_3300.c | 38 ++++++++++++++++++---- drivers/staging/comedi/drivers/addi_apci_3501.c | 38 ++++++++++++++++++---- drivers/staging/comedi/drivers/addi_apci_3xxx.c | 38 ++++++++++++++++++---- 17 files changed, 512 insertions(+), 126 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.c b/drivers/staging/comedi/drivers/addi-data/addi_common.c index 79beff1..652b5ab 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_common.c +++ b/drivers/staging/comedi/drivers/addi-data/addi_common.c @@ -107,7 +107,6 @@ static int i_ADDI_Attach(struct comedi_device *dev, struct comedi_devconfig *it) v_pci_card_list_init(this_board->i_VendorId, 1); /* 1 for displaying the list.. */ pci_list_builded = 1; } - /* printk("comedi%d: "ADDIDATA_DRIVER_NAME": board=%s",dev->minor,this_board->pc_DriverName); */ if ((this_board->i_Dma) && (it->options[2] == 0)) { i_Dma = 1; @@ -466,32 +465,3 @@ static void i_ADDI_Detach(struct comedi_device *dev) } } } - -static struct comedi_driver addi_driver = { - .driver_name = ADDIDATA_DRIVER_NAME, - .module = THIS_MODULE, - .attach = i_ADDI_Attach, - .detach = i_ADDI_Detach, - .num_names = ARRAY_SIZE(boardtypes), - .board_name = &boardtypes[0].pc_DriverName, - .offset = sizeof(struct addi_board), -}; - -static int __devinit addi_pci_probe(struct pci_dev *dev, - const struct pci_device_id *ent) -{ - return comedi_pci_auto_config(dev, &addi_driver); -} - -static void __devexit addi_pci_remove(struct pci_dev *dev) -{ - comedi_pci_auto_unconfig(dev); -} - -static struct pci_driver addi_pci_driver = { - .name = ADDIDATA_DRIVER_NAME, - .id_table = addi_apci_tbl, - .probe = &addi_pci_probe, - .remove = __devexit_p(&addi_pci_remove), -}; -module_comedi_pci_driver(addi_driver, addi_pci_driver); diff --git a/drivers/staging/comedi/drivers/addi_apci_035.c b/drivers/staging/comedi/drivers/addi_apci_035.c index 7f456e7..812092f 100644 --- a/drivers/staging/comedi/drivers/addi_apci_035.c +++ b/drivers/staging/comedi/drivers/addi_apci_035.c @@ -6,12 +6,11 @@ #define ADDIDATA_WATCHDOG 2 /* Or shold it be something else */ -#define ADDIDATA_DRIVER_NAME "addi_apci_035" - #include "addi-data/addi_eeprom.c" #include "addi-data/hwdrv_apci035.c" +#include "addi-data/addi_common.c" -static const struct addi_board boardtypes[] = { +static const struct addi_board apci035_boardtypes[] = { { .pc_DriverName = "apci035", .i_VendorId = PCI_VENDOR_ID_ADDIDATA, @@ -38,13 +37,40 @@ static const struct addi_board boardtypes[] = { }, }; -static DEFINE_PCI_DEVICE_TABLE(addi_apci_tbl) = { +static struct comedi_driver apci035_driver = { + .driver_name = "addi_apci_035", + .module = THIS_MODULE, + .attach = i_ADDI_Attach, + .detach = i_ADDI_Detach, + .num_names = ARRAY_SIZE(apci035_boardtypes), + .board_name = &apci035_boardtypes[0].pc_DriverName, + .offset = sizeof(struct addi_board), +}; + +static int __devinit apci035_pci_probe(struct pci_dev *dev, + const struct pci_device_id *ent) +{ + return comedi_pci_auto_config(dev, &apci035_driver); +} + +static void __devexit apci035_pci_remove(struct pci_dev *dev) +{ + comedi_pci_auto_unconfig(dev); +} + +static DEFINE_PCI_DEVICE_TABLE(apci035_pci_table) = { { PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x0300) }, { 0 } }; -MODULE_DEVICE_TABLE(pci, addi_apci_tbl); +MODULE_DEVICE_TABLE(pci, apci035_pci_table); -#include "addi-data/addi_common.c" +static struct pci_driver apci035_pci_driver = { + .name = "addi_apci_035", + .id_table = apci035_pci_table, + .probe = apci035_pci_probe, + .remove = __devexit_p(apci035_pci_remove), +}; +module_comedi_pci_driver(apci035_driver, apci035_pci_driver); MODULE_AUTHOR("Comedi http://www.comedi.org"); MODULE_DESCRIPTION("Comedi low-level driver"); diff --git a/drivers/staging/comedi/drivers/addi_apci_1032.c b/drivers/staging/comedi/drivers/addi_apci_1032.c index 19794f1..f787604 100644 --- a/drivers/staging/comedi/drivers/addi_apci_1032.c +++ b/drivers/staging/comedi/drivers/addi_apci_1032.c @@ -4,12 +4,11 @@ #include "addi-data/addi_common.h" #include "addi-data/addi_amcc_s5933.h" -#define ADDIDATA_DRIVER_NAME "addi_apci_1032" - #include "addi-data/addi_eeprom.c" #include "addi-data/hwdrv_apci1032.c" +#include "addi-data/addi_common.c" -static const struct addi_board boardtypes[] = { +static const struct addi_board apci1032_boardtypes[] = { { .pc_DriverName = "apci1032", .i_VendorId = PCI_VENDOR_ID_ADDIDATA, @@ -27,13 +26,40 @@ static const struct addi_board boardtypes[] = { }, }; -static DEFINE_PCI_DEVICE_TABLE(addi_apci_tbl) = { +static struct comedi_driver apci1032_driver = { + .driver_name = "addi_apci_1032", + .module = THIS_MODULE, + .attach = i_ADDI_Attach, + .detach = i_ADDI_Detach, + .num_names = ARRAY_SIZE(apci1032_boardtypes), + .board_name = &apci1032_boardtypes[0].pc_DriverName, + .offset = sizeof(struct addi_board), +}; + +static int __devinit apci1032_pci_probe(struct pci_dev *dev, + const struct pci_device_id *ent) +{ + return comedi_pci_auto_config(dev, &apci1032_driver); +} + +static void __devexit apci1032_pci_remove(struct pci_dev *dev) +{ + comedi_pci_auto_unconfig(dev); +} + +static DEFINE_PCI_DEVICE_TABLE(apci1032_pci_table) = { { PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x1003) }, { 0 } }; -MODULE_DEVICE_TABLE(pci, addi_apci_tbl); +MODULE_DEVICE_TABLE(pci, apci1032_pci_table); -#include "addi-data/addi_common.c" +static struct pci_driver apci1032_pci_driver = { + .name = "addi_apci_1032", + .id_table = apci1032_pci_table, + .probe = apci1032_pci_probe, + .remove = __devexit_p(apci1032_pci_remove), +}; +module_comedi_pci_driver(apci1032_driver, apci1032_pci_driver); MODULE_AUTHOR("Comedi http://www.comedi.org"); MODULE_DESCRIPTION("Comedi low-level driver"); diff --git a/drivers/staging/comedi/drivers/addi_apci_1500.c b/drivers/staging/comedi/drivers/addi_apci_1500.c index ee7cdfb..51f9e85 100644 --- a/drivers/staging/comedi/drivers/addi_apci_1500.c +++ b/drivers/staging/comedi/drivers/addi_apci_1500.c @@ -4,12 +4,11 @@ #include "addi-data/addi_common.h" #include "addi-data/addi_amcc_s5933.h" -#define ADDIDATA_DRIVER_NAME "addi_apci_1500" - #include "addi-data/addi_eeprom.c" #include "addi-data/hwdrv_apci1500.c" +#include "addi-data/addi_common.c" -static const struct addi_board boardtypes[] = { +static const struct addi_board apci1500_boardtypes[] = { { .pc_DriverName = "apci1500", .i_VendorId = PCI_VENDOR_ID_ADDIDATA_OLD, @@ -38,13 +37,40 @@ static const struct addi_board boardtypes[] = { }, }; -static DEFINE_PCI_DEVICE_TABLE(addi_apci_tbl) = { +static struct comedi_driver apci1500_driver = { + .driver_name = "addi_apci_1500", + .module = THIS_MODULE, + .attach = i_ADDI_Attach, + .detach = i_ADDI_Detach, + .num_names = ARRAY_SIZE(apci1500_boardtypes), + .board_name = &apci1500_boardtypes[0].pc_DriverName, + .offset = sizeof(struct addi_board), +}; + +static int __devinit apci1500_pci_probe(struct pci_dev *dev, + const struct pci_device_id *ent) +{ + return comedi_pci_auto_config(dev, &apci1500_driver); +} + +static void __devexit apci1500_pci_remove(struct pci_dev *dev) +{ + comedi_pci_auto_unconfig(dev); +} + +static DEFINE_PCI_DEVICE_TABLE(apci1500_pci_table) = { { PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA_OLD, 0x80fc) }, { 0 } }; -MODULE_DEVICE_TABLE(pci, addi_apci_tbl); +MODULE_DEVICE_TABLE(pci, apci1500_pci_table); -#include "addi-data/addi_common.c" +static struct pci_driver apci1500_pci_driver = { + .name = "addi_apci_1500", + .id_table = apci1500_pci_table, + .probe = apci1500_pci_probe, + .remove = __devexit_p(apci1500_pci_remove), +}; +module_comedi_pci_driver(apci1500_driver, apci1500_pci_driver); MODULE_AUTHOR("Comedi http://www.comedi.org"); MODULE_DESCRIPTION("Comedi low-level driver"); diff --git a/drivers/staging/comedi/drivers/addi_apci_1516.c b/drivers/staging/comedi/drivers/addi_apci_1516.c index 8f45496..ba7ffad 100644 --- a/drivers/staging/comedi/drivers/addi_apci_1516.c +++ b/drivers/staging/comedi/drivers/addi_apci_1516.c @@ -4,12 +4,11 @@ #include "addi-data/addi_common.h" #include "addi-data/addi_amcc_s5933.h" -#define ADDIDATA_DRIVER_NAME "addi_apci_1516" - #include "addi-data/addi_eeprom.c" #include "addi-data/hwdrv_apci1516.c" +#include "addi-data/addi_common.c" -static const struct addi_board boardtypes[] = { +static const struct addi_board apci1516_boardtypes[] = { { .pc_DriverName = "apci1516", .i_VendorId = PCI_VENDOR_ID_ADDIDATA, @@ -34,13 +33,40 @@ static const struct addi_board boardtypes[] = { }, }; -static DEFINE_PCI_DEVICE_TABLE(addi_apci_tbl) = { +static struct comedi_driver apci1516_driver = { + .driver_name = "addi_apci_1516", + .module = THIS_MODULE, + .attach = i_ADDI_Attach, + .detach = i_ADDI_Detach, + .num_names = ARRAY_SIZE(apci1516_boardtypes), + .board_name = &apci1516_boardtypes[0].pc_DriverName, + .offset = sizeof(struct addi_board), +}; + +static int __devinit apci1516_pci_probe(struct pci_dev *dev, + const struct pci_device_id *ent) +{ + return comedi_pci_auto_config(dev, &apci1516_driver); +} + +static void __devexit apci1516_pci_remove(struct pci_dev *dev) +{ + comedi_pci_auto_unconfig(dev); +} + +static DEFINE_PCI_DEVICE_TABLE(apci1516_pci_table) = { { PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x1001) }, { 0 } }; -MODULE_DEVICE_TABLE(pci, addi_apci_tbl); +MODULE_DEVICE_TABLE(pci, apci1516_pci_table); -#include "addi-data/addi_common.c" +static struct pci_driver apci1516_pci_driver = { + .name = "addi_apci_1516", + .id_table = apci1516_pci_table, + .probe = apci1516_pci_probe, + .remove = __devexit_p(apci1516_pci_remove), +}; +module_comedi_pci_driver(apci1516_driver, apci1516_pci_driver); MODULE_AUTHOR("Comedi http://www.comedi.org"); MODULE_DESCRIPTION("Comedi low-level driver"); diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c b/drivers/staging/comedi/drivers/addi_apci_1564.c index 0a631e1..c44007b0 100644 --- a/drivers/staging/comedi/drivers/addi_apci_1564.c +++ b/drivers/staging/comedi/drivers/addi_apci_1564.c @@ -4,12 +4,11 @@ #include "addi-data/addi_common.h" #include "addi-data/addi_amcc_s5933.h" -#define ADDIDATA_DRIVER_NAME "addi_apci_1564" - #include "addi-data/addi_eeprom.c" #include "addi-data/hwdrv_apci1564.c" +#include "addi-data/addi_common.c" -static const struct addi_board boardtypes[] = { +static const struct addi_board apci1564_boardtypes[] = { { .pc_DriverName = "apci1564", .i_VendorId = PCI_VENDOR_ID_ADDIDATA, @@ -37,13 +36,40 @@ static const struct addi_board boardtypes[] = { }, }; -static DEFINE_PCI_DEVICE_TABLE(addi_apci_tbl) = { +static struct comedi_driver apci1564_driver = { + .driver_name = "addi_apci_1564", + .module = THIS_MODULE, + .attach = i_ADDI_Attach, + .detach = i_ADDI_Detach, + .num_names = ARRAY_SIZE(apci1564_boardtypes), + .board_name = &apci1564_boardtypes[0].pc_DriverName, + .offset = sizeof(struct addi_board), +}; + +static int __devinit apci1564_pci_probe(struct pci_dev *dev, + const struct pci_device_id *ent) +{ + return comedi_pci_auto_config(dev, &apci1564_driver); +} + +static void __devexit apci1564_pci_remove(struct pci_dev *dev) +{ + comedi_pci_auto_unconfig(dev); +} + +static DEFINE_PCI_DEVICE_TABLE(apci1564_pci_table) = { { PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x1006) }, { 0 } }; -MODULE_DEVICE_TABLE(pci, addi_apci_tbl); +MODULE_DEVICE_TABLE(pci, apci1564_pci_table); -#include "addi-data/addi_common.c" +static struct pci_driver apci1564_pci_driver = { + .name = "addi_apci_1564", + .id_table = apci1564_pci_table, + .probe = apci1564_pci_probe, + .remove = __devexit_p(apci1564_pci_remove), +}; +module_comedi_pci_driver(apci1564_driver, apci1564_pci_driver); MODULE_AUTHOR("Comedi http://www.comedi.org"); MODULE_DESCRIPTION("Comedi low-level driver"); diff --git a/drivers/staging/comedi/drivers/addi_apci_16xx.c b/drivers/staging/comedi/drivers/addi_apci_16xx.c index ab2b599..18182a14 100644 --- a/drivers/staging/comedi/drivers/addi_apci_16xx.c +++ b/drivers/staging/comedi/drivers/addi_apci_16xx.c @@ -4,12 +4,11 @@ #include "addi-data/addi_common.h" #include "addi-data/addi_amcc_s5933.h" -#define ADDIDATA_DRIVER_NAME "addi_apci_16xx" - #include "addi-data/addi_eeprom.c" #include "addi-data/hwdrv_apci16xx.c" +#include "addi-data/addi_common.c" -static const struct addi_board boardtypes[] = { +static const struct addi_board apci16xx_boardtypes[] = { { .pc_DriverName = "apci1648", .i_VendorId = PCI_VENDOR_ID_ADDIDATA, @@ -37,14 +36,41 @@ static const struct addi_board boardtypes[] = { }, }; -static DEFINE_PCI_DEVICE_TABLE(addi_apci_tbl) = { +static struct comedi_driver apci16xx_driver = { + .driver_name = "addi_apci_16xx", + .module = THIS_MODULE, + .attach = i_ADDI_Attach, + .detach = i_ADDI_Detach, + .num_names = ARRAY_SIZE(apci16xx_boardtypes), + .board_name = &apci16xx_boardtypes[0].pc_DriverName, + .offset = sizeof(struct addi_board), +}; + +static int __devinit apci16xx_pci_probe(struct pci_dev *dev, + const struct pci_device_id *ent) +{ + return comedi_pci_auto_config(dev, &apci16xx_driver); +} + +static void __devexit apci16xx_pci_remove(struct pci_dev *dev) +{ + comedi_pci_auto_unconfig(dev); +} + +static DEFINE_PCI_DEVICE_TABLE(apci16xx_pci_table) = { { PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x1009) }, { PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x100a) }, { 0 } }; -MODULE_DEVICE_TABLE(pci, addi_apci_tbl); +MODULE_DEVICE_TABLE(pci, apci16xx_pci_table); -#include "addi-data/addi_common.c" +static struct pci_driver apci16xx_pci_driver = { + .name = "addi_apci_16xx", + .id_table = apci16xx_pci_table, + .probe = apci16xx_pci_probe, + .remove = __devexit_p(apci16xx_pci_remove), +}; +module_comedi_pci_driver(apci16xx_driver, apci16xx_pci_driver); MODULE_AUTHOR("Comedi http://www.comedi.org"); MODULE_DESCRIPTION("Comedi low-level driver"); diff --git a/drivers/staging/comedi/drivers/addi_apci_1710.c b/drivers/staging/comedi/drivers/addi_apci_1710.c index 58c5121..ff01317 100644 --- a/drivers/staging/comedi/drivers/addi_apci_1710.c +++ b/drivers/staging/comedi/drivers/addi_apci_1710.c @@ -18,12 +18,11 @@ static void fpu_end(void) #define CONFIG_APCI_1710 1 -#define ADDIDATA_DRIVER_NAME "addi_apci_1710" - #include "addi-data/addi_eeprom.c" #include "addi-data/hwdrv_APCI1710.c" +#include "addi-data/addi_common.c" -static const struct addi_board boardtypes[] = { +static const struct addi_board apci1710_boardtypes[] = { { .pc_DriverName = "apci1710", .i_VendorId = PCI_VENDOR_ID_ADDIDATA_OLD, @@ -37,10 +36,37 @@ static const struct addi_board boardtypes[] = { }, }; -static DEFINE_PCI_DEVICE_TABLE(addi_apci_tbl) = { +static struct comedi_driver apci1710_driver = { + .driver_name = "addi_apci_1710", + .module = THIS_MODULE, + .attach = i_ADDI_Attach, + .detach = i_ADDI_Detach, + .num_names = ARRAY_SIZE(apci1710_boardtypes), + .board_name = &apci1710_boardtypes[0].pc_DriverName, + .offset = sizeof(struct addi_board), +}; + +static int __devinit apci1710_pci_probe(struct pci_dev *dev, + const struct pci_device_id *ent) +{ + return comedi_pci_auto_config(dev, &apci1710_driver); +} + +static void __devexit apci1710_pci_remove(struct pci_dev *dev) +{ + comedi_pci_auto_unconfig(dev); +} + +static DEFINE_PCI_DEVICE_TABLE(apci1710_pci_table) = { { PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA_OLD, APCI1710_BOARD_DEVICE_ID) }, { 0 } }; -MODULE_DEVICE_TABLE(pci, addi_apci_tbl); +MODULE_DEVICE_TABLE(pci, apci1710_pci_table); -#include "addi-data/addi_common.c" +static struct pci_driver apci1710_pci_driver = { + .name = "addi_apci_1710", + .id_table = apci1710_pci_table, + .probe = apci1710_pci_probe, + .remove = __devexit_p(apci1710_pci_remove), +}; +module_comedi_pci_driver(apci1710_driver, apci1710_pci_driver); diff --git a/drivers/staging/comedi/drivers/addi_apci_2016.c b/drivers/staging/comedi/drivers/addi_apci_2016.c index 5e1d34b..2642608 100644 --- a/drivers/staging/comedi/drivers/addi_apci_2016.c +++ b/drivers/staging/comedi/drivers/addi_apci_2016.c @@ -4,12 +4,11 @@ #include "addi-data/addi_common.h" #include "addi-data/addi_amcc_s5933.h" -#define ADDIDATA_DRIVER_NAME "addi_apci_2016" - #include "addi-data/addi_eeprom.c" #include "addi-data/hwdrv_apci2016.c" +#include "addi-data/addi_common.c" -static const struct addi_board boardtypes[] = { +static const struct addi_board apci2016_boardtypes[] = { { .pc_DriverName = "apci2016", .i_VendorId = PCI_VENDOR_ID_ADDIDATA, @@ -31,13 +30,40 @@ static const struct addi_board boardtypes[] = { }, }; -static DEFINE_PCI_DEVICE_TABLE(addi_apci_tbl) = { +static struct comedi_driver apci2016_driver = { + .driver_name = "addi_apci_2016", + .module = THIS_MODULE, + .attach = i_ADDI_Attach, + .detach = i_ADDI_Detach, + .num_names = ARRAY_SIZE(apci2016_boardtypes), + .board_name = &apci2016_boardtypes[0].pc_DriverName, + .offset = sizeof(struct addi_board), +}; + +static int __devinit apci2016_pci_probe(struct pci_dev *dev, + const struct pci_device_id *ent) +{ + return comedi_pci_auto_config(dev, &apci2016_driver); +} + +static void __devexit apci2016_pci_remove(struct pci_dev *dev) +{ + comedi_pci_auto_unconfig(dev); +} + +static DEFINE_PCI_DEVICE_TABLE(apci2016_pci_table) = { { PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x1002) }, { 0 } }; -MODULE_DEVICE_TABLE(pci, addi_apci_tbl); +MODULE_DEVICE_TABLE(pci, apci2016_pci_table); -#include "addi-data/addi_common.c" +static struct pci_driver apci2016_pci_driver = { + .name = "addi_apci_2016", + .id_table = apci2016_pci_table, + .probe = apci2016_pci_probe, + .remove = __devexit_p(apci2016_pci_remove), +}; +module_comedi_pci_driver(apci2016_driver, apci2016_pci_driver); MODULE_AUTHOR("Comedi http://www.comedi.org"); MODULE_DESCRIPTION("Comedi low-level driver"); diff --git a/drivers/staging/comedi/drivers/addi_apci_2032.c b/drivers/staging/comedi/drivers/addi_apci_2032.c index b587bbc..3221419 100644 --- a/drivers/staging/comedi/drivers/addi_apci_2032.c +++ b/drivers/staging/comedi/drivers/addi_apci_2032.c @@ -4,12 +4,11 @@ #include "addi-data/addi_common.h" #include "addi-data/addi_amcc_s5933.h" -#define ADDIDATA_DRIVER_NAME "addi_apci_2032" - #include "addi-data/addi_eeprom.c" #include "addi-data/hwdrv_apci2032.c" +#include "addi-data/addi_common.c" -static const struct addi_board boardtypes[] = { +static const struct addi_board apci2032_boardtypes[] = { { .pc_DriverName = "apci2032", .i_VendorId = PCI_VENDOR_ID_ADDIDATA, @@ -33,13 +32,40 @@ static const struct addi_board boardtypes[] = { }, }; -static DEFINE_PCI_DEVICE_TABLE(addi_apci_tbl) = { +static struct comedi_driver apci2032_driver = { + .driver_name = "addi_apci_2032", + .module = THIS_MODULE, + .attach = i_ADDI_Attach, + .detach = i_ADDI_Detach, + .num_names = ARRAY_SIZE(apci2032_boardtypes), + .board_name = &apci2032_boardtypes[0].pc_DriverName, + .offset = sizeof(struct addi_board), +}; + +static int __devinit apci2032_pci_probe(struct pci_dev *dev, + const struct pci_device_id *ent) +{ + return comedi_pci_auto_config(dev, &apci2032_driver); +} + +static void __devexit apci2032_pci_remove(struct pci_dev *dev) +{ + comedi_pci_auto_unconfig(dev); +} + +static DEFINE_PCI_DEVICE_TABLE(apci2032_pci_table) = { { PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x1004) }, { 0 } }; -MODULE_DEVICE_TABLE(pci, addi_apci_tbl); +MODULE_DEVICE_TABLE(pci, apci2032_pci_table); -#include "addi-data/addi_common.c" +static struct pci_driver apci2032_pci_driver = { + .name = "addi_apci_2032", + .id_table = apci2032_pci_table, + .probe = apci2032_pci_probe, + .remove = __devexit_p(apci2032_pci_remove), +}; +module_comedi_pci_driver(apci2032_driver, apci2032_pci_driver); MODULE_AUTHOR("Comedi http://www.comedi.org"); MODULE_DESCRIPTION("Comedi low-level driver"); diff --git a/drivers/staging/comedi/drivers/addi_apci_2200.c b/drivers/staging/comedi/drivers/addi_apci_2200.c index 9834475..6c8a222 100644 --- a/drivers/staging/comedi/drivers/addi_apci_2200.c +++ b/drivers/staging/comedi/drivers/addi_apci_2200.c @@ -4,12 +4,11 @@ #include "addi-data/addi_common.h" #include "addi-data/addi_amcc_s5933.h" -#define ADDIDATA_DRIVER_NAME "addi_apci_2200" - #include "addi-data/addi_eeprom.c" #include "addi-data/hwdrv_apci2200.c" +#include "addi-data/addi_common.c" -static const struct addi_board boardtypes[] = { +static const struct addi_board apci2200_boardtypes[] = { { .pc_DriverName = "apci2200", .i_VendorId = PCI_VENDOR_ID_ADDIDATA, @@ -33,13 +32,40 @@ static const struct addi_board boardtypes[] = { }, }; -static DEFINE_PCI_DEVICE_TABLE(addi_apci_tbl) = { +static struct comedi_driver apci2200_driver = { + .driver_name = "addi_apci_2200", + .module = THIS_MODULE, + .attach = i_ADDI_Attach, + .detach = i_ADDI_Detach, + .num_names = ARRAY_SIZE(apci2200_boardtypes), + .board_name = &apci2200_boardtypes[0].pc_DriverName, + .offset = sizeof(struct addi_board), +}; + +static int __devinit apci2200_pci_probe(struct pci_dev *dev, + const struct pci_device_id *ent) +{ + return comedi_pci_auto_config(dev, &apci2200_driver); +} + +static void __devexit apci2200_pci_remove(struct pci_dev *dev) +{ + comedi_pci_auto_unconfig(dev); +} + +static DEFINE_PCI_DEVICE_TABLE(apci2200_pci_table) = { { PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x1005) }, { 0 } }; -MODULE_DEVICE_TABLE(pci, addi_apci_tbl); +MODULE_DEVICE_TABLE(pci, apci2200_pci_table); -#include "addi-data/addi_common.c" +static struct pci_driver apci2200_pci_driver = { + .name = "addi_apci_2200", + .id_table = apci2200_pci_table, + .probe = apci2200_pci_probe, + .remove = __devexit_p(apci2200_pci_remove), +}; +module_comedi_pci_driver(apci2200_driver, apci2200_pci_driver); MODULE_AUTHOR("Comedi http://www.comedi.org"); MODULE_DESCRIPTION("Comedi low-level driver"); diff --git a/drivers/staging/comedi/drivers/addi_apci_3001.c b/drivers/staging/comedi/drivers/addi_apci_3001.c index fff4a83..bfeac44 100644 --- a/drivers/staging/comedi/drivers/addi_apci_3001.c +++ b/drivers/staging/comedi/drivers/addi_apci_3001.c @@ -4,12 +4,11 @@ #include "addi-data/addi_common.h" #include "addi-data/addi_amcc_s5933.h" -#define ADDIDATA_DRIVER_NAME "addi_apci_3001" - #include "addi-data/addi_eeprom.c" #include "addi-data/hwdrv_apci3120.c" +#include "addi-data/addi_common.c" -static const struct addi_board boardtypes[] = { +static const struct addi_board apci3001_boardtypes[] = { { .pc_DriverName = "apci3001", .i_VendorId = PCI_VENDOR_ID_ADDIDATA_OLD, @@ -49,13 +48,40 @@ static const struct addi_board boardtypes[] = { }, }; -static DEFINE_PCI_DEVICE_TABLE(addi_apci_tbl) = { +static struct comedi_driver apci3001_driver = { + .driver_name = "addi_apci_3001", + .module = THIS_MODULE, + .attach = i_ADDI_Attach, + .detach = i_ADDI_Detach, + .num_names = ARRAY_SIZE(apci3001_boardtypes), + .board_name = &apci3001_boardtypes[0].pc_DriverName, + .offset = sizeof(struct addi_board), +}; + +static int __devinit apci3001_pci_probe(struct pci_dev *dev, + const struct pci_device_id *ent) +{ + return comedi_pci_auto_config(dev, &apci3001_driver); +} + +static void __devexit apci3001_pci_remove(struct pci_dev *dev) +{ + comedi_pci_auto_unconfig(dev); +} + +static DEFINE_PCI_DEVICE_TABLE(apci3001_pci_table) = { { PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA_OLD, 0x828d) }, { 0 } }; -MODULE_DEVICE_TABLE(pci, addi_apci_tbl); +MODULE_DEVICE_TABLE(pci, apci3001_pci_table); -#include "addi-data/addi_common.c" +static struct pci_driver apci3001_pci_driver = { + .name = "addi_apci_3001", + .id_table = apci3001_pci_table, + .probe = apci3001_pci_probe, + .remove = __devexit_p(apci3001_pci_remove), +}; +module_comedi_pci_driver(apci3001_driver, apci3001_pci_driver); MODULE_AUTHOR("Comedi http://www.comedi.org"); MODULE_DESCRIPTION("Comedi low-level driver"); diff --git a/drivers/staging/comedi/drivers/addi_apci_3120.c b/drivers/staging/comedi/drivers/addi_apci_3120.c index bd2a654..1df67ce 100644 --- a/drivers/staging/comedi/drivers/addi_apci_3120.c +++ b/drivers/staging/comedi/drivers/addi_apci_3120.c @@ -6,12 +6,11 @@ #define CONFIG_APCI_3120 1 -#define ADDIDATA_DRIVER_NAME "addi_apci_3120" - #include "addi-data/addi_eeprom.c" #include "addi-data/hwdrv_apci3120.c" +#include "addi-data/addi_common.c" -static const struct addi_board boardtypes[] = { +static const struct addi_board apci3120_boardtypes[] = { { .pc_DriverName = "apci3120", .i_VendorId = PCI_VENDOR_ID_ADDIDATA_OLD, @@ -55,13 +54,40 @@ static const struct addi_board boardtypes[] = { }, }; -static DEFINE_PCI_DEVICE_TABLE(addi_apci_tbl) = { +static struct comedi_driver apci3120_driver = { + .driver_name = "addi_apci_3120", + .module = THIS_MODULE, + .attach = i_ADDI_Attach, + .detach = i_ADDI_Detach, + .num_names = ARRAY_SIZE(apci3120_boardtypes), + .board_name = &apci3120_boardtypes[0].pc_DriverName, + .offset = sizeof(struct addi_board), +}; + +static int __devinit apci3120_pci_probe(struct pci_dev *dev, + const struct pci_device_id *ent) +{ + return comedi_pci_auto_config(dev, &apci3120_driver); +} + +static void __devexit apci3120_pci_remove(struct pci_dev *dev) +{ + comedi_pci_auto_unconfig(dev); +} + +static DEFINE_PCI_DEVICE_TABLE(apci3120_pci_table) = { { PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA_OLD, 0x818d) }, { 0 } }; -MODULE_DEVICE_TABLE(pci, addi_apci_tbl); +MODULE_DEVICE_TABLE(pci, apci3120_pci_table); -#include "addi-data/addi_common.c" +static struct pci_driver apci3120_pci_driver = { + .name = "addi_apci_3120", + .id_table = apci3120_pci_table, + .probe = apci3120_pci_probe, + .remove = __devexit_p(apci3120_pci_remove), +}; +module_comedi_pci_driver(apci3120_driver, apci3120_pci_driver); MODULE_AUTHOR("Comedi http://www.comedi.org"); MODULE_DESCRIPTION("Comedi low-level driver"); diff --git a/drivers/staging/comedi/drivers/addi_apci_3200.c b/drivers/staging/comedi/drivers/addi_apci_3200.c index 7a68892..cc3e814 100644 --- a/drivers/staging/comedi/drivers/addi_apci_3200.c +++ b/drivers/staging/comedi/drivers/addi_apci_3200.c @@ -16,12 +16,11 @@ static void fpu_end(void) kernel_fpu_end(); } -#define ADDIDATA_DRIVER_NAME "addi_apci_3200" - #include "addi-data/addi_eeprom.c" #include "addi-data/hwdrv_apci3200.c" +#include "addi-data/addi_common.c" -static const struct addi_board boardtypes[] = { +static const struct addi_board apci3200_boardtypes[] = { { .pc_DriverName = "apci3200", .i_VendorId = PCI_VENDOR_ID_ADDIDATA, @@ -57,10 +56,37 @@ static const struct addi_board boardtypes[] = { }, }; -static DEFINE_PCI_DEVICE_TABLE(addi_apci_tbl) = { +static DEFINE_PCI_DEVICE_TABLE(apci3200_pci_table) = { { PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x3000) }, { 0 } }; -MODULE_DEVICE_TABLE(pci, addi_apci_tbl); +MODULE_DEVICE_TABLE(pci, apci3200_pci_table); -#include "addi-data/addi_common.c" +static struct comedi_driver apci3200_driver = { + .driver_name = "addi_apci_3200", + .module = THIS_MODULE, + .attach = i_ADDI_Attach, + .detach = i_ADDI_Detach, + .num_names = ARRAY_SIZE(apci3200_boardtypes), + .board_name = &apci3200_boardtypes[0].pc_DriverName, + .offset = sizeof(struct addi_board), +}; + +static int __devinit apci3200_pci_probe(struct pci_dev *dev, + const struct pci_device_id *ent) +{ + return comedi_pci_auto_config(dev, &apci3200_driver); +} + +static void __devexit apci3200_pci_remove(struct pci_dev *dev) +{ + comedi_pci_auto_unconfig(dev); +} + +static struct pci_driver apci3200_pci_driver = { + .name = "addi_apci_3200", + .id_table = apci3200_pci_table, + .probe = apci3200_pci_probe, + .remove = __devexit_p(apci3200_pci_remove), +}; +module_comedi_pci_driver(apci3200_driver, apci3200_pci_driver); diff --git a/drivers/staging/comedi/drivers/addi_apci_3300.c b/drivers/staging/comedi/drivers/addi_apci_3300.c index 9a9a5d10..172b5ce 100644 --- a/drivers/staging/comedi/drivers/addi_apci_3300.c +++ b/drivers/staging/comedi/drivers/addi_apci_3300.c @@ -16,12 +16,11 @@ static void fpu_end(void) kernel_fpu_end(); } -#define ADDIDATA_DRIVER_NAME "addi_apci_3300" - #include "addi-data/addi_eeprom.c" #include "addi-data/hwdrv_apci3200.c" +#include "addi-data/addi_common.c" -static const struct addi_board boardtypes[] = { +static const struct addi_board apci3300_boardtypes[] = { { .pc_DriverName = "apci3300", .i_VendorId = PCI_VENDOR_ID_ADDIDATA, @@ -56,10 +55,37 @@ static const struct addi_board boardtypes[] = { }, }; -static DEFINE_PCI_DEVICE_TABLE(addi_apci_tbl) = { +static struct comedi_driver apci3300_driver = { + .driver_name = "addi_apci_3300", + .module = THIS_MODULE, + .attach = i_ADDI_Attach, + .detach = i_ADDI_Detach, + .num_names = ARRAY_SIZE(apci3300_boardtypes), + .board_name = &apci3300_boardtypes[0].pc_DriverName, + .offset = sizeof(struct addi_board), +}; + +static int __devinit apci3300_pci_probe(struct pci_dev *dev, + const struct pci_device_id *ent) +{ + return comedi_pci_auto_config(dev, &apci3300_driver); +} + +static void __devexit apci3300_pci_remove(struct pci_dev *dev) +{ + comedi_pci_auto_unconfig(dev); +} + +static DEFINE_PCI_DEVICE_TABLE(apci3300_pci_table) = { { PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x3007) }, { 0 } }; -MODULE_DEVICE_TABLE(pci, addi_apci_tbl); +MODULE_DEVICE_TABLE(pci, apci3300_pci_table); -#include "addi-data/addi_common.c" +static struct pci_driver apci3300_pci_driver = { + .name = "addi_apci_3300", + .id_table = apci3300_pci_table, + .probe = apci3300_pci_probe, + .remove = __devexit_p(apci3300_pci_remove), +}; +module_comedi_pci_driver(apci3300_driver, apci3300_pci_driver); diff --git a/drivers/staging/comedi/drivers/addi_apci_3501.c b/drivers/staging/comedi/drivers/addi_apci_3501.c index 49f0d19..6543ba8 100644 --- a/drivers/staging/comedi/drivers/addi_apci_3501.c +++ b/drivers/staging/comedi/drivers/addi_apci_3501.c @@ -4,12 +4,11 @@ #include "addi-data/addi_common.h" #include "addi-data/addi_amcc_s5933.h" -#define ADDIDATA_DRIVER_NAME "addi_apci_3501" - #include "addi-data/addi_eeprom.c" #include "addi-data/hwdrv_apci3501.c" +#include "addi-data/addi_common.c" -static const struct addi_board boardtypes[] = { +static const struct addi_board apci3501_boardtypes[] = { { .pc_DriverName = "apci3501", .i_VendorId = PCI_VENDOR_ID_ADDIDATA, @@ -38,13 +37,40 @@ static const struct addi_board boardtypes[] = { }, }; -static DEFINE_PCI_DEVICE_TABLE(addi_apci_tbl) = { +static DEFINE_PCI_DEVICE_TABLE(apci3501_pci_table) = { { PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x3001) }, { 0 } }; -MODULE_DEVICE_TABLE(pci, addi_apci_tbl); +MODULE_DEVICE_TABLE(pci, apci3501_pci_table); -#include "addi-data/addi_common.c" +static struct comedi_driver apci3501_driver = { + .driver_name = "addi_apci_3501", + .module = THIS_MODULE, + .attach = i_ADDI_Attach, + .detach = i_ADDI_Detach, + .num_names = ARRAY_SIZE(apci3501_boardtypes), + .board_name = &apci3501_boardtypes[0].pc_DriverName, + .offset = sizeof(struct addi_board), +}; + +static int __devinit apci3501_pci_probe(struct pci_dev *dev, + const struct pci_device_id *ent) +{ + return comedi_pci_auto_config(dev, &apci3501_driver); +} + +static void __devexit apci3501_pci_remove(struct pci_dev *dev) +{ + comedi_pci_auto_unconfig(dev); +} + +static struct pci_driver apci3501_pci_driver = { + .name = "addi_apci_3501", + .id_table = apci3501_pci_table, + .probe = apci3501_pci_probe, + .remove = __devexit_p(apci3501_pci_remove), +}; +module_comedi_pci_driver(apci3501_driver, apci3501_pci_driver); MODULE_AUTHOR("Comedi http://www.comedi.org"); MODULE_DESCRIPTION("Comedi low-level driver"); diff --git a/drivers/staging/comedi/drivers/addi_apci_3xxx.c b/drivers/staging/comedi/drivers/addi_apci_3xxx.c index edc0eb0..86e1780 100644 --- a/drivers/staging/comedi/drivers/addi_apci_3xxx.c +++ b/drivers/staging/comedi/drivers/addi_apci_3xxx.c @@ -4,12 +4,11 @@ #include "addi-data/addi_common.h" #include "addi-data/addi_amcc_s5933.h" -#define ADDIDATA_DRIVER_NAME "addi_apci_3xxx" - #include "addi-data/addi_eeprom.c" #include "addi-data/hwdrv_apci3xxx.c" +#include "addi-data/addi_common.c" -static const struct addi_board boardtypes[] = { +static const struct addi_board apci3xxx_boardtypes[] = { { .pc_DriverName = "apci3000-16", .i_VendorId = PCI_VENDOR_ID_ADDIDATA, @@ -778,7 +777,28 @@ static const struct addi_board boardtypes[] = { }, }; -static DEFINE_PCI_DEVICE_TABLE(addi_apci_tbl) = { +static struct comedi_driver apci3xxx_driver = { + .driver_name = "addi_apci_3xxx", + .module = THIS_MODULE, + .attach = i_ADDI_Attach, + .detach = i_ADDI_Detach, + .num_names = ARRAY_SIZE(apci3xxx_boardtypes), + .board_name = &apci3xxx_boardtypes[0].pc_DriverName, + .offset = sizeof(struct addi_board), +}; + +static int __devinit apci3xxx_pci_probe(struct pci_dev *dev, + const struct pci_device_id *ent) +{ + return comedi_pci_auto_config(dev, &apci3xxx_driver); +} + +static void __devexit apci3xxx_pci_remove(struct pci_dev *dev) +{ + comedi_pci_auto_unconfig(dev); +} + +static DEFINE_PCI_DEVICE_TABLE(apci3xxx_pci_table) = { { PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x3010) }, { PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x300f) }, { PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x300e) }, @@ -806,9 +826,15 @@ static DEFINE_PCI_DEVICE_TABLE(addi_apci_tbl) = { { PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x3024) }, { 0 } }; -MODULE_DEVICE_TABLE(pci, addi_apci_tbl); +MODULE_DEVICE_TABLE(pci, apci3xxx_pci_table); -#include "addi-data/addi_common.c" +static struct pci_driver apci3xxx_pci_driver = { + .name = "addi_apci_3xxx", + .id_table = apci3xxx_pci_table, + .probe = apci3xxx_pci_probe, + .remove = __devexit_p(apci3xxx_pci_remove), +}; +module_comedi_pci_driver(apci3xxx_driver, apci3xxx_pci_driver); MODULE_AUTHOR("Comedi http://www.comedi.org"); MODULE_DESCRIPTION("Comedi low-level driver"); -- 1.7.11 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/devel