From: Frank Mori Hess Date: Tue, 21 Oct 2008 16:10:00 +0000 (+0000) Subject: Converted all pci drivers to use COMEDI_PCI_INITCLEANUP. Automatic X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=265f15623c9ba442e6d0b9e4a91bf2a8e77a9c26;p=comedi.git Converted all pci drivers to use COMEDI_PCI_INITCLEANUP. Automatic configuration should work as long as the driver supported the usual comedi_config , configuration scheme for pci devices. --- diff --git a/comedi/drivers/adl_pci6208.c b/comedi/drivers/adl_pci6208.c index 2a6eb4da..15bd15a7 100644 --- a/comedi/drivers/adl_pci6208.c +++ b/comedi/drivers/adl_pci6208.c @@ -1,6 +1,6 @@ /* comedi/drivers/adl_pci6208.c - + Hardware driver for ADLink 6208 series cards: card | voltage output | current output -------------+-------------------+--------------- @@ -37,9 +37,9 @@ Configuration Options: none References: - - ni_660x.c + - ni_660x.c - adl_pci9111.c copied the entire pci setup section - - adl_pci9118.c + - adl_pci9118.c */ /* * These headers should be followed by a blank line, and any comments @@ -119,7 +119,7 @@ static comedi_driver driver_pci6208 = { detach:pci6208_detach, }; -COMEDI_INITCLEANUP(driver_pci6208); +COMEDI_PCI_INITCLEANUP(driver_pci6208, pci6208_pci_table); static int pci6208_find_device(comedi_device * dev, int bus, int slot); static int @@ -199,7 +199,7 @@ static int pci6208_attach(comedi_device * dev, comedi_devconfig * it) /* * _detach is called to deconfigure a device. It should deallocate - * resources. + * resources. * This function is also called when _attach() fails, so it should be * careful not to release resources that were not necessarily * allocated by _attach(). dev->private and dev->subdevices are diff --git a/comedi/drivers/adl_pci7296.c b/comedi/drivers/adl_pci7296.c index c46b2156..1f80b648 100644 --- a/comedi/drivers/adl_pci7296.c +++ b/comedi/drivers/adl_pci7296.c @@ -189,4 +189,4 @@ static int adl_pci7296_detach(comedi_device * dev) return 0; } -COMEDI_INITCLEANUP(driver_adl_pci7296); +COMEDI_PCI_INITCLEANUP(driver_adl_pci7296, adl_pci7296_pci_table); diff --git a/comedi/drivers/adl_pci7432.c b/comedi/drivers/adl_pci7432.c index ea4e7f71..6bda91b4 100644 --- a/comedi/drivers/adl_pci7432.c +++ b/comedi/drivers/adl_pci7432.c @@ -217,4 +217,4 @@ static int adl_pci7432_di_insn_bits(comedi_device * dev, comedi_subdevice * s, return 2; } -COMEDI_INITCLEANUP(driver_adl_pci7432); +COMEDI_PCI_INITCLEANUP(driver_adl_pci7432, adl_pci7432_pci_table); diff --git a/comedi/drivers/adl_pci8164.c b/comedi/drivers/adl_pci8164.c index e43c4f92..8c22b7fa 100644 --- a/comedi/drivers/adl_pci8164.c +++ b/comedi/drivers/adl_pci8164.c @@ -527,4 +527,4 @@ static int adl_pci8164_insn_write_buf1(comedi_device * dev, return 2; } -COMEDI_INITCLEANUP(driver_adl_pci8164); +COMEDI_PCI_INITCLEANUP(driver_adl_pci8164, adl_pci8164_pci_table); diff --git a/comedi/drivers/adl_pci9111.c b/comedi/drivers/adl_pci9111.c index 1295185f..b55d52da 100644 --- a/comedi/drivers/adl_pci9111.c +++ b/comedi/drivers/adl_pci9111.c @@ -336,7 +336,7 @@ static comedi_driver pci9111_driver = { offset:sizeof(pci9111_board_struct), }; -COMEDI_INITCLEANUP(pci9111_driver); +COMEDI_PCI_INITCLEANUP(pci9111_driver, pci9111_pci_table); // // Private data structure diff --git a/comedi/drivers/adl_pci9118.c b/comedi/drivers/adl_pci9118.c index 8ba859a3..cf0cfe8a 100644 --- a/comedi/drivers/adl_pci9118.c +++ b/comedi/drivers/adl_pci9118.c @@ -238,7 +238,7 @@ static comedi_driver driver_pci9118 = { offset:sizeof(boardtype), }; -COMEDI_INITCLEANUP(driver_pci9118); +COMEDI_PCI_INITCLEANUP(driver_pci9118, pci9118_pci_table); typedef struct { unsigned long iobase_a; // base+size for AMCC chip diff --git a/comedi/drivers/adv_pci1710.c b/comedi/drivers/adv_pci1710.c index a456a09b..17b02575 100644 --- a/comedi/drivers/adv_pci1710.c +++ b/comedi/drivers/adv_pci1710.c @@ -1538,7 +1538,7 @@ static int pci1710_detach(comedi_device * dev) /* ============================================================================== */ -COMEDI_INITCLEANUP(driver_pci1710); +COMEDI_PCI_INITCLEANUP(driver_pci1710, pci1710_pci_table); /* ============================================================================== */ diff --git a/comedi/drivers/adv_pci1723.c b/comedi/drivers/adv_pci1723.c index a26fd8bb..2f4506ac 100644 --- a/comedi/drivers/adv_pci1723.c +++ b/comedi/drivers/adv_pci1723.c @@ -465,4 +465,4 @@ static int pci1723_detach(comedi_device * dev) * A convenient macro that defines init_module() and cleanup_module(), * as necessary. */ -COMEDI_INITCLEANUP(driver_pci1723); +COMEDI_PCI_INITCLEANUP(driver_pci1723, pci1723_pci_table); diff --git a/comedi/drivers/adv_pci_dio.c b/comedi/drivers/adv_pci_dio.c index 37a2e1ba..d43b12b0 100644 --- a/comedi/drivers/adv_pci_dio.c +++ b/comedi/drivers/adv_pci_dio.c @@ -86,7 +86,7 @@ typedef enum { // Advantech PCI-1736UP #define PCI1736_IDI 0 /* R: Isolated digital input 0-15 */ #define PCI1736_IDO 0 /* W: Isolated digital output 0-15 */ -#define PCI1736_3_INT_EN 0x08 /* R/W: enable/disable interrupts */ +#define PCI1736_3_INT_EN 0x08 /* R/W: enable/disable interrupts */ #define PCI1736_3_INT_RF 0x0c /* R/W: set falling/raising edge for interrupts */ #define PCI1736_3_INT_CLR 0x10 /* R/W: clear interrupts */ #define PCI1736_BOARDID 4 /* R: Board I/D switch for 1736UP */ @@ -1071,7 +1071,7 @@ static int pci_dio_detach(comedi_device * dev) /* ============================================================================== */ -COMEDI_INITCLEANUP(driver_pci_dio); +COMEDI_PCI_INITCLEANUP(driver_pci_dio, pci_dio_pci_table); /* ============================================================================== */ diff --git a/comedi/drivers/amplc_dio200.c b/comedi/drivers/amplc_dio200.c index 482a3e2a..fe2ee77a 100644 --- a/comedi/drivers/amplc_dio200.c +++ b/comedi/drivers/amplc_dio200.c @@ -471,7 +471,7 @@ static comedi_driver driver_amplc_dio200 = { num_names:sizeof(dio200_boards) / sizeof(dio200_board), }; -COMEDI_INITCLEANUP(driver_amplc_dio200); +COMEDI_PCI_INITCLEANUP(driver_amplc_dio200, dio200_pci_table); /* * This function looks for a PCI device matching the requested board name, diff --git a/comedi/drivers/amplc_pc236.c b/comedi/drivers/amplc_pc236.c index 1f70aa86..7ca50903 100644 --- a/comedi/drivers/amplc_pc236.c +++ b/comedi/drivers/amplc_pc236.c @@ -165,7 +165,7 @@ static comedi_driver driver_amplc_pc236 = { num_names:sizeof(pc236_boards) / sizeof(pc236_board), }; -COMEDI_INITCLEANUP(driver_amplc_pc236); +COMEDI_PCI_INITCLEANUP(driver_amplc_pc236, pc236_pci_table); static int pc236_request_region(unsigned long from, unsigned long extent); static void pc236_intr_disable(comedi_device * dev); diff --git a/comedi/drivers/amplc_pc263.c b/comedi/drivers/amplc_pc263.c index 0e41cc01..92d8c7ee 100644 --- a/comedi/drivers/amplc_pc263.c +++ b/comedi/drivers/amplc_pc263.c @@ -310,7 +310,7 @@ static int pc263_detach(comedi_device * dev) comedi_pci_disable(devpriv->pci_dev); } pci_dev_put(devpriv->pci_dev); - } else + } else #endif { if (dev->iobase) { @@ -377,4 +377,4 @@ static int pc263_dio_insn_config(comedi_device * dev, comedi_subdevice * s, * A convenient macro that defines init_module() and cleanup_module(), * as necessary. */ -COMEDI_INITCLEANUP(driver_amplc_pc263); +COMEDI_PCI_INITCLEANUP(driver_amplc_pc263, pc263_pci_table); diff --git a/comedi/drivers/amplc_pci224.c b/comedi/drivers/amplc_pci224.c index 886b340e..e2788d87 100644 --- a/comedi/drivers/amplc_pci224.c +++ b/comedi/drivers/amplc_pci224.c @@ -428,7 +428,7 @@ static comedi_driver driver_amplc_pci224 = { num_names:sizeof(pci224_boards) / sizeof(pci224_board), }; -COMEDI_INITCLEANUP(driver_amplc_pci224); +COMEDI_PCI_INITCLEANUP(driver_amplc_pci224, pci224_pci_table); /* * Called from the 'insn_write' function to perform a single write. diff --git a/comedi/drivers/amplc_pci230.c b/comedi/drivers/amplc_pci230.c index 47ee16f5..67ad9921 100644 --- a/comedi/drivers/amplc_pci230.c +++ b/comedi/drivers/amplc_pci230.c @@ -50,7 +50,7 @@ Subdevices: PCI230(+) PCI260(+) --------- --------- Subdevices 3 1 - 0 AI AI + 0 AI AI 1 AO 2 DIO @@ -58,10 +58,10 @@ AI Subdevice: The AI subdevice has 16 single-ended channels or 8 differential channels. - + The PCI230 and PCI260 cards have 12-bit resolution. The PCI230+ and PCI260+ cards have 16-bit resolution. - + For differential mode, use inputs 2N and 2N+1 for channel N (e.g. use inputs 14 and 15 for channel 7). If the card is physically a PCI230 or PCI260 then it actually uses a "pseudo-differential" mode where the @@ -616,7 +616,7 @@ static comedi_driver driver_amplc_pci230 = { num_names:sizeof(pci230_boards) / sizeof(pci230_boards[0]), }; -COMEDI_INITCLEANUP(driver_amplc_pci230); +COMEDI_PCI_INITCLEANUP(driver_amplc_pci230, pci230_pci_table); static int pci230_ai_rinsn(comedi_device * dev, comedi_subdevice * s, comedi_insn * insn, lsampl_t * data); diff --git a/comedi/drivers/cb_pcidas.c b/comedi/drivers/cb_pcidas.c index e82b7302..534d726c 100644 --- a/comedi/drivers/cb_pcidas.c +++ b/comedi/drivers/cb_pcidas.c @@ -1825,4 +1825,4 @@ static int nvram_read(comedi_device * dev, unsigned int address, uint8_t * data) * A convenient macro that defines init_module() and cleanup_module(), * as necessary. */ -COMEDI_INITCLEANUP(driver_cb_pcidas); +COMEDI_PCI_INITCLEANUP(driver_cb_pcidas, cb_pcidas_pci_table); diff --git a/comedi/drivers/cb_pcidas64.c b/comedi/drivers/cb_pcidas64.c index f7e21347..ead9f11c 100644 --- a/comedi/drivers/cb_pcidas64.c +++ b/comedi/drivers/cb_pcidas64.c @@ -1198,7 +1198,7 @@ static void enable_ai_interrupts(comedi_device * dev, const comedi_cmd * cmd); static unsigned int get_ao_divisor(unsigned int ns, unsigned int flags); static void load_ao_dma(comedi_device * dev, const comedi_cmd * cmd); -COMEDI_INITCLEANUP(driver_cb_pcidas); +COMEDI_PCI_INITCLEANUP(driver_cb_pcidas, pcidas64_pci_table); static unsigned int ai_range_bits_6xxx(const comedi_device * dev, unsigned int range_index) diff --git a/comedi/drivers/cb_pcidda.c b/comedi/drivers/cb_pcidda.c index 1902e1aa..74b8fe03 100644 --- a/comedi/drivers/cb_pcidda.c +++ b/comedi/drivers/cb_pcidda.c @@ -838,4 +838,4 @@ static void cb_pcidda_calibrate(comedi_device * dev, unsigned int channel, * A convenient macro that defines init_module() and cleanup_module(), * as necessary. */ -COMEDI_INITCLEANUP(driver_cb_pcidda); +COMEDI_PCI_INITCLEANUP(driver_cb_pcidda, cb_pcidda_pci_table); diff --git a/comedi/drivers/cb_pcidio.c b/comedi/drivers/cb_pcidio.c index 099a749d..455c8d88 100644 --- a/comedi/drivers/cb_pcidio.c +++ b/comedi/drivers/cb_pcidio.c @@ -291,4 +291,4 @@ static int pcidio_detach(comedi_device * dev) * A convenient macro that defines init_module() and cleanup_module(), * as necessary. */ -COMEDI_INITCLEANUP(driver_cb_pcidio); +COMEDI_PCI_INITCLEANUP(driver_cb_pcidio, pcidio_pci_table); diff --git a/comedi/drivers/cb_pcimdas.c b/comedi/drivers/cb_pcimdas.c index 50d80d89..e2e242f4 100644 --- a/comedi/drivers/cb_pcimdas.c +++ b/comedi/drivers/cb_pcimdas.c @@ -481,4 +481,4 @@ static int cb_pcimdas_ao_rinsn(comedi_device * dev, comedi_subdevice * s, * A convenient macro that defines init_module() and cleanup_module(), * as necessary. */ -COMEDI_INITCLEANUP(driver_cb_pcimdas); +COMEDI_PCI_INITCLEANUP(driver_cb_pcimdas, cb_pcimdas_pci_table); diff --git a/comedi/drivers/cb_pcimdda.c b/comedi/drivers/cb_pcimdda.c index 4a8733f5..ca11bfbf 100644 --- a/comedi/drivers/cb_pcimdda.c +++ b/comedi/drivers/cb_pcimdda.c @@ -195,7 +195,7 @@ MODULE_DESCRIPTION("Comedi low-level driver for the Computerboards PCIM-DDA " "series. Currently only supports PCIM-DDA06-16 (which " "also happens to be the only board in this series. :) ) "); MODULE_LICENSE("GPL"); -COMEDI_INITCLEANUP_NOMODULE(cb_pcimdda_driver); +COMEDI_PCI_INITCLEANUP_NOMODULE(cb_pcimdda_driver, pci_table); static int ao_winsn(comedi_device * dev, comedi_subdevice * s, comedi_insn * insn, lsampl_t * data); diff --git a/comedi/drivers/contec_pci_dio.c b/comedi/drivers/contec_pci_dio.c index e3c362d1..c1680add 100644 --- a/comedi/drivers/contec_pci_dio.c +++ b/comedi/drivers/contec_pci_dio.c @@ -227,4 +227,4 @@ static int contec_di_insn_bits(comedi_device * dev, comedi_subdevice * s, return 2; } -COMEDI_INITCLEANUP(driver_contec); +COMEDI_PCI_INITCLEANUP(driver_contec, contec_pci_table); diff --git a/comedi/drivers/daqboard2000.c b/comedi/drivers/daqboard2000.c index ba5ff0bd..7ec0e73b 100644 --- a/comedi/drivers/daqboard2000.c +++ b/comedi/drivers/daqboard2000.c @@ -31,7 +31,7 @@ Devices: [IOTech] DAQBoard/2000 (daqboard2000) Much of the functionality of this driver was determined from reading the source code for the Windows driver. -The FPGA on the board requires initialization code, which can +The FPGA on the board requires initialization code, which can be loaded by comedi_config using the -i option. The initialization code is available from http://www.comedi.org in the comedi_nonfree_firmware tarball. @@ -43,26 +43,26 @@ Configuration options: PCI device found will be used. */ /* - This card was obviously never intended to leave the Windows world, - since it lacked all kind of hardware documentation (except for cable - pinouts, plug and pray has something to catch up with yet). + This card was obviously never intended to leave the Windows world, + since it lacked all kind of hardware documentation (except for cable + pinouts, plug and pray has something to catch up with yet). - With some help from our swedish distributor, we got the Windows sourcecode + With some help from our swedish distributor, we got the Windows sourcecode for the card, and here are the findings so far. 1. A good document that describes the PCI interface chip is found at: http://plx.plxtech.com/download/9080/databook/9080db-106.pdf - + 2. The initialization done so far is: a. program the FPGA (windows code sans a lot of error messages) - b. + b. - 3. Analog out seems to work OK with DAC's disabled, if DAC's are enabled, + 3. Analog out seems to work OK with DAC's disabled, if DAC's are enabled, you have to output values to all enabled DAC's until result appears, I - guess that it has something to do with pacer clocks, but the source + guess that it has something to do with pacer clocks, but the source gives me no clues. I'll keep it simple so far. - 4. Analog in. + 4. Analog in. Each channel in the scanlist seems to be controlled by four control words: @@ -107,13 +107,13 @@ Configuration options: | +---------------- Unipolar +------------------------- Correction gain high - + 999. The card seems to have an incredible amount of capabilities, but trying to reverse engineer them from the Windows source is beyond my patience. - + */ #include @@ -485,7 +485,7 @@ static int daqboard2000_ao_insn_write(comedi_device * dev, comedi_subdevice * s, //comedi_udelay(2); } devpriv->ao_readback[chan] = data[i]; - /* + /* * Since we never enabled the DAC's, we don't need to disable it... * fpga->dacControl = (chan + 2) * 0x0010 | 0x0000; comedi_udelay(1000); */ @@ -874,4 +874,4 @@ static int daqboard2000_detach(comedi_device * dev) return 0; } -COMEDI_INITCLEANUP(driver_daqboard2000); +COMEDI_PCI_INITCLEANUP(driver_daqboard2000, daqboard2000_pci_table); diff --git a/comedi/drivers/das08.c b/comedi/drivers/das08.c index d239d885..3a186184 100644 --- a/comedi/drivers/das08.c +++ b/comedi/drivers/das08.c @@ -1038,7 +1038,7 @@ int das08_common_detach(comedi_device * dev) return 0; } -COMEDI_INITCLEANUP(driver_das08); +COMEDI_PCI_INITCLEANUP(driver_das08, das08_pci_table); EXPORT_SYMBOL_GPL(das08_common_attach); EXPORT_SYMBOL_GPL(das08_common_detach); diff --git a/comedi/drivers/dt3000.c b/comedi/drivers/dt3000.c index 3c1f713a..526c0cf0 100644 --- a/comedi/drivers/dt3000.c +++ b/comedi/drivers/dt3000.c @@ -280,7 +280,7 @@ static comedi_driver driver_dt3000 = { detach:dt3000_detach, }; -COMEDI_INITCLEANUP(driver_dt3000); +COMEDI_PCI_INITCLEANUP(driver_dt3000, dt3k_pci_table); static void dt3k_ai_empty_fifo(comedi_device * dev, comedi_subdevice * s); static int dt3k_ns_to_timer(unsigned int timer_base, unsigned int *arg, diff --git a/comedi/drivers/gsc_hpdi.c b/comedi/drivers/gsc_hpdi.c index 7e27fade..b80d5922 100644 --- a/comedi/drivers/gsc_hpdi.c +++ b/comedi/drivers/gsc_hpdi.c @@ -334,7 +334,7 @@ static comedi_driver driver_hpdi = { detach:hpdi_detach, }; -COMEDI_INITCLEANUP(driver_hpdi); +COMEDI_PCI_INITCLEANUP(driver_hpdi, hpdi_pci_table); static int dio_config_insn(comedi_device * dev, comedi_subdevice * s, comedi_insn * insn, lsampl_t * data) diff --git a/comedi/drivers/jr3_pci.c b/comedi/drivers/jr3_pci.c index ac2dfe88..40f047a4 100644 --- a/comedi/drivers/jr3_pci.c +++ b/comedi/drivers/jr3_pci.c @@ -27,9 +27,9 @@ Author: Anders Blomdell Status: works Devices: [JR3] PCI force sensor board (jr3_pci) - The DSP on the board requires initialization code, which can - be loaded by placing it in /lib/firmware/comedi. - The initialization code should be somewhere on the media you got + The DSP on the board requires initialization code, which can + be loaded by placing it in /lib/firmware/comedi. + The initialization code should be somewhere on the media you got with your card. One version is available from http://www.comedi.org in the comedi_nonfree_firmware tarball. @@ -406,7 +406,7 @@ int read_idm_word(const u8 * data, size_t size, int *pos, unsigned int *val) { int result = 0; if (pos != 0 && val != 0) { - // Skip over non hex + // Skip over non hex for (; *pos < size && !isxdigit(data[*pos]); (*pos)++) { } // Collect value @@ -491,7 +491,7 @@ static int jr3_download_firmware(comedi_device * dev, const u8 * data, // printk("jr3_data, not tested\n"); // jr3[addr + 0x20000 * pnum] = data1; } else { - // Download 24 bit program + // Download 24 bit program unsigned int data1, data2; more = more @@ -547,7 +547,7 @@ static poll_delay_t jr3_pci_poll_subdevice(comedi_subdevice * s) u16 serial_no = get_u16(&channel->serial_no); if ((errors & (watch_dog | watch_dog2)) || model_no == 0 || serial_no == 0) { - // Still no sensor, keep on polling. Since it takes up to + // Still no sensor, keep on polling. Since it takes up to // 10 seconds for offsets to stabilize, polling each // second should suffice. result = poll_delay_min_max(1000, 2000); @@ -758,7 +758,7 @@ static void jr3_pci_poll_dev(unsigned long data) subdevpriv->next_time_max = jiffies + msecs_to_jiffies(sub_delay.max); if (sub_delay.max && sub_delay.max < delay) { - // Wake up as late as possible -> poll as many channels as + // Wake up as late as possible -> poll as many channels as // possible at once delay = sub_delay.max; } @@ -911,7 +911,7 @@ static int jr3_pci_attach(comedi_device * dev, comedi_devconfig * it) } // TODO: use firmware to load preferred offset tables. Suggested format: // model serial Fx Fy Fz Mx My Mz\n - // + // // comedi_load_firmware(dev, "jr3_offsets_table", jr3_download_firmware); // It takes a few milliseconds for software to settle @@ -969,4 +969,4 @@ static int jr3_pci_detach(comedi_device * dev) return 0; } -COMEDI_INITCLEANUP(driver_jr3_pci); +COMEDI_PCI_INITCLEANUP(driver_jr3_pci, jr3_pci_pci_table); diff --git a/comedi/drivers/ke_counter.c b/comedi/drivers/ke_counter.c index b13e9a4f..7e08bea8 100644 --- a/comedi/drivers/ke_counter.c +++ b/comedi/drivers/ke_counter.c @@ -93,7 +93,7 @@ static comedi_driver cnt_driver = { detach:cnt_detach, }; -COMEDI_INITCLEANUP(cnt_driver); +COMEDI_PCI_INITCLEANUP(cnt_driver, cnt_pci_table); /*-- counter write ----------------------------------------------------------*/ diff --git a/comedi/drivers/me4000.c b/comedi/drivers/me4000.c index abc9c5d8..c865b615 100644 --- a/comedi/drivers/me4000.c +++ b/comedi/drivers/me4000.c @@ -2359,4 +2359,4 @@ static int me4000_cnt_insn_write(comedi_device * dev, return 1; } -COMEDI_INITCLEANUP(driver_me4000); +COMEDI_PCI_INITCLEANUP(driver_me4000, me4000_pci_table); diff --git a/comedi/drivers/me_daq.c b/comedi/drivers/me_daq.c index 906537f6..630fd891 100644 --- a/comedi/drivers/me_daq.c +++ b/comedi/drivers/me_daq.c @@ -258,7 +258,7 @@ static comedi_driver me_driver = { offset:sizeof(me_board_struct), }; -COMEDI_INITCLEANUP(me_driver); +COMEDI_PCI_INITCLEANUP(me_driver, me_pci_table); // // Private data structure diff --git a/comedi/drivers/ni_6527.c b/comedi/drivers/ni_6527.c index 9de11589..e5acc584 100644 --- a/comedi/drivers/ni_6527.c +++ b/comedi/drivers/ni_6527.c @@ -84,8 +84,6 @@ static comedi_driver driver_ni6527 = { detach:ni6527_detach, }; -COMEDI_INITCLEANUP(driver_ni6527); - typedef struct { int dev_id; const char *name; @@ -484,3 +482,5 @@ static int ni6527_find_device(comedi_device * dev, int bus, int slot) mite_list_devices(); return -EIO; } + +COMEDI_PCI_INITCLEANUP(driver_ni6527, ni6527_pci_table); diff --git a/comedi/drivers/ni_65xx.c b/comedi/drivers/ni_65xx.c index 52cd5cc0..86e8b4d5 100644 --- a/comedi/drivers/ni_65xx.c +++ b/comedi/drivers/ni_65xx.c @@ -111,8 +111,6 @@ static comedi_driver driver_ni_65xx = { detach:ni_65xx_detach, }; -COMEDI_INITCLEANUP(driver_ni_65xx); - typedef struct { int dev_id; const char *name; @@ -803,3 +801,5 @@ static int ni_65xx_find_device(comedi_device * dev, int bus, int slot) mite_list_devices(); return -EIO; } + +COMEDI_PCI_INITCLEANUP(driver_ni_65xx, ni_65xx_pci_table); diff --git a/comedi/drivers/ni_660x.c b/comedi/drivers/ni_660x.c index 9e158ce0..bf51b2a7 100644 --- a/comedi/drivers/ni_660x.c +++ b/comedi/drivers/ni_660x.c @@ -457,7 +457,7 @@ static comedi_driver driver_ni_660x = { detach:ni_660x_detach, }; -COMEDI_INITCLEANUP(driver_ni_660x); +COMEDI_PCI_INITCLEANUP(driver_ni_660x, ni_660x_pci_table); static int ni_660x_find_device(comedi_device * dev, int bus, int slot); static int ni_660x_set_pfi_routing(comedi_device * dev, unsigned chan, diff --git a/comedi/drivers/ni_670x.c b/comedi/drivers/ni_670x.c index 31eb9726..65d22bd6 100644 --- a/comedi/drivers/ni_670x.c +++ b/comedi/drivers/ni_670x.c @@ -118,7 +118,7 @@ static comedi_driver driver_ni_670x = { detach:ni_670x_detach, }; -COMEDI_INITCLEANUP(driver_ni_670x); +COMEDI_PCI_INITCLEANUP(driver_ni_670x, ni_670x_pci_table); static comedi_lrange range_0_20mA = { 1, {RANGE_mA(0, 20)} }; diff --git a/comedi/drivers/ni_labpc.c b/comedi/drivers/ni_labpc.c index f33cd250..cc58ca58 100644 --- a/comedi/drivers/ni_labpc.c +++ b/comedi/drivers/ni_labpc.c @@ -1986,7 +1986,7 @@ static void write_caldac(comedi_device * dev, unsigned int channel, devpriv->write_byte(devpriv->command5_bits, dev->iobase + COMMAND5_REG); } -COMEDI_INITCLEANUP(driver_labpc); +COMEDI_PCI_INITCLEANUP(driver_labpc, labpc_pci_table); EXPORT_SYMBOL_GPL(labpc_common_attach); EXPORT_SYMBOL_GPL(labpc_common_detach); diff --git a/comedi/drivers/ni_pcidio.c b/comedi/drivers/ni_pcidio.c index bc260b8a..287131d5 100644 --- a/comedi/drivers/ni_pcidio.c +++ b/comedi/drivers/ni_pcidio.c @@ -298,8 +298,6 @@ static comedi_driver driver_pcidio = { detach:nidio_detach, }; -COMEDI_INITCLEANUP(driver_pcidio); - typedef struct { int dev_id; const char *name; @@ -1298,3 +1296,5 @@ static int nidio_find_device(comedi_device * dev, int bus, int slot) mite_list_devices(); return -EIO; } + +COMEDI_PCI_INITCLEANUP(driver_pcidio, ni_pcidio_pci_table); diff --git a/comedi/drivers/rtd520.c b/comedi/drivers/rtd520.c index 1daabf78..3a90a214 100644 --- a/comedi/drivers/rtd520.c +++ b/comedi/drivers/rtd520.c @@ -2259,4 +2259,4 @@ static int rtd_dio_insn_config(comedi_device * dev, * A convenient macro that defines init_module() and cleanup_module(), * as necessary. */ -COMEDI_INITCLEANUP(rtd520Driver); +COMEDI_PCI_INITCLEANUP(rtd520Driver, rtd520_pci_table); diff --git a/comedi/drivers/s626.c b/comedi/drivers/s626.c index 8d25a781..d32cf1fa 100644 --- a/comedi/drivers/s626.c +++ b/comedi/drivers/s626.c @@ -227,7 +227,7 @@ static dio_private *dio_private_word[]={ #define devpriv ((s626_private *)dev->private) #define diopriv ((dio_private *)s->private) -COMEDI_INITCLEANUP_NOMODULE(driver_s626); +COMEDI_PCI_INITCLEANUP_NOMODULE(driver_s626, s626_pci_table); //ioctl routines static int s626_ai_insn_config(comedi_device * dev, comedi_subdevice * s, diff --git a/comedi/drivers/skel.c b/comedi/drivers/skel.c index b0ffcabe..77936aad 100644 --- a/comedi/drivers/skel.c +++ b/comedi/drivers/skel.c @@ -212,7 +212,7 @@ static int skel_attach(comedi_device * dev, comedi_devconfig * it) * it is, this is the place to do it. Otherwise, dev->board_ptr * should already be initialized. */ - //dev->board_ptr = skel_probe(dev); + //dev->board_ptr = skel_probe(dev, it); /* * Initialize dev->board_name. Note that we can use the "thisboard" @@ -614,3 +614,6 @@ static int skel_dio_insn_config(comedi_device * dev, comedi_subdevice * s, * as necessary. */ COMEDI_INITCLEANUP(driver_skel); +/* If you are writing a PCI driver you should use COMEDI_PCI_INITCLEANUP instead. +*/ +// COMEDI_PCI_INITCLEANUP(driver_skel, skel_pci_table) diff --git a/include/linux/comedidev.h b/include/linux/comedidev.h index c0945083..11737a27 100644 --- a/include/linux/comedidev.h +++ b/include/linux/comedidev.h @@ -70,15 +70,9 @@ #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) \ - {comedi_driver_unregister(&(x));} \ - module_init(x ## _init_module); \ - module_exit(x ## _cleanup_module); \ + COMEDI_INITCLEANUP_NOMODULE(x) -#define COMEDI_PCI_INITCLEANUP(comedi_driver, pci_id_table) \ - COMEDI_MODULE_MACROS \ +#define COMEDI_PCI_INITCLEANUP_NOMODULE(comedi_driver, pci_id_table) \ static int __devinit comedi_driver ## _pci_probe(struct pci_dev *dev, \ const struct pci_device_id *ent) \ { \ @@ -110,6 +104,10 @@ module_init(comedi_driver ## _init_module); \ module_exit(comedi_driver ## _cleanup_module); +#define COMEDI_PCI_INITCLEANUP(comedi_driver, pci_id_table) \ + COMEDI_MODULE_MACROS \ + COMEDI_PCI_INITCLEANUP_NOMODULE(comedi_driver, pci_id_table) + #define PCI_VENDOR_ID_INOVA 0x104c #define PCI_VENDOR_ID_NATINST 0x1093 #define PCI_VENDOR_ID_DATX 0x1116