diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-21 15:26:46 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-21 15:26:46 -0700 |
commit | d79df0b1eda0099a22cbcece01ce5e7d222450de (patch) | |
tree | eb9c938fa5faf285fb091d7446508a32229ceea4 /drivers/staging/comedi | |
parent | 6e80e8ed5eb92d0112674aabe82951266a6a1051 (diff) | |
parent | c8d1a126924fcbc1d61ceb830226e0c7afdcc841 (diff) | |
download | kernel_samsung_smdk4412-d79df0b1eda0099a22cbcece01ce5e7d222450de.zip kernel_samsung_smdk4412-d79df0b1eda0099a22cbcece01ce5e7d222450de.tar.gz kernel_samsung_smdk4412-d79df0b1eda0099a22cbcece01ce5e7d222450de.tar.bz2 |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6: (577 commits)
Staging: ramzswap: Handler for swap slot free callback
swap: Add swap slot free callback to block_device_operations
swap: Add flag to identify block swap devices
Staging: vt6655: use ETH_FRAME_LEN macro instead of custom one
Staging: vt6655: use ETH_DATA_LEN macro instead of custom one
Staging: vt6655: use ETH_FCS_LEN macro instead of custom one
Staging: vt6656: use ETH_HLEN macro instead of custom one
Staging: comedi: quatech_daqp_cs.c Replace eos semaphore with a completion.
Staging: dt3155v4l: remove private memory allocator
Staging: crystalhd: Remove typedefs from driver
Staging: winbond: Fix for pointer name format issue in mds.c
Staging: vt6656: removed custom UCHAR/USHORT/UINT/ULONG/ULONGLONG typedefs
Staging: vt6656: removed custom CHAR/SHORT/INT/LONG typedefs
Staging: comedi: Altered the way printk is used in 8255.c
staging: iio: adis16350 and similar IMU driver
Staging: iio: max1363 Fix two bugs in single_channel_from_ring
Staging: iio: adis16220 extract bin_attribute structures from state
Staging: iio: adis16220 vibration sensor driver
Staging: comedi: Kconfig dependancy fixes
Staging: comedi: fix up build error from last Kconfig changes
...
Diffstat (limited to 'drivers/staging/comedi')
88 files changed, 3889 insertions, 3336 deletions
diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index d63c889..8ce307e 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -1,7 +1,7 @@ config COMEDI tristate "Data acquisition support (comedi)" default N - depends on m && (PCI || PCMCIA || PCCARD || USB) + depends on m ---help--- Enable support a wide range of data acquisition devices for Linux. @@ -9,27 +9,1295 @@ config COMEDI config COMEDI_DEBUG bool "Comedi debugging" depends on COMEDI != n - help + ---help--- This is an option for use by developers; most people should say N here. This enables comedi core and driver debugging. -config COMEDI_PCI_DRIVERS +menuconfig COMEDI_MISC_DRIVERS + tristate "Comedi misc drivers" + depends on COMEDI + default N + ---help--- + Enable comedi misc drivers to be built + + Note that the answer to this question won't directly affect the + kernel: saying N will just cause the configurator to skip all + the questions about misc non-hardware comedi drivers. + +if COMEDI_MISC_DRIVERS + +config COMEDI_KCOMEDILIB + tristate "Comedi kcomedilib" + ---help--- + Build the kcomedilib + +config COMEDI_BOND + tristate "Device bonding support" + depends on COMEDI_KCOMEDILIB + default N + ---help--- + Enable support for a driver to 'bond' (merge) multiple subdevices + from multiple devices together as one. + + To compile this driver as a module, choose M here: the module will be + called comedi_bond. + +config COMEDI_TEST + tristate "Fake waveform generator support" + select COMEDI_FC + default N + ---help--- + Enable support for the fake waveform generator. + This driver is mainly for testing purposes, but can also be used to + generate sample waveforms on systems that don't have data acquisition + hardware. + + To compile this driver as a module, choose M here: the module will be + called comedi_test. + +config COMEDI_PARPORT + tristate "Parallel port support" + default N + ---help--- + Enable support for the standard parallel port. + A cheap and easy way to get a few more digital I/O lines. Steal + additional parallel ports from old computers or your neighbors' + computers. + + To compile this driver as a module, choose M here: the module will be + called comedi_parport. + +config COMEDI_SERIAL2002 + tristate "Driver for serial connected hardware" + default N + ---help--- + Enable support for serial connected hardware + + To compile this driver as a module, choose M here: the module will be + called serial2002. + +config COMEDI_SKEL + tristate "Comedi skeleton driver" + default N + ---help--- + Build the Skeleton driver, an example for driver writers + + To compile this driver as a module, choose M here: the module will be + called skel. + +endif # COMEDI_MISC_DRIVERS + +menuconfig COMEDI_ISA_DRIVERS + tristate "Comedi ISA and PC/104 drivers" + depends on COMEDI && ISA + default N + ---help--- + Enable comedi ISA and PC/104 drivers to be built + + Note that the answer to this question won't directly affect the + kernel: saying N will just cause the configurator to skip all + the questions about ISA and PC/104 comedi drivers. + +if COMEDI_ISA_DRIVERS && ISA + +config COMEDI_8255 + tristate "Generic 8255 support" + default N + ---help--- + Enable generic 8255 support. + + To compile this driver as a module, choose M here: the module will be + called 8255. + +config COMEDI_ACL7225B + tristate "ADlink NuDAQ ACL-7225b and compatibles support" + default N + ---help--- + Enable support for ADlink NuDAQ ACL-7225b and compatibles, + ADlink ACL-7225b (acl7225b), ICP P16R16DIO (p16r16dio) + + To compile this driver as a module, choose M here: the module will be + called acl7225b. + +config COMEDI_PCL711 + tristate "Advantech PCL-711/711b and ADlink ACL-8112 ISA card support" + default N + ---help--- + Enable support for Advantech PCL-711 and 711b, ADlink ACL-8112 + + To compile this driver as a module, choose M here: the module will be + called pcl711. + +config COMEDI_PCL724 + tristate "Advantech PCL-722/724/731 and ADlink ACL-7122/7124/PET-48DIO" + default N + ---help--- + Enable support for Advantech PCL-724, PCL-722, PCL-731 and + ADlink ACL-7122, ACL-7124, PET-48DIO ISA cards + + To compile this driver as a module, choose M here: the module will be + called pcl724. + +config COMEDI_PCL725 + tristate "Advantech PCL-725 and compatible ISA card support" + default N + ---help--- + Enable support for Advantech PCL-725 and compatible ISA cards. + + To compile this driver as a module, choose M here: the module will be + called pcl725. + +config COMEDI_PCL726 + tristate "Advantech PCL-726 and compatible ISA card support" + default N + ---help--- + Enable support for Advantech PCL-726 and compatible ISA cards. + + To compile this driver as a module, choose M here: the module will be + called pcl726. + +config COMEDI_PCL730 + tristate "Advantech PCL-730 and ADlink ACL-7130 ISA card support" + default N + ---help--- + Enable support for Advantech PCL-730, ICP ISO-730 and ADlink + ACL-7130 ISA cards + + To compile this driver as a module, choose M here: the module will be + called pcl730. + +config COMEDI_PCL812 + tristate "Advantech PCL-812/813 and ADlink ACL-8112/8113/8113/8216" + default N + ---help--- + Enable support for Advantech PCL-812/PG, PCL-813/B, ADLink + ACL-8112DG/HG/PG, ACL-8113, ACL-8216, ICP DAS A-821PGH/PGL/PGL-NDA, + A-822PGH/PGL, A-823PGH/PGL, A-826PG and ICP DAS ISO-813 ISA cards + + To compile this driver as a module, choose M here: the module will be + called pcl812. + +config COMEDI_PCL816 + tristate "Advantech PCL-814 and PCL-816 ISA card support" + default N + ---help--- + Enable support for Advantech PCL-814 and PCL-816 ISA cards + + To compile this driver as a module, choose M here: the module will be + called pcl816. + +config COMEDI_PCL818 + tristate "Advantech PCL-718 and PCL-818 ISA card support" + default N + ---help--- + Enable support for Advantech PCL-818 ISA cards + PCL-818L, PCL-818H, PCL-818HD, PCL-818HG, PCL-818 and PCL-718 + + To compile this driver as a module, choose M here: the module will be + called pcl818. + +config COMEDI_PCM3724 + tristate "Advantech PCM-3724 PC/104 card support" + default N + ---help--- + Enable support for Advantech PCM-3724 PC/104 cards. + + To compile this driver as a module, choose M here: the module will be + called pcm3724. + +config COMEDI_PCM3730 + tristate "Advantech PCM-3730 and clone PC/104 board support" + default N + ---help--- + Enable support for Advantech PCM-3730 and clone PC/104 boards + + To compile this driver as a module, choose M here: the module will be + called pcm3730. + +config COMEDI_RTI800 + tristate "Analog Devices RTI-800/815 ISA card support" + default N + ---help--- + Enable support for Analog Devices RTI-800/815 ISA cards + + To compile this driver as a module, choose M here: the module will be + called rti800. + +config COMEDI_RTI802 + tristate "Analog Devices RTI-802 ISA card support" + default N + ---help--- + Enable support for Analog Devices RTI-802 ISA cards + + To compile this driver as a module, choose M here: the module will be + called rti802. + +config COMEDI_DAS08 + tristate "DAS-08 compatible ISA, PC/104 and PCMCIA card support" + default N + ---help--- + Enable support for Keithley Metrabyte/ComputerBoards DAS08 + and compatible ISA and PC/104 cards + + To compile this driver as a module, choose M here: the module will be + called das08. + +config COMEDI_DAS16M1 + tristate "MeasurementComputing CIO-DAS16/M1DAS-16 ISA card support" + select COMEDI_FC + default N + ---help--- + Enable support for Measurement Computing CIO-DAS16/M1 ISA cards. + + To compile this driver as a module, choose M here: the module will be + called das16m1. + +config COMEDI_DAS16 + tristate "DAS-16 compatible ISA and PC/104 card support" + select COMEDI_FC + default N + ---help--- + Enable support for Keithley Metrabyte/ComputerBoards DAS16 + and compatible ISA and PC/104 cards: + Keithley Metrabyte DAS-16, DAS-16G, DAS-16F, DAS-1201, DAS-1202, + DAS-1401, DAS-1402, DAS-1601, DAS-1602 and + ComputerBoards/MeasurementComputing PC104-DAS16/JR/, + PC104-DAS16JR/16, CIO-DAS16JR/16, CIO-DAS16/JR, CIO-DAS1401/12, + CIO-DAS1402/12, CIO-DAS1402/16, CIO-DAS1601/12, CIO-DAS1602/12, + CIO-DAS1602/16, CIO-DAS16/330 + + To compile this driver as a module, choose M here: the module will be + called das16. + +config COMEDI_DAS800 + tristate "DAS800 and compatible ISA card support" + select COMEDI_FC + default N + ---help--- + Enable support for Keithley Metrabyte DAS800 and compatible ISA cards + Keithley Metrabyte DAS-800, DAS-801, DAS-802 + Measurement Computing CIO-DAS800, CIO-DAS801, CIO-DAS802 and + CIO-DAS802/16 + + To compile this driver as a module, choose M here: the module will be + called das800. + +config COMEDI_DAS1800 + tristate "DAS1800 and compatible ISA card support" + select COMEDI_FC + default N + ---help--- + Enable support for DAS1800 and compatible ISA cards + Keithley Metrabyte DAS-1701ST, DAS-1701ST-DA, DAS-1701/AO, + DAS-1702ST, DAS-1702ST-DA, DAS-1702HR, DAS-1702HR-DA, DAS-1702/AO, + DAS-1801ST, DAS-1801ST-DA, DAS-1801HC, DAS-1801AO, DAS-1802ST, + DAS-1802ST-DA, DAS-1802HR, DAS-1802HR-DA, DAS-1802HC and + DAS-1802AO + + To compile this driver as a module, choose M here: the module will be + called das1800. + +config COMEDI_DAS6402 + tristate "DAS6402 and compatible ISA card support" + default N + ---help--- + Enable support for DAS6402 and compatible ISA cards + Computerboards, Keithley Metrabyte DAS6402 and compatibles + + To compile this driver as a module, choose M here: the module will be + called das6402. + +config COMEDI_DT2801 + tristate "Data Translation DT2801 ISA card support" + default N + ---help--- + Enable support for Data Translation DT2801 ISA cards + + To compile this driver as a module, choose M here: the module will be + called dt2801. + +config COMEDI_DT2811 + tristate "Data Translation DT2811 ISA card support" + default N + ---help--- + Enable support for Data Translation DT2811 ISA cards + + To compile this driver as a module, choose M here: the module will be + called dt2811. + +config COMEDI_DT2814 + tristate "Data Translation DT2814 ISA card support" + default N + ---help--- + Enable support for Data Translation DT2814 ISA cards + + To compile this driver as a module, choose M here: the module will be + called dt2814. + +config COMEDI_DT2815 + tristate "Data Translation DT2815 ISA card support" + default N + ---help--- + Enable support for Data Translation DT2815 ISA cards + + To compile this driver as a module, choose M here: the module will be + called dt2815. + +config COMEDI_DT2817 + tristate "Data Translation DT2817 ISA card support" + default N + ---help--- + Enable support for Data Translation DT2817 ISA cards + + To compile this driver as a module, choose M here: the module will be + called dt2817. + +config COMEDI_DT282X + tristate "Data Translation DT2821 series and DT-EZ ISA card support" + select COMEDI_FC + default N + ---help--- + Enable support for Data Translation DT2821 series including DT-EZ + DT2821, DT2821-F-16SE, DT2821-F-8DI, DT2821-G-16SE, DT2821-G-8DI, + DT2823 (dt2823), DT2824-PGH, DT2824-PGL, DT2825, DT2827, DT2828, + DT21-EZ, DT23-EZ, DT24-EZ and DT24-EZ-PGL + + To compile this driver as a module, choose M here: the module will be + called dt282x. + +config COMEDI_DMM32AT + tristate "Diamond Systems MM-32-AT PC/104 board support" + default N + ---help--- + Enable support for Diamond Systems MM-32-AT PC/104 boards + + To compile this driver as a module, choose M here: the module will be + called dmm32at. + +config COMEDI_FL512 + tristate "FL512 ISA card support" + default N + ---help--- + Enable support for FL512 ISA card + + To compile this driver as a module, choose M here: the module will be + called fl512. + +config COMEDI_AIO_AIO12_8 + tristate "I/O Products PC/104 AIO12-8 Analog I/O Board support" + default N + ---help--- + Enable support for I/O Products PC/104 AIO12-8 Analog I/O Board + + To compile this driver as a module, choose M here: the module will be + called aio_aio12_8. + +config COMEDI_AIO_IIRO_16 + tristate "I/O Products PC/104 IIRO16 Board support" + default N + ---help--- + Enable support for I/O Products PC/104 IIRO16 Relay And Isolated + Input Board + + To compile this driver as a module, choose M here: the module will be + called aio_iiro_16. + +config COMEDI_C6XDIGIO + tristate "Mechatronic Systems Inc. C6x_DIGIO DSP daughter card support" + default N + ---help--- + Enable support for Mechatronic Systems Inc. C6x_DIGIO DSP daughter + card + + To compile this driver as a module, choose M here: the module will be + called c6xdigio. + +config COMEDI_MPC624 + tristate "Micro/sys MPC-624 PC/104 board support" + default N + ---help--- + Enable support for Micro/sys MPC-624 PC/104 board + + To compile this driver as a module, choose M here: the module will be + called mpc624. + +config COMEDI_ADQ12B + tristate "MicroAxial ADQ12-B data acquisition and control card support" + default N + ---help--- + Enable MicroAxial ADQ12-B daq and control card support. + + To compile this driver as a module, choose M here: the module will be + called adq12b. + +config COMEDI_NI_AT_A2150 + tristate "NI AT-A2150 ISA card support" + depends on COMEDI_NI_COMMON + default N + ---help--- + Enable support for National Instruments AT-A2150 cards + + To compile this driver as a module, choose M here: the module will be + called ni_at_a2150. + +config COMEDI_NI_AT_AO + tristate "NI AT-AO-6/10 EISA card support" + depends on COMEDI_NI_COMMON + default N + ---help--- + Enable support for National Instruments AT-AO-6/10 cards + + To compile this driver as a module, choose M here: the module will be + called ni_at_ao. + +config COMEDI_NI_ATMIO + tristate "NI AT-MIO E series ISA-PNP card support" + depends on ISAPNP && COMEDI_NI_TIO && COMEDI_NI_COMMON + default N + ---help--- + Enable support for National Instruments AT-MIO E series cards + National Instruments AT-MIO-16E-1 (ni_atmio), + AT-MIO-16E-2, AT-MIO-16E-10, AT-MIO-16DE-10, AT-MIO-64E-3, + AT-MIO-16XE-50, AT-MIO-16XE-10, AT-AI-16XE-10 + + To compile this driver as a module, choose M here: the module will be + called ni_atmio. + +config COMEDI_NI_ATMIO16D + tristate "NI AT-MIO16/AT-MIO16D series ISA-PNP card support" + depends on ISAPNP && COMEDI_NI_COMMON + default N + ---help--- + Enable support for National Instruments AT-MIO16/AT-MIO16D cards. + + To compile this driver as a module, choose M here: the module will be + called ni_atmio16d. + +config COMEDI_PCMAD + tristate "Winsystems PCM-A/D12 and PCM-A/D16 PC/104 board support" + default N + ---help--- + Enable support for Winsystems PCM-A/D12 and PCM-A/D16 PC/104 boards. + + To compile this driver as a module, choose M here: the module will be + called pcmad. + +config COMEDI_PCMDA12 + tristate "Winsystems PCM-D/A-12 8-channel AO PC/104 board support" + default N + ---help--- + Enable support for Winsystems PCM-D/A-12 8-channel AO PC/104 boards. + Note that the board is not ISA-PNP capable and thus needs the I/O + port comedi_config parameter. + + To compile this driver as a module, choose M here: the module will be + called pcmda12. + +config COMEDI_PCMMIO + tristate "Winsystems PCM-MIO PC/104 board support" + default N + ---help--- + Enable support for Winsystems PCM-MIO multifunction PC/104 boards. + + To compile this driver as a module, choose M here: the module will be + called pcmmio. + +config COMEDI_PCMUIO + tristate "Winsystems PCM-UIO48A and PCM-UIO96A PC/104 board support" + default N + ---help--- + Enable support for PCM-UIO48A and PCM-UIO96A PC/104 boards. + + To compile this driver as a module, choose M here: the module will be + called pcmuio. + +config COMEDI_MULTIQ3 + tristate "Quanser Consulting MultiQ-3 ISA card support" + default N + ---help--- + Enable support for Quanser Consulting MultiQ-3 ISA cards + + To compile this driver as a module, choose M here: the module will be + called multiq3. + +config COMEDI_POC + tristate "Generic driver for very simple devices" + default N + ---help--- + Enable generic support for very simple / POC (Piece of Crap) boards, + Keithley Metrabyte DAC-02 (dac02), Advantech PCL-733 (pcl733) and + PCL-734 (pcl734) + + To compile this driver as a module, choose M here: the module will be + called poc. + +endif # COMEDI_ISA_DRIVERS + +menuconfig COMEDI_PCI_DRIVERS tristate "Comedi PCI drivers" depends on COMEDI && PCI default N ---help--- - Enable lots of comedi PCI drivers to be built + Enable comedi PCI drivers to be built + + Note that the answer to this question won't directly affect the + kernel: saying N will just cause the configurator to skip all + the questions about PCI comedi drivers. + +if COMEDI_PCI_DRIVERS && PCI + +config COMEDI_ADDI_APCI_035 + tristate "ADDI-DATA APCI_035 support" + default N + ---help--- + Enable support for ADDI-DATA APCI_035 cards + + To compile this driver as a module, choose M here: the module will be + called addi_apci_035. + +config COMEDI_ADDI_APCI_1032 + tristate "ADDI-DATA APCI_1032 support" + default N + ---help--- + Enable support for ADDI-DATA APCI_1032 cards + + To compile this driver as a module, choose M here: the module will be + called addi_apci_1032. + +config COMEDI_ADDI_APCI_1500 + tristate "ADDI-DATA APCI_1500 support" + default N + ---help--- + Enable support for ADDI-DATA APCI_1500 cards + + To compile this driver as a module, choose M here: the module will be + called addi_apci_1500. + +config COMEDI_ADDI_APCI_1516 + tristate "ADDI-DATA APCI_1516 support" + default N + ---help--- + Enable support for ADDI-DATA APCI_1516 cards + + To compile this driver as a module, choose M here: the module will be + called addi_apci_1516. + +config COMEDI_ADDI_APCI_1564 + tristate "ADDI-DATA APCI_1564 support" + default N + ---help--- + Enable support for ADDI-DATA APCI_1564 cards + + To compile this driver as a module, choose M here: the module will be + called addi_apci_1564. + +config COMEDI_ADDI_APCI_16XX + tristate "ADDI-DATA APCI_16xx support" + default N + ---help--- + Enable support for ADDI-DATA APCI_16xx cards + + To compile this driver as a module, choose M here: the module will be + called addi_apci_16xx. + +config COMEDI_ADDI_APCI_2016 + tristate "ADDI-DATA APCI_2016 support" + default N + ---help--- + Enable support for ADDI-DATA APCI_2016 cards + + To compile this driver as a module, choose M here: the module will be + called addi_apci_2016. + +config COMEDI_ADDI_APCI_2032 + tristate "ADDI-DATA APCI_2032 support" + default N + ---help--- + Enable support for ADDI-DATA APCI_2032 cards + + To compile this driver as a module, choose M here: the module will be + called addi_apci_2032. + +config COMEDI_ADDI_APCI_2200 + tristate "ADDI-DATA APCI_2200 support" + default N + ---help--- + Enable support for ADDI-DATA APCI_2200 cards + + To compile this driver as a module, choose M here: the module will be + called addi_apci_2200. + +config COMEDI_ADDI_APCI_3001 + tristate "ADDI-DATA APCI_3001 support" + select COMEDI_FC + default N + ---help--- + Enable support for ADDI-DATA APCI_3001 cards + + To compile this driver as a module, choose M here: the module will be + called addi_apci_3001. + +config COMEDI_ADDI_APCI_3120 + tristate "ADDI-DATA APCI_3520 support" + select COMEDI_FC + default N + ---help--- + Enable support for ADDI-DATA APCI_3520 cards + + To compile this driver as a module, choose M here: the module will be + called addi_apci_3120. + +config COMEDI_ADDI_APCI_3501 + tristate "ADDI-DATA APCI_3501 support" + default N + ---help--- + Enable support for ADDI-DATA APCI_3501 cards + + To compile this driver as a module, choose M here: the module will be + called addi_apci_3501. + +config COMEDI_ADDI_APCI_3XXX + tristate "ADDI-DATA APCI_3xxx support" + default N + ---help--- + Enable support for ADDI-DATA APCI_3xxx cards + + To compile this driver as a module, choose M here: the module will be + called addi_apci_3xxx. + +config COMEDI_ADL_PCI6208 + tristate "ADLink PCI-6208A support" + default N + ---help--- + Enable support for ADLink PCI-6208A cards + + To compile this driver as a module, choose M here: the module will be + called adl_pci6208. + +config COMEDI_ADL_PCI7230 + tristate "ADLink PCI-7230 digital io board support" + default N + ---help--- + Enable support for ADlink PCI-7230 digital io board support + + To compile this driver as a module, choose M here: the module will be + called adl_pci7230. + +config COMEDI_ADL_PCI7296 + tristate "ADLink PCI-7296 96 ch. digital io board support" + default N + ---help--- + Enable support for ADlink PCI-7296 96 ch. digital io board support + + To compile this driver as a module, choose M here: the module will be + called adl_pci7296. + +config COMEDI_ADL_PCI7432 + tristate "ADLink PCI-7432 64 ch. isolated digital io board support" + default N + ---help--- + Enable support for ADlink PCI-7432 64 ch. isolated digital io board + + To compile this driver as a module, choose M here: the module will be + called adl_pci7432. + +config COMEDI_ADL_PCI8164 + tristate "ADLink PCI-8164 4 Axes Motion Control board support" + default N + ---help--- + Enable support for ADlink PCI-8164 4 Axes Motion Control board + + To compile this driver as a module, choose M here: the module will be + called adl_pci8164. + +config COMEDI_ADL_PCI9111 + tristate "ADLink PCI-9111HR support" + select COMEDI_FC + default N + ---help--- + Enable support for ADlink PCI9111 cards + + To compile this driver as a module, choose M here: the module will be + called adl_pci9111. + +config COMEDI_ADL_PCI9118 + tristate "ADLink PCI-9118DG, PCI-9118HG, PCI-9118HR support" + select COMEDI_FC + default N + ---help--- + Enable support for ADlink PCI-9118DG, PCI-9118HG, PCI-9118HR cards + + To compile this driver as a module, choose M here: the module will be + called adl_pci9118. + +config COMEDI_ADV_PCI1710 + tristate "Advantech PCI-171x, PCI-1720 and PCI-1731 support" + default N + ---help--- + Enable support for Advantech PCI-1710, PCI-1710HG, PCI-1711, + PCI-1713, PCI-1720 and PCI-1731 + + To compile this driver as a module, choose M here: the module will be + called adv_pci1710. + +config COMEDI_ADV_PCI1723 + tristate "Advantech PCI-1723 support" + default N + ---help--- + Enable support for Advantech PCI-1723 cards + + To compile this driver as a module, choose M here: the module will be + called adv_pci1723. + +config COMEDI_ADV_PCI_DIO + tristate "Advantech PCI DIO card support" + default N + ---help--- + Enable support for Advantech PCI DIO cards + PCI-1730, PCI-1733, PCI-1734, PCI-1736UP, PCI-1750, PCI-1751, + PCI-1752, PCI-1753/E, PCI-1754, PCI-1756 and PCI-1762 + + To compile this driver as a module, choose M here: the module will be + called adv_pci_dio. + +config COMEDI_AMPLC_DIO200 + tristate "Amplicon PC272E and PCI272 DIO board support" + default N + ---help--- + Enable support for Amplicon PC272E and PCI272 DIO boards + + To compile this driver as a module, choose M here: the module will be + called amplc_dio200. + +config COMEDI_AMPLC_PC236 + tristate "Amplicon PC36AT and PCI236 DIO board support" + default N + ---help--- + Enable support for Amplicon PC36AT and PCI236 DIO boards + + To compile this driver as a module, choose M here: the module will be + called amplc_pc236. + +config COMEDI_AMPLC_PC263 + tristate "Amplicon PC263 and PCI263 relay board support" + default N + ---help--- + Enable support for Amplicon PC263 and PCI263 relay boards + + To compile this driver as a module, choose M here: the module will be + called amplc_pc263. + +config COMEDI_AMPLC_PCI224 + tristate "Amplicon PCI224 and PCI234 support" + select COMEDI_FC + default N + ---help--- + Enable support for Amplicon PCI224 and PCI234 AO boards + + To compile this driver as a module, choose M here: the module will be + called amplc_pci224. + +config COMEDI_AMPLC_PCI230 + tristate "Amplicon PCI230 and PCI260 support" + default N + ---help--- + Enable support for Amplicon PCI230 and PCI260 Multifunction I/O + boards + + To compile this driver as a module, choose M here: the module will be + called amplc_pci230. + +config COMEDI_CONTEC_PCI_DIO + tristate "Contec PIO1616L digital I/O board support" + default N + ---help--- + Enable support for the Contec PIO1616L digital I/O board + + To compile this driver as a module, choose M here: the module will be + called contec_pci_dio. + +config COMEDI_DT3000 + tristate "Data Translation DT3000 series support" + default N + ---help--- + Enable support for Data Translation DT3000 series + DT3001, DT3001-PGL, DT3002, DT3003, DT3003-PGL, DT3004, DT3005 and + DT3004-200 + + To compile this driver as a module, choose M here: the module will be + called dt3000. + +config COMEDI_UNIOXX5 + tristate "Fastwel UNIOxx-5 analog and digital io board support" + default N + ---help--- + Enable support for Fastwel UNIOxx-5 (analog and digital i/o) boards + + To compile this driver as a module, choose M here: the module will be + called unioxx5. + +config COMEDI_GSC_HPDI + tristate "General Standards PCI-HPDI32 / PMC-HPDI32 support" + select COMEDI_FC + default N + ---help--- + Enable support for General Standards Corporation high speed parallel + digital interface rs485 boards PCI-HPDI32 and PMC-HPDI32. + Only receive mode works, transmit not supported. + + To compile this driver as a module, choose M here: the module will be + called gsc_hpdi. + +config COMEDI_ICP_MULTI + tristate "Inova ICP_MULTI support" + default N + ---help--- + Enable support for Inova ICP_MULTI card + + To compile this driver as a module, choose M here: the module will be + called icp_multi. + +config COMEDI_II_PCI20KC + tristate "Intelligent Instruments PCI-20001C carrier support" + default N + ---help--- + Enable support for Intelligent Instruments PCI-20001C carrier + PCI-20001, PCI-20006 and PCI-20341 + + To compile this driver as a module, choose M here: the module will be + called ii_pci20kc. + +config COMEDI_DAQBOARD2000 + tristate "IOtech DAQboard/2000 support" + default N + ---help--- + Enable support for the IOtech DAQboard/2000 + + To compile this driver as a module, choose M here: the module will be + called daqboard2000. + +config COMEDI_JR3_PCI + tristate "JR3/PCI force sensor board support" + default N + ---help--- + Enable support for JR3/PCI force sensor boards + + To compile this driver as a module, choose M here: the module will be + called jr3_pci. + +config COMEDI_KE_COUNTER + tristate "Kolter-Electronic PCI Counter 1 card support" + default N + ---help--- + Enable support for Kolter-Electronic PCI Counter 1 cards + + To compile this driver as a module, choose M here: the module will be + called ke_counter. + +config COMEDI_CB_PCIDAS64 + tristate "MeasurementComputing PCI-DAS 64xx, 60xx, and 4020 support" + select COMEDI_FC + default N + ---help--- + Enable support for ComputerBoards/MeasurementComputing PCI-DAS 64xx, + 60xx, and 4020 series with the PLX 9080 PCI controller + + To compile this driver as a module, choose M here: the module will be + called cb_pcidas64. + +config COMEDI_CB_PCIDAS + tristate "MeasurementComputing PCI-DAS support" + select COMEDI_FC + default N + ---help--- + Enable support for ComputerBoards/MeasurementComputing PCI-DAS with + AMCC S5933 PCIcontroller: PCI-DAS1602/16, PCI-DAS1602/16jr, + PCI-DAS1602/12, PCI-DAS1200, PCI-DAS1200jr, PCI-DAS1000, PCI-DAS1001 + and PCI_DAS1002. + + To compile this driver as a module, choose M here: the module will be + called cb_pcidas. + +config COMEDI_CB_PCIDDA + tristate "MeasurementComputing PCI-DDA series support" + default N + ---help--- + Enable support for ComputerBoards/MeasurementComputing PCI-DDA + series: PCI-DDA08/12, PCI-DDA04/12, PCI-DDA02/12, PCI-DDA08/16, + PCI-DDA04/16 and PCI-DDA02/16 + + To compile this driver as a module, choose M here: the module will be + called cb_pcidda. + +config COMEDI_CB_PCIDIO + tristate "MeasurementComputing PCI-DIO series support" + default N + ---help--- + Enable support for ComputerBoards/MeasurementComputing PCI-DIO series + PCI-DIO24, PCI-DIO24H and PCI-DIO48H + + To compile this driver as a module, choose M here: the module will be + called cb_pcidio. + +config COMEDI_CB_PCIMDAS + tristate "MeasurementComputing PCIM-DAS1602/16 support" + default N + ---help--- + Enable support for ComputerBoards/MeasurementComputing PCI Migration + series PCIM-DAS1602/16 + + To compile this driver as a module, choose M here: the module will be + called cb_pcimdas. -config COMEDI_PCMCIA_DRIVERS +config COMEDI_CB_PCIMDDA + tristate "MeasurementComputing PCIM-DDA06-16 support" + default N + ---help--- + Enable support for ComputerBoards/MeasurementComputing PCIM-DDA06-16 + + To compile this driver as a module, choose M here: the module will be + called cb_pcimdda. + +config COMEDI_ME4000 + tristate "Meilhaus ME-4000 support" + default N + ---help--- + Enable support for Meilhaus PCI data acquisition cards + ME-4650, ME-4670i, ME-4680, ME-4680i and ME-4680is + + To compile this driver as a module, choose M here: the module will be + called me4000. + +config COMEDI_ME_DAQ + tristate "Meilhaus ME-2000i, ME-2600i, ME-3000vm1 support" + default N + ---help--- + Enable support for Meilhaus PCI data acquisition cards + ME-2000i, ME-2600i and ME-3000vm1 + + To compile this driver as a module, choose M here: the module will be + called me_daq. + +config COMEDI_NI_6527 + tristate "NI 6527 support" + depends on COMEDI_MITE + default N + ---help--- + Enable support for the National Instruments 6527 PCI card + + To compile this driver as a module, choose M here: the module will be + called ni_6527. + +config COMEDI_NI_65XX + tristate "NI 65xx static dio PCI card support" + depends on COMEDI_MITE + default N + ---help--- + Enable support for National Instruments 65xx static dio boards. + Supported devices: National Instruments PCI-6509 (ni_65xx), + PXI-6509, PCI-6510, PCI-6511, PXI-6511, PCI-6512, PXI-6512, PCI-6513, + PXI-6513, PCI-6514, PXI-6514, PCI-6515, PXI-6515, PCI-6516, PCI-6517, + PCI-6518, PCI-6519, PCI-6520, PCI-6521, PXI-6521, PCI-6528, PXI-6528 + + To compile this driver as a module, choose M here: the module will be + called ni_65xx. + +config COMEDI_NI_660X + tristate "NI 660x counter/timer PCI card support" + depends on COMEDI_NI_TIO && COMEDI_NI_COMMON + default N + ---help--- + Enable support for National Instruments PCI-6601 (ni_660x), PCI-6602, + PXI-6602 and PXI-6608. + + To compile this driver as a module, choose M here: the module will be + called ni_660x. + +config COMEDI_NI_670X + tristate "NI 670x PCI card support" + depends on COMEDI_MITE + default N + ---help--- + Enable support for National Instruments PCI-6703 and PCI-6704 + + To compile this driver as a module, choose M here: the module will be + called ni_670x. + +config COMEDI_NI_PCIDIO + tristate "NI PCI-DIO32HS, PCI-DIO96, PCI-6533, PCI-6503 support" + depends on COMEDI_MITE + default N + ---help--- + Enable support for National Instruments PCI-DIO-32HS, PXI-6533, + PCI-DIO-96, PCI-DIO-96B, PXI-6508, PCI-6503, PCI-6503B, PCI-6503X, + PXI-6503, PCI-6533 and PCI-6534 + The DIO-96 appears as four 8255 subdevices. See the 8255 + driver notes for details. + + To compile this driver as a module, choose M here: the module will be + called ni_pcidio. + +config COMEDI_NI_PCIMIO + tristate "NI PCI-MIO-E series and M series support" + depends on COMEDI_NI_TIO && COMEDI_NI_COMMON + default N + ---help--- + Enable support for National Instruments PCI-MIO-E series and M series + (all boards): PCI-MIO-16XE-10, PXI-6030E, PCI-MIO-16E-1, + PCI-MIO-16E-4, PCI-6014, PCI-6040E, PXI-6040E, PCI-6030E, PCI-6031E, + PCI-6032E, PCI-6033E, PCI-6071E, PCI-6023E, PCI-6024E, PCI-6025E, + PXI-6025E, PCI-6034E, PCI-6035E, PCI-6052E, PCI-6110, PCI-6111, + PCI-6220, PCI-6221, PCI-6224, PXI-6224, PCI-6225, PXI-6225, PCI-6229, + PCI-6250, PCI-6251, PCIe-6251, PCI-6254, PCI-6259, PCIe-6259, + PCI-6280, PCI-6281, PXI-6281, PCI-6284, PCI-6289, PCI-6711, PXI-6711, + PCI-6713, PXI-6713, PXI-6071E, PCI-6070E, PXI-6070E, PXI-6052E, + PCI-6036E, PCI-6731, PCI-6733, PXI-6733, PCI-6143, PXI-6143 + + To compile this driver as a module, choose M here: the module will be + called ni_pcimio. + +config COMEDI_RTD520 + tristate "Real Time Devices PCI4520/DM7520 support" + default N + ---help--- + Enable support for Real Time Devices PCI4520/DM7520 + + To compile this driver as a module, choose M here: the module will be + called rtd520. + +config COMEDI_S526 + tristate "Sensoray s526 support" + default N + ---help--- + Enable support for Sensoray s526 + + To compile this driver as a module, choose M here: the module will be + called s526. + +config COMEDI_S626 + tristate "Sensoray 626 support" + select COMEDI_FC + default N + ---help--- + Enable support for Sensoray 626 + + To compile this driver as a module, choose M here: the module will be + called s626. + +config COMEDI_SSV_DNP + tristate "SSV Embedded Systems DIL/Net-PC support" + default N + ---help--- + Enable support for SSV Embedded Systems DIL/Net-PC + + To compile this driver as a module, choose M here: the module will be + called ssv_dnp. + +endif # COMEDI_PCI_DRIVERS + +menuconfig COMEDI_PCMCIA_DRIVERS tristate "Comedi PCMCIA drivers" depends on COMEDI && PCMCIA && PCCARD default N ---help--- - Enable lots of comedi PCMCIA and PCCARD drivers to be built + Enable comedi PCMCIA and PCCARD drivers to be built + + Note that the answer to this question won't directly affect the + kernel: saying N will just cause the configurator to skip all + the questions about PCMCIA comedi drivers. + +if COMEDI_PCMCIA_DRIVERS && PCMCIA + +config COMEDI_CB_DAS16_CS + tristate "CB DAS16 series PCMCIA support" + default N + ---help--- + Enable support for the ComputerBoards/MeasurementComputing PCMCIA + cards DAS16/16, PCM-DAS16D/12 and PCM-DAS16s/16 + + To compile this driver as a module, choose M here: the module will be + called cb_das16_cs. + +config COMEDI_DAS08_CS + tristate "CB DAS08 PCMCIA support" + select COMEDI_DAS08 + default N + ---help--- + Enable support for the ComputerBoards/MeasurementComputing DAS-08 + PCMCIA card + + To compile this driver as a module, choose M here: the module will be + called das08_cs. -config COMEDI_USB_DRIVERS +config COMEDI_NI_DAQ_700_CS + tristate "NI DAQCard-700 PCMCIA support" + depends on COMEDI_NI_COMMON + default N + ---help--- + Enable support for the National Instruments PCMCIA DAQCard-700 DIO + + To compile this driver as a module, choose M here: the module will be + called ni_daq_700. + +config COMEDI_NI_DAQ_DIO24_CS + tristate "NI DAQ-Card DIO-24 PCMCIA support" + depends on COMEDI_NI_COMMON + default N + ---help--- + Enable support for the National Instruments PCMCIA DAQ-Card DIO-24 + + To compile this driver as a module, choose M here: the module will be + called ni_daq_dio24. + +config COMEDI_NI_LABPC_CS + tristate "NI DAQCard-1200 PCMCIA support" + depends on COMEDI_NI_LABPC + default N + ---help--- + Enable support for the National Instruments PCMCIA DAQCard-1200 + + To compile this driver as a module, choose M here: the module will be + called ni_labpc_cs. + +config COMEDI_NI_MIO_CS + tristate "NI DAQCard E series PCMCIA support" + depends on COMEDI_NI_TIO && COMEDI_NI_COMMON + default N + select COMEDI_FC + ---help--- + Enable support for the National Instruments PCMCIA DAQCard E series + DAQCard-ai-16xe-50, DAQCard-ai-16e-4, DAQCard-6062E, DAQCard-6024E + and DAQCard-6036E + + To compile this driver as a module, choose M here: the module will be + called ni_mio_cs. + +config COMEDI_QUATECH_DAQP_CS + tristate "Quatech DAQP PCMCIA data capture card support" + default N + ---help--- + Enable support for the Quatech DAQP PCMCIA data capture cards + DAQP-208 and DAQP-308 + + To compile this driver as a module, choose M here: the module will be + called quatech_daqp_cs. + +endif # COMEDI_PCMCIA_DRIVERS + +menuconfig COMEDI_USB_DRIVERS tristate "Comedi USB drivers" depends on COMEDI && USB default N ---help--- - Enable lots of comedi USB drivers to be built + Enable comedi USB drivers to be built + + Note that the answer to this question won't directly affect the + kernel: saying N will just cause the configurator to skip all + the questions about USB comedi drivers. + +if COMEDI_USB_DRIVERS && USB + +config COMEDI_DT9812 + tristate "DataTranslation DT9812 USB module support" + default N + ---help--- + Enable support for the Data Translation DT9812 USB module + + To compile this driver as a module, choose M here: the module will be + called dt9812. + +config COMEDI_USBDUX + tristate "ITL USBDUX support" + default N + ---help--- + Enable support for the University of Stirling USB DAQ and INCITE + Technology Limited driver + + To compile this driver as a module, choose M here: the module will be + called usbdux. + +config COMEDI_USBDUXFAST + tristate "ITL USB-DUXfast support" + select COMEDI_FC + default N + ---help--- + Enable support for the University of Stirling USB-DUXfast and INCITE + Technology Limited driver + + To compile this driver as a module, choose M here: the module will be + called usbduxfast. + +config COMEDI_VMK80XX + tristate "Velleman VM110/VM140 USB Board support" + default N + ---help--- + Build the Velleman USB Board Low-Level Driver supporting the + K8055/K8061 aka VM110/VM140 devices + + To compile this driver as a module, choose M here: the module will be + called vmk80xx. + +endif # COMEDI_USB_DRIVERS + +menuconfig COMEDI_NI_COMMON + tristate "Comedi National Instruments card support" + depends on COMEDI + default N + ---help--- + Enable comedi support for National Instruments cards. + Modules in this section are used by many comedi NI drivers. + + Note that the answer to this question won't directly affect the + kernel: saying N will just cause the configurator to skip all + the questions about National Instruments cards. + +if COMEDI_NI_COMMON + +config COMEDI_MITE + tristate "NI Mite PCI interface chip support" + depends on PCI + default N + ---help--- + Enable support for National Instruments Mite PCI interface chip + + To compile this driver as a module, choose M here: the module will be + called mite. + +config COMEDI_NI_TIO + tristate "NI general purpose counter support" + select COMEDI_MITE + default N + ---help--- + Enable support for National Instruments general purpose counters. + This module is not used directly by end-users. Rather, it + is used by other drivers (for example ni_660x and ni_pcimio) + to provide support for NI's general purpose counters. + + To compile this driver as a modules, choose M here: two modules will + be build: ni_tio and ni_tiocmd. + +config COMEDI_NI_LABPC + tristate "NI Lab-PC and compatibles ISA and PCI support" + select COMEDI_FC + default N + ---help--- + Enable support for National Instruments Lab-PC and compatibles + Lab-PC-1200, Lab-PC-1200AI, Lab-PC+ and PCI-1200. + Kernel-level ISA plug-and-play support for the lab-pc-1200 boards has + not yet been added to the driver. + + To compile this driver as a module, choose M here: the module will be + called ni_labpc. + +endif # COMEDI_NI_COMMON + +config COMEDI_FC + tristate "Comedi shared functions for low-level driver support" + default N + ---help--- + Enable support for shared functions for low-level drivers. + This module is not used directly by end-users. Rather, it + is used by many other comedi drivers. + + To compile this driver as a module, choose M here: the module will be + called comedi_fc. diff --git a/drivers/staging/comedi/Makefile b/drivers/staging/comedi/Makefile index 05811f7..20afea3 100644 --- a/drivers/staging/comedi/Makefile +++ b/drivers/staging/comedi/Makefile @@ -9,4 +9,3 @@ comedi-objs := \ range.o \ drivers.o \ comedi_compat32.o \ - comedi_ksyms.o \ diff --git a/drivers/staging/comedi/comedi.h b/drivers/staging/comedi/comedi.h index b559a9c..6c900e2 100644 --- a/drivers/staging/comedi/comedi.h +++ b/drivers/staging/comedi/comedi.h @@ -46,8 +46,10 @@ #define COMEDI_DEVCONF_AUX_DATA2_LENGTH 26 #define COMEDI_DEVCONF_AUX_DATA1_LENGTH 27 #define COMEDI_DEVCONF_AUX_DATA0_LENGTH 28 -#define COMEDI_DEVCONF_AUX_DATA_HI 29 /* most significant 32 bits of pointer address (if needed) */ -#define COMEDI_DEVCONF_AUX_DATA_LO 30 /* least significant 32 bits of pointer address */ +/* most significant 32 bits of pointer address (if needed) */ +#define COMEDI_DEVCONF_AUX_DATA_HI 29 +/* least significant 32 bits of pointer address */ +#define COMEDI_DEVCONF_AUX_DATA_LO 30 #define COMEDI_DEVCONF_AUX_DATA_LENGTH 31 /* total data length */ /* max length of device and driver names */ @@ -55,8 +57,10 @@ /* packs and unpacks a channel/range number */ -#define CR_PACK(chan, rng, aref) ((((aref)&0x3)<<24) | (((rng)&0xff)<<16) | (chan)) -#define CR_PACK_FLAGS(chan, range, aref, flags) (CR_PACK(chan, range, aref) | ((flags) & CR_FLAGS_MASK)) +#define CR_PACK(chan, rng, aref) \ + ((((aref)&0x3)<<24) | (((rng)&0xff)<<16) | (chan)) +#define CR_PACK_FLAGS(chan, range, aref, flags) \ + (CR_PACK(chan, range, aref) | ((flags) & CR_FLAGS_MASK)) #define CR_CHAN(a) ((a)&0xffff) #define CR_RANGE(a) (((a)>>16)&0xff) @@ -125,7 +129,8 @@ /* command flags */ /* These flags are used in comedi_cmd structures */ -#define CMDF_PRIORITY 0x00000008 /* try to use a real-time interrupt while performing command */ +/* try to use a real-time interrupt while performing command */ +#define CMDF_PRIORITY 0x00000008 #define TRIG_RT CMDF_PRIORITY /* compatibility definition */ @@ -151,15 +156,15 @@ #define TRIG_ANY 0xffffffff #define TRIG_INVALID 0x00000000 -#define TRIG_NONE 0x00000001 /* never trigger */ -#define TRIG_NOW 0x00000002 /* trigger now + N ns */ -#define TRIG_FOLLOW 0x00000004 /* trigger on next lower level trig */ -#define TRIG_TIME 0x00000008 /* trigger at time N ns */ -#define TRIG_TIMER 0x00000010 /* trigger at rate N ns */ -#define TRIG_COUNT 0x00000020 /* trigger when count reaches N */ -#define TRIG_EXT 0x00000040 /* trigger on external signal N */ -#define TRIG_INT 0x00000080 /* trigger on comedi-internal signal N */ -#define TRIG_OTHER 0x00000100 /* driver defined */ +#define TRIG_NONE 0x00000001 /* never trigger */ +#define TRIG_NOW 0x00000002 /* trigger now + N ns */ +#define TRIG_FOLLOW 0x00000004 /* trigger on next lower level trig */ +#define TRIG_TIME 0x00000008 /* trigger at time N ns */ +#define TRIG_TIMER 0x00000010 /* trigger at rate N ns */ +#define TRIG_COUNT 0x00000020 /* trigger when count reaches N */ +#define TRIG_EXT 0x00000040 /* trigger on external signal N */ +#define TRIG_INT 0x00000080 /* trigger on comedi-internal signal N */ +#define TRIG_OTHER 0x00000100 /* driver defined */ /* subdevice flags */ @@ -176,14 +181,17 @@ #define SDF_MODE3 0x0400 /* can do mode 3 */ #define SDF_MODE4 0x0800 /* can do mode 4 */ #define SDF_CMD 0x1000 /* can do commands (deprecated) */ -#define SDF_SOFT_CALIBRATED 0x2000 /* subdevice uses software calibration */ -#define SDF_CMD_WRITE 0x4000 /* can do output commands */ -#define SDF_CMD_READ 0x8000 /* can do input commands */ - -#define SDF_READABLE 0x00010000 /* subdevice can be read (e.g. analog input) */ -#define SDF_WRITABLE 0x00020000 /* subdevice can be written (e.g. analog output) */ +#define SDF_SOFT_CALIBRATED 0x2000 /* subdevice uses software calibration */ +#define SDF_CMD_WRITE 0x4000 /* can do output commands */ +#define SDF_CMD_READ 0x8000 /* can do input commands */ + +/* subdevice can be read (e.g. analog input) */ +#define SDF_READABLE 0x00010000 +/* subdevice can be written (e.g. analog output) */ +#define SDF_WRITABLE 0x00020000 #define SDF_WRITEABLE SDF_WRITABLE /* spelling error in API */ -#define SDF_INTERNAL 0x00040000 /* subdevice does not have externally visible lines */ +/* subdevice does not have externally visible lines */ +#define SDF_INTERNAL 0x00040000 #define SDF_GROUND 0x00100000 /* can do aref=ground */ #define SDF_COMMON 0x00200000 /* can do aref=common */ #define SDF_DIFF 0x00400000 /* can do aref=diff */ @@ -242,22 +250,25 @@ INSN_CONFIG_DISARM = 32, INSN_CONFIG_GET_COUNTER_STATUS = 33, INSN_CONFIG_RESET = 34, - INSN_CONFIG_GPCT_SINGLE_PULSE_GENERATOR = 1001, /* Use CTR as single pulsegenerator */ - INSN_CONFIG_GPCT_PULSE_TRAIN_GENERATOR = 1002, /* Use CTR as pulsetraingenerator */ - INSN_CONFIG_GPCT_QUADRATURE_ENCODER = 1003, /* Use the counter as encoder */ + /* Use CTR as single pulsegenerator */ + INSN_CONFIG_GPCT_SINGLE_PULSE_GENERATOR = 1001, + /* Use CTR as pulsetraingenerator */ + INSN_CONFIG_GPCT_PULSE_TRAIN_GENERATOR = 1002, + /* Use the counter as encoder */ + INSN_CONFIG_GPCT_QUADRATURE_ENCODER = 1003, INSN_CONFIG_SET_GATE_SRC = 2001, /* Set gate source */ INSN_CONFIG_GET_GATE_SRC = 2002, /* Get gate source */ - INSN_CONFIG_SET_CLOCK_SRC = 2003, /* Set master clock source */ - INSN_CONFIG_GET_CLOCK_SRC = 2004, /* Get master clock source */ - INSN_CONFIG_SET_OTHER_SRC = 2005, /* Set other source */ - /* INSN_CONFIG_GET_OTHER_SRC = 2006,*//* Get other source */ - INSN_CONFIG_GET_HARDWARE_BUFFER_SIZE = 2006, /* Get size in bytes of - subdevice's on-board - fifos used during - streaming - input/output */ + /* Set master clock source */ + INSN_CONFIG_SET_CLOCK_SRC = 2003, + INSN_CONFIG_GET_CLOCK_SRC = 2004, /* Get master clock source */ + INSN_CONFIG_SET_OTHER_SRC = 2005, /* Set other source */ + /* INSN_CONFIG_GET_OTHER_SRC = 2006,*//* Get other source */ + /* Get size in bytes of subdevice's on-board fifos used during + * streaming input/output */ + INSN_CONFIG_GET_HARDWARE_BUFFER_SIZE = 2006, INSN_CONFIG_SET_COUNTER_MODE = 4097, - INSN_CONFIG_8254_SET_MODE = INSN_CONFIG_SET_COUNTER_MODE, /* deprecated */ + /* INSN_CONFIG_8254_SET_MODE is deprecated */ + INSN_CONFIG_8254_SET_MODE = INSN_CONFIG_SET_COUNTER_MODE, INSN_CONFIG_8254_READ_STATUS = 4098, INSN_CONFIG_SET_ROUTING = 4099, INSN_CONFIG_GET_ROUTING = 4109, @@ -265,8 +276,11 @@ INSN_CONFIG_PWM_SET_PERIOD = 5000, /* sets frequency */ INSN_CONFIG_PWM_GET_PERIOD = 5001, /* gets frequency */ INSN_CONFIG_GET_PWM_STATUS = 5002, /* is it running? */ - INSN_CONFIG_PWM_SET_H_BRIDGE = 5003, /* sets H bridge: duty cycle and sign bit for a relay at the same time */ - INSN_CONFIG_PWM_GET_H_BRIDGE = 5004 /* gets H bridge data: duty cycle and the sign bit */ + /* sets H bridge: duty cycle and sign bit for a relay at the + * same time */ + INSN_CONFIG_PWM_SET_H_BRIDGE = 5003, + /* gets H bridge data: duty cycle and the sign bit */ + INSN_CONFIG_PWM_GET_H_BRIDGE = 5004 }; enum comedi_io_direction { @@ -321,7 +335,7 @@ struct comedi_insn { unsigned int insn; unsigned int n; - unsigned int *data; + unsigned int __user *data; unsigned int subdev; unsigned int chanspec; unsigned int unused[3]; @@ -329,7 +343,7 @@ struct comedi_insnlist { unsigned int n_insns; - struct comedi_insn *insns; + struct comedi_insn __user *insns; }; struct comedi_cmd { @@ -351,24 +365,24 @@ unsigned int stop_src; unsigned int stop_arg; - unsigned int *chanlist; /* channel/range list */ + unsigned int __user *chanlist; /* channel/range list */ unsigned int chanlist_len; - short *data; /* data list, size depends on subd flags */ + short __user *data; /* data list, size depends on subd flags */ unsigned int data_len; }; struct comedi_chaninfo { unsigned int subdev; - unsigned int *maxdata_list; - unsigned int *flaglist; - unsigned int *rangelist; + unsigned int __user *maxdata_list; + unsigned int __user *flaglist; + unsigned int __user *rangelist; unsigned int unused[4]; }; struct comedi_rangeinfo { unsigned int range_type; - void *range_ptr; + void __user *range_ptr; }; struct comedi_krange { @@ -387,7 +401,8 @@ unsigned int flags; /* channel flags */ unsigned int range_type; /* lookup in kernel */ unsigned int settling_time_0; - unsigned insn_bits_support; /* see support_level enum for values */ + /* see support_level enum for values */ + unsigned insn_bits_support; unsigned int unused[8]; }; @@ -451,7 +466,8 @@ #define COMEDI_CB_EOS 1 /* end of scan */ #define COMEDI_CB_EOA 2 /* end of acquisition */ -#define COMEDI_CB_BLOCK 4 /* data has arrived: wakes up read() / write() */ +#define COMEDI_CB_BLOCK 4 /* data has arrived: + * wakes up read() / write() */ #define COMEDI_CB_EOBUF 8 /* DEPRECATED: end of buffer */ #define COMEDI_CB_ERROR 16 /* card error during acquisition */ #define COMEDI_CB_OVERFLOW 32 /* buffer overflow/underflow */ @@ -485,12 +501,15 @@ I8254_MODE2 = (2 << 1), /* Rate generator */ I8254_MODE3 = (3 << 1), /* Square wave mode */ I8254_MODE4 = (4 << 1), /* Software triggered strobe */ - I8254_MODE5 = (5 << 1), /* Hardware triggered strobe (retriggerable) */ - I8254_BCD = 1, /* use binary-coded decimal instead of binary (pretty useless) */ + I8254_MODE5 = (5 << 1), /* Hardware triggered strobe + * (retriggerable) */ + I8254_BCD = 1, /* use binary-coded decimal instead of binary + * (pretty useless) */ I8254_BINARY = 0 }; - static inline unsigned NI_USUAL_PFI_SELECT(unsigned pfi_channel) { + static inline unsigned NI_USUAL_PFI_SELECT(unsigned pfi_channel) + { if (pfi_channel < 10) return 0x1 + pfi_channel; else @@ -580,24 +599,30 @@ NI_GPCT_LOGIC_LOW_CLOCK_SRC_BITS = 0x3, NI_GPCT_NEXT_GATE_CLOCK_SRC_BITS = 0x4, NI_GPCT_NEXT_TC_CLOCK_SRC_BITS = 0x5, - NI_GPCT_SOURCE_PIN_i_CLOCK_SRC_BITS = 0x6, /* NI 660x-specific */ + /* NI 660x-specific */ + NI_GPCT_SOURCE_PIN_i_CLOCK_SRC_BITS = 0x6, NI_GPCT_PXI10_CLOCK_SRC_BITS = 0x7, NI_GPCT_PXI_STAR_TRIGGER_CLOCK_SRC_BITS = 0x8, NI_GPCT_ANALOG_TRIGGER_OUT_CLOCK_SRC_BITS = 0x9, NI_GPCT_PRESCALE_MODE_CLOCK_SRC_MASK = 0x30000000, NI_GPCT_NO_PRESCALE_CLOCK_SRC_BITS = 0x0, - NI_GPCT_PRESCALE_X2_CLOCK_SRC_BITS = 0x10000000, /* divide source by 2 */ - NI_GPCT_PRESCALE_X8_CLOCK_SRC_BITS = 0x20000000, /* divide source by 8 */ + /* divide source by 2 */ + NI_GPCT_PRESCALE_X2_CLOCK_SRC_BITS = 0x10000000, + /* divide source by 8 */ + NI_GPCT_PRESCALE_X8_CLOCK_SRC_BITS = 0x20000000, NI_GPCT_INVERT_CLOCK_SRC_BIT = 0x80000000 }; - static inline unsigned NI_GPCT_SOURCE_PIN_CLOCK_SRC_BITS(unsigned n) { + static inline unsigned NI_GPCT_SOURCE_PIN_CLOCK_SRC_BITS(unsigned n) + { /* NI 660x-specific */ return 0x10 + n; } - static inline unsigned NI_GPCT_RTSI_CLOCK_SRC_BITS(unsigned n) { + static inline unsigned NI_GPCT_RTSI_CLOCK_SRC_BITS(unsigned n) + { return 0x18 + n; } - static inline unsigned NI_GPCT_PFI_CLOCK_SRC_BITS(unsigned n) { + static inline unsigned NI_GPCT_PFI_CLOCK_SRC_BITS(unsigned n) + { /* no pfi on NI 660x */ return 0x20 + n; } @@ -622,19 +647,24 @@ May be bitwise-or'd with CR_EDGE or CR_INVERT. */ NI_GPCT_UP_DOWN_PIN_i_GATE_SELECT = 0x201, NI_GPCT_SELECTED_GATE_GATE_SELECT = 0x21e, /* m-series "second gate" sources are unknown, - we should add them here with an offset of 0x300 when known. */ + * we should add them here with an offset of 0x300 when + * known. */ NI_GPCT_DISABLED_GATE_SELECT = 0x8000, }; - static inline unsigned NI_GPCT_GATE_PIN_GATE_SELECT(unsigned n) { + static inline unsigned NI_GPCT_GATE_PIN_GATE_SELECT(unsigned n) + { return 0x102 + n; } - static inline unsigned NI_GPCT_RTSI_GATE_SELECT(unsigned n) { + static inline unsigned NI_GPCT_RTSI_GATE_SELECT(unsigned n) + { return NI_USUAL_RTSI_SELECT(n); } - static inline unsigned NI_GPCT_PFI_GATE_SELECT(unsigned n) { + static inline unsigned NI_GPCT_PFI_GATE_SELECT(unsigned n) + { return NI_USUAL_PFI_SELECT(n); } - static inline unsigned NI_GPCT_UP_DOWN_PIN_GATE_SELECT(unsigned n) { + static inline unsigned NI_GPCT_UP_DOWN_PIN_GATE_SELECT(unsigned n) + { return 0x202 + n; } @@ -650,7 +680,8 @@ INSN_CONFIG_SET_OTHER_SRC when using NI general-purpose counters. */ /* Still unknown, probably only need NI_GPCT_PFI_OTHER_SELECT */ NI_GPCT_DISABLED_OTHER_SELECT = 0x8000, }; - static inline unsigned NI_GPCT_PFI_OTHER_SELECT(unsigned n) { + static inline unsigned NI_GPCT_PFI_OTHER_SELECT(unsigned n) + { return NI_USUAL_PFI_SELECT(n); } @@ -658,14 +689,14 @@ INSN_CONFIG_SET_OTHER_SRC when using NI general-purpose counters. */ INSN_CONFIG_ARM */ enum ni_gpct_arm_source { NI_GPCT_ARM_IMMEDIATE = 0x0, - NI_GPCT_ARM_PAIRED_IMMEDIATE = 0x1, /* Start both the counter and - the adjacent paired counter - simultaneously */ - /* NI doesn't document bits for selecting hardware arm triggers. If - * the NI_GPCT_ARM_UNKNOWN bit is set, we will pass the least - * significant bits (3 bits for 660x or 5 bits for m-series) through to - * the hardware. This will at least allow someone to figure out what - * the bits do later. */ + NI_GPCT_ARM_PAIRED_IMMEDIATE = 0x1, /* Start both the counter + * and the adjacent paired + * counter simultaneously */ + /* NI doesn't document bits for selecting hardware arm triggers. + * If the NI_GPCT_ARM_UNKNOWN bit is set, we will pass the least + * significant bits (3 bits for 660x or 5 bits for m-series) + * through to the hardware. This will at least allow someone to + * figure out what the bits do later. */ NI_GPCT_ARM_UNKNOWN = 0x1000, }; @@ -699,7 +730,8 @@ INSN_CONFIG_ARM */ NI_MIO_PLL_PXI10_CLOCK = 3, NI_MIO_PLL_RTSI0_CLOCK = 4 }; - static inline unsigned NI_MIO_PLL_RTSI_CLOCK(unsigned rtsi_channel) { + static inline unsigned NI_MIO_PLL_RTSI_CLOCK(unsigned rtsi_channel) + { return NI_MIO_PLL_RTSI0_CLOCK + rtsi_channel; } @@ -716,10 +748,11 @@ INSN_CONFIG_ARM */ NI_RTSI_OUTPUT_G_GATE0 = 6, NI_RTSI_OUTPUT_RGOUT0 = 7, NI_RTSI_OUTPUT_RTSI_BRD_0 = 8, - NI_RTSI_OUTPUT_RTSI_OSC = 12 /* pre-m-series always have RTSI clock - on line 7 */ + NI_RTSI_OUTPUT_RTSI_OSC = 12 /* pre-m-series always have RTSI + * clock on line 7 */ }; - static inline unsigned NI_RTSI_OUTPUT_RTSI_BRD(unsigned n) { + static inline unsigned NI_RTSI_OUTPUT_RTSI_BRD(unsigned n) + { return NI_RTSI_OUTPUT_RTSI_BRD_0 + n; } @@ -754,7 +787,8 @@ INSN_CONFIG_ARM */ NI_PFI_OUTPUT_CDI_SAMPLE = 29, NI_PFI_OUTPUT_CDO_UPDATE = 30 }; - static inline unsigned NI_PFI_OUTPUT_RTSI(unsigned rtsi_channel) { + static inline unsigned NI_PFI_OUTPUT_RTSI(unsigned rtsi_channel) + { return NI_PFI_OUTPUT_RTSI0 + rtsi_channel; } @@ -772,10 +806,12 @@ INSN_CONFIG_ARM */ /* NI External Trigger lines. These values are not arbitrary, but are related * to the bits required to program the board (offset by 1 for historical * reasons). */ - static inline unsigned NI_EXT_PFI(unsigned pfi_channel) { + static inline unsigned NI_EXT_PFI(unsigned pfi_channel) + { return NI_USUAL_PFI_SELECT(pfi_channel) - 1; } - static inline unsigned NI_EXT_RTSI(unsigned rtsi_channel) { + static inline unsigned NI_EXT_RTSI(unsigned rtsi_channel) + { return NI_USUAL_RTSI_SELECT(rtsi_channel) - 1; } @@ -801,21 +837,25 @@ INSN_CONFIG_ARM */ NI_CDIO_SCAN_BEGIN_SRC_FREQ_OUT = 32, NI_CDIO_SCAN_BEGIN_SRC_DIO_CHANGE_DETECT_IRQ = 33 }; - static inline unsigned NI_CDIO_SCAN_BEGIN_SRC_PFI(unsigned pfi_channel) { + static inline unsigned NI_CDIO_SCAN_BEGIN_SRC_PFI(unsigned pfi_channel) + { return NI_USUAL_PFI_SELECT(pfi_channel); } - static inline unsigned NI_CDIO_SCAN_BEGIN_SRC_RTSI(unsigned - rtsi_channel) { + static inline unsigned + NI_CDIO_SCAN_BEGIN_SRC_RTSI(unsigned rtsi_channel) + { return NI_USUAL_RTSI_SELECT(rtsi_channel); } /* scan_begin_src for scan_begin_arg==TRIG_EXT with analog output command on NI * boards. These scan begin sources can also be bitwise-or'd with CR_INVERT to * change polarity. */ - static inline unsigned NI_AO_SCAN_BEGIN_SRC_PFI(unsigned pfi_channel) { + static inline unsigned NI_AO_SCAN_BEGIN_SRC_PFI(unsigned pfi_channel) + { return NI_USUAL_PFI_SELECT(pfi_channel); } - static inline unsigned NI_AO_SCAN_BEGIN_SRC_RTSI(unsigned rtsi_channel) { + static inline unsigned NI_AO_SCAN_BEGIN_SRC_RTSI(unsigned rtsi_channel) + { return NI_USUAL_RTSI_SELECT(rtsi_channel); } diff --git a/drivers/staging/comedi/comedi_compat32.c b/drivers/staging/comedi/comedi_compat32.c index 581aa5f..41a7a62 100644 --- a/drivers/staging/comedi/comedi_compat32.c +++ b/drivers/staging/comedi/comedi_compat32.c @@ -25,9 +25,8 @@ */ #define __NO_VERSION__ -#include "comedi.h" #include <linux/uaccess.h> - +#include "comedi.h" #include "comedi_compat32.h" #ifdef CONFIG_COMPAT diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index aca9674..aced00e 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -49,7 +49,7 @@ #include <linux/io.h> #include <linux/uaccess.h> -/* #include "kvmem.h" */ +#include "internal.h" MODULE_AUTHOR("http://www.comedi.org"); MODULE_DESCRIPTION("Comedi core module"); @@ -57,13 +57,14 @@ MODULE_LICENSE("GPL"); #ifdef CONFIG_COMEDI_DEBUG int comedi_debug; +EXPORT_SYMBOL(comedi_debug); module_param(comedi_debug, int, 0644); #endif int comedi_autoconfig = 1; module_param(comedi_autoconfig, bool, 0444); -int comedi_num_legacy_minors; +static int comedi_num_legacy_minors; module_param(comedi_num_legacy_minors, int, 0444); static DEFINE_SPINLOCK(comedi_file_info_table_lock); @@ -71,25 +72,32 @@ static struct comedi_device_file_info *comedi_file_info_table[COMEDI_NUM_MINORS]; static int do_devconfig_ioctl(struct comedi_device *dev, - struct comedi_devconfig *arg); -static int do_bufconfig_ioctl(struct comedi_device *dev, void *arg); + struct comedi_devconfig __user *arg); +static int do_bufconfig_ioctl(struct comedi_device *dev, + struct comedi_bufconfig __user *arg); static int do_devinfo_ioctl(struct comedi_device *dev, - struct comedi_devinfo *arg, struct file *file); + struct comedi_devinfo __user *arg, + struct file *file); static int do_subdinfo_ioctl(struct comedi_device *dev, - struct comedi_subdinfo *arg, void *file); + struct comedi_subdinfo __user *arg, void *file); static int do_chaninfo_ioctl(struct comedi_device *dev, - struct comedi_chaninfo *arg); -static int do_bufinfo_ioctl(struct comedi_device *dev, void *arg); -static int do_cmd_ioctl(struct comedi_device *dev, void *arg, void *file); + struct comedi_chaninfo __user *arg); +static int do_bufinfo_ioctl(struct comedi_device *dev, + struct comedi_bufinfo __user *arg); +static int do_cmd_ioctl(struct comedi_device *dev, + struct comedi_cmd __user *arg, void *file); static int do_lock_ioctl(struct comedi_device *dev, unsigned int arg, void *file); static int do_unlock_ioctl(struct comedi_device *dev, unsigned int arg, void *file); static int do_cancel_ioctl(struct comedi_device *dev, unsigned int arg, void *file); -static int do_cmdtest_ioctl(struct comedi_device *dev, void *arg, void *file); -static int do_insnlist_ioctl(struct comedi_device *dev, void *arg, void *file); -static int do_insn_ioctl(struct comedi_device *dev, void *arg, void *file); +static int do_cmdtest_ioctl(struct comedi_device *dev, + struct comedi_cmd __user *arg, void *file); +static int do_insnlist_ioctl(struct comedi_device *dev, + struct comedi_insnlist __user *arg, void *file); +static int do_insn_ioctl(struct comedi_device *dev, + struct comedi_insn __user *arg, void *file); static int do_poll_ioctl(struct comedi_device *dev, unsigned int subd, void *file); @@ -128,7 +136,8 @@ static long comedi_unlocked_ioctl(struct file *file, unsigned int cmd, /* Device config is special, because it must work on * an unconfigured device. */ if (cmd == COMEDI_DEVCONFIG) { - rc = do_devconfig_ioctl(dev, (void *)arg); + rc = do_devconfig_ioctl(dev, + (struct comedi_devconfig __user *)arg); goto done; } @@ -140,22 +149,27 @@ static long comedi_unlocked_ioctl(struct file *file, unsigned int cmd, switch (cmd) { case COMEDI_BUFCONFIG: - rc = do_bufconfig_ioctl(dev, (void *)arg); + rc = do_bufconfig_ioctl(dev, + (struct comedi_bufconfig __user *)arg); break; case COMEDI_DEVINFO: - rc = do_devinfo_ioctl(dev, (void *)arg, file); + rc = do_devinfo_ioctl(dev, (struct comedi_devinfo __user *)arg, + file); break; case COMEDI_SUBDINFO: - rc = do_subdinfo_ioctl(dev, (void *)arg, file); + rc = do_subdinfo_ioctl(dev, + (struct comedi_subdinfo __user *)arg, + file); break; case COMEDI_CHANINFO: - rc = do_chaninfo_ioctl(dev, (void *)arg); + rc = do_chaninfo_ioctl(dev, (void __user *)arg); break; case COMEDI_RANGEINFO: - rc = do_rangeinfo_ioctl(dev, (void *)arg); + rc = do_rangeinfo_ioctl(dev, (void __user *)arg); break; case COMEDI_BUFINFO: - rc = do_bufinfo_ioctl(dev, (void *)arg); + rc = do_bufinfo_ioctl(dev, + (struct comedi_bufinfo __user *)arg); break; case COMEDI_LOCK: rc = do_lock_ioctl(dev, arg, file); @@ -167,16 +181,20 @@ static long comedi_unlocked_ioctl(struct file *file, unsigned int cmd, rc = do_cancel_ioctl(dev, arg, file); break; case COMEDI_CMD: - rc = do_cmd_ioctl(dev, (void *)arg, file); + rc = do_cmd_ioctl(dev, (struct comedi_cmd __user *)arg, file); break; case COMEDI_CMDTEST: - rc = do_cmdtest_ioctl(dev, (void *)arg, file); + rc = do_cmdtest_ioctl(dev, (struct comedi_cmd __user *)arg, + file); break; case COMEDI_INSNLIST: - rc = do_insnlist_ioctl(dev, (void *)arg, file); + rc = do_insnlist_ioctl(dev, + (struct comedi_insnlist __user *)arg, + file); break; case COMEDI_INSN: - rc = do_insn_ioctl(dev, (void *)arg, file); + rc = do_insn_ioctl(dev, (struct comedi_insn __user *)arg, + file); break; case COMEDI_POLL: rc = do_poll_ioctl(dev, arg, file); @@ -205,7 +223,7 @@ done: none */ static int do_devconfig_ioctl(struct comedi_device *dev, - struct comedi_devconfig *arg) + struct comedi_devconfig __user *arg) { struct comedi_devconfig it; int ret; @@ -285,7 +303,8 @@ static int do_devconfig_ioctl(struct comedi_device *dev, modified bufconfig at arg */ -static int do_bufconfig_ioctl(struct comedi_device *dev, void *arg) +static int do_bufconfig_ioctl(struct comedi_device *dev, + struct comedi_bufconfig __user *arg) { struct comedi_bufconfig bc; struct comedi_async *async; @@ -346,7 +365,8 @@ copyback: */ static int do_devinfo_ioctl(struct comedi_device *dev, - struct comedi_devinfo *arg, struct file *file) + struct comedi_devinfo __user *arg, + struct file *file) { struct comedi_devinfo devinfo; const unsigned minor = iminor(file->f_dentry->d_inode); @@ -396,7 +416,7 @@ static int do_devinfo_ioctl(struct comedi_device *dev, */ static int do_subdinfo_ioctl(struct comedi_device *dev, - struct comedi_subdinfo *arg, void *file) + struct comedi_subdinfo __user *arg, void *file) { int ret, i; struct comedi_subdinfo *tmp, *us; @@ -478,7 +498,7 @@ static int do_subdinfo_ioctl(struct comedi_device *dev, */ static int do_chaninfo_ioctl(struct comedi_device *dev, - struct comedi_chaninfo *arg) + struct comedi_chaninfo __user *arg) { struct comedi_subdevice *s; struct comedi_chaninfo it; @@ -542,7 +562,8 @@ static int do_chaninfo_ioctl(struct comedi_device *dev, modified bufinfo at arg */ -static int do_bufinfo_ioctl(struct comedi_device *dev, void *arg) +static int do_bufinfo_ioctl(struct comedi_device *dev, + struct comedi_bufinfo __user *arg) { struct comedi_bufinfo bi; struct comedi_subdevice *s; @@ -598,23 +619,24 @@ copyback: static int parse_insn(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data, void *file); /* - * COMEDI_INSNLIST - * synchronous instructions + * COMEDI_INSNLIST + * synchronous instructions * - * arg: - * pointer to sync cmd structure + * arg: + * pointer to sync cmd structure * - * reads: - * sync cmd struct at arg - * instruction list - * data (for writes) + * reads: + * sync cmd struct at arg + * instruction list + * data (for writes) * - * writes: - * data (for reads) + * writes: + * data (for reads) */ /* arbitrary limits */ #define MAX_SAMPLES 256 -static int do_insnlist_ioctl(struct comedi_device *dev, void *arg, void *file) +static int do_insnlist_ioctl(struct comedi_device *dev, + struct comedi_insnlist __user *arg, void *file) { struct comedi_insnlist insnlist; struct comedi_insn *insns = NULL; @@ -736,7 +758,8 @@ static int check_insn_config_length(struct comedi_insn *insn, /* by default we allow the insn since we don't have checks for * all possible cases yet */ default: - printk("comedi: no check for data length of config insn id " + printk(KERN_WARNING + "comedi: no check for data length of config insn id " "%i is implemented.\n" " Add a check to %s in %s.\n" " Assuming n=%i is correct.\n", data[0], __func__, @@ -837,7 +860,7 @@ static int parse_insn(struct comedi_device *dev, struct comedi_insn *insn, goto out; } - ret = check_chanlist(s, 1, &insn->chanspec); + ret = comedi_check_chanlist(s, 1, &insn->chanspec); if (ret < 0) { ret = -EINVAL; DPRINTK("bad chanspec\n"); @@ -894,20 +917,21 @@ out: } /* - * COMEDI_INSN - * synchronous instructions + * COMEDI_INSN + * synchronous instructions * - * arg: - * pointer to insn + * arg: + * pointer to insn * - * reads: - * struct comedi_insn struct at arg - * data (for writes) + * reads: + * struct comedi_insn struct at arg + * data (for writes) * - * writes: - * data (for reads) + * writes: + * data (for reads) */ -static int do_insn_ioctl(struct comedi_device *dev, void *arg, void *file) +static int do_insn_ioctl(struct comedi_device *dev, + struct comedi_insn __user *arg, void *file) { struct comedi_insn insn; unsigned int *data = NULL; @@ -928,8 +952,9 @@ static int do_insn_ioctl(struct comedi_device *dev, void *arg, void *file) if (insn.n > MAX_SAMPLES) insn.n = MAX_SAMPLES; if (insn.insn & INSN_MASK_WRITE) { - if (copy_from_user - (data, insn.data, insn.n * sizeof(unsigned int))) { + if (copy_from_user(data, + insn.data, + insn.n * sizeof(unsigned int))) { ret = -EFAULT; goto error; } @@ -938,8 +963,9 @@ static int do_insn_ioctl(struct comedi_device *dev, void *arg, void *file) if (ret < 0) goto error; if (insn.insn & INSN_MASK_READ) { - if (copy_to_user - (insn.data, data, insn.n * sizeof(unsigned int))) { + if (copy_to_user(insn.data, + data, + insn.n * sizeof(unsigned int))) { ret = -EFAULT; goto error; } @@ -952,30 +978,27 @@ error: return ret; } -/* - COMEDI_CMD - command ioctl - - arg: - pointer to cmd structure - - reads: - cmd structure at arg - channel/range list +static void comedi_set_subdevice_runflags(struct comedi_subdevice *s, + unsigned mask, unsigned bits) +{ + unsigned long flags; - writes: - modified cmd structure at arg + spin_lock_irqsave(&s->spin_lock, flags); + s->runflags &= ~mask; + s->runflags |= (bits & mask); + spin_unlock_irqrestore(&s->spin_lock, flags); +} -*/ -static int do_cmd_ioctl(struct comedi_device *dev, void *arg, void *file) +static int do_cmd_ioctl(struct comedi_device *dev, + struct comedi_cmd __user *cmd, void *file) { struct comedi_cmd user_cmd; struct comedi_subdevice *s; struct comedi_async *async; int ret = 0; - unsigned int *chanlist_saver = NULL; + unsigned int __user *chanlist_saver = NULL; - if (copy_from_user(&user_cmd, arg, sizeof(struct comedi_cmd))) { + if (copy_from_user(&user_cmd, cmd, sizeof(struct comedi_cmd))) { DPRINTK("bad cmd address\n"); return -EFAULT; } @@ -1050,7 +1073,9 @@ static int do_cmd_ioctl(struct comedi_device *dev, void *arg, void *file) } /* make sure each element in channel/gain list is valid */ - ret = check_chanlist(s, async->cmd.chanlist_len, async->cmd.chanlist); + ret = comedi_check_chanlist(s, + async->cmd.chanlist_len, + async->cmd.chanlist); if (ret < 0) { DPRINTK("bad chanlist\n"); goto cleanup; @@ -1064,7 +1089,7 @@ static int do_cmd_ioctl(struct comedi_device *dev, void *arg, void *file) /* restore chanlist pointer before copying back */ user_cmd.chanlist = chanlist_saver; user_cmd.data = NULL; - if (copy_to_user(arg, &user_cmd, sizeof(struct comedi_cmd))) { + if (copy_to_user(cmd, &user_cmd, sizeof(struct comedi_cmd))) { DPRINTK("fault writing cmd\n"); ret = -EFAULT; goto cleanup; @@ -1114,13 +1139,14 @@ cleanup: modified cmd structure at arg */ -static int do_cmdtest_ioctl(struct comedi_device *dev, void *arg, void *file) +static int do_cmdtest_ioctl(struct comedi_device *dev, + struct comedi_cmd __user *arg, void *file) { struct comedi_cmd user_cmd; struct comedi_subdevice *s; int ret = 0; unsigned int *chanlist = NULL; - unsigned int *chanlist_saver = NULL; + unsigned int __user *chanlist_saver = NULL; if (copy_from_user(&user_cmd, arg, sizeof(struct comedi_cmd))) { DPRINTK("bad cmd address\n"); @@ -1172,7 +1198,7 @@ static int do_cmdtest_ioctl(struct comedi_device *dev, void *arg, void *file) } /* make sure each element in channel/gain list is valid */ - ret = check_chanlist(s, user_cmd.chanlist_len, chanlist); + ret = comedi_check_chanlist(s, user_cmd.chanlist_len, chanlist); if (ret < 0) { DPRINTK("bad chanlist\n"); goto cleanup; @@ -1371,7 +1397,7 @@ static int do_cancel(struct comedi_device *dev, struct comedi_subdevice *s) return ret; } -void comedi_unmap(struct vm_area_struct *area) +static void comedi_unmap(struct vm_area_struct *area) { struct comedi_async *async; struct comedi_device *dev; @@ -1509,8 +1535,8 @@ static unsigned int comedi_poll(struct file *file, poll_table * wait) return mask; } -static ssize_t comedi_write(struct file *file, const char *buf, size_t nbytes, - loff_t *offset) +static ssize_t comedi_write(struct file *file, const char __user *buf, + size_t nbytes, loff_t *offset) { struct comedi_subdevice *s; struct comedi_async *async; @@ -1611,7 +1637,7 @@ done: return count ? count : retval; } -static ssize_t comedi_read(struct file *file, char *buf, size_t nbytes, +static ssize_t comedi_read(struct file *file, char __user *buf, size_t nbytes, loff_t *offset) { struct comedi_subdevice *s; @@ -1925,7 +1951,7 @@ static int __init comedi_init(void) } comedi_class = class_create(THIS_MODULE, "comedi"); if (IS_ERR(comedi_class)) { - printk("comedi: failed to create class"); + printk(KERN_ERR "comedi: failed to create class"); cdev_del(&comedi_cdev); unregister_chrdev_region(MKDEV(COMEDI_MAJOR, 0), COMEDI_NUM_MINORS); @@ -1971,8 +1997,10 @@ module_exit(comedi_cleanup); void comedi_error(const struct comedi_device *dev, const char *s) { - printk("comedi%d: %s: %s\n", dev->minor, dev->driver->driver_name, s); + printk(KERN_ERR "comedi%d: %s: %s\n", dev->minor, + dev->driver->driver_name, s); } +EXPORT_SYMBOL(comedi_error); void comedi_event(struct comedi_device *dev, struct comedi_subdevice *s) { @@ -2015,17 +2043,7 @@ void comedi_event(struct comedi_device *dev, struct comedi_subdevice *s) } s->async->events = 0; } - -void comedi_set_subdevice_runflags(struct comedi_subdevice *s, unsigned mask, - unsigned bits) -{ - unsigned long flags; - - spin_lock_irqsave(&s->spin_lock, flags); - s->runflags &= ~mask; - s->runflags |= (bits & mask); - spin_unlock_irqrestore(&s->spin_lock, flags); -} +EXPORT_SYMBOL(comedi_event); unsigned comedi_get_subdevice_runflags(struct comedi_subdevice *s) { @@ -2037,6 +2055,7 @@ unsigned comedi_get_subdevice_runflags(struct comedi_subdevice *s) spin_unlock_irqrestore(&s->spin_lock, flags); return runflags; } +EXPORT_SYMBOL(comedi_get_subdevice_runflags); static int is_device_busy(struct comedi_device *dev) { @@ -2057,7 +2076,7 @@ static int is_device_busy(struct comedi_device *dev) return 0; } -void comedi_device_init(struct comedi_device *dev) +static void comedi_device_init(struct comedi_device *dev) { memset(dev, 0, sizeof(struct comedi_device)); spin_lock_init(&dev->spinlock); @@ -2065,7 +2084,7 @@ void comedi_device_init(struct comedi_device *dev) dev->minor = -1; } -void comedi_device_cleanup(struct comedi_device *dev) +static void comedi_device_cleanup(struct comedi_device *dev) { if (dev == NULL) return; @@ -2105,7 +2124,8 @@ int comedi_alloc_board_minor(struct device *hardware_device) kfree(info->device); kfree(info); printk(KERN_ERR - "comedi: error: ran out of minor numbers for board device files.\n"); + "comedi: error: " + "ran out of minor numbers for board device files.\n"); return -EBUSY; } info->device->minor = i; @@ -2118,7 +2138,8 @@ int comedi_alloc_board_minor(struct device *hardware_device) retval = device_create_file(csdev, &dev_attr_max_read_buffer_kb); if (retval) { printk(KERN_ERR - "comedi: failed to create sysfs attribute file \"%s\".\n", + "comedi: " + "failed to create sysfs attribute file \"%s\".\n", dev_attr_max_read_buffer_kb.attr.name); comedi_free_board_minor(i); return retval; @@ -2126,7 +2147,8 @@ int comedi_alloc_board_minor(struct device *hardware_device) retval = device_create_file(csdev, &dev_attr_read_buffer_kb); if (retval) { printk(KERN_ERR - "comedi: failed to create sysfs attribute file \"%s\".\n", + "comedi: " + "failed to create sysfs attribute file \"%s\".\n", dev_attr_read_buffer_kb.attr.name); comedi_free_board_minor(i); return retval; @@ -2134,7 +2156,8 @@ int comedi_alloc_board_minor(struct device *hardware_device) retval = device_create_file(csdev, &dev_attr_max_write_buffer_kb); if (retval) { printk(KERN_ERR - "comedi: failed to create sysfs attribute file \"%s\".\n", + "comedi: " + "failed to create sysfs attribute file \"%s\".\n", dev_attr_max_write_buffer_kb.attr.name); comedi_free_board_minor(i); return retval; @@ -2142,7 +2165,8 @@ int comedi_alloc_board_minor(struct device *hardware_device) retval = device_create_file(csdev, &dev_attr_write_buffer_kb); if (retval) { printk(KERN_ERR - "comedi: failed to create sysfs attribute file \"%s\".\n", + "comedi: " + "failed to create sysfs attribute file \"%s\".\n", dev_attr_write_buffer_kb.attr.name); comedi_free_board_minor(i); return retval; @@ -2201,7 +2225,8 @@ int comedi_alloc_subdevice_minor(struct comedi_device *dev, if (i == COMEDI_NUM_MINORS) { kfree(info); printk(KERN_ERR - "comedi: error: ran out of minor numbers for board device files.\n"); + "comedi: error: " + "ran out of minor numbers for board device files.\n"); return -EBUSY; } s->minor = i; @@ -2215,7 +2240,8 @@ int comedi_alloc_subdevice_minor(struct comedi_device *dev, retval = device_create_file(csdev, &dev_attr_max_read_buffer_kb); if (retval) { printk(KERN_ERR - "comedi: failed to create sysfs attribute file \"%s\".\n", + "comedi: " + "failed to create sysfs attribute file \"%s\".\n", dev_attr_max_read_buffer_kb.attr.name); comedi_free_subdevice_minor(s); return retval; @@ -2223,7 +2249,8 @@ int comedi_alloc_subdevice_minor(struct comedi_device *dev, retval = device_create_file(csdev, &dev_attr_read_buffer_kb); if (retval) { printk(KERN_ERR - "comedi: failed to create sysfs attribute file \"%s\".\n", + "comedi: " + "failed to create sysfs attribute file \"%s\".\n", dev_attr_read_buffer_kb.attr.name); comedi_free_subdevice_minor(s); return retval; @@ -2231,7 +2258,8 @@ int comedi_alloc_subdevice_minor(struct comedi_device *dev, retval = device_create_file(csdev, &dev_attr_max_write_buffer_kb); if (retval) { printk(KERN_ERR - "comedi: failed to create sysfs attribute file \"%s\".\n", + "comedi: " + "failed to create sysfs attribute file \"%s\".\n", dev_attr_max_write_buffer_kb.attr.name); comedi_free_subdevice_minor(s); return retval; @@ -2239,7 +2267,8 @@ int comedi_alloc_subdevice_minor(struct comedi_device *dev, retval = device_create_file(csdev, &dev_attr_write_buffer_kb); if (retval) { printk(KERN_ERR - "comedi: failed to create sysfs attribute file \"%s\".\n", + "comedi: " + "failed to create sysfs attribute file \"%s\".\n", dev_attr_write_buffer_kb.attr.name); comedi_free_subdevice_minor(s); return retval; @@ -2283,6 +2312,7 @@ struct comedi_device_file_info *comedi_get_device_file_info(unsigned minor) spin_unlock_irqrestore(&comedi_file_info_table_lock, flags); return info; } +EXPORT_SYMBOL_GPL(comedi_get_device_file_info); static int resize_async_buffer(struct comedi_device *dev, struct comedi_subdevice *s, diff --git a/drivers/staging/comedi/comedi_fops.h b/drivers/staging/comedi/comedi_fops.h index cb503c8..da4b4f5 100644 --- a/drivers/staging/comedi/comedi_fops.h +++ b/drivers/staging/comedi/comedi_fops.h @@ -5,5 +5,6 @@ extern struct class *comedi_class; extern const struct file_operations comedi_fops; extern int comedi_autoconfig; +extern struct comedi_driver *comedi_drivers; #endif /* _COMEDI_FOPS_H */ diff --git a/drivers/staging/comedi/comedi_ksyms.c b/drivers/staging/comedi/comedi_ksyms.c deleted file mode 100644 index 87803e6..0000000 --- a/drivers/staging/comedi/comedi_ksyms.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - module/exp_ioctl.c - exported comedi functions - - COMEDI - Linux Control and Measurement Device Interface - Copyright (C) 1997-8 David A. Schleef <ds@schleef.org> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#define __NO_VERSION__ - -#include "comedidev.h" - -/* for drivers */ -EXPORT_SYMBOL(comedi_driver_register); -EXPORT_SYMBOL(comedi_driver_unregister); -/* EXPORT_SYMBOL(comedi_bufcheck); */ -/* EXPORT_SYMBOL(comedi_done); */ -/* EXPORT_SYMBOL(comedi_error_done); */ -EXPORT_SYMBOL(comedi_error); -/* EXPORT_SYMBOL(comedi_eobuf); */ -/* EXPORT_SYMBOL(comedi_eos); */ -EXPORT_SYMBOL(comedi_event); -EXPORT_SYMBOL(comedi_get_subdevice_runflags); -EXPORT_SYMBOL(comedi_set_subdevice_runflags); -EXPORT_SYMBOL(range_bipolar10); -EXPORT_SYMBOL(range_bipolar5); -EXPORT_SYMBOL(range_bipolar2_5); -EXPORT_SYMBOL(range_unipolar10); -EXPORT_SYMBOL(range_unipolar5); -EXPORT_SYMBOL(range_unknown); -#ifdef CONFIG_COMEDI_DEBUG -EXPORT_SYMBOL(comedi_debug); -#endif -EXPORT_SYMBOL_GPL(comedi_alloc_board_minor); -EXPORT_SYMBOL_GPL(comedi_free_board_minor); -EXPORT_SYMBOL_GPL(comedi_pci_auto_config); -EXPORT_SYMBOL_GPL(comedi_pci_auto_unconfig); -EXPORT_SYMBOL_GPL(comedi_usb_auto_config); -EXPORT_SYMBOL_GPL(comedi_usb_auto_unconfig); - -/* for kcomedilib */ -EXPORT_SYMBOL(check_chanlist); -EXPORT_SYMBOL_GPL(comedi_get_device_file_info); - -EXPORT_SYMBOL(comedi_buf_put); -EXPORT_SYMBOL(comedi_buf_get); -EXPORT_SYMBOL(comedi_buf_read_n_available); -EXPORT_SYMBOL(comedi_buf_write_free); -EXPORT_SYMBOL(comedi_buf_write_alloc); -EXPORT_SYMBOL(comedi_buf_read_free); -EXPORT_SYMBOL(comedi_buf_read_alloc); -EXPORT_SYMBOL(comedi_buf_memcpy_to); -EXPORT_SYMBOL(comedi_buf_memcpy_from); -EXPORT_SYMBOL(comedi_reset_async_buf); diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index ebdccfd..4eb2b77 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -57,7 +57,7 @@ static int __init x ## _init_module(void) \ {return comedi_driver_register(&(x)); } \ static void __exit x ## _cleanup_module(void) \ - {comedi_driver_unregister(&(x)); } \ + {comedi_driver_unregister(&(x)); } \ module_init(x ## _init_module); \ module_exit(x ## _cleanup_module); @@ -109,17 +109,9 @@ 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 -#define PCI_VENDOR_ID_COMPUTERBOARDS 0x1307 -#define PCI_VENDOR_ID_ADVANTECH 0x13fe -#define PCI_VENDOR_ID_RTD 0x1435 -#define PCI_VENDOR_ID_AMPLICON 0x14dc #define PCI_VENDOR_ID_ADLINK 0x144a #define PCI_VENDOR_ID_ICP 0x104c #define PCI_VENDOR_ID_CONTEC 0x1221 -#define PCI_VENDOR_ID_MEILHAUS 0x1402 #define COMEDI_NUM_MINORS 0x100 #define COMEDI_NUM_BOARD_MINORS 0x30 @@ -132,7 +124,7 @@ struct comedi_subdevice { struct comedi_device *device; int type; int n_chan; - volatile int subdev_flags; + int subdev_flags; int len_chanlist; /* maximum length of channel/gain list */ void *private; @@ -359,9 +351,6 @@ void cleanup_polling(void); void start_polling(struct comedi_device *); void stop_polling(struct comedi_device *); -int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s, - unsigned long new_size); - #ifdef CONFIG_PROC_FS void comedi_proc_init(void); void comedi_proc_cleanup(void); @@ -385,24 +374,17 @@ enum subdevice_runflags { SRF_RUNNING = 0x08000000 }; -/* - various internal comedi functions - */ - -int do_rangeinfo_ioctl(struct comedi_device *dev, struct comedi_rangeinfo *arg); -int check_chanlist(struct comedi_subdevice *s, int n, unsigned int *chanlist); -void comedi_set_subdevice_runflags(struct comedi_subdevice *s, unsigned mask, - unsigned bits); +int comedi_check_chanlist(struct comedi_subdevice *s, + int n, + unsigned int *chanlist); unsigned comedi_get_subdevice_runflags(struct comedi_subdevice *s); -int insn_inval(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); /* range stuff */ #define RANGE(a, b) {(a)*1e6, (b)*1e6, 0} #define RANGE_ext(a, b) {(a)*1e6, (b)*1e6, RF_EXTERNAL} #define RANGE_mA(a, b) {(a)*1e6, (b)*1e6, UNIT_mA} -#define RANGE_unitless(a, b) {(a)*1e6, (b)*1e6, 0} /* XXX */ +#define RANGE_unitless(a, b) {(a)*1e6, (b)*1e6, 0} #define BIP_RANGE(a) {-(a)*1e6, (a)*1e6, 0} #define UNI_RANGE(a) {0, (a)*1e6, 0} @@ -505,8 +487,6 @@ static inline unsigned comedi_buf_read_n_allocated(struct comedi_async *async) return async->buf_read_alloc_count - async->buf_read_count; } -void comedi_reset_async_buf(struct comedi_async *async); - static inline void *comedi_aux_data(int options[], int n) { unsigned long address; @@ -532,8 +512,6 @@ static inline void *comedi_aux_data(int options[], int n) return (void *)address; } -int comedi_alloc_board_minor(struct device *hardware_device); -void comedi_free_board_minor(unsigned minor); int comedi_alloc_subdevice_minor(struct comedi_device *dev, struct comedi_subdevice *s); void comedi_free_subdevice_minor(struct comedi_subdevice *s); diff --git a/drivers/staging/comedi/comedilib.h b/drivers/staging/comedi/comedilib.h index 3918d53..ca92c43 100644 --- a/drivers/staging/comedi/comedilib.h +++ b/drivers/staging/comedi/comedilib.h @@ -24,170 +24,14 @@ #ifndef _LINUX_COMEDILIB_H #define _LINUX_COMEDILIB_H -#include "comedi.h" - -/* Kernel internal stuff. Needed by real-time modules and such. */ - -#ifndef __KERNEL__ -#error linux/comedilib.h should not be included by non-kernel-space code -#endif - -/* exported functions */ - -#ifndef KCOMEDILIB_DEPRECATED - -/* these functions may not be called at real-time priority */ - -void *comedi_open(const char *path); -int comedi_close(void *dev); - -/* these functions may be called at any priority, but may fail at - real-time priority */ - -int comedi_lock(void *dev, unsigned int subdev); -int comedi_unlock(void *dev, unsigned int subdev); - -/* these functions may be called at any priority, but you must hold - the lock for the subdevice */ - -int comedi_loglevel(int loglevel); -void comedi_perror(const char *s); -char *comedi_strerror(int errnum); -int comedi_errno(void); -int comedi_fileno(void *dev); - -int comedi_cancel(void *dev, unsigned int subdev); -int comedi_register_callback(void *dev, unsigned int subdev, - unsigned int mask, int (*cb) (unsigned int, - void *), void *arg); - -int comedi_command(void *dev, struct comedi_cmd *cmd); -int comedi_command_test(void *dev, struct comedi_cmd *cmd); -int comedi_trigger(void *dev, unsigned int subdev, struct comedi_trig *it); -int __comedi_trigger(void *dev, unsigned int subdev, struct comedi_trig *it); -int comedi_data_write(void *dev, unsigned int subdev, unsigned int chan, - unsigned int range, unsigned int aref, unsigned int data); -int comedi_data_read(void *dev, unsigned int subdev, unsigned int chan, - unsigned int range, unsigned int aref, unsigned int *data); -int comedi_data_read_hint(void *dev, unsigned int subdev, - unsigned int chan, unsigned int range, - unsigned int aref); -int comedi_data_read_delayed(void *dev, unsigned int subdev, unsigned int chan, - unsigned int range, unsigned int aref, - unsigned int *data, unsigned int nano_sec); -int comedi_dio_config(void *dev, unsigned int subdev, unsigned int chan, - unsigned int io); -int comedi_dio_read(void *dev, unsigned int subdev, unsigned int chan, - unsigned int *val); -int comedi_dio_write(void *dev, unsigned int subdev, unsigned int chan, - unsigned int val); -int comedi_dio_bitfield(void *dev, unsigned int subdev, unsigned int mask, - unsigned int *bits); -int comedi_get_n_subdevices(void *dev); -int comedi_get_version_code(void *dev); -const char *comedi_get_driver_name(void *dev); -const char *comedi_get_board_name(void *dev); -int comedi_get_subdevice_type(void *dev, unsigned int subdevice); -int comedi_find_subdevice_by_type(void *dev, int type, unsigned int subd); -int comedi_get_n_channels(void *dev, unsigned int subdevice); -unsigned int comedi_get_maxdata(void *dev, unsigned int subdevice, unsigned - int chan); -int comedi_get_n_ranges(void *dev, unsigned int subdevice, unsigned int chan); -int comedi_do_insn(void *dev, struct comedi_insn *insn); -int comedi_poll(void *dev, unsigned int subdev); - -/* DEPRECATED functions */ -int comedi_get_rangetype(void *dev, unsigned int subdevice, unsigned int chan); - -/* ALPHA functions */ -unsigned int comedi_get_subdevice_flags(void *dev, unsigned int subdevice); -int comedi_get_len_chanlist(void *dev, unsigned int subdevice); -int comedi_get_krange(void *dev, unsigned int subdevice, unsigned int - chan, unsigned int range, struct comedi_krange *krange); -unsigned int comedi_get_buf_head_pos(void *dev, unsigned int subdevice); -int comedi_set_user_int_count(void *dev, unsigned int subdevice, - unsigned int buf_user_count); -int comedi_map(void *dev, unsigned int subdev, void *ptr); -int comedi_unmap(void *dev, unsigned int subdev); -int comedi_get_buffer_size(void *dev, unsigned int subdev); -int comedi_mark_buffer_read(void *dev, unsigned int subdevice, - unsigned int num_bytes); -int comedi_mark_buffer_written(void *d, unsigned int subdevice, - unsigned int num_bytes); -int comedi_get_buffer_contents(void *dev, unsigned int subdevice); -int comedi_get_buffer_offset(void *dev, unsigned int subdevice); - -#else - -/* these functions may not be called at real-time priority */ - -int comedi_open(unsigned int minor); -void comedi_close(unsigned int minor); - -/* these functions may be called at any priority, but may fail at - real-time priority */ - -int comedi_lock(unsigned int minor, unsigned int subdev); -int comedi_unlock(unsigned int minor, unsigned int subdev); - -/* these functions may be called at any priority, but you must hold - the lock for the subdevice */ - -int comedi_cancel(unsigned int minor, unsigned int subdev); -int comedi_register_callback(unsigned int minor, unsigned int subdev, - unsigned int mask, int (*cb) (unsigned int, - void *), void *arg); - -int comedi_command(unsigned int minor, struct comedi_cmd *cmd); -int comedi_command_test(unsigned int minor, struct comedi_cmd *cmd); -int comedi_trigger(unsigned int minor, unsigned int subdev, - struct comedi_trig *it); -int __comedi_trigger(unsigned int minor, unsigned int subdev, - struct comedi_trig *it); -int comedi_data_write(unsigned int dev, unsigned int subdev, unsigned int chan, - unsigned int range, unsigned int aref, unsigned int data); -int comedi_data_read(unsigned int dev, unsigned int subdev, unsigned int chan, - unsigned int range, unsigned int aref, unsigned int *data); -int comedi_dio_config(unsigned int dev, unsigned int subdev, unsigned int chan, - unsigned int io); -int comedi_dio_read(unsigned int dev, unsigned int subdev, unsigned int chan, - unsigned int *val); -int comedi_dio_write(unsigned int dev, unsigned int subdev, unsigned int chan, - unsigned int val); -int comedi_dio_bitfield(unsigned int dev, unsigned int subdev, +struct comedi_device *comedi_open(const char *path); +int comedi_close(struct comedi_device *dev); +int comedi_dio_config(struct comedi_device *dev, unsigned int subdev, + unsigned int chan, unsigned int io); +int comedi_dio_bitfield(struct comedi_device *dev, unsigned int subdev, unsigned int mask, unsigned int *bits); -int comedi_get_n_subdevices(unsigned int dev); -int comedi_get_version_code(unsigned int dev); -char *comedi_get_driver_name(unsigned int dev); -char *comedi_get_board_name(unsigned int minor); -int comedi_get_subdevice_type(unsigned int minor, unsigned int subdevice); -int comedi_find_subdevice_by_type(unsigned int minor, int type, +int comedi_find_subdevice_by_type(struct comedi_device *dev, int type, unsigned int subd); -int comedi_get_n_channels(unsigned int minor, unsigned int subdevice); -unsigned int comedi_get_maxdata(unsigned int minor, unsigned int subdevice, unsigned - int chan); -int comedi_get_n_ranges(unsigned int minor, unsigned int subdevice, unsigned int - chan); -int comedi_do_insn(unsigned int minor, struct comedi_insn *insn); -int comedi_poll(unsigned int minor, unsigned int subdev); - -/* DEPRECATED functions */ -int comedi_get_rangetype(unsigned int minor, unsigned int subdevice, - unsigned int chan); - -/* ALPHA functions */ -unsigned int comedi_get_subdevice_flags(unsigned int minor, unsigned int - subdevice); -int comedi_get_len_chanlist(unsigned int minor, unsigned int subdevice); -int comedi_get_krange(unsigned int minor, unsigned int subdevice, unsigned int - chan, unsigned int range, struct comedi_krange *krange); -unsigned int comedi_get_buf_head_pos(unsigned int minor, unsigned int - subdevice); -int comedi_set_user_int_count(unsigned int minor, unsigned int subdevice, - unsigned int buf_user_count); -int comedi_map(unsigned int minor, unsigned int subdev, void **ptr); -int comedi_unmap(unsigned int minor, unsigned int subdev); - -#endif +int comedi_get_n_channels(struct comedi_device *dev, unsigned int subdevice); #endif diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c index 44d6b62..4a29ed7 100644 --- a/drivers/staging/comedi/drivers.c +++ b/drivers/staging/comedi/drivers.c @@ -37,16 +37,16 @@ #include <linux/ioport.h> #include <linux/mm.h> #include <linux/slab.h> -#include "comedidev.h" -#include "wrapper.h" #include <linux/highmem.h> /* for SuSE brokenness */ #include <linux/vmalloc.h> #include <linux/cdev.h> #include <linux/dma-mapping.h> - #include <linux/io.h> #include <asm/system.h> +#include "comedidev.h" +#include "internal.h" + static int postconfig(struct comedi_device *dev); static int insn_rw_emulate_bits(struct comedi_device *dev, struct comedi_subdevice *s, @@ -54,16 +54,9 @@ static int insn_rw_emulate_bits(struct comedi_device *dev, static void *comedi_recognize(struct comedi_driver *driv, const char *name); static void comedi_report_boards(struct comedi_driver *driv); static int poll_invalid(struct comedi_device *dev, struct comedi_subdevice *s); -int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s, - unsigned long new_size); struct comedi_driver *comedi_drivers; -int comedi_modprobe(int minor) -{ - return -EINVAL; -} - static void cleanup_device(struct comedi_device *dev) { int i; @@ -84,7 +77,7 @@ static void cleanup_device(struct comedi_device *dev) } kfree(dev->private); dev->private = NULL; - dev->driver = 0; + dev->driver = NULL; dev->board_name = NULL; dev->board_ptr = NULL; dev->iobase = 0; @@ -102,7 +95,8 @@ static void __comedi_device_detach(struct comedi_device *dev) if (dev->driver) dev->driver->detach(dev); else - printk("BUG: dev->driver=NULL in comedi_device_detach()\n"); + printk(KERN_WARNING + "BUG: dev->driver=NULL in comedi_device_detach()\n"); cleanup_device(dev); } @@ -124,7 +118,7 @@ int comedi_device_attach(struct comedi_device *dev, struct comedi_devconfig *it) for (driv = comedi_drivers; driv; driv = driv->next) { if (!try_module_get(driv->module)) { printk - ("comedi: failed to increment module count, skipping\n"); + (KERN_INFO "comedi: failed to increment module count, skipping\n"); continue; } if (driv->num_names) { @@ -139,7 +133,8 @@ int comedi_device_attach(struct comedi_device *dev, struct comedi_devconfig *it) continue; } } - /* initialize dev->driver here so comedi_error() can be called from attach */ + /* initialize dev->driver here so + * comedi_error() can be called from attach */ dev->driver = driv; ret = driv->attach(dev, it); if (ret < 0) { @@ -154,7 +149,8 @@ int comedi_device_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* report valid board names before returning error */ for (driv = comedi_drivers; driv; driv = driv->next) { if (!try_module_get(driv->module)) { - printk("comedi: failed to increment module count\n"); + printk(KERN_INFO + "comedi: failed to increment module count\n"); continue; } comedi_report_boards(driv); @@ -172,7 +168,8 @@ attached: } if (!dev->board_name) { - printk("BUG: dev->board_name=<%p>\n", dev->board_name); + printk(KERN_WARNING "BUG: dev->board_name=<%p>\n", + dev->board_name); dev->board_name = "BUG"; } smp_wmb(); @@ -188,6 +185,7 @@ int comedi_driver_register(struct comedi_driver *driver) return 0; } +EXPORT_SYMBOL(comedi_driver_register); int comedi_driver_unregister(struct comedi_driver *driver) { @@ -208,7 +206,7 @@ int comedi_driver_unregister(struct comedi_driver *driver) if (dev->attached && dev->driver == driver) { if (dev->use_count) printk - ("BUG! detaching device with use_count=%d\n", + (KERN_WARNING "BUG! detaching device with use_count=%d\n", dev->use_count); comedi_device_detach(dev); } @@ -228,6 +226,7 @@ int comedi_driver_unregister(struct comedi_driver *driver) } return -EINVAL; } +EXPORT_SYMBOL(comedi_driver_unregister); static int postconfig(struct comedi_device *dev) { @@ -253,7 +252,8 @@ static int postconfig(struct comedi_device *dev) async = kzalloc(sizeof(struct comedi_async), GFP_KERNEL); if (async == NULL) { - printk("failed to allocate async struct\n"); + printk(KERN_INFO + "failed to allocate async struct\n"); return -ENOMEM; } init_waitqueue_head(&async->wait_head); @@ -268,7 +268,7 @@ static int postconfig(struct comedi_device *dev) async->prealloc_buf = NULL; async->prealloc_bufsz = 0; if (comedi_buf_alloc(dev, s, DEFAULT_BUF_SIZE) < 0) { - printk("Buffer allocation failed\n"); + printk(KERN_INFO "Buffer allocation failed\n"); return -ENOMEM; } if (s->buf_change) { @@ -303,8 +303,9 @@ static int postconfig(struct comedi_device *dev) return 0; } -/* generic recognize function for drivers that register their supported board names */ -void *comedi_recognize(struct comedi_driver *driv, const char *name) +/* generic recognize function for drivers + * that register their supported board names */ +static void *comedi_recognize(struct comedi_driver *driv, const char *name) { unsigned i; const char *const *name_ptr = driv->board_name; @@ -319,22 +320,22 @@ void *comedi_recognize(struct comedi_driver *driv, const char *name) return NULL; } -void comedi_report_boards(struct comedi_driver *driv) +static void comedi_report_boards(struct comedi_driver *driv) { unsigned int i; const char *const *name_ptr; - printk("comedi: valid board names for %s driver are:\n", + printk(KERN_INFO "comedi: valid board names for %s driver are:\n", driv->driver_name); name_ptr = driv->board_name; for (i = 0; i < driv->num_names; i++) { - printk(" %s\n", *name_ptr); + printk(KERN_INFO " %s\n", *name_ptr); name_ptr = (const char **)((char *)name_ptr + driv->offset); } if (driv->num_names == 0) - printk(" %s\n", driv->driver_name); + printk(KERN_INFO " %s\n", driv->driver_name); } static int poll_invalid(struct comedi_device *dev, struct comedi_subdevice *s) @@ -371,8 +372,9 @@ static int insn_rw_emulate_bits(struct comedi_device *dev, if (insn->insn == INSN_WRITE) { if (!(s->subdev_flags & SDF_WRITABLE)) return -EINVAL; - new_data[0] = 1 << (chan - base_bitfield_channel); /* mask */ - new_data[1] = data[0] ? (1 << (chan - base_bitfield_channel)) : 0; /* bits */ + new_data[0] = 1 << (chan - base_bitfield_channel); /* mask */ + new_data[1] = data[0] ? (1 << (chan - base_bitfield_channel)) + : 0; /* bits */ } ret = s->insn_bits(dev, s, &new_insn, new_data); @@ -440,9 +442,7 @@ int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s, unsigned i; for (i = 0; i < async->n_buf_pages; ++i) { if (async->buf_page_list[i].virt_addr) { - mem_map_unreserve(virt_to_page - (async->buf_page_list[i]. - virt_addr)); + clear_bit(PG_reserved, &(virt_to_page(async->buf_page_list[i].virt_addr)->flags)); if (s->async_dma_dir != DMA_NONE) { dma_free_coherent(dev->hw_dev, PAGE_SIZE, @@ -495,12 +495,9 @@ int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s, if (async->buf_page_list[i].virt_addr == NULL) break; - mem_map_reserve(virt_to_page - (async->buf_page_list[i]. - virt_addr)); - pages[i] = - virt_to_page(async-> - buf_page_list[i].virt_addr); + set_bit(PG_reserved, + &(virt_to_page(async->buf_page_list[i].virt_addr)->flags)); + pages[i] = virt_to_page(async->buf_page_list[i].virt_addr); } } if (i == n_pages) { @@ -517,9 +514,7 @@ int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s, NULL) { break; } - mem_map_unreserve(virt_to_page - (async->buf_page_list - [i].virt_addr)); + clear_bit(PG_reserved, &(virt_to_page(async->buf_page_list[i].virt_addr)->flags)); if (s->async_dma_dir != DMA_NONE) { dma_free_coherent(dev->hw_dev, PAGE_SIZE, @@ -549,8 +544,8 @@ int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s, /* munging is applied to data by core as it passes between user * and kernel space */ -unsigned int comedi_buf_munge(struct comedi_async *async, - unsigned int num_bytes) +static unsigned int comedi_buf_munge(struct comedi_async *async, + unsigned int num_bytes) { struct comedi_subdevice *s = async->subdevice; unsigned int count = 0; @@ -568,7 +563,8 @@ unsigned int comedi_buf_munge(struct comedi_async *async, block_size = num_bytes - count; if (block_size < 0) { - printk("%s: %s: bug! block_size is negative\n", + printk(KERN_WARNING + "%s: %s: bug! block_size is negative\n", __FILE__, __func__); break; } @@ -579,7 +575,8 @@ unsigned int comedi_buf_munge(struct comedi_async *async, s->munge(s->device, s, async->prealloc_buf + async->munge_ptr, block_size, async->munge_chan); - smp_wmb(); /* barrier insures data is munged in buffer before munge_count is incremented */ + smp_wmb(); /* barrier insures data is munged in buffer + * before munge_count is incremented */ async->munge_chan += block_size / num_sample_bytes; async->munge_chan %= async->cmd.chanlist_len; @@ -626,6 +623,7 @@ unsigned int comedi_buf_write_alloc(struct comedi_async *async, smp_mb(); return nbytes; } +EXPORT_SYMBOL(comedi_buf_write_alloc); /* allocates nothing unless it can completely fulfill the request */ unsigned int comedi_buf_write_alloc_strict(struct comedi_async *async, @@ -649,7 +647,7 @@ unsigned comedi_buf_write_free(struct comedi_async *async, unsigned int nbytes) if ((int)(async->buf_write_count + nbytes - async->buf_write_alloc_count) > 0) { printk - ("comedi: attempted to write-free more bytes than have been write-allocated.\n"); + (KERN_INFO "comedi: attempted to write-free more bytes than have been write-allocated.\n"); nbytes = async->buf_write_alloc_count - async->buf_write_count; } async->buf_write_count += nbytes; @@ -660,6 +658,7 @@ unsigned comedi_buf_write_free(struct comedi_async *async, unsigned int nbytes) return nbytes; } +EXPORT_SYMBOL(comedi_buf_write_free); /* allocates a chunk for the reader from filled (and munged) buffer space */ unsigned comedi_buf_read_alloc(struct comedi_async *async, unsigned nbytes) @@ -674,16 +673,18 @@ unsigned comedi_buf_read_alloc(struct comedi_async *async, unsigned nbytes) smp_rmb(); return nbytes; } +EXPORT_SYMBOL(comedi_buf_read_alloc); /* transfers control of a chunk from reader to free buffer space */ unsigned comedi_buf_read_free(struct comedi_async *async, unsigned int nbytes) { - /* barrier insures data has been read out of buffer before read count is incremented */ + /* barrier insures data has been read out of + * buffer before read count is incremented */ smp_mb(); if ((int)(async->buf_read_count + nbytes - async->buf_read_alloc_count) > 0) { - printk - ("comedi: attempted to read-free more bytes than have been read-allocated.\n"); + printk(KERN_INFO + "comedi: attempted to read-free more bytes than have been read-allocated.\n"); nbytes = async->buf_read_alloc_count - async->buf_read_count; } async->buf_read_count += nbytes; @@ -691,6 +692,7 @@ unsigned comedi_buf_read_free(struct comedi_async *async, unsigned int nbytes) async->buf_read_ptr %= async->prealloc_bufsz; return nbytes; } +EXPORT_SYMBOL(comedi_buf_read_free); void comedi_buf_memcpy_to(struct comedi_async *async, unsigned int offset, const void *data, unsigned int num_bytes) @@ -716,6 +718,7 @@ void comedi_buf_memcpy_to(struct comedi_async *async, unsigned int offset, write_ptr = 0; } } +EXPORT_SYMBOL(comedi_buf_memcpy_to); void comedi_buf_memcpy_from(struct comedi_async *async, unsigned int offset, void *dest, unsigned int nbytes) @@ -742,6 +745,7 @@ void comedi_buf_memcpy_from(struct comedi_async *async, unsigned int offset, read_ptr = 0; } } +EXPORT_SYMBOL(comedi_buf_memcpy_from); unsigned int comedi_buf_read_n_available(struct comedi_async *async) { @@ -757,6 +761,7 @@ unsigned int comedi_buf_read_n_available(struct comedi_async *async) smp_rmb(); return num_bytes; } +EXPORT_SYMBOL(comedi_buf_read_n_available); int comedi_buf_get(struct comedi_async *async, short *x) { @@ -769,6 +774,7 @@ int comedi_buf_get(struct comedi_async *async, short *x) comedi_buf_read_free(async, sizeof(short)); return 1; } +EXPORT_SYMBOL(comedi_buf_get); int comedi_buf_put(struct comedi_async *async, short x) { @@ -782,6 +788,7 @@ int comedi_buf_put(struct comedi_async *async, short x) comedi_buf_write_free(async, sizeof(short)); return 1; } +EXPORT_SYMBOL(comedi_buf_put); void comedi_reset_async_buf(struct comedi_async *async) { @@ -802,8 +809,9 @@ void comedi_reset_async_buf(struct comedi_async *async) async->events = 0; } -int comedi_auto_config(struct device *hardware_device, const char *board_name, - const int *options, unsigned num_options) +static int comedi_auto_config(struct device *hardware_device, + const char *board_name, const int *options, + unsigned num_options) { struct comedi_devconfig it; int minor; @@ -848,7 +856,7 @@ cleanup: return retval; } -void comedi_auto_unconfig(struct device *hardware_device) +static void comedi_auto_unconfig(struct device *hardware_device) { unsigned *minor = (unsigned *)dev_get_drvdata(hardware_device); if (minor == NULL) @@ -873,20 +881,24 @@ int comedi_pci_auto_config(struct pci_dev *pcidev, const char *board_name) return comedi_auto_config(&pcidev->dev, board_name, options, ARRAY_SIZE(options)); } +EXPORT_SYMBOL_GPL(comedi_pci_auto_config); void comedi_pci_auto_unconfig(struct pci_dev *pcidev) { comedi_auto_unconfig(&pcidev->dev); } +EXPORT_SYMBOL_GPL(comedi_pci_auto_unconfig); int comedi_usb_auto_config(struct usb_device *usbdev, const char *board_name) { BUG_ON(usbdev == NULL); return comedi_auto_config(&usbdev->dev, board_name, NULL, 0); } +EXPORT_SYMBOL_GPL(comedi_usb_auto_config); void comedi_usb_auto_unconfig(struct usb_device *usbdev) { BUG_ON(usbdev == NULL); comedi_auto_unconfig(&usbdev->dev); } +EXPORT_SYMBOL_GPL(comedi_usb_auto_unconfig); diff --git a/drivers/staging/comedi/drivers/8253.h b/drivers/staging/comedi/drivers/8253.h index 0bb35db..3eb45d4 100644 --- a/drivers/staging/comedi/drivers/8253.h +++ b/drivers/staging/comedi/drivers/8253.h @@ -214,7 +214,8 @@ static inline void i8253_cascade_ns_to_timer_2div(int i8253_osc_base, #ifndef CMDTEST /* i8254_load programs 8254 counter chip. It should also work for the 8253. - * base_address is the lowest io address for the chip (the address of counter 0). + * base_address is the lowest io address + * for the chip (the address of counter 0). * counter_number is the counter you want to load (0,1 or 2) * count is the number to load into the counter. * diff --git a/drivers/staging/comedi/drivers/8255.c b/drivers/staging/comedi/drivers/8255.c index 2d54993..fe63830 100644 --- a/drivers/staging/comedi/drivers/8255.c +++ b/drivers/staging/comedi/drivers/8255.c @@ -82,6 +82,7 @@ I/O port base address can be found in the output of 'lspci -v'. #include <linux/ioport.h> #include <linux/slab.h> +#include "8255.h" #define _8255_SIZE 4 @@ -395,8 +396,6 @@ static int dev_8255_attach(struct comedi_device *dev, unsigned long iobase; int i; - printk("comedi%d: 8255:", dev->minor); - dev->board_name = "8255"; for (i = 0; i < COMEDI_NDEVCONFOPTS; i++) { @@ -405,13 +404,20 @@ static int dev_8255_attach(struct comedi_device *dev, break; } if (i == 0) { - printk(" no devices specified\n"); + printk(KERN_WARNING + "comedi%d: 8255: no devices specified\n", dev->minor); return -EINVAL; } ret = alloc_subdevices(dev, i); - if (ret < 0) + if (ret < 0) { + /* FIXME this printk call should give a proper message, the + * below line just maintains previous functionality */ + printk("comedi%d: 8255:", dev->minor); return ret; + } + + printk(KERN_INFO "comedi%d: 8255:", dev->minor); for (i = 0; i < dev->n_subdevices; i++) { iobase = it->options[i]; @@ -438,7 +444,7 @@ static int dev_8255_detach(struct comedi_device *dev) unsigned long iobase; struct comedi_subdevice *s; - printk("comedi%d: 8255: remove\n", dev->minor); + printk(KERN_INFO "comedi%d: 8255: remove\n", dev->minor); for (i = 0; i < dev->n_subdevices; i++) { s = dev->subdevices + i; diff --git a/drivers/staging/comedi/drivers/8255.h b/drivers/staging/comedi/drivers/8255.h index 02c5a36..b6314c9 100644 --- a/drivers/staging/comedi/drivers/8255.h +++ b/drivers/staging/comedi/drivers/8255.h @@ -26,8 +26,6 @@ #include "../comedidev.h" -#if defined(CONFIG_COMEDI_8255) || defined(CONFIG_COMEDI_8255_MODULE) - int subdev_8255_init(struct comedi_device *dev, struct comedi_subdevice *s, int (*cb) (int, int, int, unsigned long), unsigned long arg); @@ -38,24 +36,4 @@ void subdev_8255_cleanup(struct comedi_device *dev, struct comedi_subdevice *s); void subdev_8255_interrupt(struct comedi_device *dev, struct comedi_subdevice *s); -#else - -static inline int subdev_8255_init(struct comedi_device *dev, - struct comedi_subdevice *s, void *x, - unsigned long y) -{ - printk("8255 support not configured -- disabling subdevice\n"); - - s->type = COMEDI_SUBD_UNUSED; - - return 0; -} - -static inline void subdev_8255_cleanup(struct comedi_device *dev, - struct comedi_subdevice *s) -{ -} - -#endif - #endif diff --git a/drivers/staging/comedi/drivers/Makefile b/drivers/staging/comedi/drivers/Makefile index df2854d..5ccf246 100644 --- a/drivers/staging/comedi/drivers/Makefile +++ b/drivers/staging/comedi/drivers/Makefile @@ -2,132 +2,137 @@ # # Comedi "helper" modules -obj-$(CONFIG_COMEDI) += comedi_fc.o -obj-$(CONFIG_COMEDI) += comedi_bond.o -obj-$(CONFIG_COMEDI) += comedi_test.o -obj-$(CONFIG_COMEDI) += comedi_parport.o obj-$(CONFIG_COMEDI) += pcm_common.o +# Comedi misc drivers +obj-$(CONFIG_COMEDI_BOND) += comedi_bond.o +obj-$(CONFIG_COMEDI_TEST) += comedi_test.o +obj-$(CONFIG_COMEDI_PARPORT) += comedi_parport.o +obj-$(CONFIG_COMEDI_SERIAL2002) += serial2002.o +obj-$(CONFIG_COMEDI_SKEL) += skel.o + +# Comedi ISA drivers +obj-$(CONFIG_COMEDI_8255) += 8255.o +obj-$(CONFIG_COMEDI_ACL7225B) += acl7225b.o +obj-$(CONFIG_COMEDI_PCL711) += pcl711.o +obj-$(CONFIG_COMEDI_PCL724) += pcl724.o +obj-$(CONFIG_COMEDI_PCL725) += pcl725.o +obj-$(CONFIG_COMEDI_PCL726) += pcl726.o +obj-$(CONFIG_COMEDI_PCL730) += pcl730.o +obj-$(CONFIG_COMEDI_PCL812) += pcl812.o +obj-$(CONFIG_COMEDI_PCL816) += pcl816.o +obj-$(CONFIG_COMEDI_PCL818) += pcl818.o +obj-$(CONFIG_COMEDI_PCM3724) += pcm3724.o +obj-$(CONFIG_COMEDI_PCM3730) += pcm3730.o +obj-$(CONFIG_COMEDI_RTI800) += rti800.o +obj-$(CONFIG_COMEDI_RTI802) += rti802.o +obj-$(CONFIG_COMEDI_DAS08) += das08.o +obj-$(CONFIG_COMEDI_DAS16M1) += das16m1.o +obj-$(CONFIG_COMEDI_DAS16) += das16.o +obj-$(CONFIG_COMEDI_DAS800) += das800.o +obj-$(CONFIG_COMEDI_DAS1800) += das1800.o +obj-$(CONFIG_COMEDI_DAS6402) += das6402.o +obj-$(CONFIG_COMEDI_DT2801) += dt2801.o +obj-$(CONFIG_COMEDI_DT2811) += dt2811.o +obj-$(CONFIG_COMEDI_DT2814) += dt2814.o +obj-$(CONFIG_COMEDI_DT2815) += dt2815.o +obj-$(CONFIG_COMEDI_DT2817) += dt2817.o +obj-$(CONFIG_COMEDI_DT282X) += dt282x.o +obj-$(CONFIG_COMEDI_DMM32AT) += dmm32at.o +obj-$(CONFIG_COMEDI_FL512) += fl512.o +obj-$(CONFIG_COMEDI_AIO_AIO12_8) += aio_aio12_8.o +obj-$(CONFIG_COMEDI_AIO_IIRO_16) += aio_iiro_16.o +obj-$(CONFIG_COMEDI_C6XDIGIO) += c6xdigio.o +obj-$(CONFIG_COMEDI_MPC624) += mpc624.o +obj-$(CONFIG_COMEDI_ADQ12B) += adq12b.o +obj-$(CONFIG_COMEDI_NI_AT_A2150) += ni_at_a2150.o +obj-$(CONFIG_COMEDI_NI_AT_AO) += ni_at_ao.o +obj-$(CONFIG_COMEDI_NI_ATMIO) += ni_atmio.o +obj-$(CONFIG_COMEDI_NI_ATMIO16D) += ni_atmio16d.o +obj-$(CONFIG_COMEDI_PCMAD) += pcmad.o +obj-$(CONFIG_COMEDI_PCMDA12) += pcmda12.o +obj-$(CONFIG_COMEDI_PCMMIO) += pcmmio.o +obj-$(CONFIG_COMEDI_PCMUIO) += pcmuio.o +obj-$(CONFIG_COMEDI_MULTIQ3) += multiq3.o +obj-$(CONFIG_COMEDI_POC) += poc.o + # Comedi PCI drivers obj-$(CONFIG_COMEDI_PCI_DRIVERS) += 8255.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += acl7225b.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += addi_apci_035.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += addi_apci_1032.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += addi_apci_1500.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += addi_apci_1516.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += addi_apci_1564.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += addi_apci_16xx.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += addi_apci_2016.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += addi_apci_2032.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += addi_apci_2200.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += addi_apci_3001.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += addi_apci_3120.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += addi_apci_3501.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += addi_apci_3xxx.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += adl_pci6208.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += adl_pci7296.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += adl_pci7432.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += adl_pci8164.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += adl_pci9111.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += adl_pci9118.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += adq12b.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += adv_pci1710.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += adv_pci1723.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += adv_pci_dio.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += aio_aio12_8.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += aio_iiro_16.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += amplc_dio200.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += amplc_pc236.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += amplc_pc263.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += amplc_pci224.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += amplc_pci230.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += c6xdigio.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += cb_pcidas64.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += cb_pcidas.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += cb_pcidda.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += cb_pcidio.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += cb_pcimdas.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += cb_pcimdda.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += comedi_bond.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += comedi_parport.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += comedi_test.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += contec_pci_dio.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += daqboard2000.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += das08.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += das16m1.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += das16.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += das1800.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += das6402.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += das800.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += dmm32at.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += dt2801.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += dt2811.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += dt2814.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += dt2815.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += dt2817.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += dt282x.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += dt3000.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += fl512.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += gsc_hpdi.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += icp_multi.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += ii_pci20kc.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += jr3_pci.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += ke_counter.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += me4000.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += me_daq.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += mite.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += mpc624.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += multiq3.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += ni_6527.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += ni_65xx.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += ni_660x.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += ni_670x.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += ni_at_a2150.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += ni_at_ao.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += ni_atmio16d.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += ni_atmio.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += ni_labpc.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += ni_pcidio.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += ni_pcimio.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += ni_tiocmd.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += ni_tio.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += pcl711.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += pcl724.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += pcl725.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += pcl726.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += pcl730.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += pcl812.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += pcl816.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += pcl818.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += pcm3724.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += pcm3730.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += pcmad.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += pcmda12.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += pcmmio.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += pcmuio.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += poc.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += rtd520.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += rti800.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += rti802.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += s526.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += s626.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += serial2002.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += skel.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += ssv_dnp.o -obj-$(CONFIG_COMEDI_PCI_DRIVERS) += unioxx5.o +obj-$(CONFIG_COMEDI_ADDI_APCI_035) += addi_apci_035.o +obj-$(CONFIG_COMEDI_ADDI_APCI_1032) += addi_apci_1032.o +obj-$(CONFIG_COMEDI_ADDI_APCI_1500) += addi_apci_1500.o +obj-$(CONFIG_COMEDI_ADDI_APCI_1516) += addi_apci_1516.o +obj-$(CONFIG_COMEDI_ADDI_APCI_1564) += addi_apci_1564.o +obj-$(CONFIG_COMEDI_ADDI_APCI_16XX) += addi_apci_16xx.o +obj-$(CONFIG_COMEDI_ADDI_APCI_2016) += addi_apci_2016.o +obj-$(CONFIG_COMEDI_ADDI_APCI_2032) += addi_apci_2032.o +obj-$(CONFIG_COMEDI_ADDI_APCI_2200) += addi_apci_2200.o +obj-$(CONFIG_COMEDI_ADDI_APCI_3001) += addi_apci_3001.o +obj-$(CONFIG_COMEDI_ADDI_APCI_3120) += addi_apci_3120.o +obj-$(CONFIG_COMEDI_ADDI_APCI_3501) += addi_apci_3501.o +obj-$(CONFIG_COMEDI_ADDI_APCI_3XXX) += addi_apci_3xxx.o +obj-$(CONFIG_COMEDI_ADL_PCI6208) += adl_pci6208.o +obj-$(CONFIG_COMEDI_ADL_PCI7230) += adl_pci7230.o +obj-$(CONFIG_COMEDI_ADL_PCI7296) += adl_pci7296.o +obj-$(CONFIG_COMEDI_ADL_PCI7432) += adl_pci7432.o +obj-$(CONFIG_COMEDI_ADL_PCI8164) += adl_pci8164.o +obj-$(CONFIG_COMEDI_ADL_PCI9111) += adl_pci9111.o +obj-$(CONFIG_COMEDI_ADL_PCI9118) += adl_pci9118.o +obj-$(CONFIG_COMEDI_ADV_PCI1710) += adv_pci1710.o +obj-$(CONFIG_COMEDI_ADV_PCI1723) += adv_pci1723.o +obj-$(CONFIG_COMEDI_ADV_PCI_DIO) += adv_pci_dio.o +obj-$(CONFIG_COMEDI_AMPLC_DIO200) += amplc_dio200.o +obj-$(CONFIG_COMEDI_AMPLC_PC236) += amplc_pc236.o +obj-$(CONFIG_COMEDI_AMPLC_PC263) += amplc_pc263.o +obj-$(CONFIG_COMEDI_AMPLC_PCI224) += amplc_pci224.o +obj-$(CONFIG_COMEDI_AMPLC_PCI230) += amplc_pci230.o +obj-$(CONFIG_COMEDI_CONTEC_PCI_DIO) += contec_pci_dio.o +obj-$(CONFIG_COMEDI_DT3000) += dt3000.o +obj-$(CONFIG_COMEDI_UNIOXX5) += unioxx5.o +obj-$(CONFIG_COMEDI_GSC_HPDI) += gsc_hpdi.o +obj-$(CONFIG_COMEDI_ICP_MULTI) += icp_multi.o +obj-$(CONFIG_COMEDI_II_PCI20KC) += ii_pci20kc.o +obj-$(CONFIG_COMEDI_DAQBOARD2000) += daqboard2000.o +obj-$(CONFIG_COMEDI_JR3_PCI) += jr3_pci.o +obj-$(CONFIG_COMEDI_KE_COUNTER) += ke_counter.o +obj-$(CONFIG_COMEDI_CB_PCIDAS64) += cb_pcidas64.o +obj-$(CONFIG_COMEDI_CB_PCIDAS) += cb_pcidas.o +obj-$(CONFIG_COMEDI_CB_PCIDDA) += cb_pcidda.o +obj-$(CONFIG_COMEDI_CB_PCIDIO) += cb_pcidio.o +obj-$(CONFIG_COMEDI_CB_PCIMDAS) += cb_pcimdas.o +obj-$(CONFIG_COMEDI_CB_PCIMDDA) += cb_pcimdda.o +obj-$(CONFIG_COMEDI_ME4000) += me4000.o +obj-$(CONFIG_COMEDI_ME_DAQ) += me_daq.o +obj-$(CONFIG_COMEDI_NI_6527) += ni_6527.o +obj-$(CONFIG_COMEDI_NI_65XX) += ni_65xx.o +obj-$(CONFIG_COMEDI_NI_660X) += ni_660x.o +obj-$(CONFIG_COMEDI_NI_670X) += ni_670x.o +obj-$(CONFIG_COMEDI_NI_PCIDIO) += ni_pcidio.o +obj-$(CONFIG_COMEDI_NI_PCIMIO) += ni_pcimio.o +obj-$(CONFIG_COMEDI_RTD520) += rtd520.o +obj-$(CONFIG_COMEDI_S526) += s526.o +obj-$(CONFIG_COMEDI_S626) += s626.o +obj-$(CONFIG_COMEDI_SSV_DNP) += ssv_dnp.o # Comedi PCMCIA drivers -obj-$(CONFIG_COMEDI_PCMCIA_DRIVERS) += cb_das16_cs.o -obj-$(CONFIG_COMEDI_PCMCIA_DRIVERS) += das08_cs.o -obj-$(CONFIG_COMEDI_PCMCIA_DRIVERS) += ni_daq_700.o -obj-$(CONFIG_COMEDI_PCMCIA_DRIVERS) += ni_daq_dio24.o -obj-$(CONFIG_COMEDI_PCMCIA_DRIVERS) += ni_labpc_cs.o -obj-$(CONFIG_COMEDI_PCMCIA_DRIVERS) += ni_mio_cs.o -obj-$(CONFIG_COMEDI_PCMCIA_DRIVERS) += quatech_daqp_cs.o +obj-$(CONFIG_COMEDI_CB_DAS16_CS) += cb_das16_cs.o +obj-$(CONFIG_COMEDI_DAS08_CS) += das08_cs.o +obj-$(CONFIG_COMEDI_NI_DAQ_700_CS) += ni_daq_700.o +obj-$(CONFIG_COMEDI_NI_DAQ_DIO24_CS) += ni_daq_dio24.o +obj-$(CONFIG_COMEDI_NI_LABPC_CS) += ni_labpc_cs.o +obj-$(CONFIG_COMEDI_NI_MIO_CS) += ni_mio_cs.o +obj-$(CONFIG_COMEDI_QUATECH_DAQP_CS) += quatech_daqp_cs.o # Comedi USB drivers -obj-$(CONFIG_COMEDI_USB_DRIVERS) += dt9812.o -obj-$(CONFIG_COMEDI_USB_DRIVERS) += usbdux.o -obj-$(CONFIG_COMEDI_USB_DRIVERS) += usbduxfast.o -obj-$(CONFIG_COMEDI_USB_DRIVERS) += vmk80xx.o +obj-$(CONFIG_COMEDI_DT9812) += dt9812.o +obj-$(CONFIG_COMEDI_USBDUX) += usbdux.o +obj-$(CONFIG_COMEDI_USBDUXFAST) += usbduxfast.o +obj-$(CONFIG_COMEDI_VMK80XX) += vmk80xx.o + +# Comedi NI drivers +obj-$(CONFIG_COMEDI_MITE) += mite.o +obj-$(CONFIG_COMEDI_NI_TIO) += ni_tio.o +obj-$(CONFIG_COMEDI_NI_TIO) += ni_tiocmd.o +obj-$(CONFIG_COMEDI_NI_LABPC) += ni_labpc.o +obj-$(CONFIG_COMEDI_FC) += comedi_fc.o diff --git a/drivers/staging/comedi/drivers/addi-data/addi_amcc_s5933.h b/drivers/staging/comedi/drivers/addi-data/addi_amcc_s5933.h index f96b128..c3284eb 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_amcc_s5933.h +++ b/drivers/staging/comedi/drivers/addi-data/addi_amcc_s5933.h @@ -212,7 +212,7 @@ struct pcilst_struct { }; /* ptr to root list of all amcc devices */ -struct pcilst_struct *amcc_devices; +static struct pcilst_struct *amcc_devices; static const int i_ADDIDATADeviceID[] = { 0x15B8, 0x10E8 }; @@ -260,12 +260,10 @@ void v_pci_card_list_init(unsigned short pci_vendor, char display) for (i_Count = 0; i_Count < 2; i_Count++) { pci_vendor = i_ADDIDATADeviceID[i_Count]; if (pcidev->vendor == pci_vendor) { - amcc = kmalloc(sizeof(*amcc), GFP_KERNEL); + amcc = kzalloc(sizeof(*amcc), GFP_KERNEL); if (amcc == NULL) continue; - memset(amcc, 0, sizeof(*amcc)); - amcc->pcidev = pcidev; if (last) last->next = amcc; diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.c b/drivers/staging/comedi/drivers/addi-data/addi_common.c index 6625fdc..2c98641 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_common.c +++ b/drivers/staging/comedi/drivers/addi-data/addi_common.c @@ -293,8 +293,8 @@ static const struct addi_board boardtypes[] = { 0, 0, 0, - 0, - 0, + NULL, + NULL, 32, 0, 0, @@ -2527,7 +2527,7 @@ static const struct addi_board boardtypes[] = { #define n_boardtypes (sizeof(boardtypes)/sizeof(struct addi_board)) -struct comedi_driver driver_addi = { +static struct comedi_driver driver_addi = { .driver_name = "addi_common", .module = THIS_MODULE, .attach = i_ADDI_Attach, @@ -2639,9 +2639,8 @@ static int i_ADDI_Attach(struct comedi_device *dev, struct comedi_devconfig *it) devpriv->ps_BoardInfo = this_board; devpriv->i_IobaseReserved = (int) io_addr[3]; printk("\nioremap begin"); - devpriv->dw_AiBase = - (unsigned long) ioremap(io_addr[3], - this_board->i_IorangeBase3); + devpriv->dw_AiBase = ioremap(io_addr[3], + this_board->i_IorangeBase3); printk("\nioremap end"); } @@ -2952,7 +2951,7 @@ static int i_ADDI_Detach(struct comedi_device *dev) devpriv->ui_DmaBufferPages[1]); } } else { - iounmap((void *)devpriv->dw_AiBase); + iounmap(devpriv->dw_AiBase); if (devpriv->allocated) { i_pci_card_free(devpriv->amcc); diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.h b/drivers/staging/comedi/drivers/addi-data/addi_common.h index caeb6fd..1a28169 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_common.h +++ b/drivers/staging/comedi/drivers/addi-data/addi_common.h @@ -351,7 +351,7 @@ struct addi_private { int i_IobaseAmcc; /* base+size for AMCC chip */ int i_IobaseAddon; /* addon base address */ int i_IobaseReserved; - unsigned long dw_AiBase; + void __iomem *dw_AiBase; struct pcilst_struct *amcc; /* ptr too AMCC data */ unsigned char allocated; /* we have blocked card */ unsigned char b_ValidDriver; /* driver is ok */ diff --git a/drivers/staging/comedi/drivers/addi-data/amcc_s5933_58.h b/drivers/staging/comedi/drivers/addi-data/amcc_s5933_58.h index 49141b3..349e93c 100644 --- a/drivers/staging/comedi/drivers/addi-data/amcc_s5933_58.h +++ b/drivers/staging/comedi/drivers/addi-data/amcc_s5933_58.h @@ -253,12 +253,10 @@ void v_pci_card_list_init(unsigned short pci_vendor, char display) pci_for_each_dev(pcidev) { if (pcidev->vendor == pci_vendor) { - amcc = kmalloc(sizeof(*amcc), GFP_KERNEL); + amcc = kzalloc(sizeof(*amcc), GFP_KERNEL); if (amcc == NULL) continue; - memset(amcc, 0, sizeof(*amcc)); - amcc->pcidev = pcidev; if (last) { last->next = amcc; diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.c index 7912972..1369e22 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.c @@ -52,9 +52,9 @@ You should also find the complete GPL in the COPYING file accompanying this sour +----------------------------------------------------------------------------+ */ #include "hwdrv_apci035.h" -int i_WatchdogNbr = 0; -int i_Temp = 0; -int i_Flag = 1; +static int i_WatchdogNbr = 0; +static int i_Temp = 0; +static int i_Flag = 1; /* +----------------------------------------------------------------------------+ | Function Name : int i_APCI035_ConfigTimerWatchdog | diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.h b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.h index e0023c8..68db9c1 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.h +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.h @@ -19,22 +19,8 @@ #define APCI035_BOARD_VENDOR_ID 0x15B8 #define APCI035_ADDRESS_RANGE 255 -int i_TW_Number; -struct { - int i_Gain; - int i_Polarity; - int i_OffsetRange; - int i_Coupling; - int i_SingleDiff; - int i_AutoCalibration; - unsigned int ui_ReloadValue; - unsigned int ui_TimeUnitReloadVal; - int i_Interrupt; - int i_ModuleSelection; -} Config_Parameters_Main; - /* ANALOG INPUT RANGE */ -struct comedi_lrange range_apci035_ai = { 8, { +static struct comedi_lrange range_apci035_ai = { 8, { BIP_RANGE(10), BIP_RANGE(5), BIP_RANGE(2), diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1032.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1032.c index fe06789..faea003 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1032.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1032.c @@ -53,8 +53,8 @@ You should also find the complete GPL in the COPYING file accompanying this sour */ #include "hwdrv_apci1032.h" #include <linux/delay.h> -/* Global variables */ -unsigned int ui_InterruptStatus; + +static unsigned int ui_InterruptStatus; /* +----------------------------------------------------------------------------+ diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c index d5e06ad..b3b9218 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c @@ -47,16 +47,16 @@ You should also find the complete GPL in the COPYING file accompanying this sour */ #include "hwdrv_apci1500.h" -int i_TimerCounter1Init = 0; -int i_TimerCounter2Init = 0; -int i_WatchdogCounter3Init = 0; -int i_Event1Status = 0, i_Event2Status = 0; -int i_TimerCounterWatchdogInterrupt = 0; -int i_Logic = 0, i_CounterLogic = 0; -int i_InterruptMask = 0; -int i_InputChannel = 0; -int i_TimerCounter1Enabled = 0, i_TimerCounter2Enabled = - 0, i_WatchdogCounter3Enabled = 0; +static int i_TimerCounter1Init = 0; +static int i_TimerCounter2Init = 0; +static int i_WatchdogCounter3Init = 0; +static int i_Event1Status = 0, i_Event2Status = 0; +static int i_TimerCounterWatchdogInterrupt = 0; +static int i_Logic = 0, i_CounterLogic = 0; +static int i_InterruptMask = 0; +static int i_InputChannel = 0; +static int i_TimerCounter1Enabled = 0, i_TimerCounter2Enabled = 0, + i_WatchdogCounter3Enabled = 0; /* +----------------------------------------------------------------------------+ @@ -136,9 +136,10 @@ int i_TimerCounter1Enabled = 0, i_TimerCounter2Enabled = | | +----------------------------------------------------------------------------+ */ - -int i_APCI1500_ConfigDigitalInputEvent(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) +static int i_APCI1500_ConfigDigitalInputEvent(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { int i_PatternPolarity = 0, i_PatternTransition = 0, i_PatternMask = 0; int i_MaxChannel = 0, i_Count = 0, i_EventMask = 0; @@ -519,8 +520,10 @@ int i_APCI1500_ConfigDigitalInputEvent(struct comedi_device *dev, | | +----------------------------------------------------------------------------+ */ -int i_APCI1500_StartStopInputEvent(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) +static int i_APCI1500_StartStopInputEvent(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { int i_Event1InterruptStatus = 0, i_Event2InterruptStatus = 0, i_RegValue; @@ -784,8 +787,10 @@ int i_APCI1500_StartStopInputEvent(struct comedi_device *dev, struct comedi_subd | | +----------------------------------------------------------------------------+ */ -int i_APCI1500_Initialisation(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) +static int i_APCI1500_Initialisation(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { int i_DummyRead = 0; /******************/ @@ -956,9 +961,10 @@ int i_APCI1500_Initialisation(struct comedi_device *dev, struct comedi_subdevice | | +----------------------------------------------------------------------------+ */ - -int i_APCI1500_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) +static int i_APCI1500_ReadMoreDigitalInput(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { unsigned int ui_PortValue = data[1]; unsigned int ui_Mask = 0; @@ -1040,8 +1046,10 @@ int i_APCI1500_ReadMoreDigitalInput(struct comedi_device *dev, struct comedi_sub | | +----------------------------------------------------------------------------+ */ -int i_APCI1500_ConfigDigitalOutputErrorInterrupt(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) +static int i_APCI1500_ConfigDigitalOutputErrorInterrupt(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { devpriv->b_OutputMemoryStatus = data[0]; return insn->n; @@ -1066,9 +1074,10 @@ int i_APCI1500_ConfigDigitalOutputErrorInterrupt(struct comedi_device *dev, | | +----------------------------------------------------------------------------+ */ - -int i_APCI1500_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) +static int i_APCI1500_WriteDigitalOutput(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { static unsigned int ui_Temp = 0; unsigned int ui_Temp1; @@ -1260,9 +1269,10 @@ int i_APCI1500_WriteDigitalOutput(struct comedi_device *dev, struct comedi_subde | | +----------------------------------------------------------------------------+ */ - -int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) +static int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { int i_TimerCounterMode, i_MasterConfiguration; @@ -1860,8 +1870,10 @@ int i_APCI1500_ConfigCounterTimerWatchdog(struct comedi_device *dev, | | +----------------------------------------------------------------------------+ */ -int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) +static int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { int i_CommandAndStatusValue; @@ -2181,9 +2193,10 @@ int i_APCI1500_StartStopTriggerTimerCounterWatchdog(struct comedi_device *dev, | | +----------------------------------------------------------------------------+ */ - -int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) +static int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { int i_CommandAndStatusValue; switch (data[0]) { @@ -2370,8 +2383,10 @@ int i_APCI1500_ReadCounterTimerWatchdog(struct comedi_device *dev, | | +----------------------------------------------------------------------------+ */ -int i_APCI1500_ReadInterruptMask(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) +static int i_APCI1500_ReadInterruptMask(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { data[0] = i_InterruptMask; data[1] = i_InputChannel; @@ -2401,8 +2416,10 @@ int i_APCI1500_ReadInterruptMask(struct comedi_device *dev, struct comedi_subdev | | +----------------------------------------------------------------------------+ */ -int i_APCI1500_ConfigureInterrupt(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) +static int i_APCI1500_ConfigureInterrupt(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { unsigned int ui_Status; int i_RegValue; @@ -2821,8 +2838,7 @@ static void v_APCI1500_Interrupt(int irq, void *d) | | +----------------------------------------------------------------------------+ */ - -int i_APCI1500_Reset(struct comedi_device *dev) +static int i_APCI1500_Reset(struct comedi_device *dev) { int i_DummyRead = 0; i_TimerCounter1Init = 0; diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c index 4413279..4299ff5 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1564.c @@ -56,8 +56,8 @@ You should also find the complete GPL in the COPYING file accompanying this sour #include "hwdrv_apci1564.h" /* Global variables */ -unsigned int ui_InterruptStatus_1564 = 0; -unsigned int ui_InterruptData, ui_Type; +static unsigned int ui_InterruptStatus_1564 = 0; +static unsigned int ui_InterruptData, ui_Type; /* +----------------------------------------------------------------------------+ diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2032.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2032.c index 2d32516..d7d2223 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2032.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci2032.c @@ -53,7 +53,7 @@ You should also find the complete GPL in the COPYING file accompanying this sour */ #include "hwdrv_apci2032.h" -unsigned int ui_InterruptData, ui_Type; +static unsigned int ui_InterruptData, ui_Type; /* +----------------------------------------------------------------------------+ | Function Name : int i_APCI2032_ConfigDigitalOutput | diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.h b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.h index c456d75..743523e 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.h +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3501.h @@ -32,7 +32,7 @@ #define MODE0 0 #define MODE1 1 /* ANALOG OUTPUT RANGE */ -struct comedi_lrange range_apci3501_ao = { 2, { +static struct comedi_lrange range_apci3501_ao = { 2, { BIP_RANGE(10), UNI_RANGE(10) } diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3xxx.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3xxx.c index 3692326..2e20bc7 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3xxx.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3xxx.c @@ -67,10 +67,9 @@ You should also find the complete GPL in the COPYING file accompanying this sour | 1 : Conversion started | +----------------------------------------------------------------------------+ */ - -int i_APCI3XXX_TestConversionStarted(struct comedi_device *dev) +static int i_APCI3XXX_TestConversionStarted(struct comedi_device *dev) { - if ((readl((void *)(devpriv->dw_AiBase + 8)) & 0x80000UL) == 0x80000UL) + if ((readl(devpriv->dw_AiBase + 8) & 0x80000UL) == 0x80000UL) return 1; else return 0; @@ -104,9 +103,10 @@ int i_APCI3XXX_TestConversionStarted(struct comedi_device *dev) | -101 : Data size error | +----------------------------------------------------------------------------+ */ - -int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) +static int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { int i_ReturnValue = insn->n; unsigned char b_TimeBase = 0; @@ -204,19 +204,14 @@ int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device *dev, /* Set the convert timing unit */ /*******************************/ - writel((unsigned int) - b_TimeBase, - (void *) - (devpriv-> - dw_AiBase - + - 36)); + writel((unsigned int)b_TimeBase, + devpriv->dw_AiBase + 36); /**************************/ /* Set the convert timing */ /*************************/ - writel(dw_ReloadValue, (void *)(devpriv->dw_AiBase + 32)); + writel(dw_ReloadValue, devpriv->dw_AiBase + 32); } else { /**************************/ /* Any conversion started */ @@ -294,9 +289,10 @@ int i_APCI3XXX_AnalogInputConfigOperatingMode(struct comedi_device *dev, | -101 : Data size error | +----------------------------------------------------------------------------+ */ - -int i_APCI3XXX_InsnConfigAnalogInput(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) +static int i_APCI3XXX_InsnConfigAnalogInput(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { int i_ReturnValue = insn->n; @@ -354,9 +350,10 @@ int i_APCI3XXX_InsnConfigAnalogInput(struct comedi_device *dev, | -101 : Data size error | +----------------------------------------------------------------------------+ */ - -int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) +static int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { int i_ReturnValue = insn->n; unsigned char b_Configuration = (unsigned char) CR_RANGE(insn->chanspec); @@ -422,26 +419,20 @@ int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device *dev, /* Clear the FIFO */ /******************/ - writel(0x10000UL, - (void *)(devpriv->dw_AiBase + - 12)); + writel(0x10000UL, devpriv->dw_AiBase + 12); /*******************************/ /* Get and save the delay mode */ /*******************************/ - dw_Temp = - readl((void *)(devpriv-> - dw_AiBase + 4)); + dw_Temp = readl(devpriv->dw_AiBase + 4); dw_Temp = dw_Temp & 0xFFFFFEF0UL; /***********************************/ /* Channel configuration selection */ /***********************************/ - writel(dw_Temp, - (void *)(devpriv->dw_AiBase + - 4)); + writel(dw_Temp, devpriv->dw_AiBase + 4); /**************************/ /* Make the configuration */ @@ -458,35 +449,28 @@ int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device *dev, /***************************/ writel(dw_Configuration, - (void *)(devpriv->dw_AiBase + - 0)); + devpriv->dw_AiBase + 0); /*********************/ /* Channel selection */ /*********************/ writel(dw_Temp | 0x100UL, - (void *)(devpriv->dw_AiBase + - 4)); + devpriv->dw_AiBase + 4); writel((unsigned int) b_Channel, - (void *)(devpriv->dw_AiBase + - 0)); + devpriv->dw_AiBase + 0); /***********************/ /* Restaure delay mode */ /***********************/ - writel(dw_Temp, - (void *)(devpriv->dw_AiBase + - 4)); + writel(dw_Temp, devpriv->dw_AiBase + 4); /***********************************/ /* Set the number of sequence to 1 */ /***********************************/ - writel(1, - (void *)(devpriv->dw_AiBase + - 48)); + writel(1, devpriv->dw_AiBase + 48); /***************************/ /* Save the interrupt flag */ @@ -514,50 +498,29 @@ int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device *dev, /* Start the conversion */ /************************/ - writel(0x80000UL, - (void *) - (devpriv-> - dw_AiBase - + 8)); + writel(0x80000UL, devpriv->dw_AiBase + 8); /****************/ /* Wait the EOS */ /****************/ do { - dw_Temp = - readl( - (void *) - (devpriv-> - dw_AiBase - + - 20)); - dw_Temp = - dw_Temp - & 1; + dw_Temp = readl(devpriv->dw_AiBase + 20); + dw_Temp = dw_Temp & 1; } while (dw_Temp != 1); /*************************/ /* Read the analog value */ /*************************/ - data[dw_AcquisitionCpt] - = - (unsigned int) - readl((void - *) - (devpriv-> - dw_AiBase - + 28)); + data[dw_AcquisitionCpt] = (unsigned int)readl(devpriv->dw_AiBase + 28); } } else { /************************/ /* Start the conversion */ /************************/ - writel(0x180000UL, - (void *)(devpriv-> - dw_AiBase + 8)); + writel(0x180000UL, devpriv->dw_AiBase + 8); } } else { /**************************/ @@ -603,7 +566,7 @@ int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device *dev, +----------------------------------------------------------------------------+ */ -void v_APCI3XXX_Interrupt(int irq, void *d) +static void v_APCI3XXX_Interrupt(int irq, void *d) { struct comedi_device *dev = d; unsigned char b_CopyCpt = 0; @@ -613,13 +576,13 @@ void v_APCI3XXX_Interrupt(int irq, void *d) /* Test if interrupt occur */ /***************************/ - dw_Status = readl((void *)(devpriv->dw_AiBase + 16)); + dw_Status = readl(devpriv->dw_AiBase + 16); if ( (dw_Status & 0x2UL) == 0x2UL) { /***********************/ /* Reset the interrupt */ /***********************/ - writel(dw_Status, (void *)(devpriv->dw_AiBase + 16)); + writel(dw_Status, devpriv->dw_AiBase + 16); /*****************************/ /* Test if interrupt enabled */ @@ -634,8 +597,7 @@ void v_APCI3XXX_Interrupt(int irq, void *d) b_CopyCpt < devpriv->ui_AiNbrofChannels; b_CopyCpt++) { devpriv->ui_AiReadData[b_CopyCpt] = - (unsigned int) readl((void *)(devpriv-> - dw_AiBase + 28)); + (unsigned int)readl(devpriv->dw_AiBase + 28); } /**************************/ @@ -682,9 +644,10 @@ void v_APCI3XXX_Interrupt(int irq, void *d) | -101 : Data size error | +----------------------------------------------------------------------------+ */ - -int i_APCI3XXX_InsnWriteAnalogOutput(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) +static int i_APCI3XXX_InsnWriteAnalogOutput(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { unsigned char b_Range = (unsigned char) CR_RANGE(insn->chanspec); unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec); @@ -710,24 +673,21 @@ int i_APCI3XXX_InsnWriteAnalogOutput(struct comedi_device *dev, /* Set the range selection */ /***************************/ - writel(b_Range, - (void *)(devpriv->dw_AiBase + 96)); + writel(b_Range, devpriv->dw_AiBase + 96); /**************************************************/ /* Write the analog value to the selected channel */ /**************************************************/ writel((data[0] << 8) | b_Channel, - (void *)(devpriv->dw_AiBase + 100)); + devpriv->dw_AiBase + 100); /****************************/ /* Wait the end of transfer */ /****************************/ do { - dw_Status = - readl((void *)(devpriv-> - dw_AiBase + 96)); + dw_Status = readl(devpriv->dw_AiBase + 96); } while ((dw_Status & 0x100) != 0x100); } else { /***************************/ @@ -788,9 +748,10 @@ int i_APCI3XXX_InsnWriteAnalogOutput(struct comedi_device *dev, | -101 : Data size error | +----------------------------------------------------------------------------+ */ - -int i_APCI3XXX_InsnConfigInitTTLIO(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) +static int i_APCI3XXX_InsnConfigInitTTLIO(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { int i_ReturnValue = insn->n; unsigned char b_Command = 0; @@ -916,9 +877,10 @@ int i_APCI3XXX_InsnConfigInitTTLIO(struct comedi_device *dev, | -101 : Data size error | +----------------------------------------------------------------------------+ */ - -int i_APCI3XXX_InsnBitsTTLIO(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) +static int i_APCI3XXX_InsnBitsTTLIO(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { int i_ReturnValue = insn->n; unsigned char b_ChannelCpt = 0; @@ -1071,9 +1033,10 @@ int i_APCI3XXX_InsnBitsTTLIO(struct comedi_device *dev, | -101 : Data size error | +----------------------------------------------------------------------------+ */ - -int i_APCI3XXX_InsnReadTTLIO(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) +static int i_APCI3XXX_InsnReadTTLIO(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec); int i_ReturnValue = insn->n; @@ -1184,9 +1147,10 @@ int i_APCI3XXX_InsnReadTTLIO(struct comedi_device *dev, | -101 : Data size error | +----------------------------------------------------------------------------+ */ - -int i_APCI3XXX_InsnWriteTTLIO(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) +static int i_APCI3XXX_InsnWriteTTLIO(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { int i_ReturnValue = insn->n; unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec); @@ -1296,8 +1260,10 @@ int i_APCI3XXX_InsnWriteTTLIO(struct comedi_device *dev, +----------------------------------------------------------------------------+ */ -int i_APCI3XXX_InsnReadDigitalInput(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) +static int i_APCI3XXX_InsnReadDigitalInput(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { int i_ReturnValue = insn->n; unsigned char b_Channel = (unsigned char) CR_CHAN(insn->chanspec); @@ -1354,8 +1320,10 @@ int i_APCI3XXX_InsnReadDigitalInput(struct comedi_device *dev, | -101 : Data size error | +----------------------------------------------------------------------------+ */ -int i_APCI3XXX_InsnBitsDigitalInput(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) +static int i_APCI3XXX_InsnBitsDigitalInput(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { int i_ReturnValue = insn->n; unsigned int dw_Temp = 0; @@ -1407,8 +1375,10 @@ int i_APCI3XXX_InsnBitsDigitalInput(struct comedi_device *dev, | -101 : Data size error | +----------------------------------------------------------------------------+ */ -int i_APCI3XXX_InsnBitsDigitalOutput(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) +static int i_APCI3XXX_InsnBitsDigitalOutput(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { int i_ReturnValue = insn->n; unsigned char b_ChannelCpt = 0; @@ -1503,8 +1473,10 @@ int i_APCI3XXX_InsnBitsDigitalOutput(struct comedi_device *dev, +----------------------------------------------------------------------------+ */ -int i_APCI3XXX_InsnWriteDigitalOutput(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) +static int i_APCI3XXX_InsnWriteDigitalOutput(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { int i_ReturnValue = insn->n; unsigned char b_Channel = CR_CHAN(insn->chanspec); @@ -1578,8 +1550,10 @@ int i_APCI3XXX_InsnWriteDigitalOutput(struct comedi_device *dev, +----------------------------------------------------------------------------+ */ -int i_APCI3XXX_InsnReadDigitalOutput(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) +static int i_APCI3XXX_InsnReadDigitalOutput(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { int i_ReturnValue = insn->n; unsigned char b_Channel = CR_CHAN(insn->chanspec); @@ -1636,7 +1610,7 @@ int i_APCI3XXX_InsnReadDigitalOutput(struct comedi_device *dev, +----------------------------------------------------------------------------+ */ -int i_APCI3XXX_Reset(struct comedi_device *dev) +static int i_APCI3XXX_Reset(struct comedi_device *dev) { unsigned char b_Cpt = 0; @@ -1656,27 +1630,26 @@ int i_APCI3XXX_Reset(struct comedi_device *dev) /* Clear the start command */ /***************************/ - writel(0, (void *)(devpriv->dw_AiBase + 8)); + writel(0, devpriv->dw_AiBase + 8); /*****************************/ /* Reset the interrupt flags */ /*****************************/ - writel(readl((void *)(devpriv->dw_AiBase + 16)), - (void *)(devpriv->dw_AiBase + 16)); + writel(readl(devpriv->dw_AiBase + 16), devpriv->dw_AiBase + 16); /*****************/ /* clear the EOS */ /*****************/ - readl((void *)(devpriv->dw_AiBase + 20)); + readl(devpriv->dw_AiBase + 20); /******************/ /* Clear the FIFO */ /******************/ for (b_Cpt = 0; b_Cpt < 16; b_Cpt++) { - readl((void *)(devpriv->dw_AiBase + 28)); + readl(devpriv->dw_AiBase + 28); } /************************/ diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c index 6925faa..712b9e0 100644 --- a/drivers/staging/comedi/drivers/adl_pci6208.c +++ b/drivers/staging/comedi/drivers/adl_pci6208.c @@ -54,7 +54,7 @@ References: #include "../comedidev.h" #include "comedi_pci.h" -#define PCI6208_DRIVER_NAME "adl_pci6208" +#define PCI6208_DRIVER_NAME "adl_pci6208" /* Board descriptions */ struct pci6208_board { @@ -134,10 +134,10 @@ static int pci6208_ao_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); /* static int pci6208_dio_insn_bits (struct comedi_device *dev, - * struct comedi_subdevice *s, */ + * struct comedi_subdevice *s, */ /* struct comedi_insn *insn,unsigned int *data); */ /* static int pci6208_dio_insn_config(struct comedi_device *dev, - * struct comedi_subdevice *s, */ + * struct comedi_subdevice *s, */ /* struct comedi_insn *insn,unsigned int *data); */ /* @@ -268,7 +268,7 @@ static int pci6208_ao_rinsn(struct comedi_device *dev, * This allows packed reading/writing of the DIO channels. The * comedi core can convert between insn_bits and insn_read/write */ /* static int pci6208_dio_insn_bits(struct comedi_device *dev, - * struct comedi_subdevice *s, */ + * struct comedi_subdevice *s, */ /* struct comedi_insn *insn,unsigned int *data) */ /* { */ /* if(insn->n!=2)return -EINVAL; */ @@ -293,7 +293,7 @@ static int pci6208_ao_rinsn(struct comedi_device *dev, /* } */ /* static int pci6208_dio_insn_config(struct comedi_device *dev, - * struct comedi_subdevice *s, */ + * struct comedi_subdevice *s, */ /* struct comedi_insn *insn,unsigned int *data) */ /* { */ /* int chan=CR_CHAN(insn->chanspec); */ diff --git a/drivers/staging/comedi/drivers/adl_pci7230.c b/drivers/staging/comedi/drivers/adl_pci7230.c new file mode 100644 index 0000000..24a82eb --- /dev/null +++ b/drivers/staging/comedi/drivers/adl_pci7230.c @@ -0,0 +1,206 @@ +/* + comedi/drivers/adl_pci7230.c + + Hardware comedi driver fot PCI7230 Adlink card + Copyright (C) 2010 David Fernandez <dfcastelao@gmail.com> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ +/* +Driver: adl_pci7230 +Description: Driver for the Adlink PCI-7230 32 ch. isolated digital io board +Devices: [ADLink] PCI-7230 (adl_pci7230) +Author: David Fernandez <dfcastelao@gmail.com> +Status: experimental +Updated: Mon, 14 Apr 2008 15:08:14 +0100 + +Configuration Options: + [0] - PCI bus of device (optional) + [1] - PCI slot of device (optional) + If bus/slot is not specified, the first supported + PCI device found will be used. +*/ + +#include "../comedidev.h" +#include <linux/kernel.h> +#include "comedi_pci.h" + +#define PCI7230_DI 0x00 +#define PCI7230_DO 0x00 + +#define PCI_DEVICE_ID_PCI7230 0x7230 + +static DEFINE_PCI_DEVICE_TABLE(adl_pci7230_pci_table) = { + { + PCI_VENDOR_ID_ADLINK, + PCI_DEVICE_ID_PCI7230, + PCI_ANY_ID, + PCI_ANY_ID, + 0, + 0, + 0 + }, + {0} +}; + +MODULE_DEVICE_TABLE(pci, adl_pci7230_pci_table); + +struct adl_pci7230_private { + int data; + struct pci_dev *pci_dev; +}; + +#define devpriv ((struct adl_pci7230_private *)dev->private) + +static int adl_pci7230_attach(struct comedi_device *dev, + struct comedi_devconfig *it); +static int adl_pci7230_detach(struct comedi_device *dev); +static struct comedi_driver driver_adl_pci7230 = { + .driver_name = "adl_pci7230", + .module = THIS_MODULE, + .attach = adl_pci7230_attach, + .detach = adl_pci7230_detach, +}; + +/* Digital IO */ + +static int adl_pci7230_di_insn_bits(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data); + +static int adl_pci7230_do_insn_bits(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data); + +static int adl_pci7230_attach(struct comedi_device *dev, + struct comedi_devconfig *it) +{ + struct pci_dev *pcidev; + struct comedi_subdevice *s; + int bus, slot; + + printk(KERN_INFO "comedi%d: adl_pci7230\n", dev->minor); + + dev->board_name = "pci7230"; + bus = it->options[0]; + slot = it->options[1]; + + if (alloc_private(dev, sizeof(struct adl_pci7230_private)) < 0) + return -ENOMEM; + + if (alloc_subdevices(dev, 2) < 0) + return -ENOMEM; + + for (pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL); + pcidev != NULL; + pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) { + + if (pcidev->vendor == PCI_VENDOR_ID_ADLINK && + pcidev->device == PCI_DEVICE_ID_PCI7230) { + if (bus || slot) { + /* requested particular bus/slot */ + if (pcidev->bus->number != bus || + PCI_SLOT(pcidev->devfn) != slot) { + continue; + } + } + devpriv->pci_dev = pcidev; + break; + } + } + if (pcidev == NULL) { + printk(KERN_ERR "comedi%d: no supported board found! (req. bus/slot : %d/%d)\n", + dev->minor, bus, slot); + return -EIO; + } + if (comedi_pci_enable(pcidev, "adl_pci7230") < 0) { + printk(KERN_ERR "comedi%d: Failed to enable PCI device and request regions\n", + dev->minor); + return -EIO; + } + dev->iobase = pci_resource_start(pcidev, 2); + printk(KERN_DEBUG "comedi: base addr %4lx\n", dev->iobase); + + s = dev->subdevices + 0; + /* Isolated do */ + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_COMMON; + s->n_chan = 16; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = adl_pci7230_do_insn_bits; + + s = dev->subdevices + 1; + /* Isolated di */ + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_COMMON; + s->n_chan = 16; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = adl_pci7230_di_insn_bits; + + printk(KERN_DEBUG "comedi: attached\n"); + + return 1; +} + +static int adl_pci7230_detach(struct comedi_device *dev) +{ + printk(KERN_DEBUG "comedi%d: pci7230: remove\n", dev->minor); + + if (devpriv && devpriv->pci_dev) { + if (dev->iobase) + comedi_pci_disable(devpriv->pci_dev); + pci_dev_put(devpriv->pci_dev); + } + + return 0; +} + +static int adl_pci7230_do_insn_bits(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) +{ + if (insn->n != 2) + return -EINVAL; + + if (data[0]) { + s->state &= ~data[0]; + s->state |= (data[0] & data[1]); + + outl((s->state << 16) & 0xffffffff, dev->iobase + PCI7230_DO); + } + + return 2; +} + +static int adl_pci7230_di_insn_bits(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) +{ + if (insn->n != 2) + return -EINVAL; + + data[1] = inl(dev->iobase + PCI7230_DI) & 0xffffffff; + + return 2; +} + +COMEDI_PCI_INITCLEANUP(driver_adl_pci7230, adl_pci7230_pci_table); diff --git a/drivers/staging/comedi/drivers/adl_pci9111.c b/drivers/staging/comedi/drivers/adl_pci9111.c index da172a5..36a254c 100644 --- a/drivers/staging/comedi/drivers/adl_pci9111.c +++ b/drivers/staging/comedi/drivers/adl_pci9111.c @@ -358,8 +358,8 @@ struct pci9111_private_data { int ao_readback; /* Last written analog output data */ - int timer_divisor_1; /* Divisor values for the 8254 timer pacer */ - int timer_divisor_2; + unsigned int timer_divisor_1; /* Divisor values for the 8254 timer pacer */ + unsigned int timer_divisor_2; int is_valid; /* Is device valid */ @@ -585,19 +585,17 @@ pci9111_ai_do_cmd_test(struct comedi_device *dev, (cmd->scan_begin_src != TRIG_EXT)) error++; - if ((cmd->convert_src != TRIG_TIMER) && (cmd->convert_src != TRIG_EXT)) { + if ((cmd->convert_src != TRIG_TIMER) && (cmd->convert_src != TRIG_EXT)) error++; - } if ((cmd->convert_src == TRIG_TIMER) && !((cmd->scan_begin_src == TRIG_TIMER) || - (cmd->scan_begin_src == TRIG_FOLLOW))) { + (cmd->scan_begin_src == TRIG_FOLLOW))) error++; - } if ((cmd->convert_src == TRIG_EXT) && !((cmd->scan_begin_src == TRIG_EXT) || - (cmd->scan_begin_src == TRIG_FOLLOW))) { + (cmd->scan_begin_src == TRIG_FOLLOW))) error++; - } + if (cmd->scan_end_src != TRIG_COUNT) error++; @@ -1067,9 +1065,8 @@ static int pci9111_ai_insn_read(struct comedi_device *dev, pci9111_ai_channel_set(CR_CHAN((&insn->chanspec)[0])); - if ((pci9111_ai_range_get()) != CR_RANGE((&insn->chanspec)[0])) { + if ((pci9111_ai_range_get()) != CR_RANGE((&insn->chanspec)[0])) pci9111_ai_range_set(CR_RANGE((&insn->chanspec)[0])); - } pci9111_fifo_reset(); @@ -1090,11 +1087,10 @@ static int pci9111_ai_insn_read(struct comedi_device *dev, conversion_done: - if (resolution == PCI9111_HR_AI_RESOLUTION) { + if (resolution == PCI9111_HR_AI_RESOLUTION) data[i] = pci9111_hr_ai_get_data(); - } else { + else data[i] = pci9111_ai_get_data(); - } } #ifdef AI_INSN_DEBUG @@ -1131,9 +1127,8 @@ static int pci9111_ao_insn_read(struct comedi_device *dev, { int i; - for (i = 0; i < insn->n; i++) { + for (i = 0; i < insn->n; i++) data[i] = dev_private->ao_readback & PCI9111_AO_RESOLUTION_MASK; - } return i; } @@ -1222,9 +1217,8 @@ static int pci9111_attach(struct comedi_device *dev, int error, i; const struct pci9111_board *board; - if (alloc_private(dev, sizeof(struct pci9111_private_data)) < 0) { + if (alloc_private(dev, sizeof(struct pci9111_private_data)) < 0) return -ENOMEM; - } /* Probe the device to determine what device in the series it is. */ printk("comedi%d: " PCI9111_DRIVER_NAME " driver\n", dev->minor); @@ -1275,9 +1269,6 @@ found: /* TODO: Warn about non-tested boards. */ - switch (board->device_id) { - }; - /* Read local configuration register base address [PCI_BASE_ADDRESS #1]. */ lcr_io_base = pci_resource_start(pci_device, 1); @@ -1387,21 +1378,19 @@ static int pci9111_detach(struct comedi_device *dev) { /* Reset device */ - if (dev->private != 0) { + if (dev->private != NULL) { if (dev_private->is_valid) pci9111_reset(dev); } /* Release previously allocated irq */ - if (dev->irq != 0) { + if (dev->irq != 0) free_irq(dev->irq, dev); - } - if (dev_private != 0 && dev_private->pci_device != 0) { - if (dev->iobase) { + if (dev_private != NULL && dev_private->pci_device != NULL) { + if (dev->iobase) comedi_pci_disable(dev_private->pci_device); - } pci_dev_put(dev_private->pci_device); } diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index 944f20a..ccef549 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -44,26 +44,25 @@ c) If isn't used DMA then you can use only mode where Configuration options: [0] - PCI bus of device (optional) [1] - PCI slot of device (optional) - If bus/slot is not specified, then first available PCI - card will be used. + If bus/slot is not specified, then first available PCI + card will be used. [2] - 0= standard 8 DIFF/16 SE channels configuration - n= external multiplexer connected, 1<=n<=256 + n = external multiplexer connected, 1 <= n <= 256 [3] - 0=autoselect DMA or EOC interrupts operation - 1=disable DMA mode - 3=disable DMA and INT, only insn interface will work + 1 = disable DMA mode + 3 = disable DMA and INT, only insn interface will work [4] - sample&hold signal - card can generate signal for external S&H board - 0=use SSHO (pin 45) signal is generated in onboard hardware S&H logic - 0!=use ADCHN7 (pin 23) signal is generated from driver, number - say how long delay is requested in ns and sign polarity of the hold - (in this case external multiplexor can serve only 128 channels) + 0 = use SSHO(pin 45) signal is generated in onboard hardware S&H logic + 0 != use ADCHN7(pin 23) signal is generated from driver, number say how + long delay is requested in ns and sign polarity of the hold + (in this case external multiplexor can serve only 128 channels) [5] - 0=stop measure on all hardware errors - 2|=ignore ADOR - A/D Overrun status + 2 | = ignore ADOR - A/D Overrun status 8|=ignore Bover - A/D Burst Mode Overrun status 256|=ignore nFull - A/D FIFO Full status */ #include "../comedidev.h" -#include "../pci_ids.h" #include <linux/delay.h> #include <linux/gfp.h> @@ -74,10 +73,18 @@ Configuration options: #include "comedi_pci.h" #include "comedi_fc.h" +#define PCI_VENDOR_ID_AMCC 0x10e8 + /* paranoid checks are broken */ -#undef PCI9118_PARANOIDCHECK /* if defined, then is used code which control correct channel number on every 12 bit sample */ +#undef PCI9118_PARANOIDCHECK /* + * if defined, then is used code which control + * correct channel number on every 12 bit sample + */ -#undef PCI9118_EXTDEBUG /* if defined then driver prints a lot of messages */ +#undef PCI9118_EXTDEBUG /* + * if defined then driver prints + * a lot of messages + */ #undef DPRINTK #ifdef PCI9118_EXTDEBUG @@ -87,7 +94,10 @@ Configuration options: #endif #define IORANGE_9118 64 /* I hope */ -#define PCI9118_CHANLEN 255 /* len of chanlist, some source say 256, but reality looks like 255 :-( */ +#define PCI9118_CHANLEN 255 /* + * len of chanlist, some source say 256, + * but reality looks like 255 :-( + */ #define PCI9118_CNT0 0x00 /* R/W: 8254 counter 0 */ #define PCI9118_CNT1 0x04 /* R/W: 8254 counter 0 */ @@ -113,20 +123,47 @@ Configuration options: #define AdControl_UniP 0x80 /* 1=bipolar, 0=unipolar */ #define AdControl_Diff 0x40 /* 1=differential, 0= single end inputs */ #define AdControl_SoftG 0x20 /* 1=8254 counter works, 0=counter stops */ -#define AdControl_ExtG 0x10 /* 1=8254 countrol controlled by TGIN(pin 46), 0=controled by SoftG */ -#define AdControl_ExtM 0x08 /* 1=external hardware trigger (pin 44), 0=internal trigger */ -#define AdControl_TmrTr 0x04 /* 1=8254 is iternal trigger source, 0=software trigger is source (register PCI9118_SOFTTRG) */ +#define AdControl_ExtG 0x10 /* + * 1=8254 countrol controlled by TGIN(pin 46), + * 0=controlled by SoftG + */ +#define AdControl_ExtM 0x08 /* + * 1=external hardware trigger (pin 44), + * 0=internal trigger + */ +#define AdControl_TmrTr 0x04 /* + * 1=8254 is iternal trigger source, + * 0=software trigger is source + * (register PCI9118_SOFTTRG) + */ #define AdControl_Int 0x02 /* 1=enable INT, 0=disable */ #define AdControl_Dma 0x01 /* 1=enable DMA, 0=disable */ /* bits from A/D function register (PCI9118_ADFUNC) */ -#define AdFunction_PDTrg 0x80 /* 1=positive, 0=negative digital trigger (only positive is correct) */ -#define AdFunction_PETrg 0x40 /* 1=positive, 0=negative external trigger (only positive is correct) */ +#define AdFunction_PDTrg 0x80 /* + * 1=positive, + * 0=negative digital trigger + * (only positive is correct) + */ +#define AdFunction_PETrg 0x40 /* + * 1=positive, + * 0=negative external trigger + * (only positive is correct) + */ #define AdFunction_BSSH 0x20 /* 1=with sample&hold, 0=without */ #define AdFunction_BM 0x10 /* 1=burst mode, 0=normal mode */ -#define AdFunction_BS 0x08 /* 1=burst mode start, 0=burst mode stop */ -#define AdFunction_PM 0x04 /* 1=post trigger mode, 0=not post trigger */ -#define AdFunction_AM 0x02 /* 1=about trigger mode, 0=not about trigger */ +#define AdFunction_BS 0x08 /* + * 1=burst mode start, + * 0=burst mode stop + */ +#define AdFunction_PM 0x04 /* + * 1=post trigger mode, + * 0=not post trigger + */ +#define AdFunction_AM 0x02 /* + * 1=about trigger mode, + * 0=not about trigger + */ #define AdFunction_Start 0x01 /* 1=trigger start, 0=trigger stop */ /* bits from A/D status register (PCI9118_ADSTAT) */ @@ -178,30 +215,39 @@ static const struct comedi_lrange range_pci9118hg = { 8, { } }; -#define PCI9118_BIPOLAR_RANGES 4 /* used for test on mixture of BIP/UNI ranges */ +#define PCI9118_BIPOLAR_RANGES 4 /* + * used for test on mixture + * of BIP/UNI ranges + */ static int pci9118_attach(struct comedi_device *dev, struct comedi_devconfig *it); static int pci9118_detach(struct comedi_device *dev); struct boardtype { - const char *name; /* board name */ - int vendor_id; /* PCI vendor a device ID of card */ + const char *name; /* board name */ + int vendor_id; /* PCI vendor a device ID of card */ int device_id; - int iorange_amcc; /* iorange for own S5933 region */ - int iorange_9118; /* pass thru card region size */ - int n_aichan; /* num of A/D chans */ - int n_aichand; /* num of A/D chans in diff mode */ - int mux_aichan; /* num of A/D chans with external multiplexor */ - int n_aichanlist; /* len of chanlist */ - int n_aochan; /* num of D/A chans */ - int ai_maxdata; /* resolution of A/D */ - int ao_maxdata; /* resolution of D/A */ - const struct comedi_lrange *rangelist_ai; /* rangelist for A/D */ - const struct comedi_lrange *rangelist_ao; /* rangelist for D/A */ - unsigned int ai_ns_min; /* max sample speed of card v ns */ - unsigned int ai_pacer_min; /* minimal pacer value (c1*c2 or c1 in burst) */ - int half_fifo_size; /* size of FIFO/2 */ + int iorange_amcc; /* iorange for own S5933 region */ + int iorange_9118; /* pass thru card region size */ + int n_aichan; /* num of A/D chans */ + int n_aichand; /* num of A/D chans in diff mode */ + int mux_aichan; /* + * num of A/D chans with + * external multiplexor + */ + int n_aichanlist; /* len of chanlist */ + int n_aochan; /* num of D/A chans */ + int ai_maxdata; /* resolution of A/D */ + int ao_maxdata; /* resolution of D/A */ + const struct comedi_lrange *rangelist_ai; /* rangelist for A/D */ + const struct comedi_lrange *rangelist_ao; /* rangelist for D/A */ + unsigned int ai_ns_min; /* max sample speed of card v ns */ + unsigned int ai_pacer_min; /* + * minimal pacer value + * (c1*c2 or c1 in burst) + */ + int half_fifo_size; /* size of FIFO/2 */ }; @@ -246,63 +292,113 @@ static struct comedi_driver driver_pci9118 = { COMEDI_PCI_INITCLEANUP(driver_pci9118, pci9118_pci_table); struct pci9118_private { - unsigned long iobase_a; /* base+size for AMCC chip */ - unsigned int master; /* master capable */ - struct pci_dev *pcidev; /* ptr to actual pcidev */ - unsigned int usemux; /* we want to use external multiplexor! */ + unsigned long iobase_a; /* base+size for AMCC chip */ + unsigned int master; /* master capable */ + struct pci_dev *pcidev; /* ptr to actual pcidev */ + unsigned int usemux; /* we want to use external multiplexor! */ #ifdef PCI9118_PARANOIDCHECK - unsigned short chanlist[PCI9118_CHANLEN + 1]; /* list of scaned channel */ - unsigned char chanlistlen; /* number of scanlist */ + unsigned short chanlist[PCI9118_CHANLEN + 1]; /* + * list of + * scanned channel + */ + unsigned char chanlistlen; /* number of scanlist */ #endif - unsigned char AdControlReg; /* A/D control register */ - unsigned char IntControlReg; /* Interrupt control register */ - unsigned char AdFunctionReg; /* A/D function register */ - char valid; /* driver is ok */ - char ai_neverending; /* we do unlimited AI */ - unsigned int i8254_osc_base; /* frequence of onboard oscilator */ - unsigned int ai_do; /* what do AI? 0=nothing, 1 to 4 mode */ - unsigned int ai_act_scan; /* how many scans we finished */ - unsigned int ai_buf_ptr; /* data buffer ptr in samples */ - unsigned int ai_n_chan; /* how many channels is measured */ - unsigned int ai_n_scanlen; /* len of actual scanlist */ - unsigned int ai_n_realscanlen; /* what we must transfer for one outgoing scan include front/back adds */ - unsigned int ai_act_dmapos; /* position in actual real stream */ - unsigned int ai_add_front; /* how many channels we must add before scan to satisfy S&H? */ - unsigned int ai_add_back; /* how many channels we must add before scan to satisfy DMA? */ - unsigned int *ai_chanlist; /* actaul chanlist */ + unsigned char AdControlReg; /* A/D control register */ + unsigned char IntControlReg; /* Interrupt control register */ + unsigned char AdFunctionReg; /* A/D function register */ + char valid; /* driver is ok */ + char ai_neverending; /* we do unlimited AI */ + unsigned int i8254_osc_base; /* frequence of onboard oscilator */ + unsigned int ai_do; /* what do AI? 0=nothing, 1 to 4 mode */ + unsigned int ai_act_scan; /* how many scans we finished */ + unsigned int ai_buf_ptr; /* data buffer ptr in samples */ + unsigned int ai_n_chan; /* how many channels is measured */ + unsigned int ai_n_scanlen; /* len of actual scanlist */ + unsigned int ai_n_realscanlen; /* + * what we must transfer for one + * outgoing scan include front/back adds + */ + unsigned int ai_act_dmapos; /* position in actual real stream */ + unsigned int ai_add_front; /* + * how many channels we must add + * before scan to satisfy S&H? + */ + unsigned int ai_add_back; /* + * how many channels we must add + * before scan to satisfy DMA? + */ + unsigned int *ai_chanlist; /* actual chanlist */ unsigned int ai_timer1; unsigned int ai_timer2; unsigned int ai_flags; - char ai12_startstop; /* measure can start/stop on external trigger */ - unsigned int ai_divisor1, ai_divisor2; /* divisors for start of measure on external start */ + char ai12_startstop; /* + * measure can start/stop + * on external trigger + */ + unsigned int ai_divisor1, ai_divisor2; /* + * divisors for start of measure + * on external start + */ unsigned int ai_data_len; short *ai_data; - short ao_data[2]; /* data output buffer */ - unsigned int ai_scans; /* number of scans to do */ - char dma_doublebuf; /* we can use double buffring */ - unsigned int dma_actbuf; /* which buffer is used now */ - short *dmabuf_virt[2]; /* pointers to begin of DMA buffer */ - unsigned long dmabuf_hw[2]; /* hw address of DMA buff */ - unsigned int dmabuf_size[2]; /* size of dma buffer in bytes */ - unsigned int dmabuf_use_size[2]; /* which size we may now used for transfer */ - unsigned int dmabuf_used_size[2]; /* which size was trully used */ + short ao_data[2]; /* data output buffer */ + unsigned int ai_scans; /* number of scans to do */ + char dma_doublebuf; /* we can use double buffring */ + unsigned int dma_actbuf; /* which buffer is used now */ + short *dmabuf_virt[2]; /* + * pointers to begin of + * DMA buffer + */ + unsigned long dmabuf_hw[2]; /* hw address of DMA buff */ + unsigned int dmabuf_size[2]; /* + * size of dma buffer in bytes + */ + unsigned int dmabuf_use_size[2]; /* + * which size we may now use + * for transfer + */ + unsigned int dmabuf_used_size[2]; /* which size was truly used */ unsigned int dmabuf_panic_size[2]; - unsigned int dmabuf_samples[2]; /* size in samples */ - int dmabuf_pages[2]; /* number of pages in buffer */ - unsigned char cnt0_users; /* bit field of 8254 CNT0 users (0-unused, 1-AO, 2-DI, 3-DO) */ - unsigned char exttrg_users; /* bit field of external trigger users (0-AI, 1-AO, 2-DI, 3-DO) */ - unsigned int cnt0_divisor; /* actual CNT0 divisor */ - void (*int_ai_func) (struct comedi_device *, struct comedi_subdevice *, unsigned short, unsigned int, unsigned short); /* ptr to actual interrupt AI function */ - unsigned char ai16bits; /* =1 16 bit card */ - unsigned char usedma; /* =1 use DMA transfer and not INT */ - unsigned char useeoshandle; /* =1 change WAKE_EOS DMA transfer to fit on every second */ - unsigned char usessh; /* =1 turn on S&H support */ - int softsshdelay; /* >0 use software S&H, numer is requested delay in ns */ - unsigned char softsshsample; /* polarity of S&H signal in sample state */ - unsigned char softsshhold; /* polarity of S&H signal in hold state */ - unsigned int ai_maskerr; /* which warning was printed */ - unsigned int ai_maskharderr; /* on which error bits stops */ - unsigned int ai_inttrig_start; /* TRIG_INT for start */ + unsigned int dmabuf_samples[2]; /* size in samples */ + int dmabuf_pages[2]; /* number of pages in buffer */ + unsigned char cnt0_users; /* + * bit field of 8254 CNT0 users + * (0-unused, 1-AO, 2-DI, 3-DO) + */ + unsigned char exttrg_users; /* + * bit field of external trigger + * users(0-AI, 1-AO, 2-DI, 3-DO) + */ + unsigned int cnt0_divisor; /* actual CNT0 divisor */ + void (*int_ai_func) (struct comedi_device *, struct comedi_subdevice *, + unsigned short, + unsigned int, + unsigned short); /* + * ptr to actual interrupt + * AI function + */ + unsigned char ai16bits; /* =1 16 bit card */ + unsigned char usedma; /* =1 use DMA transfer and not INT */ + unsigned char useeoshandle; /* + * =1 change WAKE_EOS DMA transfer + * to fit on every second + */ + unsigned char usessh; /* =1 turn on S&H support */ + int softsshdelay; /* + * >0 use software S&H, + * numer is requested delay in ns + */ + unsigned char softsshsample; /* + * polarity of S&H signal + * in sample state + */ + unsigned char softsshhold; /* + * polarity of S&H signal + * in hold state + */ + unsigned int ai_maskerr; /* which warning was printed */ + unsigned int ai_maskharderr; /* on which error bits stops */ + unsigned int ai_inttrig_start; /* TRIG_INT for start */ }; #define devpriv ((struct pci9118_private *)dev->private) @@ -346,12 +442,19 @@ static int pci9118_insn_read_ai(struct comedi_device *dev, devpriv->AdControlReg = AdControl_Int & 0xff; devpriv->AdFunctionReg = AdFunction_PDTrg | AdFunction_PETrg; - outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC); /* positive triggers, no S&H, no burst, burst stop, no post trigger, no about trigger, trigger stop */ + outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC); + /* + * positive triggers, no S&H, + * no burst, burst stop, + * no post trigger, + * no about trigger, + * trigger stop + */ if (!setup_channel_list(dev, s, 1, &insn->chanspec, 0, 0, 0, 0, 0)) return -EINVAL; - outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ + outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ for (n = 0; n < insn->n; n++) { outw(0, dev->iobase + PCI9118_SOFTTRG); /* start conversion */ @@ -365,7 +468,7 @@ static int pci9118_insn_read_ai(struct comedi_device *dev, comedi_error(dev, "A/D insn timeout"); data[n] = 0; - outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ + outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ return -ETIME; conv_finish: @@ -379,7 +482,7 @@ conv_finish: } } - outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ + outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ return n; } @@ -394,11 +497,11 @@ static int pci9118_insn_write_ao(struct comedi_device *dev, int n, chanreg, ch; ch = CR_CHAN(insn->chanspec); - if (ch) { + if (ch) chanreg = PCI9118_DA2; - } else { + else chanreg = PCI9118_DA1; - } + for (n = 0; n < insn->n; n++) { outl(data[n], dev->iobase + chanreg); @@ -561,11 +664,11 @@ static void pci9118_ai_munge(struct comedi_device *dev, for (i = 0; i < num_samples; i++) { if (devpriv->usedma) array[i] = be16_to_cpu(array[i]); - if (devpriv->ai16bits) { + if (devpriv->ai16bits) array[i] ^= 0x8000; - } else { + else array[i] = (array[i] >> 4) & 0x0fff; - } + } } @@ -590,11 +693,13 @@ static void interrupt_pci9118_ai_onesample(struct comedi_device *dev, #ifdef PCI9118_PARANOIDCHECK if (devpriv->ai16bits == 0) { - if ((sampl & 0x000f) != devpriv->chanlist[s->async->cur_chan]) { /* data dropout! */ + if ((sampl & 0x000f) != devpriv->chanlist[s->async->cur_chan]) { + /* data dropout! */ printk - ("comedi: A/D SAMPL - data dropout: received channel %d, expected %d!\n", - sampl & 0x000f, - devpriv->chanlist[s->async->cur_chan]); + ("comedi: A/D SAMPL - data dropout: " + "received channel %d, expected %d!\n", + sampl & 0x000f, + devpriv->chanlist[s->async->cur_chan]); s->async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA; pci9118_ai_cancel(dev, s); comedi_event(dev, s); @@ -604,11 +709,13 @@ static void interrupt_pci9118_ai_onesample(struct comedi_device *dev, #endif cfc_write_to_buffer(s, sampl); s->async->cur_chan++; - if (s->async->cur_chan >= devpriv->ai_n_scanlen) { /* one scan done */ + if (s->async->cur_chan >= devpriv->ai_n_scanlen) { + /* one scan done */ s->async->cur_chan %= devpriv->ai_n_scanlen; devpriv->ai_act_scan++; if (!(devpriv->ai_neverending)) - if (devpriv->ai_act_scan >= devpriv->ai_scans) { /* all data sampled */ + if (devpriv->ai_act_scan >= devpriv->ai_scans) { + /* all data sampled */ pci9118_ai_cancel(dev, s); s->async->events |= COMEDI_CB_EOA; } @@ -644,16 +751,19 @@ static void interrupt_pci9118_ai_dma(struct comedi_device *dev, comedi_event(dev, s); return; } - if (int_adstat & devpriv->ai_maskerr) -/* if (int_adstat & 0x106) */ + /* if (int_adstat & 0x106) */ if (pci9118_decode_error_status(dev, s, int_adstat)) return; - samplesinbuf = devpriv->dmabuf_use_size[devpriv->dma_actbuf] >> 1; /* number of received real samples */ + samplesinbuf = devpriv->dmabuf_use_size[devpriv->dma_actbuf] >> 1; + /* number of received real samples */ /* DPRINTK("dma_actbuf=%d\n",devpriv->dma_actbuf); */ - if (devpriv->dma_doublebuf) { /* switch DMA buffers if is used double buffering */ + if (devpriv->dma_doublebuf) { /* + * switch DMA buffers if is used + * double buffering + */ next_dma_buf = 1 - devpriv->dma_actbuf; outl(devpriv->dmabuf_hw[next_dma_buf], devpriv->iobase_a + AMCC_OP_REG_MWAR); @@ -666,25 +776,32 @@ static void interrupt_pci9118_ai_dma(struct comedi_device *dev, } if (samplesinbuf) { - m = devpriv->ai_data_len >> 1; /* how many samples is to end of buffer */ -/* DPRINTK("samps=%d m=%d %d %d\n",samplesinbuf,m,s->async->buf_int_count,s->async->buf_int_ptr); */ + m = devpriv->ai_data_len >> 1; /* + * how many samples is to + * end of buffer + */ +/* + * DPRINTK("samps=%d m=%d %d %d\n", + * samplesinbuf,m,s->async->buf_int_count,s->async->buf_int_ptr); + */ sampls = m; move_block_from_dma(dev, s, devpriv->dmabuf_virt[devpriv->dma_actbuf], samplesinbuf); - m = m - sampls; /* m= how many samples was transfered */ + m = m - sampls; /* m= how many samples was transfered */ } /* DPRINTK("YYY\n"); */ if (!devpriv->ai_neverending) - if (devpriv->ai_act_scan >= devpriv->ai_scans) { /* all data sampled */ + if (devpriv->ai_act_scan >= devpriv->ai_scans) { + /* all data sampled */ pci9118_ai_cancel(dev, s); s->async->events |= COMEDI_CB_EOA; } - if (devpriv->dma_doublebuf) { /* switch dma buffers */ + if (devpriv->dma_doublebuf) { /* switch dma buffers */ devpriv->dma_actbuf = 1 - devpriv->dma_actbuf; - } else { /* restart DMA if is not used double buffering */ + } else { /* restart DMA if is not used double buffering */ outl(devpriv->dmabuf_hw[0], devpriv->iobase_a + AMCC_OP_REG_MWAR); outl(devpriv->dmabuf_use_size[0], @@ -705,39 +822,62 @@ static irqreturn_t interrupt_pci9118(int irq, void *d) unsigned int int_daq = 0, int_amcc, int_adstat; if (!dev->attached) - return IRQ_NONE; /* not fully initialized */ + return IRQ_NONE; /* not fully initialized */ - int_daq = inl(dev->iobase + PCI9118_INTSRC) & 0xf; /* get IRQ reasons from card */ - int_amcc = inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR); /* get INT register from AMCC chip */ + int_daq = inl(dev->iobase + PCI9118_INTSRC) & 0xf; + /* get IRQ reasons from card */ + int_amcc = inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR); + /* get INT register from AMCC chip */ -/* DPRINTK("INT daq=0x%01x amcc=0x%08x MWAR=0x%08x MWTC=0x%08x ADSTAT=0x%02x ai_do=%d\n", int_daq, int_amcc, inl(devpriv->iobase_a+AMCC_OP_REG_MWAR), inl(devpriv->iobase_a+AMCC_OP_REG_MWTC), inw(dev->iobase+PCI9118_ADSTAT)&0x1ff,devpriv->ai_do); */ +/* + * DPRINTK("INT daq=0x%01x amcc=0x%08x MWAR=0x%08x + * MWTC=0x%08x ADSTAT=0x%02x ai_do=%d\n", + * int_daq, int_amcc, inl(devpriv->iobase_a+AMCC_OP_REG_MWAR), + * inl(devpriv->iobase_a+AMCC_OP_REG_MWTC), + * inw(dev->iobase+PCI9118_ADSTAT)&0x1ff,devpriv->ai_do); + */ if ((!int_daq) && (!(int_amcc & ANY_S593X_INT))) - return IRQ_NONE; /* interrupt from other source */ + return IRQ_NONE; /* interrupt from other source */ - outl(int_amcc | 0x00ff0000, devpriv->iobase_a + AMCC_OP_REG_INTCSR); /* shutdown IRQ reasons in AMCC */ + outl(int_amcc | 0x00ff0000, devpriv->iobase_a + AMCC_OP_REG_INTCSR); + /* shutdown IRQ reasons in AMCC */ - int_adstat = inw(dev->iobase + PCI9118_ADSTAT) & 0x1ff; /* get STATUS register */ + int_adstat = inw(dev->iobase + PCI9118_ADSTAT) & 0x1ff; + /* get STATUS register */ if (devpriv->ai_do) { if (devpriv->ai12_startstop) - if ((int_adstat & AdStatus_DTH) && (int_daq & Int_DTrg)) { /* start stop of measure */ + if ((int_adstat & AdStatus_DTH) && + (int_daq & Int_DTrg)) { + /* start stop of measure */ if (devpriv->ai12_startstop & START_AI_EXT) { devpriv->ai12_startstop &= ~START_AI_EXT; if (!(devpriv->ai12_startstop & - STOP_AI_EXT)) - pci9118_exttrg_del(dev, EXTTRG_AI); /* deactivate EXT trigger */ - start_pacer(dev, devpriv->ai_do, devpriv->ai_divisor1, devpriv->ai_divisor2); /* start pacer */ + STOP_AI_EXT)) + pci9118_exttrg_del + (dev, EXTTRG_AI); + /* deactivate EXT trigger */ + start_pacer(dev, devpriv->ai_do, + devpriv->ai_divisor1, + devpriv->ai_divisor2); + /* start pacer */ outl(devpriv->AdControlReg, - dev->iobase + PCI9118_ADCNTRL); + dev->iobase + PCI9118_ADCNTRL); } else { if (devpriv->ai12_startstop & - STOP_AI_EXT) { + STOP_AI_EXT) { devpriv->ai12_startstop &= - ~STOP_AI_EXT; - pci9118_exttrg_del(dev, EXTTRG_AI); /* deactivate EXT trigger */ - devpriv->ai_neverending = 0; /* well, on next interrupt from DMA/EOC measure will stop */ + ~STOP_AI_EXT; + pci9118_exttrg_del + (dev, EXTTRG_AI); + /* deactivate EXT trigger */ + devpriv->ai_neverending = 0; + /* + * well, on next interrupt from + * DMA/EOC measure will stop + */ } } } @@ -781,7 +921,8 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev, struct comedi_cmd *cmd) { int err = 0; - int tmp, divisor1 = 0, divisor2 = 0; + int tmp; + unsigned int divisor1 = 0, divisor2 = 0; /* step 1: make sure trigger sources are trivially valid */ @@ -791,20 +932,20 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev, err++; tmp = cmd->scan_begin_src; - if (devpriv->master) { + if (devpriv->master) cmd->scan_begin_src &= TRIG_TIMER | TRIG_EXT | TRIG_FOLLOW; - } else { + else cmd->scan_begin_src &= TRIG_FOLLOW; - } + if (!cmd->scan_begin_src || tmp != cmd->scan_begin_src) err++; tmp = cmd->convert_src; - if (devpriv->master) { + if (devpriv->master) cmd->convert_src &= TRIG_TIMER | TRIG_EXT | TRIG_NOW; - } else { + else cmd->convert_src &= TRIG_TIMER | TRIG_EXT; - } + if (!cmd->convert_src || tmp != cmd->convert_src) err++; @@ -821,7 +962,11 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev, if (err) return 1; - /* step 2: make sure trigger sources are unique and mutually compatible */ + /* + * step 2: + * make sure trigger sources are + * unique and mutually compatible + */ if (cmd->start_src != TRIG_NOW && cmd->start_src != TRIG_INT && cmd->start_src != TRIG_EXT) { @@ -1026,7 +1171,7 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev, if (cmd->chanlist) if (!check_channel_list(dev, s, cmd->chanlist_len, cmd->chanlist, 0, 0)) - return 5; /* incorrect channels list */ + return 5; /* incorrect channels list */ return 0; } @@ -1043,88 +1188,101 @@ static int Compute_and_setup_dma(struct comedi_device *dev) dmalen1 = devpriv->dmabuf_size[1]; DPRINTK("1 dmalen0=%d dmalen1=%d ai_data_len=%d\n", dmalen0, dmalen1, devpriv->ai_data_len); - /* isn't output buff smaller that our DMA buff? */ + /* isn't output buff smaller that our DMA buff? */ if (dmalen0 > (devpriv->ai_data_len)) { - dmalen0 = devpriv->ai_data_len & ~3L; /* allign to 32bit down */ + dmalen0 = devpriv->ai_data_len & ~3L; /* + * align to 32bit down + */ } if (dmalen1 > (devpriv->ai_data_len)) { - dmalen1 = devpriv->ai_data_len & ~3L; /* allign to 32bit down */ + dmalen1 = devpriv->ai_data_len & ~3L; /* + * align to 32bit down + */ } DPRINTK("2 dmalen0=%d dmalen1=%d \n", dmalen0, dmalen1); - /* we want wake up every scan? */ + /* we want wake up every scan? */ if (devpriv->ai_flags & TRIG_WAKE_EOS) { if (dmalen0 < (devpriv->ai_n_realscanlen << 1)) { - /* uff, too short DMA buffer, disable EOS support! */ + /* uff, too short DMA buffer, disable EOS support! */ devpriv->ai_flags &= (~TRIG_WAKE_EOS); printk - ("comedi%d: WAR: DMA0 buf too short, cann't support TRIG_WAKE_EOS (%d<%d)\n", + ("comedi%d: WAR: DMA0 buf too short, can't " + "support TRIG_WAKE_EOS (%d<%d)\n", dev->minor, dmalen0, devpriv->ai_n_realscanlen << 1); } else { - /* short first DMA buffer to one scan */ + /* short first DMA buffer to one scan */ dmalen0 = devpriv->ai_n_realscanlen << 1; DPRINTK - ("21 dmalen0=%d ai_n_realscanlen=%d useeoshandle=%d\n", - dmalen0, devpriv->ai_n_realscanlen, - devpriv->useeoshandle); + ("21 dmalen0=%d ai_n_realscanlen=%d " + "useeoshandle=%d\n", + dmalen0, devpriv->ai_n_realscanlen, + devpriv->useeoshandle); if (devpriv->useeoshandle) dmalen0 += 2; if (dmalen0 < 4) { printk - ("comedi%d: ERR: DMA0 buf len bug? (%d<4)\n", - dev->minor, dmalen0); + ("comedi%d: ERR: DMA0 buf len bug? " + "(%d<4)\n", + dev->minor, dmalen0); dmalen0 = 4; } } } if (devpriv->ai_flags & TRIG_WAKE_EOS) { if (dmalen1 < (devpriv->ai_n_realscanlen << 1)) { - /* uff, too short DMA buffer, disable EOS support! */ + /* uff, too short DMA buffer, disable EOS support! */ devpriv->ai_flags &= (~TRIG_WAKE_EOS); printk - ("comedi%d: WAR: DMA1 buf too short, cann't support TRIG_WAKE_EOS (%d<%d)\n", + ("comedi%d: WAR: DMA1 buf too short, " + "can't support TRIG_WAKE_EOS (%d<%d)\n", dev->minor, dmalen1, devpriv->ai_n_realscanlen << 1); } else { - /* short second DMA buffer to one scan */ + /* short second DMA buffer to one scan */ dmalen1 = devpriv->ai_n_realscanlen << 1; DPRINTK - ("22 dmalen1=%d ai_n_realscanlen=%d useeoshandle=%d\n", + ("22 dmalen1=%d ai_n_realscanlen=%d " + "useeoshandle=%d\n", dmalen1, devpriv->ai_n_realscanlen, devpriv->useeoshandle); if (devpriv->useeoshandle) dmalen1 -= 2; if (dmalen1 < 4) { printk - ("comedi%d: ERR: DMA1 buf len bug? (%d<4)\n", - dev->minor, dmalen1); + ("comedi%d: ERR: DMA1 buf len bug? " + "(%d<4)\n", + dev->minor, dmalen1); dmalen1 = 4; } } } DPRINTK("3 dmalen0=%d dmalen1=%d \n", dmalen0, dmalen1); - /* transfer without TRIG_WAKE_EOS */ + /* transfer without TRIG_WAKE_EOS */ if (!(devpriv->ai_flags & TRIG_WAKE_EOS)) { - /* if it's possible then allign DMA buffers to length of scan */ + /* if it's possible then allign DMA buffers to length of scan */ i = dmalen0; dmalen0 = (dmalen0 / (devpriv->ai_n_realscanlen << 1)) * (devpriv->ai_n_realscanlen << 1); dmalen0 &= ~3L; if (!dmalen0) - dmalen0 = i; /* uff. very long scan? */ + dmalen0 = i; /* uff. very long scan? */ i = dmalen1; dmalen1 = (dmalen1 / (devpriv->ai_n_realscanlen << 1)) * (devpriv->ai_n_realscanlen << 1); dmalen1 &= ~3L; if (!dmalen1) - dmalen1 = i; /* uff. very long scan? */ - /* if measure isn't neverending then test, if it whole fits into one or two DMA buffers */ + dmalen1 = i; /* uff. very long scan? */ + /* + * if measure isn't neverending then test, if it fits whole + * into one or two DMA buffers + */ if (!devpriv->ai_neverending) { - /* fits whole measure into one DMA buffer? */ + /* fits whole measure into one DMA buffer? */ if (dmalen0 > ((devpriv->ai_n_realscanlen << 1) * devpriv->ai_scans)) { @@ -1138,7 +1296,10 @@ static int Compute_and_setup_dma(struct comedi_device *dev) DPRINTK("3.1 dmalen0=%d dmalen1=%d \n", dmalen0, dmalen1); dmalen0 &= ~3L; - } else { /* fits whole measure into two DMA buffer? */ + } else { /* + * fits whole measure into + * two DMA buffer? + */ if (dmalen1 > ((devpriv->ai_n_realscanlen << 1) * devpriv->ai_scans - dmalen0)) @@ -1154,7 +1315,7 @@ static int Compute_and_setup_dma(struct comedi_device *dev) DPRINTK("4 dmalen0=%d dmalen1=%d \n", dmalen0, dmalen1); - /* these DMA buffer size we'll be used */ + /* these DMA buffer size will be used */ devpriv->dma_actbuf = 0; devpriv->dmabuf_use_size[0] = dmalen0; devpriv->dmabuf_use_size[1] = dmalen1; @@ -1176,10 +1337,11 @@ static int Compute_and_setup_dma(struct comedi_device *dev) } #endif - outl(inl(devpriv->iobase_a + AMCC_OP_REG_MCSR) & (~EN_A2P_TRANSFERS), devpriv->iobase_a + AMCC_OP_REG_MCSR); /* stop DMA */ + outl(inl(devpriv->iobase_a + AMCC_OP_REG_MCSR) & (~EN_A2P_TRANSFERS), + devpriv->iobase_a + AMCC_OP_REG_MCSR); /* stop DMA */ outl(devpriv->dmabuf_hw[0], devpriv->iobase_a + AMCC_OP_REG_MWAR); outl(devpriv->dmabuf_use_size[0], devpriv->iobase_a + AMCC_OP_REG_MWTC); - /* init DMA transfer */ + /* init DMA transfer */ outl(0x00000000 | AINT_WRITE_COMPL, devpriv->iobase_a + AMCC_OP_REG_INTCSR); /* outl(0x02000000|AINT_WRITE_COMPL, devpriv->iobase_a+AMCC_OP_REG_INTCSR); */ @@ -1187,7 +1349,9 @@ static int Compute_and_setup_dma(struct comedi_device *dev) outl(inl(devpriv->iobase_a + AMCC_OP_REG_MCSR) | RESET_A2P_FLAGS | A2P_HI_PRIORITY | EN_A2P_TRANSFERS, devpriv->iobase_a + AMCC_OP_REG_MCSR); - outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) | EN_A2P_TRANSFERS, devpriv->iobase_a + AMCC_OP_REG_INTCSR); /* allow bus mastering */ + outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) | EN_A2P_TRANSFERS, + devpriv->iobase_a + AMCC_OP_REG_INTCSR); + /* allow bus mastering */ DPRINTK("adl_pci9118 EDBG: END: Compute_and_setup_dma()\n"); return 0; @@ -1220,17 +1384,21 @@ static int pci9118_ai_docmd_sampl(struct comedi_device *dev, return -EIO; }; - devpriv->int_ai_func = interrupt_pci9118_ai_onesample; /* transfer function */ + devpriv->int_ai_func = interrupt_pci9118_ai_onesample; + /* transfer function */ if (devpriv->ai12_startstop) - pci9118_exttrg_add(dev, EXTTRG_AI); /* activate EXT trigger */ + pci9118_exttrg_add(dev, EXTTRG_AI); + /* activate EXT trigger */ if ((devpriv->ai_do == 1) || (devpriv->ai_do == 2)) devpriv->IntControlReg |= Int_Timer; devpriv->AdControlReg |= AdControl_Int; - outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) | 0x1f00, devpriv->iobase_a + AMCC_OP_REG_INTCSR); /* allow INT in AMCC */ + outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) | 0x1f00, + devpriv->iobase_a + AMCC_OP_REG_INTCSR); + /* allow INT in AMCC */ if (!(devpriv->ai12_startstop & (START_AI_EXT | START_AI_INT))) { outl(devpriv->IntControlReg, dev->iobase + PCI9118_INTCTRL); @@ -1296,10 +1464,12 @@ static int pci9118_ai_docmd_dma(struct comedi_device *dev, }; if (devpriv->ai12_startstop) { - pci9118_exttrg_add(dev, EXTTRG_AI); /* activate EXT trigger */ + pci9118_exttrg_add(dev, EXTTRG_AI); + /* activate EXT trigger */ } - devpriv->int_ai_func = interrupt_pci9118_ai_dma; /* transfer function */ + devpriv->int_ai_func = interrupt_pci9118_ai_dma; + /* transfer function */ outl(0x02000000 | AINT_WRITE_COMPL, devpriv->iobase_a + AMCC_OP_REG_INTCSR); @@ -1342,7 +1512,7 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) devpriv->ai_add_back = 0; devpriv->ai_maskerr = 0x10e; - /* prepare for start/stop conditions */ + /* prepare for start/stop conditions */ if (cmd->start_src == TRIG_EXT) devpriv->ai12_startstop |= START_AI_EXT; if (cmd->stop_src == TRIG_EXT) { @@ -1369,10 +1539,10 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) devpriv->ai_scans = 0; } - /* use sample&hold signal? */ + /* use sample&hold signal? */ if (cmd->convert_src == TRIG_NOW) { devpriv->usessh = 1; - } /* yes */ + } /* yes */ else { devpriv->usessh = 0; } /* no */ @@ -1381,7 +1551,10 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) devpriv->ai_neverending, devpriv->ai_scans, devpriv->usessh, devpriv->ai12_startstop); - /* use additional sample at end of every scan to satisty DMA 32 bit transfer? */ + /* + * use additional sample at end of every scan + * to satisty DMA 32 bit transfer? + */ devpriv->ai_add_front = 0; devpriv->ai_add_back = 0; devpriv->useeoshandle = 0; @@ -1393,27 +1566,44 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) devpriv->ai_add_back = 1; } if (cmd->convert_src == TRIG_TIMER) { - devpriv->usedma = 0; /* use INT transfer if scanlist have only one channel */ + devpriv->usedma = 0; + /* + * use INT transfer if scanlist + * have only one channel + */ } } if ((cmd->flags & TRIG_WAKE_EOS) && (devpriv->ai_n_scanlen & 1) && (devpriv->ai_n_scanlen > 1)) { if (cmd->scan_begin_src == TRIG_FOLLOW) { - /* vpriv->useeoshandle=1; // change DMA transfer block to fit EOS on every second call */ - devpriv->usedma = 0; /* XXX maybe can be corrected to use 16 bit DMA */ - } else { /* well, we must insert one sample to end of EOS to meet 32 bit transfer */ + /* + * vpriv->useeoshandle=1; // change DMA transfer + * block to fit EOS on every second call + */ + devpriv->usedma = 0; + /* + * XXX maybe can be corrected to use 16 bit DMA + */ + } else { /* + * well, we must insert one sample + * to end of EOS to meet 32 bit transfer + */ devpriv->ai_add_back = 1; } } - } else { /* interrupt transfer don't need any correction */ + } else { /* interrupt transfer don't need any correction */ devpriv->usedma = 0; } - /* we need software S&H signal? It add two samples before every scan as minimum */ + /* + * we need software S&H signal? + * It adds two samples before every scan as minimum + */ if (devpriv->usessh && devpriv->softsshdelay) { devpriv->ai_add_front = 2; - if ((devpriv->usedma == 1) && (devpriv->ai_add_back == 1)) { /* move it to front */ + if ((devpriv->usedma == 1) && (devpriv->ai_add_back == 1)) { + /* move it to front */ devpriv->ai_add_front++; devpriv->ai_add_back = 0; } @@ -1422,17 +1612,22 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) addchans = devpriv->softsshdelay / cmd->convert_arg; if (devpriv->softsshdelay % cmd->convert_arg) addchans++; - if (addchans > (devpriv->ai_add_front - 1)) { /* uff, still short :-( */ + if (addchans > (devpriv->ai_add_front - 1)) { + /* uff, still short */ devpriv->ai_add_front = addchans + 1; if (devpriv->usedma == 1) if ((devpriv->ai_add_front + devpriv->ai_n_chan + devpriv->ai_add_back) & 1) - devpriv->ai_add_front++; /* round up to 32 bit */ + devpriv->ai_add_front++; + /* round up to 32 bit */ } } - /* well, we now know what must be all added */ - devpriv->ai_n_realscanlen = /* what we must take from card in real to have ai_n_scanlen on output? */ + /* well, we now know what must be all added */ + devpriv->ai_n_realscanlen = /* + * what we must take from card in real + * to have ai_n_scanlen on output? + */ (devpriv->ai_add_front + devpriv->ai_n_chan + devpriv->ai_add_back) * (devpriv->ai_n_scanlen / devpriv->ai_n_chan); @@ -1443,7 +1638,7 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) devpriv->ai_n_chan, devpriv->ai_add_back, devpriv->ai_n_scanlen); - /* check and setup channel list */ + /* check and setup channel list */ if (!check_channel_list(dev, s, devpriv->ai_n_chan, devpriv->ai_chanlist, devpriv->ai_add_front, devpriv->ai_add_back)) @@ -1454,9 +1649,16 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) devpriv->useeoshandle)) return -EINVAL; - /* compute timers settings */ - /* simplest way, fr=4Mhz/(tim1*tim2), channel manipulation without timers effect */ - if (((cmd->scan_begin_src == TRIG_FOLLOW) || (cmd->scan_begin_src == TRIG_EXT) || (cmd->scan_begin_src == TRIG_INT)) && (cmd->convert_src == TRIG_TIMER)) { /* both timer is used for one time */ + /* compute timers settings */ + /* + * simplest way, fr=4Mhz/(tim1*tim2), + * channel manipulation without timers effect + */ + if (((cmd->scan_begin_src == TRIG_FOLLOW) || + (cmd->scan_begin_src == TRIG_EXT) || + (cmd->scan_begin_src == TRIG_INT)) && + (cmd->convert_src == TRIG_TIMER)) { + /* both timer is used for one time */ if (cmd->scan_begin_src == TRIG_EXT) { devpriv->ai_do = 4; } else { @@ -1472,10 +1674,14 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) devpriv->ai_timer2 = cmd->convert_arg; } - if ((cmd->scan_begin_src == TRIG_TIMER) && ((cmd->convert_src == TRIG_TIMER) || (cmd->convert_src == TRIG_NOW))) { /* double timed action */ + if ((cmd->scan_begin_src == TRIG_TIMER) && + ((cmd->convert_src == TRIG_TIMER) || + (cmd->convert_src == TRIG_NOW))) { + /* double timed action */ if (!devpriv->usedma) { comedi_error(dev, - "cmd->scan_begin_src=TRIG_TIMER works only with bus mastering!"); + "cmd->scan_begin_src=TRIG_TIMER works " + "only with bus mastering!"); return -EIO; } @@ -1496,15 +1702,27 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) devpriv->ai_do = 3; } - start_pacer(dev, -1, 0, 0); /* stop pacer */ + start_pacer(dev, -1, 0, 0); /* stop pacer */ - devpriv->AdControlReg = 0; /* bipolar, S.E., use 8254, stop 8354, internal trigger, soft trigger, disable DMA */ + devpriv->AdControlReg = 0; /* + * bipolar, S.E., use 8254, stop 8354, + * internal trigger, soft trigger, + * disable DMA + */ outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL); - devpriv->AdFunctionReg = AdFunction_PDTrg | AdFunction_PETrg; /* positive triggers, no S&H, no burst, burst stop, no post trigger, no about trigger, trigger stop */ + devpriv->AdFunctionReg = AdFunction_PDTrg | AdFunction_PETrg; + /* + * positive triggers, no S&H, no burst, + * burst stop, no post trigger, + * no about trigger, trigger stop + */ outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC); udelay(1); - outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ - inl(dev->iobase + PCI9118_ADSTAT); /* flush A/D and INT status register */ + outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ + inl(dev->iobase + PCI9118_ADSTAT); /* + * flush A/D and INT + * status register + */ inl(dev->iobase + PCI9118_INTSRC); devpriv->ai_act_scan = 0; @@ -1537,33 +1755,37 @@ static int check_channel_list(struct comedi_device *dev, } if ((frontadd + n_chan + backadd) > s->len_chanlist) { printk - ("comedi%d: range/channel list is too long for actual configuration (%d>%d)!", + ("comedi%d: range/channel list is too long for " + "actual configuration (%d>%d)!", dev->minor, n_chan, s->len_chanlist - frontadd - backadd); return 0; } if (CR_AREF(chanlist[0]) == AREF_DIFF) - differencial = 1; /* all input must be diff */ + differencial = 1; /* all input must be diff */ if (CR_RANGE(chanlist[0]) < PCI9118_BIPOLAR_RANGES) - bipolar = 1; /* all input must be bipolar */ + bipolar = 1; /* all input must be bipolar */ if (n_chan > 1) - for (i = 1; i < n_chan; i++) { /* check S.E/diff */ + for (i = 1; i < n_chan; i++) { /* check S.E/diff */ if ((CR_AREF(chanlist[i]) == AREF_DIFF) != (differencial)) { comedi_error(dev, - "Differencial and single ended inputs cann't be mixtured!"); + "Differencial and single ended " + "inputs can't be mixtured!"); return 0; } if ((CR_RANGE(chanlist[i]) < PCI9118_BIPOLAR_RANGES) != (bipolar)) { comedi_error(dev, - "Bipolar and unipolar ranges cann't be mixtured!"); + "Bipolar and unipolar ranges " + "can't be mixtured!"); return 0; } if ((!devpriv->usemux) & (differencial) & (CR_CHAN(chanlist[i]) >= this_board->n_aichand)) { comedi_error(dev, - "If AREF_DIFF is used then is available only first 8 channels!"); + "If AREF_DIFF is used then is " + "available only first 8 channels!"); return 0; } } @@ -1583,7 +1805,8 @@ static int setup_channel_list(struct comedi_device *dev, unsigned int scanquad, gain, ssh = 0x00; DPRINTK - ("adl_pci9118 EDBG: BGN: setup_channel_list(%d,.,%d,.,%d,%d,%d,%d)\n", + ("adl_pci9118 EDBG: BGN: setup_channel_list" + "(%d,.,%d,.,%d,%d,%d,%d)\n", dev->minor, n_chan, rot, frontadd, backadd, usedma); if (usedma == 1) { @@ -1592,27 +1815,33 @@ static int setup_channel_list(struct comedi_device *dev, } if (CR_AREF(chanlist[0]) == AREF_DIFF) - differencial = 1; /* all input must be diff */ + differencial = 1; /* all input must be diff */ if (CR_RANGE(chanlist[0]) < PCI9118_BIPOLAR_RANGES) - bipolar = 1; /* all input must be bipolar */ + bipolar = 1; /* all input must be bipolar */ - /* All is ok, so we can setup channel/range list */ + /* All is ok, so we can setup channel/range list */ if (!bipolar) { - devpriv->AdControlReg |= AdControl_UniP; /* set unibipolar */ + devpriv->AdControlReg |= AdControl_UniP; + /* set unibipolar */ } else { - devpriv->AdControlReg &= ((~AdControl_UniP) & 0xff); /* enable bipolar */ + devpriv->AdControlReg &= ((~AdControl_UniP) & 0xff); + /* enable bipolar */ } if (differencial) { - devpriv->AdControlReg |= AdControl_Diff; /* enable diff inputs */ + devpriv->AdControlReg |= AdControl_Diff; + /* enable diff inputs */ } else { - devpriv->AdControlReg &= ((~AdControl_Diff) & 0xff); /* set single ended inputs */ + devpriv->AdControlReg &= ((~AdControl_Diff) & 0xff); + /* set single ended inputs */ } - outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL); /* setup mode */ + outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL); + /* setup mode */ - outl(2, dev->iobase + PCI9118_SCANMOD); /* gods know why this sequence! */ + outl(2, dev->iobase + PCI9118_SCANMOD); + /* gods know why this sequence! */ outl(0, dev->iobase + PCI9118_SCANMOD); outl(1, dev->iobase + PCI9118_SCANMOD); @@ -1622,12 +1851,15 @@ static int setup_channel_list(struct comedi_device *dev, devpriv->chanlist[i] = 0x55aa; #endif - if (frontadd) { /* insert channels for S&H */ + if (frontadd) { /* insert channels for S&H */ ssh = devpriv->softsshsample; DPRINTK("FA: %04x: ", ssh); - for (i = 0; i < frontadd; i++) { /* store range list to card */ - scanquad = CR_CHAN(chanlist[0]); /* get channel number; */ - gain = CR_RANGE(chanlist[0]); /* get gain number */ + for (i = 0; i < frontadd; i++) { + /* store range list to card */ + scanquad = CR_CHAN(chanlist[0]); + /* get channel number; */ + gain = CR_RANGE(chanlist[0]); + /* get gain number */ scanquad |= ((gain & 0x03) << 8); outl(scanquad | ssh, dev->iobase + PCI9118_GAIN); DPRINTK("%02x ", scanquad | ssh); @@ -1637,23 +1869,24 @@ static int setup_channel_list(struct comedi_device *dev, } DPRINTK("SL: ", ssh); - for (i = 0; i < n_chan; i++) { /* store range list to card */ - scanquad = CR_CHAN(chanlist[i]); /* get channel number; */ + for (i = 0; i < n_chan; i++) { /* store range list to card */ + scanquad = CR_CHAN(chanlist[i]); /* get channel number */ #ifdef PCI9118_PARANOIDCHECK devpriv->chanlist[i ^ usedma] = (scanquad & 0xf) << rot; #endif - gain = CR_RANGE(chanlist[i]); /* get gain number */ + gain = CR_RANGE(chanlist[i]); /* get gain number */ scanquad |= ((gain & 0x03) << 8); outl(scanquad | ssh, dev->iobase + PCI9118_GAIN); DPRINTK("%02x ", scanquad | ssh); } DPRINTK("\n "); - if (backadd) { /* insert channels for fit onto 32bit DMA */ + if (backadd) { /* insert channels for fit onto 32bit DMA */ DPRINTK("BA: %04x: ", ssh); - for (i = 0; i < backadd; i++) { /* store range list to card */ - scanquad = CR_CHAN(chanlist[0]); /* get channel number; */ - gain = CR_RANGE(chanlist[0]); /* get gain number */ + for (i = 0; i < backadd; i++) { /* store range list to card */ + scanquad = CR_CHAN(chanlist[0]); + /* get channel number */ + gain = CR_RANGE(chanlist[0]); /* get gain number */ scanquad |= ((gain & 0x03) << 8); outl(scanquad | ssh, dev->iobase + PCI9118_GAIN); DPRINTK("%02x ", scanquad | ssh); @@ -1661,30 +1894,33 @@ static int setup_channel_list(struct comedi_device *dev, DPRINTK("\n "); } #ifdef PCI9118_PARANOIDCHECK - devpriv->chanlist[n_chan ^ usedma] = devpriv->chanlist[0 ^ usedma]; /* for 32bit oerations */ + devpriv->chanlist[n_chan ^ usedma] = devpriv->chanlist[0 ^ usedma]; + /* for 32bit operations */ if (useeos) { - for (i = 1; i < n_chan; i++) { /* store range list to card */ + for (i = 1; i < n_chan; i++) { /* store range list to card */ devpriv->chanlist[(n_chan + i) ^ usedma] = (CR_CHAN(chanlist[i]) & 0xf) << rot; } - devpriv->chanlist[(2 * n_chan) ^ usedma] = devpriv->chanlist[0 ^ usedma]; /* for 32bit oerations */ + devpriv->chanlist[(2 * n_chan) ^ usedma] = + devpriv->chanlist[0 ^ usedma]; + /* for 32bit operations */ useeos = 2; } else { useeos = 1; } #ifdef PCI9118_EXTDEBUG DPRINTK("CHL: "); - for (i = 0; i <= (useeos * n_chan); i++) { + for (i = 0; i <= (useeos * n_chan); i++) DPRINTK("%04x ", devpriv->chanlist[i]); - } + DPRINTK("\n "); #endif #endif - outl(0, dev->iobase + PCI9118_SCANMOD); /* close scan queue */ -/* udelay(100); important delay, or first sample will be cripled */ + outl(0, dev->iobase + PCI9118_SCANMOD); /* close scan queue */ + /* udelay(100); important delay, or first sample will be crippled */ DPRINTK("adl_pci9118 EDBG: END: setup_channel_list()\n"); - return 1; /* we can serve this with scan logic */ + return 1; /* we can serve this with scan logic */ } /* @@ -1699,7 +1935,8 @@ static void pci9118_calc_divisors(char mode, struct comedi_device *dev, char usessh, unsigned int chnsshfront) { DPRINTK - ("adl_pci9118 EDBG: BGN: pci9118_calc_divisors(%d,%d,.,%u,%u,%u,%d,.,.,,%u,%u)\n", + ("adl_pci9118 EDBG: BGN: pci9118_calc_divisors" + "(%d,%d,.,%u,%u,%u,%d,.,.,,%u,%u)\n", mode, dev->minor, *tim1, *tim2, flags, chans, usessh, chnsshfront); switch (mode) { case 1: @@ -1716,17 +1953,18 @@ static void pci9118_calc_divisors(char mode, struct comedi_device *dev, *tim2 = this_board->ai_ns_min; DPRINTK("1 div1=%u div2=%u timer1=%u timer2=%u\n", *div1, *div2, *tim1, *tim2); - *div1 = *tim2 / devpriv->i8254_osc_base; /* convert timer (burst) */ + *div1 = *tim2 / devpriv->i8254_osc_base; + /* convert timer (burst) */ DPRINTK("2 div1=%u div2=%u timer1=%u timer2=%u\n", *div1, *div2, *tim1, *tim2); if (*div1 < this_board->ai_pacer_min) *div1 = this_board->ai_pacer_min; DPRINTK("3 div1=%u div2=%u timer1=%u timer2=%u\n", *div1, *div2, *tim1, *tim2); - *div2 = *tim1 / devpriv->i8254_osc_base; /* scan timer */ + *div2 = *tim1 / devpriv->i8254_osc_base; /* scan timer */ DPRINTK("4 div1=%u div2=%u timer1=%u timer2=%u\n", *div1, *div2, *tim1, *tim2); - *div2 = *div2 / *div1; /* major timer is c1*c2 */ + *div2 = *div2 / *div1; /* major timer is c1*c2 */ DPRINTK("5 div1=%u div2=%u timer1=%u timer2=%u\n", *div1, *div2, *tim1, *tim2); if (*div2 < chans) @@ -1734,9 +1972,10 @@ static void pci9118_calc_divisors(char mode, struct comedi_device *dev, DPRINTK("6 div1=%u div2=%u timer1=%u timer2=%u\n", *div1, *div2, *tim1, *tim2); - *tim2 = *div1 * devpriv->i8254_osc_base; /* real convert timer */ + *tim2 = *div1 * devpriv->i8254_osc_base; + /* real convert timer */ - if (usessh & (chnsshfront == 0)) /* use BSSH signal */ + if (usessh & (chnsshfront == 0)) /* use BSSH signal */ if (*div2 < (chans + 2)) *div2 = chans + 2; @@ -1776,11 +2015,13 @@ static void start_pacer(struct comedi_device *dev, int mode, static int pci9118_exttrg_add(struct comedi_device *dev, unsigned char source) { if (source > 3) - return -1; /* incorrect source */ + return -1; /* incorrect source */ devpriv->exttrg_users |= (1 << source); devpriv->IntControlReg |= Int_DTrg; outl(devpriv->IntControlReg, dev->iobase + PCI9118_INTCTRL); - outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) | 0x1f00, devpriv->iobase_a + AMCC_OP_REG_INTCSR); /* allow INT in AMCC */ + outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) | 0x1f00, + devpriv->iobase_a + AMCC_OP_REG_INTCSR); + /* allow INT in AMCC */ return 0; } @@ -1790,12 +2031,15 @@ static int pci9118_exttrg_add(struct comedi_device *dev, unsigned char source) static int pci9118_exttrg_del(struct comedi_device *dev, unsigned char source) { if (source > 3) - return -1; /* incorrect source */ + return -1; /* incorrect source */ devpriv->exttrg_users &= ~(1 << source); - if (!devpriv->exttrg_users) { /* shutdown ext trg intterrupts */ + if (!devpriv->exttrg_users) { /* shutdown ext trg intterrupts */ devpriv->IntControlReg &= ~Int_DTrg; - if (!devpriv->IntControlReg) /* all IRQ disabled */ - outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) & (~0x00001f00), devpriv->iobase_a + AMCC_OP_REG_INTCSR); /* disable int in AMCC */ + if (!devpriv->IntControlReg) /* all IRQ disabled */ + outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) & + (~0x00001f00), + devpriv->iobase_a + AMCC_OP_REG_INTCSR); + /* disable int in AMCC */ outl(devpriv->IntControlReg, dev->iobase + PCI9118_INTCTRL); } return 0; @@ -1808,17 +2052,29 @@ static int pci9118_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) { if (devpriv->usedma) - outl(inl(devpriv->iobase_a + AMCC_OP_REG_MCSR) & (~EN_A2P_TRANSFERS), devpriv->iobase_a + AMCC_OP_REG_MCSR); /* stop DMA */ + outl(inl(devpriv->iobase_a + AMCC_OP_REG_MCSR) & + (~EN_A2P_TRANSFERS), + devpriv->iobase_a + AMCC_OP_REG_MCSR); /* stop DMA */ pci9118_exttrg_del(dev, EXTTRG_AI); - start_pacer(dev, 0, 0, 0); /* stop 8254 counters */ + start_pacer(dev, 0, 0, 0); /* stop 8254 counters */ devpriv->AdFunctionReg = AdFunction_PDTrg | AdFunction_PETrg; - outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC); /* positive triggers, no S&H, no burst, burst stop, no post trigger, no about trigger, trigger stop */ + outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC); + /* + * positive triggers, no S&H, no burst, + * burst stop, no post trigger, + * no about trigger, trigger stop + */ devpriv->AdControlReg = 0x00; - outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL); /* bipolar, S.E., use 8254, stop 8354, internal trigger, soft trigger, disable INT and DMA */ + outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL); + /* + * bipolar, S.E., use 8254, stop 8354, + * internal trigger, soft trigger, + * disable INT and DMA + */ outl(0, dev->iobase + PCI9118_BURST); outl(1, dev->iobase + PCI9118_SCANMOD); - outl(2, dev->iobase + PCI9118_SCANMOD); /* reset scan queue */ - outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ + outl(2, dev->iobase + PCI9118_SCANMOD); /* reset scan queue */ + outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ devpriv->ai_do = 0; devpriv->usedma = 0; @@ -1832,7 +2088,9 @@ static int pci9118_ai_cancel(struct comedi_device *dev, devpriv->dma_actbuf = 0; if (!devpriv->IntControlReg) - outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) | 0x1f00, devpriv->iobase_a + AMCC_OP_REG_INTCSR); /* allow INT in AMCC */ + outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) | 0x1f00, + devpriv->iobase_a + AMCC_OP_REG_INTCSR); + /* allow INT in AMCC */ return 0; } @@ -1845,31 +2103,52 @@ static int pci9118_reset(struct comedi_device *dev) devpriv->IntControlReg = 0; devpriv->exttrg_users = 0; inl(dev->iobase + PCI9118_INTCTRL); - outl(devpriv->IntControlReg, dev->iobase + PCI9118_INTCTRL); /* disable interrupts source */ + outl(devpriv->IntControlReg, dev->iobase + PCI9118_INTCTRL); + /* disable interrupts source */ outl(0x30, dev->iobase + PCI9118_CNTCTRL); /* outl(0xb4, dev->iobase + PCI9118_CNTCTRL); */ - start_pacer(dev, 0, 0, 0); /* stop 8254 counters */ + start_pacer(dev, 0, 0, 0); /* stop 8254 counters */ devpriv->AdControlReg = 0; - outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL); /* bipolar, S.E., use 8254, stop 8354, internal trigger, soft trigger, disable INT and DMA */ + outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL); + /* + * bipolar, S.E., use 8254, + * stop 8354, internal trigger, + * soft trigger, + * disable INT and DMA + */ outl(0, dev->iobase + PCI9118_BURST); outl(1, dev->iobase + PCI9118_SCANMOD); - outl(2, dev->iobase + PCI9118_SCANMOD); /* reset scan queue */ + outl(2, dev->iobase + PCI9118_SCANMOD); /* reset scan queue */ devpriv->AdFunctionReg = AdFunction_PDTrg | AdFunction_PETrg; - outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC); /* positive triggers, no S&H, no burst, burst stop, no post trigger, no about trigger, trigger stop */ + outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC); + /* + * positive triggers, no S&H, + * no burst, burst stop, + * no post trigger, + * no about trigger, + * trigger stop + */ devpriv->ao_data[0] = 2047; devpriv->ao_data[1] = 2047; - outl(devpriv->ao_data[0], dev->iobase + PCI9118_DA1); /* reset A/D outs to 0V */ + outl(devpriv->ao_data[0], dev->iobase + PCI9118_DA1); + /* reset A/D outs to 0V */ outl(devpriv->ao_data[1], dev->iobase + PCI9118_DA2); - outl(0, dev->iobase + PCI9118_DO); /* reset digi outs to L */ + outl(0, dev->iobase + PCI9118_DO); /* reset digi outs to L */ udelay(10); inl(dev->iobase + PCI9118_AD_DATA); - outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ - outl(0, dev->iobase + PCI9118_INTSRC); /* remove INT requests */ - inl(dev->iobase + PCI9118_ADSTAT); /* flush A/D status register */ - inl(dev->iobase + PCI9118_INTSRC); /* flush INT requests */ + outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO */ + outl(0, dev->iobase + PCI9118_INTSRC); /* remove INT requests */ + inl(dev->iobase + PCI9118_ADSTAT); /* flush A/D status register */ + inl(dev->iobase + PCI9118_INTSRC); /* flush INT requests */ devpriv->AdControlReg = 0; - outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL); /* bipolar, S.E., use 8254, stop 8354, internal trigger, soft trigger, disable INT and DMA */ + outl(devpriv->AdControlReg, dev->iobase + PCI9118_ADCNTRL); + /* + * bipolar, S.E., use 8254, + * stop 8354, internal trigger, + * soft trigger, + * disable INT and DMA + */ devpriv->cnt0_users = 0; devpriv->exttrg_users = 0; @@ -1899,7 +2178,7 @@ static int pci9118_attach(struct comedi_device *dev, opt_bus = it->options[0]; opt_slot = it->options[1]; if (it->options[3] & 1) { - master = 0; /* user don't want use bus master */ + master = 0; /* user don't want use bus master */ } else { master = 1; } @@ -1937,17 +2216,17 @@ static int pci9118_attach(struct comedi_device *dev, if (!pcidev) { if (opt_bus || opt_slot) { - printk(" - Card at b:s %d:%d %s\n", + printk(KERN_ERR " - Card at b:s %d:%d %s\n", opt_bus, opt_slot, errstr); } else { - printk(" - Card %s\n", errstr); + printk(KERN_ERR " - Card %s\n", errstr); } return -EIO; } - if (master) { + if (master) pci_set_master(pcidev); - } + pci_bus = pcidev->bus->number; pci_slot = PCI_SLOT(pcidev->devfn); @@ -1956,8 +2235,8 @@ static int pci9118_attach(struct comedi_device *dev, iobase_a = pci_resource_start(pcidev, 0); iobase_9 = pci_resource_start(pcidev, 2); - printk(", b:s:f=%d:%d:%d, io=0x%4lx, 0x%4lx", pci_bus, pci_slot, - pci_func, iobase_9, iobase_a); + printk(KERN_ERR ", b:s:f=%d:%d:%d, io=0x%4lx, 0x%4lx", pci_bus, + pci_slot, pci_func, iobase_9, iobase_a); dev->iobase = iobase_9; dev->board_name = this_board->name; @@ -1968,7 +2247,7 @@ static int pci9118_attach(struct comedi_device *dev, pci9118_reset(dev); if (it->options[3] & 2) - irq = 0; /* user don't want use IRQ */ + irq = 0; /* user don't want use IRQ */ if (irq > 0) { if (request_irq(irq, interrupt_pci9118, IRQF_SHARED, "ADLink PCI-9118", dev)) { @@ -1984,7 +2263,7 @@ static int pci9118_attach(struct comedi_device *dev, dev->irq = irq; - if (master) { /* alloc DMA buffers */ + if (master) { /* alloc DMA buffers */ devpriv->dma_doublebuf = 0; for (i = 0; i < 2; i++) { for (pages = 4; pages >= 0; pages--) { @@ -2024,16 +2303,18 @@ static int pci9118_attach(struct comedi_device *dev, if (it->options[2] > 0) { devpriv->usemux = it->options[2]; if (devpriv->usemux > 256) - devpriv->usemux = 256; /* max 256 channels! */ + devpriv->usemux = 256; /* max 256 channels! */ if (it->options[4] > 0) if (devpriv->usemux > 128) { - devpriv->usemux = 128; /* max 128 channels with softare S&H! */ + devpriv->usemux = 128; + /* max 128 channels with softare S&H! */ } printk(", ext. mux %d channels", devpriv->usemux); } devpriv->softsshdelay = it->options[4]; - if (devpriv->softsshdelay < 0) { /* select sample&hold signal polarity */ + if (devpriv->softsshdelay < 0) { + /* select sample&hold signal polarity */ devpriv->softsshdelay = -devpriv->softsshdelay; devpriv->softsshsample = 0x80; devpriv->softsshhold = 0x00; @@ -2045,7 +2326,8 @@ static int pci9118_attach(struct comedi_device *dev, printk(".\n"); pci_read_config_word(devpriv->pcidev, PCI_COMMAND, &u16w); - pci_write_config_word(devpriv->pcidev, PCI_COMMAND, u16w | 64); /* Enable parity check for parity error */ + pci_write_config_word(devpriv->pcidev, PCI_COMMAND, u16w | 64); + /* Enable parity check for parity error */ ret = alloc_subdevices(dev, 4); if (ret < 0) @@ -2055,11 +2337,11 @@ static int pci9118_attach(struct comedi_device *dev, dev->read_subdev = s; s->type = COMEDI_SUBD_AI; s->subdev_flags = SDF_READABLE | SDF_COMMON | SDF_GROUND | SDF_DIFF; - if (devpriv->usemux) { + if (devpriv->usemux) s->n_chan = devpriv->usemux; - } else { + else s->n_chan = this_board->n_aichan; - } + s->maxdata = this_board->ai_maxdata; s->len_chanlist = this_board->n_aichanlist; s->range_table = this_board->rangelist_ai; @@ -2103,9 +2385,10 @@ static int pci9118_attach(struct comedi_device *dev, s->insn_bits = pci9118_insn_bits_do; devpriv->valid = 1; - devpriv->i8254_osc_base = 250; /* 250ns=4MHz */ - devpriv->ai_maskharderr = 0x10a; /* default measure crash condition */ - if (it->options[5]) /* disable some requested */ + devpriv->i8254_osc_base = 250; /* 250ns=4MHz */ + devpriv->ai_maskharderr = 0x10a; + /* default measure crash condition */ + if (it->options[5]) /* disable some requested */ devpriv->ai_maskharderr &= ~it->options[5]; switch (this_board->ai_maxdata) { @@ -2130,9 +2413,9 @@ static int pci9118_detach(struct comedi_device *dev) if (dev->irq) free_irq(dev->irq, dev); if (devpriv->pcidev) { - if (dev->iobase) { + if (dev->iobase) comedi_pci_disable(devpriv->pcidev); - } + pci_dev_put(devpriv->pcidev); } if (devpriv->dmabuf_virt[0]) diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index 394d2ea..67c4f11 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -63,6 +63,8 @@ Configuration options: #define DPRINTK(fmt, args...) #endif +#define PCI_VENDOR_ID_ADVANTECH 0x13fe + /* hardware types of the cards */ #define TYPE_PCI171X 0 #define TYPE_PCI1713 2 @@ -657,9 +659,9 @@ static void interrupt_pci1710_every_sample(void *d) #endif ++s->async->cur_chan; - if (s->async->cur_chan >= devpriv->ai_n_chan) { + if (s->async->cur_chan >= devpriv->ai_n_chan) s->async->cur_chan = 0; - } + if (s->async->cur_chan == 0) { /* one scan done */ devpriv->ai_act_scan++; @@ -863,12 +865,12 @@ static int pci171x_ai_docmd_and_mode(int mode, struct comedi_device *dev, devpriv->ai_eos = 0; } - if ((devpriv->ai_scans == 0) || (devpriv->ai_scans == -1)) { + if ((devpriv->ai_scans == 0) || (devpriv->ai_scans == -1)) devpriv->neverending_ai = 1; - } /* well, user want neverending */ - else { + /* well, user want neverending */ + else devpriv->neverending_ai = 0; - } + switch (mode) { case 1: case 2: @@ -935,7 +937,8 @@ static int pci171x_ai_cmdtest(struct comedi_device *dev, struct comedi_cmd *cmd) { int err = 0; - int tmp, divisor1 = 0, divisor2 = 0; + int tmp; + unsigned int divisor1 = 0, divisor2 = 0; DPRINTK("adv_pci1710 EDBG: BGN: pci171x_ai_cmdtest(...)\n"); #ifdef PCI171X_EXTDEBUG @@ -1109,11 +1112,11 @@ static int pci171x_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) devpriv->ai_timer1 = 0; devpriv->ai_timer2 = 0; - if (cmd->stop_src == TRIG_COUNT) { + if (cmd->stop_src == TRIG_COUNT) devpriv->ai_scans = cmd->stop_arg; - } else { + else devpriv->ai_scans = 0; - } + if (cmd->scan_begin_src == TRIG_FOLLOW) { /* mode 1, 2, 3 */ if (cmd->convert_src == TRIG_TIMER) { /* mode 1 and 2 */ @@ -1593,9 +1596,9 @@ static int pci1710_detach(struct comedi_device *dev) if (dev->irq) free_irq(dev->irq, dev); if (devpriv->pcidev) { - if (dev->iobase) { + if (dev->iobase) comedi_pci_disable(devpriv->pcidev); - } + pci_dev_put(devpriv->pcidev); } } diff --git a/drivers/staging/comedi/drivers/adv_pci1723.c b/drivers/staging/comedi/drivers/adv_pci1723.c index 6b0b7ed..9fe8fcc 100644 --- a/drivers/staging/comedi/drivers/adv_pci1723.c +++ b/drivers/staging/comedi/drivers/adv_pci1723.c @@ -52,7 +52,7 @@ TODO: #include "comedi_pci.h" -#define ADVANTECH_VENDOR 0x13fe /* Advantech PCI vendor ID */ +#define PCI_VENDOR_ID_ADVANTECH 0x13fe /* Advantech PCI vendor ID */ /* hardware types of the cards */ #define TYPE_PCI1723 0 @@ -60,35 +60,57 @@ TODO: #define IORANGE_1723 0x2A /* all the registers for the pci1723 board */ -#define PCI1723_DA(N) ((N)<<1) /* W: D/A register N (0 to 7) */ - -#define PCI1723_SYN_SET 0x12 /*synchronized set register */ -#define PCI1723_ALL_CHNNELE_SYN_STROBE 0x12 /*synchronized status register */ - -#define PCI1723_RANGE_CALIBRATION_MODE 0x14 /* range and calibration mode */ -#define PCI1723_RANGE_CALIBRATION_STATUS 0x14 /* range and calibration status */ - -#define PCI1723_CONTROL_CMD_CALIBRATION_FUN 0x16 /* SADC control command for calibration function */ -#define PCI1723_STATUS_CMD_CALIBRATION_FUN 0x16 /* SADC control status for calibration function */ - -#define PCI1723_CALIBRATION_PARA_STROBE 0x18 /* Calibration parameter strobe */ +#define PCI1723_DA(N) ((N)<<1) /* W: D/A register N (0 to 7) */ + +#define PCI1723_SYN_SET 0x12 /* synchronized set register */ +#define PCI1723_ALL_CHNNELE_SYN_STROBE 0x12 + /* synchronized status register */ + +#define PCI1723_RANGE_CALIBRATION_MODE 0x14 + /* range and calibration mode */ +#define PCI1723_RANGE_CALIBRATION_STATUS 0x14 + /* range and calibration status */ + +#define PCI1723_CONTROL_CMD_CALIBRATION_FUN 0x16 + /* + * SADC control command for + * calibration function + */ +#define PCI1723_STATUS_CMD_CALIBRATION_FUN 0x16 + /* + * SADC control status for + * calibration function + */ + +#define PCI1723_CALIBRATION_PARA_STROBE 0x18 + /* Calibration parameter strobe */ #define PCI1723_DIGITAL_IO_PORT_SET 0x1A /* Digital I/O port setting */ #define PCI1723_DIGITAL_IO_PORT_MODE 0x1A /* Digital I/O port mode */ -#define PCI1723_WRITE_DIGITAL_OUTPUT_CMD 0x1C /* Write digital output command */ +#define PCI1723_WRITE_DIGITAL_OUTPUT_CMD 0x1C + /* Write digital output command */ #define PCI1723_READ_DIGITAL_INPUT_DATA 0x1C /* Read digital input data */ -#define PCI1723_WRITE_CAL_CMD 0x1E /* Write calibration command */ -#define PCI1723_READ_CAL_STATUS 0x1E /* Read calibration status */ +#define PCI1723_WRITE_CAL_CMD 0x1E /* Write calibration command */ +#define PCI1723_READ_CAL_STATUS 0x1E /* Read calibration status */ -#define PCI1723_SYN_STROBE 0x20 /* Synchronized strobe */ +#define PCI1723_SYN_STROBE 0x20 /* Synchronized strobe */ -#define PCI1723_RESET_ALL_CHN_STROBE 0x22 /* Reset all D/A channels strobe */ +#define PCI1723_RESET_ALL_CHN_STROBE 0x22 + /* Reset all D/A channels strobe */ -#define PCI1723_RESET_CAL_CONTROL_STROBE 0x24 /* Reset the calibration controller strobe */ +#define PCI1723_RESET_CAL_CONTROL_STROBE 0x24 + /* + * Reset the calibration + * controller strobe + */ -#define PCI1723_CHANGE_CHA_OUTPUT_TYPE_STROBE 0x26 /* Change D/A channels output type strobe */ +#define PCI1723_CHANGE_CHA_OUTPUT_TYPE_STROBE 0x26 + /* + * Change D/A channels output + * type strobe + */ #define PCI1723_SELECT_CALIBRATION 0x28 /* Select the calibration Ref_V */ @@ -104,20 +126,20 @@ static const struct comedi_lrange range_pci1723 = { 1, { */ struct pci1723_board { const char *name; - int vendor_id; /* PCI vendor a device ID of card */ + int vendor_id; /* PCI vendor a device ID of card */ int device_id; int iorange; char cardtype; - int n_aochan; /* num of D/A chans */ - int n_diochan; /* num of DIO chans */ - int ao_maxdata; /* resolution of D/A */ - const struct comedi_lrange *rangelist_ao; /* rangelist for D/A */ + int n_aochan; /* num of D/A chans */ + int n_diochan; /* num of DIO chans */ + int ao_maxdata; /* resolution of D/A */ + const struct comedi_lrange *rangelist_ao; /* rangelist for D/A */ }; static const struct pci1723_board boardtypes[] = { { .name = "pci1723", - .vendor_id = ADVANTECH_VENDOR, + .vendor_id = PCI_VENDOR_ID_ADVANTECH, .device_id = 0x1723, .iorange = IORANGE_1723, .cardtype = TYPE_PCI1723, @@ -128,8 +150,10 @@ static const struct pci1723_board boardtypes[] = { }, }; -/* This is used by modprobe to translate PCI IDs to drivers. Should - * only be used for PCI and ISA-PnP devices */ +/* + * This is used by modprobe to translate PCI IDs to drivers. + * Should only be used for PCI and ISA-PnP devices + */ static DEFINE_PCI_DEVICE_TABLE(pci1723_pci_table) = { { PCI_VENDOR_ID_ADVANTECH, 0x1723, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { @@ -157,47 +181,47 @@ static struct comedi_driver driver_pci1723 = { .detach = pci1723_detach, }; -/* this structure is for data unique to this hardware driver. */ +/* This structure is for data unique to this hardware driver. */ struct pci1723_private { int valid; /* card is usable; */ struct pci_dev *pcidev; - unsigned char da_range[8]; /* D/A output range for each channel */ + unsigned char da_range[8]; /* D/A output range for each channel */ - short ao_data[8]; /* data output buffer */ + short ao_data[8]; /* data output buffer */ }; -/*the following macro to make it easy to -* access the private structure. -*/ +/* The following macro to make it easy to access the private structure. */ #define devpriv ((struct pci1723_private *)dev->private) #define this_board boardtypes /* - * the pci1723 card reset; + * The pci1723 card reset; */ static int pci1723_reset(struct comedi_device *dev) { int i; DPRINTK("adv_pci1723 EDBG: BGN: pci1723_reset(...)\n"); - outw(0x01, dev->iobase + PCI1723_SYN_SET); /* set synchronous output mode */ + outw(0x01, dev->iobase + PCI1723_SYN_SET); + /* set synchronous output mode */ for (i = 0; i < 8; i++) { - /* set all outputs to 0V */ + /* set all outputs to 0V */ devpriv->ao_data[i] = 0x8000; outw(devpriv->ao_data[i], dev->iobase + PCI1723_DA(i)); - /* set all ranges to +/- 10V */ + /* set all ranges to +/- 10V */ devpriv->da_range[i] = 0; outw(((devpriv->da_range[i] << 4) | i), PCI1723_RANGE_CALIBRATION_MODE); } - outw(0, dev->iobase + PCI1723_CHANGE_CHA_OUTPUT_TYPE_STROBE); /* update ranges */ - outw(0, dev->iobase + PCI1723_SYN_STROBE); /* update outputs */ + outw(0, dev->iobase + PCI1723_CHANGE_CHA_OUTPUT_TYPE_STROBE); + /* update ranges */ + outw(0, dev->iobase + PCI1723_SYN_STROBE); /* update outputs */ - /* set asynchronous output mode */ + /* set asynchronous output mode */ outw(0, dev->iobase + PCI1723_SYN_SET); DPRINTK("adv_pci1723 EDBG: END: pci1723_reset(...)\n"); @@ -251,11 +275,11 @@ static int pci1723_dio_insn_config(struct comedi_device *dev, unsigned short dio_mode; mask = 1 << CR_CHAN(insn->chanspec); - if (mask & 0x00FF) { + if (mask & 0x00FF) bits = 0x00FF; - } else { + else bits = 0xFF00; - } + switch (data[0]) { case INSN_CONFIG_DIO_INPUT: s->io_bits &= ~bits; @@ -270,12 +294,12 @@ static int pci1723_dio_insn_config(struct comedi_device *dev, return -EINVAL; } - /* update hardware DIO mode */ - dio_mode = 0x0000; /* low byte output, high byte output */ + /* update hardware DIO mode */ + dio_mode = 0x0000; /* low byte output, high byte output */ if ((s->io_bits & 0x00FF) == 0) - dio_mode |= 0x0001; /* low byte input */ + dio_mode |= 0x0001; /* low byte input */ if ((s->io_bits & 0xFF00) == 0) - dio_mode |= 0x0002; /* high byte input */ + dio_mode |= 0x0002; /* high byte input */ outw(dio_mode, dev->iobase + PCI1723_DIGITAL_IO_PORT_SET); return 1; } @@ -311,7 +335,8 @@ static int pci1723_attach(struct comedi_device *dev, int opt_bus, opt_slot; const char *errstr; - printk("comedi%d: adv_pci1723: board=%s", dev->minor, this_board->name); + printk(KERN_ERR "comedi%d: adv_pci1723: board=%s", + dev->minor, this_board->name); opt_bus = it->options[0]; opt_slot = it->options[1]; @@ -349,10 +374,10 @@ static int pci1723_attach(struct comedi_device *dev, if (!pcidev) { if (opt_bus || opt_slot) { - printk(" - Card at b:s %d:%d %s\n", - opt_bus, opt_slot, errstr); + printk(KERN_ERR " - Card at b:s %d:%d %s\n", + opt_bus, opt_slot, errstr); } else { - printk(" - Card %s\n", errstr); + printk(KERN_ERR " - Card %s\n", errstr); } return -EIO; } @@ -362,8 +387,8 @@ static int pci1723_attach(struct comedi_device *dev, pci_func = PCI_FUNC(pcidev->devfn); iobase = pci_resource_start(pcidev, 2); - printk(", b:s:f=%d:%d:%d, io=0x%4x", pci_bus, pci_slot, pci_func, - iobase); + printk(KERN_ERR ", b:s:f=%d:%d:%d, io=0x%4x", + pci_bus, pci_slot, pci_func, iobase); dev->iobase = iobase; @@ -398,22 +423,23 @@ static int pci1723_attach(struct comedi_device *dev, s->insn_write = pci1723_ao_write_winsn; s->insn_read = pci1723_insn_read_ao; - /* read DIO config */ - switch (inw(dev->iobase + PCI1723_DIGITAL_IO_PORT_MODE) & 0x03) { - case 0x00: /* low byte output, high byte output */ + /* read DIO config */ + switch (inw(dev->iobase + PCI1723_DIGITAL_IO_PORT_MODE) + & 0x03) { + case 0x00: /* low byte output, high byte output */ s->io_bits = 0xFFFF; break; - case 0x01: /* low byte input, high byte output */ + case 0x01: /* low byte input, high byte output */ s->io_bits = 0xFF00; break; - case 0x02: /* low byte output, high byte input */ + case 0x02: /* low byte output, high byte input */ s->io_bits = 0x00FF; break; - case 0x03: /* low byte input, high byte input */ + case 0x03: /* low byte input, high byte input */ s->io_bits = 0x0000; break; } - /* read DIO port state */ + /* read DIO port state */ s->state = inw(dev->iobase + PCI1723_READ_DIGITAL_INPUT_DATA); subdev++; @@ -450,16 +476,15 @@ static int pci1723_attach(struct comedi_device *dev, */ static int pci1723_detach(struct comedi_device *dev) { - printk("comedi%d: pci1723: remove\n", dev->minor); + printk(KERN_ERR "comedi%d: pci1723: remove\n", dev->minor); if (dev->private) { if (devpriv->valid) pci1723_reset(dev); if (devpriv->pcidev) { - if (dev->iobase) { + if (dev->iobase) comedi_pci_disable(devpriv->pcidev); - } pci_dev_put(devpriv->pcidev); } } diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c index 61d35fe..40eeecf 100644 --- a/drivers/staging/comedi/drivers/adv_pci_dio.c +++ b/drivers/staging/comedi/drivers/adv_pci_dio.c @@ -45,6 +45,8 @@ Configuration options: #define DPRINTK(fmt, args...) #endif +#define PCI_VENDOR_ID_ADVANTECH 0x13fe + /* hardware types of the cards */ enum hw_cards_id { TYPE_PCI1730, TYPE_PCI1733, TYPE_PCI1734, TYPE_PCI1736, @@ -367,9 +369,9 @@ static int pci_dio_insn_bits_di_b(struct comedi_device *dev, int i; data[1] = 0; - for (i = 0; i < d->regs; i++) { + for (i = 0; i < d->regs; i++) data[1] |= inb(dev->iobase + d->addr + i) << (8 * i); - } + return 2; } @@ -882,9 +884,9 @@ static int CheckAndAllocCard(struct comedi_device *dev, struct pci_dio_private *pr, *prev; for (pr = pci_priv, prev = NULL; pr != NULL; prev = pr, pr = pr->next) { - if (pr->pcidev == pcidev) { + if (pr->pcidev == pcidev) return 0; /* this card is used, look for another */ - } + } if (prev) { @@ -1040,22 +1042,22 @@ static int pci_dio_detach(struct comedi_device *dev) int subdev; if (dev->private) { - if (devpriv->valid) { + if (devpriv->valid) pci_dio_reset(dev); - } + /* This shows the silliness of using this kind of * scheme for numbering subdevices. Don't do it. --ds */ subdev = 0; for (i = 0; i < MAX_DI_SUBDEVS; i++) { - if (this_board->sdi[i].chans) { + if (this_board->sdi[i].chans) subdev++; - } + } for (i = 0; i < MAX_DO_SUBDEVS; i++) { - if (this_board->sdo[i].chans) { + if (this_board->sdo[i].chans) subdev++; - } + } for (i = 0; i < MAX_DIO_SUBDEVG; i++) { for (j = 0; j < this_board->sdio[i].regs; j++) { @@ -1071,20 +1073,20 @@ static int pci_dio_detach(struct comedi_device *dev) } if (devpriv->pcidev) { - if (dev->iobase) { + if (dev->iobase) comedi_pci_disable(devpriv->pcidev); - } + pci_dev_put(devpriv->pcidev); } - if (devpriv->prev) { + if (devpriv->prev) devpriv->prev->next = devpriv->next; - } else { + else pci_priv = devpriv->next; - } - if (devpriv->next) { + + if (devpriv->next) devpriv->next->prev = devpriv->prev; - } + } return 0; diff --git a/drivers/staging/comedi/drivers/aio_aio12_8.c b/drivers/staging/comedi/drivers/aio_aio12_8.c index c4cac66..7a1c636 100644 --- a/drivers/staging/comedi/drivers/aio_aio12_8.c +++ b/drivers/staging/comedi/drivers/aio_aio12_8.c @@ -110,7 +110,7 @@ static int aio_aio12_8_ai_read(struct comedi_device *dev, while (timeout && !(inb(dev->iobase + AIO12_8_STATUS) & STATUS_ADC_EOC)) { timeout--; - printk("timeout %d\n", timeout); + printk(KERN_ERR "timeout %d\n", timeout); udelay(1); } if (timeout == 0) { @@ -172,7 +172,7 @@ static int aio_aio12_8_attach(struct comedi_device *dev, iobase = it->options[0]; if (!request_region(iobase, 24, "aio_aio12_8")) { - printk("I/O port conflict"); + printk(KERN_ERR "I/O port conflict"); return -EIO; } diff --git a/drivers/staging/comedi/drivers/amplc_dio200.c b/drivers/staging/comedi/drivers/amplc_dio200.c index 92bcc205..8eb6765 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200.c +++ b/drivers/staging/comedi/drivers/amplc_dio200.c @@ -218,7 +218,7 @@ order they appear in the channel list. #define DIO200_DRIVER_NAME "amplc_dio200" /* PCI IDs */ -/* #define PCI_VENDOR_ID_AMPLICON 0x14dc */ +#define PCI_VENDOR_ID_AMPLICON 0x14dc #define PCI_DEVICE_ID_AMPLICON_PCI272 0x000a #define PCI_DEVICE_ID_AMPLICON_PCI215 0x000b #define PCI_DEVICE_ID_INVALID 0xffff @@ -661,7 +661,7 @@ dio200_inttrig_start_intr(struct comedi_device *dev, struct comedi_subdevice *s, subpriv = s->private; spin_lock_irqsave(&subpriv->spinlock, flags); - s->async->inttrig = 0; + s->async->inttrig = NULL; if (subpriv->active) event = dio200_start_intr(dev, s); @@ -1364,7 +1364,7 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it) break; case sd_8255: /* digital i/o subdevice (8255) */ - ret = subdev_8255_init(dev, s, 0, + ret = subdev_8255_init(dev, s, NULL, iobase + layout->sdinfo[n]); if (ret < 0) return ret; diff --git a/drivers/staging/comedi/drivers/amplc_pci224.c b/drivers/staging/comedi/drivers/amplc_pci224.c index c54cca8..c486a87 100644 --- a/drivers/staging/comedi/drivers/amplc_pci224.c +++ b/drivers/staging/comedi/drivers/amplc_pci224.c @@ -118,7 +118,7 @@ Caveats: /* * PCI IDs. */ -/* #define PCI_VENDOR_ID_AMPLICON 0x14dc */ +#define PCI_VENDOR_ID_AMPLICON 0x14dc #define PCI_DEVICE_ID_AMPLICON_PCI224 0x0007 #define PCI_DEVICE_ID_AMPLICON_PCI234 0x0008 #define PCI_DEVICE_ID_INVALID 0xffff @@ -496,9 +496,9 @@ pci224_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, /* Writing a list of values to an AO channel is probably not * very useful, but that's how the interface is defined. */ - for (i = 0; i < insn->n; i++) { + for (i = 0; i < insn->n; i++) pci224_ao_set_data(dev, chan, range, data[i]); - } + return i; } @@ -519,9 +519,9 @@ pci224_ao_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, chan = CR_CHAN(insn->chanspec); - for (i = 0; i < insn->n; i++) { + for (i = 0; i < insn->n; i++) data[i] = devpriv->ao_readback[chan]; - } + return i; } @@ -544,9 +544,9 @@ static void pci224_ao_stop(struct comedi_device *dev, { unsigned long flags; - if (!test_and_clear_bit(AO_CMD_STARTED, &devpriv->state)) { + if (!test_and_clear_bit(AO_CMD_STARTED, &devpriv->state)) return; - } + spin_lock_irqsave(&devpriv->ao_spinlock, flags); /* Kill the interrupts. */ @@ -597,11 +597,11 @@ static void pci224_ao_start(struct comedi_device *dev, } else { /* Enable interrupts. */ spin_lock_irqsave(&devpriv->ao_spinlock, flags); - if (cmd->stop_src == TRIG_EXT) { + if (cmd->stop_src == TRIG_EXT) devpriv->intsce = PCI224_INTR_EXT | PCI224_INTR_DAC; - } else { + else devpriv->intsce = PCI224_INTR_DAC; - } + outb(devpriv->intsce, devpriv->iobase1 + PCI224_INT_SCE); spin_unlock_irqrestore(&devpriv->ao_spinlock, flags); } @@ -630,9 +630,9 @@ static void pci224_ao_handle_fifo(struct comedi_device *dev, num_scans = comedi_buf_read_n_available(s->async) / bytes_per_scan; if (!devpriv->ao_stop_continuous) { /* Fixed number of scans. */ - if (num_scans > devpriv->ao_stop_count) { + if (num_scans > devpriv->ao_stop_count) num_scans = devpriv->ao_stop_count; - } + } /* Determine how much room is in the FIFO (in samples). */ @@ -669,13 +669,13 @@ static void pci224_ao_handle_fifo(struct comedi_device *dev, } } /* Determine how many new scans can be put in the FIFO. */ - if (cmd->chanlist_len) { + if (cmd->chanlist_len) room /= cmd->chanlist_len; - } + /* Determine how many scans to process. */ - if (num_scans > room) { + if (num_scans > room) num_scans = room; - } + /* Process scans. */ for (n = 0; n < num_scans; n++) { cfc_read_array_from_buffer(s, &devpriv->ao_scan_vals[0], @@ -718,19 +718,19 @@ static void pci224_ao_handle_fifo(struct comedi_device *dev, trig = PCI224_DACCON_TRIG_Z2CT0; } else { /* cmd->scan_begin_src == TRIG_EXT */ - if (cmd->scan_begin_arg & CR_INVERT) { + if (cmd->scan_begin_arg & CR_INVERT) trig = PCI224_DACCON_TRIG_EXTN; - } else { + else trig = PCI224_DACCON_TRIG_EXTP; - } + } devpriv->daccon = COMBINE(devpriv->daccon, trig, PCI224_DACCON_TRIG_MASK); outw(devpriv->daccon, dev->iobase + PCI224_DACCON); } - if (s->async->events) { + if (s->async->events) comedi_event(dev, s); - } + } /* @@ -855,9 +855,9 @@ pci224_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, err++; } tmp = cmd->chanlist_len * CONVERT_PERIOD; - if (tmp < MIN_SCAN_PERIOD) { + if (tmp < MIN_SCAN_PERIOD) tmp = MIN_SCAN_PERIOD; - } + if (cmd->scan_begin_arg < tmp) { cmd->scan_begin_arg = tmp; err++; @@ -966,9 +966,9 @@ pci224_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, devpriv->cached_div1 = div1; devpriv->cached_div2 = div2; } - if (tmp != cmd->scan_begin_arg) { + if (tmp != cmd->scan_begin_arg) err++; - } + } if (err) @@ -994,13 +994,13 @@ pci224_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, tmp = 0; for (n = 0; n < cmd->chanlist_len; n++) { ch = CR_CHAN(cmd->chanlist[n]); - if (tmp & (1U << ch)) { + if (tmp & (1U << ch)) errors |= dupchan_err; - } + tmp |= (1U << ch); - if (CR_RANGE(cmd->chanlist[n]) != range) { + if (CR_RANGE(cmd->chanlist[n]) != range) errors |= range_err; - } + } if (errors) { if (errors & dupchan_err) { @@ -1038,9 +1038,9 @@ static int pci224_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s) unsigned long flags; /* Cannot handle null/empty chanlist. */ - if (cmd->chanlist == NULL || cmd->chanlist_len == 0) { + if (cmd->chanlist == NULL || cmd->chanlist_len == 0) return -EINVAL; - } + /* Determine which channels are enabled and their load order. */ devpriv->ao_enab = 0; @@ -1050,9 +1050,9 @@ static int pci224_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s) devpriv->ao_enab |= 1U << ch; rank = 0; for (j = 0; j < cmd->chanlist_len; j++) { - if (CR_CHAN(cmd->chanlist[j]) < ch) { + if (CR_CHAN(cmd->chanlist[j]) < ch) rank++; - } + } devpriv->ao_scan_order[rank] = i; } @@ -1221,9 +1221,9 @@ pci224_ao_munge(struct comedi_device *dev, struct comedi_subdevice *s, offset = 32768; } /* Munge the data. */ - for (i = 0; i < length; i++) { + for (i = 0; i < length; i++) array[i] = (array[i] << shift) - offset; - } + } /* @@ -1254,15 +1254,15 @@ static irqreturn_t pci224_interrupt(int irq, void *d) cmd = &s->async->cmd; if (valid_intstat & PCI224_INTR_EXT) { devpriv->intsce &= ~PCI224_INTR_EXT; - if (cmd->start_src == TRIG_EXT) { + if (cmd->start_src == TRIG_EXT) pci224_ao_start(dev, s); - } else if (cmd->stop_src == TRIG_EXT) { + else if (cmd->stop_src == TRIG_EXT) pci224_ao_stop(dev, s); - } + } - if (valid_intstat & PCI224_INTR_DAC) { + if (valid_intstat & PCI224_INTR_DAC) pci224_ao_handle_fifo(dev, s); - } + } /* Reenable interrupt sources. */ spin_lock_irqsave(&devpriv->ao_spinlock, flags); @@ -1381,23 +1381,23 @@ static int pci224_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* Allocate readback buffer for AO channels. */ devpriv->ao_readback = kmalloc(sizeof(devpriv->ao_readback[0]) * thisboard->ao_chans, GFP_KERNEL); - if (!devpriv->ao_readback) { + if (!devpriv->ao_readback) return -ENOMEM; - } + /* Allocate buffer to hold values for AO channel scan. */ devpriv->ao_scan_vals = kmalloc(sizeof(devpriv->ao_scan_vals[0]) * thisboard->ao_chans, GFP_KERNEL); - if (!devpriv->ao_scan_vals) { + if (!devpriv->ao_scan_vals) return -ENOMEM; - } + /* Allocate buffer to hold AO channel scan order. */ devpriv->ao_scan_order = kmalloc(sizeof(devpriv->ao_scan_order[0]) * thisboard->ao_chans, GFP_KERNEL); - if (!devpriv->ao_scan_order) { + if (!devpriv->ao_scan_order) return -ENOMEM; - } + /* Disable interrupt sources. */ devpriv->intsce = 0; @@ -1445,9 +1445,9 @@ static int pci224_attach(struct comedi_device *dev, struct comedi_devconfig *it) s->range_table_list = range_table_list = kmalloc(sizeof(struct comedi_lrange *) * s->n_chan, GFP_KERNEL); - if (!s->range_table_list) { + if (!s->range_table_list) return -ENOMEM; - } + for (n = 2; n < 3 + s->n_chan; n++) { if (it->options[n] < 0 || it->options[n] > 1) { printk(KERN_WARNING "comedi%d: %s: warning! " @@ -1459,11 +1459,11 @@ static int pci224_attach(struct comedi_device *dev, struct comedi_devconfig *it) for (n = 0; n < s->n_chan; n++) { if (n < COMEDI_NDEVCONFOPTS - 3 && it->options[3 + n] == 1) { - if (it->options[2] == 1) { + if (it->options[2] == 1) range_table_list[n] = &range_pci234_ext; - } else { + else range_table_list[n] = &range_bipolar5; - } + } else { if (it->options[2] == 1) { range_table_list[n] = @@ -1506,11 +1506,11 @@ static int pci224_attach(struct comedi_device *dev, struct comedi_devconfig *it) printk(KERN_INFO "comedi%d: %s ", dev->minor, dev->board_name); printk("(pci %s) ", pci_name(pci_dev)); - if (irq) { + if (irq) printk("(irq %u%s) ", irq, (dev->irq ? "" : " UNAVAILABLE")); - } else { + else printk("(no irq) "); - } + printk("attached\n"); @@ -1529,9 +1529,9 @@ static int pci224_detach(struct comedi_device *dev) { printk(KERN_DEBUG "comedi%d: %s: detach\n", dev->minor, DRIVER_NAME); - if (dev->irq) { + if (dev->irq) free_irq(dev->irq, dev); - } + if (dev->subdevices) { struct comedi_subdevice *s; @@ -1544,9 +1544,9 @@ static int pci224_detach(struct comedi_device *dev) kfree(devpriv->ao_scan_vals); kfree(devpriv->ao_scan_order); if (devpriv->pci_dev) { - if (dev->iobase) { + if (dev->iobase) comedi_pci_disable(devpriv->pci_dev); - } + pci_dev_put(devpriv->pci_dev); } } diff --git a/drivers/staging/comedi/drivers/amplc_pci230.c b/drivers/staging/comedi/drivers/amplc_pci230.c index 091a1a5..7fffd96 100644 --- a/drivers/staging/comedi/drivers/amplc_pci230.c +++ b/drivers/staging/comedi/drivers/amplc_pci230.c @@ -669,9 +669,9 @@ static short pci230_ai_read(struct comedi_device *dev) /* If a bipolar range was specified, mangle it (twos * complement->straight binary). */ - if (devpriv->ai_bipolar) { + if (devpriv->ai_bipolar) data ^= 1 << (thisboard->ai_bits - 1); - } + return data; } @@ -680,9 +680,9 @@ static inline unsigned short pci230_ao_mangle_datum(struct comedi_device *dev, { /* If a bipolar range was specified, mangle it (straight binary->twos * complement). */ - if (devpriv->ao_bipolar) { + if (devpriv->ao_bipolar) datum ^= 1 << (thisboard->ao_bits - 1); - } + /* PCI230 is 12 bit - stored in upper bits of 16 bit register (lower * four bits reserved for expansion). */ @@ -734,9 +734,9 @@ static int pci230_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* Allocate the private structure area using alloc_private(). * Macro defined in comedidev.h - memsets struct fields to 0. */ - if ((alloc_private(dev, sizeof(struct pci230_private))) < 0) { + if ((alloc_private(dev, sizeof(struct pci230_private))) < 0) return -ENOMEM; - } + spin_lock_init(&devpriv->isr_spinlock); spin_lock_init(&devpriv->res_spinlock); spin_lock_init(&devpriv->ai_stop_spinlock); @@ -991,9 +991,9 @@ static int pci230_detach(struct comedi_device *dev) if (devpriv) { if (devpriv->pci_dev) { - if (dev->iobase) { + if (dev->iobase) comedi_pci_disable(devpriv->pci_dev); - } + pci_dev_put(devpriv->pci_dev); } } @@ -1055,9 +1055,9 @@ static void put_resources(struct comedi_device *dev, unsigned int res_mask, && (res_mask != 0); b <<= 1, i++) { if ((res_mask & b) != 0) { res_mask &= ~b; - if (devpriv->res_owner[i] == owner) { + if (devpriv->res_owner[i] == owner) devpriv->res_owner[i] = OWNER_NONE; - } + } } spin_unlock_irqrestore(&devpriv->res_spinlock, irqflags); @@ -1132,11 +1132,11 @@ static int pci230_ai_rinsn(struct comedi_device *dev, } devpriv->adcg = (devpriv->adcg & ~(3 << gainshift)) | (pci230_ai_gain[range] << gainshift); - if (devpriv->ai_bipolar) { + if (devpriv->ai_bipolar) adccon |= PCI230_ADC_IR_BIP; - } else { + else adccon |= PCI230_ADC_IR_UNI; - } + /* Enable only this channel in the scan list - otherwise by default * we'll get one sample from each channel. */ @@ -1408,13 +1408,13 @@ static int pci230_ao_cmdtest(struct comedi_device *dev, chan = CR_CHAN(cmd->chanlist[n]); range = CR_RANGE(cmd->chanlist[n]); /* Channel numbers must strictly increase. */ - if (chan < prev_chan) { + if (chan < prev_chan) errors |= seq_err; - } + /* Ranges must be the same. */ - if (range != first_range) { + if (range != first_range) errors |= range_err; - } + prev_chan = chan; } if (errors != 0) { @@ -1583,9 +1583,9 @@ static int pci230_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s) if (cmd->scan_begin_src == TRIG_TIMER) { /* Claim Z2-CT1. */ - if (!get_one_resource(dev, RES_Z2CT1, OWNER_AOCMD)) { + if (!get_one_resource(dev, RES_Z2CT1, OWNER_AOCMD)) return -EBUSY; - } + } /* Get number of scans required. */ @@ -1609,9 +1609,9 @@ static int pci230_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s) unsigned int i; dacen = 0; - for (i = 0; i < cmd->chanlist_len; i++) { + for (i = 0; i < cmd->chanlist_len; i++) dacen |= 1 << CR_CHAN(cmd->chanlist[i]); - } + /* Set channel scan list. */ outw(dacen, dev->iobase + PCI230P2_DACEN); /* @@ -1656,9 +1656,9 @@ static int pci230_ai_check_scan_period(struct comedi_cmd *cmd) int err = 0; chanlist_len = cmd->chanlist_len; - if (cmd->chanlist_len == 0) { + if (cmd->chanlist_len == 0) chanlist_len = 1; - } + min_scan_period = chanlist_len * cmd->convert_arg; if ((min_scan_period < chanlist_len) || (min_scan_period < cmd->convert_arg)) { @@ -1777,11 +1777,11 @@ static int pci230_ai_cmdtest(struct comedi_device *dev, * single-ended or pseudo-differential. */ if (cmd->chanlist && (cmd->chanlist_len > 0)) { /* Peek analogue reference of first channel. */ - if (CR_AREF(cmd->chanlist[0]) == AREF_DIFF) { + if (CR_AREF(cmd->chanlist[0]) == AREF_DIFF) max_speed_ai = MAX_SPEED_AI_DIFF; - } else { + else max_speed_ai = MAX_SPEED_AI_SE; - } + } else { /* No channel list. Assume single-ended. */ max_speed_ai = MAX_SPEED_AI_SE; @@ -1871,9 +1871,9 @@ static int pci230_ai_cmdtest(struct comedi_device *dev, } } else if (cmd->scan_begin_src == TRIG_TIMER) { /* N.B. cmd->convert_arg is also TRIG_TIMER */ - if (!pci230_ai_check_scan_period(cmd)) { + if (!pci230_ai_check_scan_period(cmd)) err++; - } + } else { if (cmd->scan_begin_arg != 0) { cmd->scan_begin_arg = 0; @@ -1961,13 +1961,13 @@ static int pci230_ai_cmdtest(struct comedi_device *dev, errors |= seq_err; } /* Channels must have same AREF. */ - if (aref != prev_aref) { + if (aref != prev_aref) errors |= aref_err; - } + /* Channel ranges must have same polarity. */ - if (polarity != prev_polarity) { + if (polarity != prev_polarity) errors |= polarity_err; - } + /* Single-ended channel pairs must have same * range. */ if ((aref != AREF_DIFF) @@ -1987,9 +1987,9 @@ static int pci230_ai_cmdtest(struct comedi_device *dev, } /* If channel list is a repeating subsequence, need a whole * number of repeats. */ - if ((n % subseq_len) != 0) { + if ((n % subseq_len) != 0) errors |= seq_err; - } + if ((devpriv->hwver > 0) && (devpriv->hwver < 4)) { /* * Buggy PCI230+ or PCI260+ requires channel 0 to be @@ -2228,9 +2228,9 @@ static void pci230_ai_start(struct comedi_device *dev, devpriv->adccon = (devpriv->adccon & ~PCI230_ADC_TRIG_MASK) | conv; outw(devpriv->adccon, dev->iobase + PCI230_ADCCON); - if (cmd->convert_src == TRIG_INT) { + if (cmd->convert_src == TRIG_INT) async->inttrig = pci230_ai_inttrig_convert; - } + /* Update FIFO interrupt trigger level, which is currently * set to "full". */ pci230_ai_update_fifo_trigger_level(dev, s); @@ -2345,9 +2345,9 @@ static int pci230_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) } } /* Claim resources. */ - if (!get_resources(dev, res_mask, OWNER_AICMD)) { + if (!get_resources(dev, res_mask, OWNER_AICMD)) return -EBUSY; - } + /* Get number of scans required. */ if (cmd->stop_src == TRIG_COUNT) { @@ -2392,11 +2392,11 @@ static int pci230_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) range = CR_RANGE(cmd->chanlist[0]); devpriv->ai_bipolar = pci230_ai_bipolar[range]; - if (devpriv->ai_bipolar) { + if (devpriv->ai_bipolar) adccon |= PCI230_ADC_IR_BIP; - } else { + else adccon |= PCI230_ADC_IR_UNI; - } + for (i = 0; i < cmd->chanlist_len; i++) { unsigned int gainshift; @@ -2543,9 +2543,9 @@ static unsigned int pci230_choose_clk_count(uint64_t ns, unsigned int *count, for (clk_src = CLK_10MHZ;; clk_src++) { cnt = divide_ns(ns, pci230_timebase[clk_src], round_mode); - if ((cnt <= 65536) || (clk_src == CLK_1KHZ)) { + if ((cnt <= 65536) || (clk_src == CLK_1KHZ)) break; - } + } *count = cnt; return clk_src; @@ -2575,9 +2575,9 @@ static void pci230_ct_setup_ns_mode(struct comedi_device *dev, unsigned int ct, /* Program clock source. */ outb(CLK_CONFIG(ct, clk_src), devpriv->iobase1 + PCI230_ZCLK_SCE); /* Set initial count. */ - if (count >= 65536) { + if (count >= 65536) count = 0; - } + i8254_write(devpriv->iobase1 + PCI230_Z2_CT_BASE, 0, ct, count); } @@ -2599,9 +2599,9 @@ static irqreturn_t pci230_interrupt(int irq, void *d) /* Read interrupt status/enable register. */ status_int = inb(devpriv->iobase1 + PCI230_INT_STAT); - if (status_int == PCI230_INT_DISABLE) { + if (status_int == PCI230_INT_DISABLE) return IRQ_NONE; - } + spin_lock_irqsave(&devpriv->isr_spinlock, irqflags); valid_status_int = devpriv->int_en & status_int; @@ -2660,9 +2660,9 @@ static void pci230_handle_ao_nofifo(struct comedi_device *dev, struct comedi_async *async = s->async; struct comedi_cmd *cmd = &async->cmd; - if (!devpriv->ao_continuous && (devpriv->ao_scan_count == 0)) { + if (!devpriv->ao_continuous && (devpriv->ao_scan_count == 0)) return; - } + for (i = 0; i < cmd->chanlist_len; i++) { /* Read sample from Comedi's circular buffer. */ @@ -2711,9 +2711,9 @@ static int pci230_handle_ao_fifo(struct comedi_device *dev, num_scans = comedi_buf_read_n_available(async) / bytes_per_scan; if (!devpriv->ao_continuous) { /* Fixed number of scans. */ - if (num_scans > devpriv->ao_scan_count) { + if (num_scans > devpriv->ao_scan_count) num_scans = devpriv->ao_scan_count; - } + if (devpriv->ao_scan_count == 0) { /* End of acquisition. */ events |= COMEDI_CB_EOA; @@ -2736,21 +2736,21 @@ static int pci230_handle_ao_fifo(struct comedi_device *dev, } if (events == 0) { /* Determine how much room is in the FIFO (in samples). */ - if ((dacstat & PCI230P2_DAC_FIFO_FULL) != 0) { + if ((dacstat & PCI230P2_DAC_FIFO_FULL) != 0) room = PCI230P2_DAC_FIFOROOM_FULL; - } else if ((dacstat & PCI230P2_DAC_FIFO_HALF) != 0) { + else if ((dacstat & PCI230P2_DAC_FIFO_HALF) != 0) room = PCI230P2_DAC_FIFOROOM_HALFTOFULL; - } else if ((dacstat & PCI230P2_DAC_FIFO_EMPTY) != 0) { + else if ((dacstat & PCI230P2_DAC_FIFO_EMPTY) != 0) room = PCI230P2_DAC_FIFOROOM_EMPTY; - } else { + else room = PCI230P2_DAC_FIFOROOM_ONETOHALF; - } + /* Convert room to number of scans that can be added. */ room /= cmd->chanlist_len; /* Determine number of scans to process. */ - if (num_scans > room) { + if (num_scans > room) num_scans = room; - } + /* Process scans. */ for (n = 0; n < num_scans; n++) { for (i = 0; i < cmd->chanlist_len; i++) { @@ -2817,14 +2817,14 @@ static void pci230_handle_ai(struct comedi_device *dev, } else { todo = (devpriv->ai_scan_count * scanlen) - devpriv->ai_scan_pos; - if (todo > PCI230_ADC_FIFOLEVEL_HALFFULL) { + if (todo > PCI230_ADC_FIFOLEVEL_HALFFULL) todo = PCI230_ADC_FIFOLEVEL_HALFFULL; - } + } - if (todo == 0) { + if (todo == 0) return; - } + fifoamount = 0; for (i = 0; i < todo; i++) { @@ -2906,9 +2906,9 @@ static void pci230_ao_stop(struct comedi_device *dev, spin_lock_irqsave(&devpriv->ao_stop_spinlock, irqflags); started = test_and_clear_bit(AO_CMD_STARTED, &devpriv->state); spin_unlock_irqrestore(&devpriv->ao_stop_spinlock, irqflags); - if (!started) { + if (!started) return; - } + cmd = &s->async->cmd; if (cmd->scan_begin_src == TRIG_TIMER) { @@ -2968,9 +2968,9 @@ static void pci230_ai_stop(struct comedi_device *dev, spin_lock_irqsave(&devpriv->ai_stop_spinlock, irqflags); started = test_and_clear_bit(AI_CMD_STARTED, &devpriv->state); spin_unlock_irqrestore(&devpriv->ai_stop_spinlock, irqflags); - if (!started) { + if (!started) return; - } + cmd = &s->async->cmd; if (cmd->convert_src == TRIG_TIMER) { diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index 30b522c..cfeb11f 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -175,17 +175,18 @@ static int das16cs_attach(struct comedi_device *dev, printk("I/O base=0x%04lx ", dev->iobase); printk("fingerprint:\n"); - for (i = 0; i < 48; i += 2) { + for (i = 0; i < 48; i += 2) printk("%04x ", inw(dev->iobase + i)); - } + printk("\n"); ret = request_irq(link->irq, das16cs_interrupt, IRQF_SHARED, "cb_das16_cs", dev); - if (ret < 0) { + if (ret < 0) return ret; - } + dev->irq = link->irq; + printk("irq=%u ", dev->irq); dev->board_ptr = das16cs_probe(dev, link); @@ -262,9 +263,9 @@ static int das16cs_detach(struct comedi_device *dev) { printk("comedi%d: das16cs: remove\n", dev->minor); - if (dev->irq) { + if (dev->irq) free_irq(dev->irq, dev); - } + return 0; } @@ -834,6 +835,9 @@ static struct pcmcia_device_id das16cs_id_table[] = { }; MODULE_DEVICE_TABLE(pcmcia, das16cs_id_table); +MODULE_AUTHOR("David A. Schleef <ds@schleef.org>"); +MODULE_DESCRIPTION("Comedi driver for Computer Boards PC-CARD DAS16/16"); +MODULE_LICENSE("GPL"); struct pcmcia_driver das16cs_driver = { .probe = das16cs_pcmcia_attach, diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c index 82295e0..79aa286 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas64.c +++ b/drivers/staging/comedi/drivers/cb_pcidas64.c @@ -107,6 +107,8 @@ TODO: #define PRESCALED_TIMER_BASE 10000 /* 100kHz 'prescaled' clock for slow aquisition, maybe I'll support this someday */ #define DMA_BUFFER_SIZE 0x1000 +#define PCI_VENDOR_ID_COMPUTERBOARDS 0x1307 + /* maximum value that can be loaded into board's 24-bit counters*/ static const int max_counter_value = 0xffffff; @@ -1099,9 +1101,9 @@ struct pcidas64_private { resource_size_t main_phys_iobase; resource_size_t dio_counter_phys_iobase; /* base addresses (ioremapped) */ - void *plx9080_iobase; - void *main_iobase; - void *dio_counter_iobase; + void __iomem *plx9080_iobase; + void __iomem *main_iobase; + void __iomem *dio_counter_iobase; /* local address (used by dma controller) */ uint32_t local0_iobase; uint32_t local1_iobase; @@ -1314,7 +1316,7 @@ static inline int ao_cmd_is_supported(const struct pcidas64_board *board) static void init_plx9080(struct comedi_device *dev) { uint32_t bits; - void *plx_iobase = priv(dev)->plx9080_iobase; + void __iomem *plx_iobase = priv(dev)->plx9080_iobase; priv(dev)->plx_control_bits = readl(priv(dev)->plx9080_iobase + PLX_CONTROL_REG); @@ -1404,7 +1406,7 @@ static void init_plx9080(struct comedi_device *dev) static int setup_subdevices(struct comedi_device *dev) { struct comedi_subdevice *s; - void *dio_8255_iobase; + void __iomem *dio_8255_iobase; int i; if (alloc_subdevices(dev, 10) < 0) @@ -1430,7 +1432,6 @@ static int setup_subdevices(struct comedi_device *dev) s->do_cmdtest = ai_cmdtest; s->cancel = ai_cancel; if (board(dev)->layout == LAYOUT_4020) { - unsigned int i; uint8_t data; /* set adc to read from inputs (not internal calibration sources) */ priv(dev)->i2c_cal_range_bits = adc_src_4020_bits(4); @@ -1612,7 +1613,7 @@ static void init_stc_registers(struct comedi_device *dev) disable_ai_pacing(dev); }; -int alloc_and_init_dma_members(struct comedi_device *dev) +static int alloc_and_init_dma_members(struct comedi_device *dev) { int i; @@ -1621,9 +1622,9 @@ int alloc_and_init_dma_members(struct comedi_device *dev) priv(dev)->ai_buffer[i] = pci_alloc_consistent(priv(dev)->hw_dev, DMA_BUFFER_SIZE, &priv(dev)->ai_buffer_bus_addr[i]); - if (priv(dev)->ai_buffer[i] == NULL) { + if (priv(dev)->ai_buffer[i] == NULL) return -ENOMEM; - } + } for (i = 0; i < AO_DMA_RING_COUNT; i++) { if (ao_cmd_is_supported(board(dev))) { @@ -1632,9 +1633,9 @@ int alloc_and_init_dma_members(struct comedi_device *dev) DMA_BUFFER_SIZE, &priv(dev)-> ao_buffer_bus_addr[i]); - if (priv(dev)->ao_buffer[i] == NULL) { + if (priv(dev)->ao_buffer[i] == NULL) return -ENOMEM; - } + } } /* allocate dma descriptors */ @@ -1643,9 +1644,9 @@ int alloc_and_init_dma_members(struct comedi_device *dev) sizeof(struct plx_dma_desc) * ai_dma_ring_count(board(dev)), &priv(dev)->ai_dma_desc_bus_addr); - if (priv(dev)->ai_dma_desc == NULL) { + if (priv(dev)->ai_dma_desc == NULL) return -ENOMEM; - } + DEBUG_PRINT("ai dma descriptors start at bus addr 0x%x\n", priv(dev)->ai_dma_desc_bus_addr); if (ao_cmd_is_supported(board(dev))) { @@ -1654,9 +1655,9 @@ int alloc_and_init_dma_members(struct comedi_device *dev) sizeof(struct plx_dma_desc) * AO_DMA_RING_COUNT, &priv(dev)->ao_dma_desc_bus_addr); - if (priv(dev)->ao_dma_desc == NULL) { + if (priv(dev)->ao_dma_desc == NULL) return -ENOMEM; - } + DEBUG_PRINT("ao dma descriptors start at bus addr 0x%x\n", priv(dev)->ao_dma_desc_bus_addr); } @@ -1848,9 +1849,9 @@ static int attach(struct comedi_device *dev, struct comedi_devconfig *it) printk(" irq %u\n", dev->irq); retval = setup_subdevices(dev); - if (retval < 0) { + if (retval < 0) return retval; - } + return 0; } @@ -1875,12 +1876,12 @@ static int detach(struct comedi_device *dev) if (priv(dev)->hw_dev) { if (priv(dev)->plx9080_iobase) { disable_plx_interrupts(dev); - iounmap((void *)priv(dev)->plx9080_iobase); + iounmap(priv(dev)->plx9080_iobase); } if (priv(dev)->main_iobase) - iounmap((void *)priv(dev)->main_iobase); + iounmap(priv(dev)->main_iobase); if (priv(dev)->dio_counter_iobase) - iounmap((void *)priv(dev)->dio_counter_iobase); + iounmap(priv(dev)->dio_counter_iobase); /* free pci dma buffers */ for (i = 0; i < ai_dma_ring_count(board(dev)); i++) { if (priv(dev)->ai_buffer[i]) @@ -1919,9 +1920,9 @@ static int detach(struct comedi_device *dev) priv(dev)->ao_dma_desc, priv(dev)-> ao_dma_desc_bus_addr); - if (priv(dev)->main_phys_iobase) { + if (priv(dev)->main_phys_iobase) comedi_pci_disable(priv(dev)->hw_dev); - } + pci_dev_put(priv(dev)->hw_dev); } } @@ -2902,9 +2903,9 @@ static void pio_drain_ai_fifo_16(struct comedi_device *dev) if (cmd->stop_src == TRIG_COUNT) { if (priv(dev)->ai_count == 0) break; - if (num_samples > priv(dev)->ai_count) { + if (num_samples > priv(dev)->ai_count) num_samples = priv(dev)->ai_count; - } + priv(dev)->ai_count -= num_samples; } @@ -2943,9 +2944,9 @@ static void pio_drain_ai_fifo_32(struct comedi_device *dev) readw(priv(dev)->main_iobase + ADC_READ_PNTR_REG) & 0x7fff; if (cmd->stop_src == TRIG_COUNT) { - if (max_transfer > priv(dev)->ai_count) { + if (max_transfer > priv(dev)->ai_count) max_transfer = priv(dev)->ai_count; - } + } for (i = 0; read_code != write_code && i < max_transfer;) { fifo_data = readl(priv(dev)->dio_counter_iobase + ADC_FIFO_REG); @@ -2964,9 +2965,9 @@ static void pio_drain_ai_fifo_32(struct comedi_device *dev) /* empty fifo */ static void pio_drain_ai_fifo(struct comedi_device *dev) { - if (board(dev)->layout == LAYOUT_4020) { + if (board(dev)->layout == LAYOUT_4020) pio_drain_ai_fifo_32(dev); - } else + else pio_drain_ai_fifo_16(dev); } @@ -2976,7 +2977,7 @@ static void drain_dma_buffers(struct comedi_device *dev, unsigned int channel) uint32_t next_transfer_addr; int j; int num_samples = 0; - void *pci_addr_reg; + void __iomem *pci_addr_reg; if (channel) pci_addr_reg = @@ -3016,8 +3017,9 @@ static void drain_dma_buffers(struct comedi_device *dev, unsigned int channel) * unused buffer) */ } -void handle_ai_interrupt(struct comedi_device *dev, unsigned short status, - unsigned int plx_status) +static void handle_ai_interrupt(struct comedi_device *dev, + unsigned short status, + unsigned int plx_status) { struct comedi_subdevice *s = dev->read_subdev; struct comedi_async *async = s->async; @@ -3038,9 +3040,9 @@ void handle_ai_interrupt(struct comedi_device *dev, unsigned short status, priv(dev)->plx9080_iobase + PLX_DMA1_CS_REG); DEBUG_PRINT("dma1 status 0x%x\n", dma1_status); - if (dma1_status & PLX_DMA_EN_BIT) { + if (dma1_status & PLX_DMA_EN_BIT) drain_dma_buffers(dev, 1); - } + DEBUG_PRINT(" cleared dma ch1 interrupt\n"); } spin_unlock_irqrestore(&dev->spinlock, flags); @@ -3227,7 +3229,7 @@ static irqreturn_t handle_interrupt(int irq, void *d) return IRQ_HANDLED; } -void abort_dma(struct comedi_device *dev, unsigned int channel) +static void abort_dma(struct comedi_device *dev, unsigned int channel) { unsigned long flags; @@ -3422,7 +3424,7 @@ static void load_ao_dma(struct comedi_device *dev, const struct comedi_cmd *cmd) { unsigned int num_bytes; unsigned int next_transfer_addr; - void *pci_addr_reg = + void __iomem *pci_addr_reg = priv(dev)->plx9080_iobase + PLX_DMA0_PCI_ADDRESS_REG; unsigned int buffer_index; @@ -3656,24 +3658,26 @@ static int ao_cancel(struct comedi_device *dev, struct comedi_subdevice *s) return 0; } -static int dio_callback(int dir, int port, int data, unsigned long iobase) +static int dio_callback(int dir, int port, int data, unsigned long arg) { + void __iomem *iobase = (void __iomem *)arg; if (dir) { - writeb(data, (void *)(iobase + port)); + writeb(data, iobase + port); DEBUG_PRINT("wrote 0x%x to port %i\n", data, port); return 0; } else { - return readb((void *)(iobase + port)); + return readb(iobase + port); } } -static int dio_callback_4020(int dir, int port, int data, unsigned long iobase) +static int dio_callback_4020(int dir, int port, int data, unsigned long arg) { + void __iomem *iobase = (void __iomem *)arg; if (dir) { - writew(data, (void *)(iobase + 2 * port)); + writew(data, iobase + 2 * port); return 0; } else { - return readw((void *)(iobase + 2 * port)); + return readw(iobase + 2 * port); } } @@ -3860,7 +3864,7 @@ static uint16_t read_eeprom(struct comedi_device *dev, uint8_t address) static const int read_command = 0x6; unsigned int bitstream = (read_command << 8) | address; unsigned int bit; - void *const plx_control_addr = + void __iomem * const plx_control_addr = priv(dev)->plx9080_iobase + PLX_CONTROL_REG; uint16_t value; static const int value_length = 16; @@ -4183,7 +4187,8 @@ static const int i2c_low_udelay = 10; static void i2c_set_sda(struct comedi_device *dev, int state) { static const int data_bit = CTL_EE_W; - void *plx_control_addr = priv(dev)->plx9080_iobase + PLX_CONTROL_REG; + void __iomem *plx_control_addr = priv(dev)->plx9080_iobase + + PLX_CONTROL_REG; if (state) { /* set data line high */ @@ -4202,7 +4207,8 @@ static void i2c_set_sda(struct comedi_device *dev, int state) static void i2c_set_scl(struct comedi_device *dev, int state) { static const int clock_bit = CTL_USERO; - void *plx_control_addr = priv(dev)->plx9080_iobase + PLX_CONTROL_REG; + void __iomem *plx_control_addr = priv(dev)->plx9080_iobase + + PLX_CONTROL_REG; if (state) { /* set clock line high */ diff --git a/drivers/staging/comedi/drivers/cb_pcimdas.c b/drivers/staging/comedi/drivers/cb_pcimdas.c index 2e61727..49dccbb 100644 --- a/drivers/staging/comedi/drivers/cb_pcimdas.c +++ b/drivers/staging/comedi/drivers/cb_pcimdas.c @@ -52,6 +52,8 @@ See http://www.measurementcomputing.com/PDFManuals/pcim-das1602_16.pdf for more /* #define CBPCIMDAS_DEBUG */ #undef CBPCIMDAS_DEBUG +#define PCI_VENDOR_ID_COMPUTERBOARDS 0x1307 + /* Registers for the PCIM-DAS1602/16 */ /* sizes of io regions (bytes) */ diff --git a/drivers/staging/comedi/drivers/cb_pcimdda.c b/drivers/staging/comedi/drivers/cb_pcimdda.c index e32a317..f404ec77 100644 --- a/drivers/staging/comedi/drivers/cb_pcimdda.c +++ b/drivers/staging/comedi/drivers/cb_pcimdda.c @@ -91,7 +91,8 @@ Configuration Options: #include "8255.h" /* device ids of the cards we support -- currently only 1 card supported */ -#define PCI_ID_PCIM_DDA06_16 0x0053 +#define PCI_VENDOR_ID_COMPUTERBOARDS 0x1307 +#define PCI_ID_PCIM_DDA06_16 0x0053 /* * This is straight from skel.c -- I did this in case this source file diff --git a/drivers/staging/comedi/drivers/comedi_bond.c b/drivers/staging/comedi/drivers/comedi_bond.c index 41311d9..7016222 100644 --- a/drivers/staging/comedi/drivers/comedi_bond.c +++ b/drivers/staging/comedi/drivers/comedi_bond.c @@ -87,18 +87,17 @@ Configuration Options: * options that are used with comedi_config. */ -#include "../comedilib.h" -#include "../comedidev.h" #include <linux/string.h> #include <linux/slab.h> +#include "../comedi.h" +#include "../comedilib.h" +#include "../comedidev.h" /* The maxiumum number of channels per subdevice. */ #define MAX_CHANS 256 #define MODULE_NAME "comedi_bond" -#ifdef MODULE_LICENSE MODULE_LICENSE("GPL"); -#endif #ifndef STR # define STR1(x) #x # define STR(x) STR1(x) @@ -143,7 +142,7 @@ static const struct BondingBoard bondingBoards[] = { #define thisboard ((const struct BondingBoard *)dev->board_ptr) struct BondedDevice { - void *dev; + struct comedi_device *dev; unsigned minor; unsigned subdev; unsigned subdev_type; @@ -405,7 +404,7 @@ static void *Realloc(const void *oldmem, size_t newlen, size_t oldlen) static int doDevConfig(struct comedi_device *dev, struct comedi_devconfig *it) { int i; - void *devs_opened[COMEDI_NUM_BOARD_MINORS]; + struct comedi_device *devs_opened[COMEDI_NUM_BOARD_MINORS]; memset(devs_opened, 0, sizeof(devs_opened)); devpriv->name[0] = 0;; @@ -414,7 +413,7 @@ static int doDevConfig(struct comedi_device *dev, struct comedi_devconfig *it) for (i = 0; i < COMEDI_NDEVCONFOPTS && (!i || it->options[i]); ++i) { char file[] = "/dev/comediXXXXXX"; int minor = it->options[i]; - void *d; + struct comedi_device *d; int sdev = -1, nchans, tmp; struct BondedDevice *bdev = NULL; diff --git a/drivers/staging/comedi/drivers/comedi_parport.c b/drivers/staging/comedi/drivers/comedi_parport.c index 043afe4..fcd7721 100644 --- a/drivers/staging/comedi/drivers/comedi_parport.c +++ b/drivers/staging/comedi/drivers/comedi_parport.c @@ -309,18 +309,18 @@ static int parport_attach(struct comedi_device *dev, iobase = it->options[0]; printk(KERN_INFO "comedi%d: parport: 0x%04lx ", dev->minor, iobase); if (!request_region(iobase, PARPORT_SIZE, "parport (comedi)")) { - printk("I/O port conflict\n"); + printk(KERN_ERR "I/O port conflict\n"); return -EIO; } dev->iobase = iobase; irq = it->options[1]; if (irq) { - printk(" irq=%u", irq); + printk(KERN_INFO " irq=%u", irq); ret = request_irq(irq, parport_interrupt, 0, "comedi_parport", dev); if (ret < 0) { - printk(" irq not available\n"); + printk(KERN_ERR " irq not available\n"); return -EINVAL; } dev->irq = irq; @@ -380,13 +380,13 @@ static int parport_attach(struct comedi_device *dev, devpriv->c_data = 0; outb(devpriv->c_data, dev->iobase + PARPORT_C); - printk("\n"); + printk(KERN_INFO "\n"); return 1; } static int parport_detach(struct comedi_device *dev) { - printk("comedi%d: parport: remove\n", dev->minor); + printk(KERN_INFO "comedi%d: parport: remove\n", dev->minor); if (dev->iobase) release_region(dev->iobase, PARPORT_SIZE); diff --git a/drivers/staging/comedi/drivers/das08.c b/drivers/staging/comedi/drivers/das08.c index f425833..9cb144f 100644 --- a/drivers/staging/comedi/drivers/das08.c +++ b/drivers/staging/comedi/drivers/das08.c @@ -1,55 +1,55 @@ /* - comedi/drivers/das08.c - DAS08 driver - - COMEDI - Linux Control and Measurement Device Interface - Copyright (C) 2000 David A. Schleef <ds@schleef.org> - Copyright (C) 2001,2002,2003 Frank Mori Hess <fmhess@users.sourceforge.net> - Copyright (C) 2004 Salvador E. Tropea <set@users.sf.net> <set@ieee.org> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -***************************************************************** + * comedi/drivers/das08.c + * DAS08 driver + * + * COMEDI - Linux Control and Measurement Device Interface + * Copyright (C) 2000 David A. Schleef <ds@schleef.org> + * Copyright (C) 2001,2002,2003 Frank Mori Hess <fmhess@users.sourceforge.net> + * Copyright (C) 2004 Salvador E. Tropea <set@users.sf.net> <set@ieee.org> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + ***************************************************************** + */ -*/ /* -Driver: das08 -Description: DAS-08 compatible boards -Author: Warren Jasper, ds, Frank Hess -Devices: [Keithley Metrabyte] DAS08 (isa-das08), [ComputerBoards] DAS08 (isa-das08), - DAS08-PGM (das08-pgm), - DAS08-PGH (das08-pgh), DAS08-PGL (das08-pgl), DAS08-AOH (das08-aoh), - DAS08-AOL (das08-aol), DAS08-AOM (das08-aom), DAS08/JR-AO (das08/jr-ao), - DAS08/JR-16-AO (das08jr-16-ao), PCI-DAS08 (das08), - PC104-DAS08 (pc104-das08), DAS08/JR/16 (das08jr/16) -Status: works - -This is a rewrite of the das08 and das08jr drivers. - -Options (for ISA cards): - [0] - base io address - -Options (for pci-das08): - [0] - bus (optional) - [1] = slot (optional) - -The das08 driver doesn't support asynchronous commands, since -the cheap das08 hardware doesn't really support them. The -comedi_rt_timer driver can be used to emulate commands for this -driver. -*/ + * Driver: das08 + * Description: DAS-08 compatible boards + * Author: Warren Jasper, ds, Frank Hess + * Devices: [Keithley Metrabyte] DAS08 (isa-das08), + * [ComputerBoards] DAS08 (isa-das08), DAS08-PGM (das08-pgm), + * DAS08-PGH (das08-pgh), DAS08-PGL (das08-pgl), DAS08-AOH (das08-aoh), + * DAS08-AOL (das08-aol), DAS08-AOM (das08-aom), DAS08/JR-AO (das08/jr-ao), + * DAS08/JR-16-AO (das08jr-16-ao), PCI-DAS08 (das08), + * PC104-DAS08 (pc104-das08), DAS08/JR/16 (das08jr/16) + * Status: works + * + * This is a rewrite of the das08 and das08jr drivers. + * + * Options (for ISA cards): + * [0] - base io address + * + * Options (for pci-das08): + * [0] - bus (optional) + * [1] = slot (optional) + * + * The das08 driver doesn't support asynchronous commands, since + * the cheap das08 hardware doesn't really support them. The + * comedi_rt_timer driver can be used to emulate commands for this + * driver. + */ #include "../comedidev.h" @@ -122,8 +122,8 @@ driver. */ #define DAS08JR_DIO 3 -#define DAS08JR_AO_LSB(x) ((x)?6:4) -#define DAS08JR_AO_MSB(x) ((x)?7:5) +#define DAS08JR_AO_LSB(x) ((x) ? 6 : 4) +#define DAS08JR_AO_MSB(x) ((x) ? 7 : 5) /* cio-das08_aox.pdf @@ -148,8 +148,8 @@ driver. #define DAS08AO_GAIN_CONTROL 3 #define DAS08AO_GAIN_STATUS 3 -#define DAS08AO_AO_LSB(x) ((x)?0xa:8) -#define DAS08AO_AO_MSB(x) ((x)?0xb:9) +#define DAS08AO_AO_LSB(x) ((x) ? 0xa : 8) +#define DAS08AO_AO_MSB(x) ((x) ? 0xb : 9) #define DAS08AO_AO_UPDATE 8 /* gainlist same as _pgx_ below */ @@ -239,8 +239,9 @@ static const struct comedi_lrange *const das08_ai_lranges[] = { &range_das08_pgm, }; -static const int das08_pgh_gainlist[] = - { 8, 0, 10, 2, 12, 4, 14, 6, 1, 3, 5, 7 }; +static const int das08_pgh_gainlist[] = { + 8, 0, 10, 2, 12, 4, 14, 6, 1, 3, 5, 7 +}; static const int das08_pgl_gainlist[] = { 8, 0, 2, 4, 6, 1, 3, 5, 7 }; static const int das08_pgm_gainlist[] = { 8, 0, 10, 12, 14, 9, 11, 13, 15 }; @@ -535,7 +536,8 @@ static int das08_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, inb(dev->iobase + DAS08_MSB); /* set multiplexer */ - spin_lock(&dev->spinlock); /* lock to prevent race with digital output */ + /* lock to prevent race with digital output */ + spin_lock(&dev->spinlock); devpriv->do_mux_bits &= ~DAS08_MUX_MASK; devpriv->do_mux_bits |= DAS08_MUX(chan); outb(devpriv->do_mux_bits, dev->iobase + DAS08_CONTROL); @@ -552,7 +554,7 @@ static int das08_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, /* clear over-range bits for 16-bit boards */ if (thisboard->ai_nbits == 16) if (inb(dev->iobase + DAS08_MSB) & 0x80) - printk("das08: over-range\n"); + printk(KERN_INFO "das08: over-range\n"); /* trigger conversion */ outb_p(0, dev->iobase + DAS08_TRIG_12BIT); @@ -562,7 +564,7 @@ static int das08_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, break; } if (i == TIMEOUT) { - printk("das08: timeout\n"); + printk(KERN_ERR "das08: timeout\n"); return -ETIME; } msb = inb(dev->iobase + DAS08_MSB); @@ -607,7 +609,8 @@ static int das08_do_wbits(struct comedi_device *dev, struct comedi_subdevice *s, /* set new bit values */ wbits |= data[0] & data[1]; /* remember digital output bits */ - spin_lock(&dev->spinlock); /* prevent race with setting of analog input mux */ + /* prevent race with setting of analog input mux */ + spin_lock(&dev->spinlock); devpriv->do_mux_bits &= ~DAS08_DO_MASK; devpriv->do_mux_bits |= DAS08_OP(wbits); outb(devpriv->do_mux_bits, dev->iobase + DAS08_CONTROL); @@ -860,9 +863,9 @@ int das08_common_attach(struct comedi_device *dev, unsigned long iobase) /* allocate ioports for non-pcmcia, non-pci boards */ if ((thisboard->bustype != pcmcia) && (thisboard->bustype != pci)) { - printk(" iobase 0x%lx\n", iobase); + printk(KERN_INFO " iobase 0x%lx\n", iobase); if (!request_region(iobase, thisboard->iosize, DRV_NAME)) { - printk(" I/O port conflict\n"); + printk(KERN_ERR " I/O port conflict\n"); return -EIO; } } @@ -878,8 +881,11 @@ int das08_common_attach(struct comedi_device *dev, unsigned long iobase) /* ai */ if (thisboard->ai) { s->type = COMEDI_SUBD_AI; - /* XXX some boards actually have differential inputs instead of single ended. - * The driver does nothing with arefs though, so it's no big deal. */ + /* XXX some boards actually have differential + * inputs instead of single ended. + * The driver does nothing with arefs though, + * so it's no big deal. + */ s->subdev_flags = SDF_READABLE | SDF_GROUND; s->n_chan = 8; s->maxdata = (1 << thisboard->ai_nbits) - 1; @@ -966,6 +972,7 @@ int das08_common_attach(struct comedi_device *dev, unsigned long iobase) return 0; } +EXPORT_SYMBOL_GPL(das08_common_attach); static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it) { @@ -980,7 +987,7 @@ static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (ret < 0) return ret; - printk("comedi%d: das08: ", dev->minor); + printk(KERN_INFO "comedi%d: das08: ", dev->minor); /* deal with a pci board */ if (thisboard->bustype == pci) { #ifdef CONFIG_COMEDI_PCI @@ -1007,20 +1014,21 @@ static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it) } } if (!pdev) { - printk("No pci das08 cards found\n"); + printk(KERN_ERR "No pci das08 cards found\n"); return -EIO; } devpriv->pdev = pdev; /* enable PCI device and reserve I/O spaces */ if (comedi_pci_enable(pdev, DRV_NAME)) { - printk - (" Error enabling PCI device and requesting regions\n"); + printk(KERN_ERR " Error enabling PCI device and " + "requesting regions\n"); return -EIO; } /* read base addresses */ pci_iobase = pci_resource_start(pdev, 1); iobase = pci_resource_start(pdev, 2); - printk("pcibase 0x%lx iobase 0x%lx\n", pci_iobase, iobase); + printk(KERN_INFO "pcibase 0x%lx iobase 0x%lx\n", + pci_iobase, iobase); devpriv->pci_iobase = pci_iobase; #if 0 /* We could enable to pci-das08's interrupt here to make it possible @@ -1034,17 +1042,18 @@ static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it) outw(INTR1_ENABLE | PCI_INTR_ENABLE, pci_iobase + INTCSR); #endif #else /* CONFIG_COMEDI_PCI */ - printk("this driver has not been built with PCI support.\n"); + printk(KERN_ERR "this driver has not been built with PCI support.\n"); return -EINVAL; #endif /* CONFIG_COMEDI_PCI */ } else { iobase = it->options[0]; } - printk("\n"); + printk(KERN_INFO "\n"); return das08_common_attach(dev, iobase); } + int das08_common_detach(struct comedi_device *dev) { printk(KERN_INFO "comedi%d: das08: remove\n", dev->minor); @@ -1060,9 +1069,9 @@ int das08_common_detach(struct comedi_device *dev) #ifdef CONFIG_COMEDI_PCI if (devpriv) { if (devpriv->pdev) { - if (devpriv->pci_iobase) { + if (devpriv->pci_iobase) comedi_pci_disable(devpriv->pdev); - } + pci_dev_put(devpriv->pdev); } } @@ -1070,6 +1079,7 @@ int das08_common_detach(struct comedi_device *dev) return 0; } +EXPORT_SYMBOL_GPL(das08_common_detach); #ifdef CONFIG_COMEDI_PCI COMEDI_PCI_INITCLEANUP(driver_das08, das08_pci_table); @@ -1077,8 +1087,6 @@ COMEDI_PCI_INITCLEANUP(driver_das08, das08_pci_table); COMEDI_INITCLEANUP(driver_das08); #endif -EXPORT_SYMBOL_GPL(das08_common_attach); -EXPORT_SYMBOL_GPL(das08_common_detach); #ifdef CONFIG_COMEDI_PCMCIA EXPORT_SYMBOL_GPL(das08_cs_boards); #endif diff --git a/drivers/staging/comedi/drivers/das08.h b/drivers/staging/comedi/drivers/das08.h index 35d2660..2a30d76 100644 --- a/drivers/staging/comedi/drivers/das08.h +++ b/drivers/staging/comedi/drivers/das08.h @@ -62,7 +62,7 @@ struct i8254_struct { #define I8254_CTRL 3 struct das08_private_struct { - unsigned int do_mux_bits; /* bits for do/mux register on boards without seperate do register */ + unsigned int do_mux_bits; /* bits for do/mux register on boards without separate do register */ unsigned int do_bits; /* bits for do register on boards with register dedicated to digital out only */ const unsigned int *pg_gainlist; struct pci_dev *pdev; /* struct for pci-das08 */ diff --git a/drivers/staging/comedi/drivers/das08_cs.c b/drivers/staging/comedi/drivers/das08_cs.c index 896d25b..8761a6d 100644 --- a/drivers/staging/comedi/drivers/das08_cs.c +++ b/drivers/staging/comedi/drivers/das08_cs.c @@ -350,6 +350,10 @@ static struct pcmcia_device_id das08_cs_id_table[] = { }; MODULE_DEVICE_TABLE(pcmcia, das08_cs_id_table); +MODULE_AUTHOR("David A. Schleef <ds@schleef.org>, " + "Frank Mori Hess <fmhess@users.sourceforge.net>"); +MODULE_DESCRIPTION("Comedi driver for ComputerBoards DAS-08 PCMCIA boards"); +MODULE_LICENSE("GPL"); struct pcmcia_driver das08_cs_driver = { .probe = das08_pcmcia_attach, @@ -392,6 +396,5 @@ static void __exit das08_cs_exit_module(void) comedi_driver_unregister(&driver_das08_cs); } -MODULE_LICENSE("GPL"); module_init(das08_cs_init_module); module_exit(das08_cs_exit_module); diff --git a/drivers/staging/comedi/drivers/das16.c b/drivers/staging/comedi/drivers/das16.c index f2aadda..ccee4f1 100644 --- a/drivers/staging/comedi/drivers/das16.c +++ b/drivers/staging/comedi/drivers/das16.c @@ -74,7 +74,8 @@ Keithley Manuals: 4922.PDF (das-1400) 4923.PDF (das1200, 1400, 1600) -Computer boards manuals also available from their website www.measurementcomputing.com +Computer boards manuals also available from their website +www.measurementcomputing.com */ @@ -92,7 +93,8 @@ Computer boards manuals also available from their website www.measurementcomputi /* #define DEBUG */ #ifdef DEBUG -#define DEBUG_PRINT(format, args...) printk("das16: " format, ## args) +#define DEBUG_PRINT(format, args...) \ + printk(KERN_DEBUG "das16: " format, ## args) #else #define DEBUG_PRINT(format, args...) #endif @@ -186,15 +188,16 @@ Computer boards manuals also available from their website www.measurementcomputi */ -static const int sample_size = 2; /* size in bytes of a sample from board */ +/* size in bytes of a sample from board */ +static const int sample_size = 2; #define DAS16_TRIG 0 #define DAS16_AI_LSB 0 #define DAS16_AI_MSB 1 #define DAS16_MUX 2 #define DAS16_DIO 3 -#define DAS16_AO_LSB(x) ((x)?6:4) -#define DAS16_AO_MSB(x) ((x)?7:5) +#define DAS16_AO_LSB(x) ((x) ? 6 : 4) +#define DAS16_AO_MSB(x) ((x) ? 7 : 5) #define DAS16_STATUS 8 #define BUSY (1<<7) #define UNIPOLAR (1<<6) @@ -271,7 +274,7 @@ static const struct comedi_lrange range_das1x02_unip = { 4, { }; static const struct comedi_lrange range_das16jr = { 9, { - /* also used by 16/330 */ + /* also used by 16/330 */ BIP_RANGE(10), BIP_RANGE(5), BIP_RANGE(2.5), @@ -547,7 +550,8 @@ static const struct das16_board das16_boards[] = { .id = 0x20, }, { - .name = "das-1401", /* 4919.pdf and 4922.pdf (keithley user's manual) */ + /* 4919.pdf and 4922.pdf (keithley user's manual) */ + .name = "das-1401", .ai = das16_ai_rinsn, .ai_nbits = 12, .ai_speed = 10000, @@ -558,10 +562,11 @@ static const struct das16_board das16_boards[] = { .i8255_offset = 0x0, .i8254_offset = 0x0c, .size = 0x408, - .id = 0xc0 /* 4919.pdf says id bits are 0xe0, 4922.pdf says 0xc0 */ + .id = 0xc0 /* 4919.pdf says id bits are 0xe0, 4922.pdf says 0xc0 */ }, { - .name = "das-1402", /* 4919.pdf and 4922.pdf (keithley user's manual) */ + /* 4919.pdf and 4922.pdf (keithley user's manual) */ + .name = "das-1402", .ai = das16_ai_rinsn, .ai_nbits = 12, .ai_speed = 10000, @@ -572,7 +577,7 @@ static const struct das16_board das16_boards[] = { .i8255_offset = 0x0, .i8254_offset = 0x0c, .size = 0x408, - .id = 0xc0 /* 4919.pdf says id bits are 0xe0, 4922.pdf says 0xc0 */ + .id = 0xc0 /* 4919.pdf says id bits are 0xe0, 4922.pdf says 0xc0 */ }, { .name = "das-1601", /* 4919.pdf */ @@ -704,7 +709,8 @@ static const struct das16_board das16_boards[] = { .name = "das16/jr/ctr5", /* ? */ }, { - .name = "cio-das16/m1/16", /* cio-das16_m1_16.pdf, this board is a bit quirky, no dma */ + /* cio-das16_m1_16.pdf, this board is a bit quirky, no dma */ + .name = "cio-das16/m1/16", }, #endif }; @@ -736,14 +742,19 @@ struct das16_private_struct { unsigned int clockbase; /* master clock speed in ns */ volatile unsigned int control_state; /* dma, interrupt and trigger control bits */ volatile unsigned long adc_byte_count; /* number of bytes remaining */ - unsigned int divisor1; /* divisor dividing master clock to get conversion frequency */ - unsigned int divisor2; /* divisor dividing master clock to get conversion frequency */ + /* divisor dividing master clock to get conversion frequency */ + unsigned int divisor1; + /* divisor dividing master clock to get conversion frequency */ + unsigned int divisor2; unsigned int dma_chan; /* dma channel */ uint16_t *dma_buffer[2]; dma_addr_t dma_buffer_addr[2]; unsigned int current_buffer; volatile unsigned int dma_transfer_size; /* target number of bytes to transfer per dma shot */ - /* user-defined analog input and output ranges defined from config options */ + /** + * user-defined analog input and output ranges + * defined from config options + */ struct comedi_lrange *user_ai_range_table; struct comedi_lrange *user_ao_range_table; @@ -798,7 +809,10 @@ static int das16_cmd_test(struct comedi_device *dev, struct comedi_subdevice *s, if (err) return 1; - /* step 2: make sure trigger sources are unique and mutually compatible */ + /** + * step 2: make sure trigger sources are unique and + * mutually compatible + */ if (cmd->scan_begin_src != TRIG_TIMER && cmd->scan_begin_src != TRIG_EXT && cmd->scan_begin_src != TRIG_FOLLOW) @@ -893,12 +907,15 @@ static int das16_cmd_test(struct comedi_device *dev, struct comedi_subdevice *s, if (CR_CHAN(cmd->chanlist[i]) != (start_chan + i) % s->n_chan) { comedi_error(dev, - "entries in chanlist must be consecutive channels, counting upwards\n"); + "entries in chanlist must be " + "consecutive channels, " + "counting upwards\n"); err++; } if (CR_RANGE(cmd->chanlist[i]) != gain) { comedi_error(dev, - "entries in chanlist must all have the same gain\n"); + "entries in chanlist must all " + "have the same gain\n"); err++; } } @@ -920,12 +937,13 @@ static int das16_cmd_exec(struct comedi_device *dev, struct comedi_subdevice *s) if (devpriv->dma_chan == 0 || (dev->irq == 0 && devpriv->timer_mode == 0)) { comedi_error(dev, - "irq (or use of 'timer mode') dma required to execute comedi_cmd"); + "irq (or use of 'timer mode') dma required to " + "execute comedi_cmd"); return -1; } if (cmd->flags & TRIG_RT) { - comedi_error(dev, - "isa dma transfers cannot be performed with TRIG_RT, aborting"); + comedi_error(dev, "isa dma transfers cannot be performed with " + "TRIG_RT, aborting"); return -1; } @@ -933,16 +951,17 @@ static int das16_cmd_exec(struct comedi_device *dev, struct comedi_subdevice *s) cmd->stop_arg * cmd->chanlist_len * sizeof(uint16_t); /* disable conversions for das1600 mode */ - if (thisboard->size > 0x400) { + if (thisboard->size > 0x400) outb(DAS1600_CONV_DISABLE, dev->iobase + DAS1600_CONV); - } + /* set scan limits */ byte = CR_CHAN(cmd->chanlist[0]); byte |= CR_CHAN(cmd->chanlist[cmd->chanlist_len - 1]) << 4; outb(byte, dev->iobase + DAS16_MUX); /* set gain (this is also burst rate register but according to - * computer boards manual, burst rate does nothing, even on keithley cards) */ + * computer boards manual, burst rate does nothing, even on + * keithley cards) */ if (thisboard->ai_pg != das16_pg_none) { range = CR_RANGE(cmd->chanlist[0]); outb((das16_gainlists[thisboard->ai_pg])[range], @@ -1005,9 +1024,9 @@ static int das16_cmd_exec(struct comedi_device *dev, struct comedi_subdevice *s) outb(devpriv->control_state, dev->iobase + DAS16_CONTROL); /* Enable conversions if using das1600 mode */ - if (thisboard->size > 0x400) { + if (thisboard->size > 0x400) outb(0, dev->iobase + DAS1600_CONV); - } + return 0; } @@ -1030,9 +1049,9 @@ static int das16_cancel(struct comedi_device *dev, struct comedi_subdevice *s) } /* disable burst mode */ - if (thisboard->size > 0x400) { + if (thisboard->size > 0x400) outb(0, dev->iobase + DAS1600_BURST); - } + spin_unlock_irqrestore(&dev->spinlock, flags); @@ -1085,11 +1104,11 @@ static int das16_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, } msb = inb(dev->iobase + DAS16_AI_MSB); lsb = inb(dev->iobase + DAS16_AI_LSB); - if (thisboard->ai_nbits == 12) { + if (thisboard->ai_nbits == 12) data[n] = ((lsb >> 4) & 0xf) | (msb << 4); - } else { + else data[n] = lsb | (msb << 8); - } + } return n; @@ -1207,8 +1226,8 @@ static int disable_dma_on_even(struct comedi_device *dev) residue = get_dma_residue(devpriv->dma_chan); } if (i == disable_limit) { - comedi_error(dev, - "failed to get an even dma transfer, could be trouble."); + comedi_error(dev, "failed to get an even dma transfer, " + "could be trouble."); } return residue; } @@ -1254,7 +1273,8 @@ static void das16_interrupt(struct comedi_device *dev) } else num_bytes = devpriv->dma_transfer_size - residue; - if (cmd->stop_src == TRIG_COUNT && num_bytes >= devpriv->adc_byte_count) { + if (cmd->stop_src == TRIG_COUNT && + num_bytes >= devpriv->adc_byte_count) { num_bytes = devpriv->adc_byte_count; async->events |= COMEDI_CB_EOA; } @@ -1275,9 +1295,9 @@ static void das16_interrupt(struct comedi_device *dev) set_dma_count(devpriv->dma_chan, devpriv->dma_transfer_size); enable_dma(devpriv->dma_chan); /* reenable conversions for das1600 mode, (stupid hardware) */ - if (thisboard->size > 0x400 && devpriv->timer_mode == 0) { + if (thisboard->size > 0x400 && devpriv->timer_mode == 0) outb(0x00, dev->iobase + DAS1600_CONV); - } + } release_dma_lock(dma_flags); @@ -1330,25 +1350,25 @@ static int das16_probe(struct comedi_device *dev, struct comedi_devconfig *it) status = inb(dev->iobase + DAS16_STATUS); - if ((status & UNIPOLAR)) { + if ((status & UNIPOLAR)) devpriv->ai_unipolar = 1; - } else { + else devpriv->ai_unipolar = 0; - } - if ((status & DAS16_MUXBIT)) { + + if ((status & DAS16_MUXBIT)) devpriv->ai_singleended = 1; - } else { + else devpriv->ai_singleended = 0; - } + /* diobits indicates boards */ diobits = inb(dev->iobase + DAS16_DIO) & 0xf0; - printk(" id bits are 0x%02x\n", diobits); + printk(KERN_INFO " id bits are 0x%02x\n", diobits); if (thisboard->id != diobits) { - printk(" requested board's id bits are 0x%x (ignore)\n", + printk(KERN_INFO " requested board's id bits are 0x%x (ignore)\n", thisboard->id); } @@ -1363,10 +1383,10 @@ static int das1600_mode_detect(struct comedi_device *dev) if (status & DAS1600_CLK_10MHZ) { devpriv->clockbase = 100; - printk(" 10MHz pacer clock\n"); + printk(KERN_INFO " 10MHz pacer clock\n"); } else { devpriv->clockbase = 1000; - printk(" 1MHz pacer clock\n"); + printk(KERN_INFO " 1MHz pacer clock\n"); } reg_dump(dev); @@ -1406,14 +1426,15 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (timer_mode) irq = 0; - printk("comedi%d: das16:", dev->minor); + printk(KERN_INFO "comedi%d: das16:", dev->minor); /* check that clock setting is valid */ if (it->options[3]) { if (it->options[3] != 0 && it->options[3] != 1 && it->options[3] != 10) { printk - ("\n Invalid option. Master clock must be set to 1 or 10 (MHz)\n"); + ("\n Invalid option. Master clock must be set " + "to 1 or 10 (MHz)\n"); return -EINVAL; } } @@ -1425,23 +1446,23 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (thisboard->size < 0x400) { printk(" 0x%04lx-0x%04lx\n", iobase, iobase + thisboard->size); if (!request_region(iobase, thisboard->size, "das16")) { - printk(" I/O port conflict\n"); + printk(KERN_ERR " I/O port conflict\n"); return -EIO; } } else { - printk(" 0x%04lx-0x%04lx 0x%04lx-0x%04lx\n", + printk(KERN_INFO " 0x%04lx-0x%04lx 0x%04lx-0x%04lx\n", iobase, iobase + 0x0f, iobase + 0x400, iobase + 0x400 + (thisboard->size & 0x3ff)); if (!request_region(iobase, 0x10, "das16")) { - printk(" I/O port conflict: 0x%04lx-0x%04lx\n", + printk(KERN_ERR " I/O port conflict: 0x%04lx-0x%04lx\n", iobase, iobase + 0x0f); return -EIO; } if (!request_region(iobase + 0x400, thisboard->size & 0x3ff, "das16")) { release_region(iobase, 0x10); - printk(" I/O port conflict: 0x%04lx-0x%04lx\n", + printk(KERN_ERR " I/O port conflict: 0x%04lx-0x%04lx\n", iobase + 0x400, iobase + 0x400 + (thisboard->size & 0x3ff)); return -EIO; @@ -1452,7 +1473,7 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* probe id bits to make sure they are consistent */ if (das16_probe(dev, it)) { - printk(" id bits do not match selected board, aborting\n"); + printk(KERN_ERR " id bits do not match selected board, aborting\n"); return -EINVAL; } dev->board_name = thisboard->name; @@ -1474,7 +1495,7 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (ret < 0) return ret; dev->irq = irq; - printk(" ( irq = %u )", irq); + printk(KERN_INFO " ( irq = %u )", irq); } else if (irq == 0) { printk(" ( no irq )"); } else { @@ -1488,16 +1509,15 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* allocate dma buffers */ int i; for (i = 0; i < 2; i++) { - devpriv->dma_buffer[i] = pci_alloc_consistent(NULL, - DAS16_DMA_SIZE, - &devpriv-> - dma_buffer_addr - [i]); + devpriv->dma_buffer[i] = pci_alloc_consistent( + NULL, DAS16_DMA_SIZE, + &devpriv->dma_buffer_addr[i]); + if (devpriv->dma_buffer[i] == NULL) return -ENOMEM; } if (request_dma(dma_chan, "das16")) { - printk(" failed to allocate dma channel %i\n", + printk(KERN_ERR " failed to allocate dma channel %i\n", dma_chan); return -EINVAL; } @@ -1506,11 +1526,11 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it) disable_dma(devpriv->dma_chan); set_dma_mode(devpriv->dma_chan, DMA_MODE_READ); release_dma_lock(flags); - printk(" ( dma = %u)\n", dma_chan); + printk(KERN_INFO " ( dma = %u)\n", dma_chan); } else if (dma_chan == 0) { - printk(" ( no dma )\n"); + printk(KERN_INFO " ( no dma )\n"); } else { - printk(" invalid dma channel\n"); + printk(KERN_ERR " invalid dma channel\n"); return -EINVAL; } @@ -1569,7 +1589,7 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it) s->subdev_flags |= SDF_DIFF; } s->maxdata = (1 << thisboard->ai_nbits) - 1; - if (devpriv->user_ai_range_table) { /* user defined ai range */ + if (devpriv->user_ai_range_table) { /* user defined ai range */ s->range_table = devpriv->user_ai_range_table; } else if (devpriv->ai_unipolar) { s->range_table = das16_ai_uni_lranges[thisboard->ai_pg]; @@ -1592,11 +1612,12 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it) s->subdev_flags = SDF_WRITABLE; s->n_chan = 2; s->maxdata = (1 << thisboard->ao_nbits) - 1; - if (devpriv->user_ao_range_table) { /* user defined ao range */ + /* user defined ao range */ + if (devpriv->user_ao_range_table) s->range_table = devpriv->user_ao_range_table; - } else { + else s->range_table = &range_unknown; - } + s->insn_write = thisboard->ao; } else { s->type = COMEDI_SUBD_UNUSED; @@ -1656,7 +1677,7 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it) static int das16_detach(struct comedi_device *dev) { - printk("comedi%d: das16: remove\n", dev->minor); + printk(KERN_INFO "comedi%d: das16: remove\n", dev->minor); das16_reset(dev); @@ -1750,8 +1771,8 @@ static void das16_ai_munge(struct comedi_device *dev, for (i = 0; i < num_samples; i++) { data[i] = le16_to_cpu(data[i]); - if (thisboard->ai_nbits == 12) { + if (thisboard->ai_nbits == 12) data[i] = (data[i] >> 4) & 0xfff; - } + } } diff --git a/drivers/staging/comedi/drivers/das1800.c b/drivers/staging/comedi/drivers/das1800.c index 3c3e045..de5e82f 100644 --- a/drivers/staging/comedi/drivers/das1800.c +++ b/drivers/staging/comedi/drivers/das1800.c @@ -797,10 +797,8 @@ static int das1800_detach(struct comedi_device *dev) free_dma(devpriv->dma0); if (devpriv->dma1) free_dma(devpriv->dma1); - if (devpriv->ai_buf0) - kfree(devpriv->ai_buf0); - if (devpriv->ai_buf1) - kfree(devpriv->ai_buf1); + kfree(devpriv->ai_buf0); + kfree(devpriv->ai_buf1); } printk("comedi%d: %s: remove\n", dev->minor, @@ -1639,7 +1637,8 @@ static int das1800_ai_rinsn(struct comedi_device *dev, } if (i == timeout) { comedi_error(dev, "timeout"); - return -ETIME; + n = -ETIME; + goto exit; } dpnt = inw(dev->iobase + DAS1800_FIFO); /* shift data to offset binary for bipolar ranges */ @@ -1647,6 +1646,7 @@ static int das1800_ai_rinsn(struct comedi_device *dev, dpnt += 1 << (thisboard->resolution - 1); data[n] = dpnt; } +exit: spin_unlock_irqrestore(&dev->spinlock, irq_flags); return n; diff --git a/drivers/staging/comedi/drivers/dt2801.c b/drivers/staging/comedi/drivers/dt2801.c index 3f365ae..83fb6e5 100644 --- a/drivers/staging/comedi/drivers/dt2801.c +++ b/drivers/staging/comedi/drivers/dt2801.c @@ -472,7 +472,7 @@ static const struct comedi_lrange *dac_range_table[] = { static const struct comedi_lrange *dac_range_lkup(int opt) { - if (opt < 0 || opt > 5) + if (opt < 0 || opt >= 5) return &range_unknown; return dac_range_table[opt]; } diff --git a/drivers/staging/comedi/drivers/dt2811.c b/drivers/staging/comedi/drivers/dt2811.c index 51ef695..ea9bfb7 100644 --- a/drivers/staging/comedi/drivers/dt2811.c +++ b/drivers/staging/comedi/drivers/dt2811.c @@ -34,13 +34,13 @@ Configuration options: [0] - I/O port base address [1] - IRQ, although this is currently unused [2] - A/D reference - 0 = signle-ended - 1 = differential + 0 = signle-ended + 1 = differential 2 = pseudo-differential (common reference) [3] - A/D range - 0 = [-5,5] - 1 = [-2.5,2.5] - 2 = [0,5] + 0 = [-5, 5] + 1 = [-2.5, 2.5] + 2 = [0, 5] [4] - D/A 0 range (same choices) [4] - D/A 1 range (same choices) */ @@ -52,96 +52,58 @@ Configuration options: static const char *driver_name = "dt2811"; -static const struct comedi_lrange range_dt2811_pgh_ai_5_unipolar = { 4, { - RANGE - (0, 5), - RANGE - (0, - 2.5), - RANGE - (0, - 1.25), - RANGE - (0, - 0.625) - } +static const struct comedi_lrange range_dt2811_pgh_ai_5_unipolar = { + 4, { + RANGE(0, 5), + RANGE(0, 2.5), + RANGE(0, 1.25), + RANGE(0, 0.625) + } }; -static const struct comedi_lrange range_dt2811_pgh_ai_2_5_bipolar = { 4, { - RANGE - (-2.5, - 2.5), - RANGE - (-1.25, - 1.25), - RANGE - (-0.625, - 0.625), - RANGE - (-0.3125, - 0.3125) - } +static const struct comedi_lrange range_dt2811_pgh_ai_2_5_bipolar = { + 4, { + RANGE(-2.5, 2.5), + RANGE(-1.25, 1.25), + RANGE(-0.625, 0.625), + RANGE(-0.3125, 0.3125) + } }; -static const struct comedi_lrange range_dt2811_pgh_ai_5_bipolar = { 4, { - RANGE - (-5, 5), - RANGE - (-2.5, - 2.5), - RANGE - (-1.25, - 1.25), - RANGE - (-0.625, - 0.625) - } +static const struct comedi_lrange range_dt2811_pgh_ai_5_bipolar = { + 4, { + RANGE(-5, 5), + RANGE(-2.5, 2.5), + RANGE(-1.25, 1.25), + RANGE(-0.625, 0.625) + } }; -static const struct comedi_lrange range_dt2811_pgl_ai_5_unipolar = { 4, { - RANGE - (0, 5), - RANGE - (0, - 0.5), - RANGE - (0, - 0.05), - RANGE - (0, - 0.01) - } +static const struct comedi_lrange range_dt2811_pgl_ai_5_unipolar = { + 4, { + RANGE(0, 5), + RANGE(0, 0.5), + RANGE(0, 0.05), + RANGE(0, 0.01) + } }; -static const struct comedi_lrange range_dt2811_pgl_ai_2_5_bipolar = { 4, { - RANGE - (-2.5, - 2.5), - RANGE - (-0.25, - 0.25), - RANGE - (-0.025, - 0.025), - RANGE - (-0.005, - 0.005) - } +static const struct comedi_lrange range_dt2811_pgl_ai_2_5_bipolar = { + 4, { + RANGE(-2.5, 2.5), + RANGE(-0.25, 0.25), + RANGE(-0.025, 0.025), + RANGE(-0.005, 0.005) + } }; -static const struct comedi_lrange range_dt2811_pgl_ai_5_bipolar = { 4, { - RANGE - (-5, 5), - RANGE - (-0.5, - 0.5), - RANGE - (-0.05, - 0.05), - RANGE - (-0.01, - 0.01) - } +static const struct comedi_lrange range_dt2811_pgl_ai_5_bipolar = { + 4, { + RANGE(-5, 5), + RANGE(-0.5, 0.5), + RANGE(-0.05, 0.05), + RANGE(-0.01, 0.01) + } }; /* @@ -348,21 +310,21 @@ static irqreturn_t dt2811_interrupt(int irq, void *d) options[0] Board base address options[1] IRQ options[2] Input configuration - 0 == single-ended - 1 == differential - 2 == pseudo-differential + 0 == single-ended + 1 == differential + 2 == pseudo-differential options[3] Analog input range configuration - 0 == bipolar 5 (-5V -- +5V) - 1 == bipolar 2.5V (-2.5V -- +2.5V) - 2 == unipolar 5V (0V -- +5V) + 0 == bipolar 5 (-5V -- +5V) + 1 == bipolar 2.5V (-2.5V -- +2.5V) + 2 == unipolar 5V (0V -- +5V) options[4] Analog output 0 range configuration - 0 == bipolar 5 (-5V -- +5V) - 1 == bipolar 2.5V (-2.5V -- +2.5V) - 2 == unipolar 5V (0V -- +5V) + 0 == bipolar 5 (-5V -- +5V) + 1 == bipolar 2.5V (-2.5V -- +2.5V) + 2 == unipolar 5V (0V -- +5V) options[5] Analog output 1 range configuration - 0 == bipolar 5 (-5V -- +5V) - 1 == bipolar 2.5V (-2.5V -- +2.5V) - 2 == unipolar 5V (0V -- +5V) + 0 == bipolar 5 (-5V -- +5V) + 1 == bipolar 2.5V (-2.5V -- +2.5V) + 2 == unipolar 5V (0V -- +5V) */ static int dt2811_attach(struct comedi_device *dev, struct comedi_devconfig *it) @@ -377,10 +339,10 @@ static int dt2811_attach(struct comedi_device *dev, struct comedi_devconfig *it) iobase = it->options[0]; - printk("comedi%d: dt2811: base=0x%04lx\n", dev->minor, iobase); + printk(KERN_INFO "comedi%d: dt2811:base=0x%04lx\n", dev->minor, iobase); if (!request_region(iobase, DT2811_SIZE, driver_name)) { - printk("I/O port conflict\n"); + printk(KERN_ERR "I/O port conflict\n"); return -EIO; } @@ -410,25 +372,25 @@ static int dt2811_attach(struct comedi_device *dev, struct comedi_devconfig *it) irq = probe_irq_off(irqs); restore_flags(flags); - /*outb(DT2811_CLRERROR|DT2811_INTENB,dev->iobase+DT2811_ADCSR); */ + /*outb(DT2811_CLRERROR|DT2811_INTENB, + dev->iobase+DT2811_ADCSR);*/ - if (inb(dev->iobase + DT2811_ADCSR) & DT2811_ADERROR) { - printk("error probing irq (bad) \n"); - } + if (inb(dev->iobase + DT2811_ADCSR) & DT2811_ADERROR) + printk(KERN_ERR "error probing irq (bad)\n"); dev->irq = 0; if (irq > 0) { i = inb(dev->iobase + DT2811_ADDATLO); i = inb(dev->iobase + DT2811_ADDATHI); - printk("(irq = %d)\n", irq); + printk(KERN_INFO "(irq = %d)\n", irq); ret = request_irq(irq, dt2811_interrupt, 0, driver_name, dev); if (ret < 0) return -EIO; dev->irq = irq; } else if (irq == 0) { - printk("(no irq)\n"); + printk(KERN_INFO "(no irq)\n"); } else { - printk("( multiple irq's -- this is bad! )\n"); + printk(KERN_ERR "( multiple irq's -- this is bad! )\n"); } } #endif @@ -540,14 +502,12 @@ static int dt2811_attach(struct comedi_device *dev, struct comedi_devconfig *it) static int dt2811_detach(struct comedi_device *dev) { - printk("comedi%d: dt2811: remove\n", dev->minor); + printk(KERN_INFO "comedi%d: dt2811: remove\n", dev->minor); - if (dev->irq) { + if (dev->irq) free_irq(dev->irq, dev); - } - if (dev->iobase) { + if (dev->iobase) release_region(dev->iobase, DT2811_SIZE); - } return 0; } @@ -579,7 +539,7 @@ static int dt2811_ai_insn(struct comedi_device *dev, struct comedi_subdevice *s, #if 0 /* Wow. This is code from the Comedi stone age. But it hasn't been * replaced, so I'll let it stay. */ -int dt2811_adtrig(kdev_t minor, comedi_adtrig * adtrig) +int dt2811_adtrig(kdev_t minor, comedi_adtrig *adtrig) { struct comedi_device *dev = comedi_devices + minor; @@ -589,8 +549,10 @@ int dt2811_adtrig(kdev_t minor, comedi_adtrig * adtrig) switch (dev->i_admode) { case COMEDI_MDEMAND: dev->ntrig = adtrig->n - 1; + /* not neccessary */ /*printk("dt2811: AD soft trigger\n"); */ - /*outb(DT2811_CLRERROR|DT2811_INTENB,dev->iobase+DT2811_ADCSR); *//* not neccessary */ + /*outb(DT2811_CLRERROR|DT2811_INTENB, + dev->iobase+DT2811_ADCSR); */ outb(dev->curadchan, dev->iobase + DT2811_ADGCR); do_gettimeofday(&trigtime); break; @@ -630,9 +592,8 @@ static int dt2811_ao_insn_read(struct comedi_device *dev, chan = CR_CHAN(insn->chanspec); - for (i = 0; i < insn->n; i++) { + for (i = 0; i < insn->n; i++) data[i] = devpriv->ao_readback[chan]; - } return i; } diff --git a/drivers/staging/comedi/drivers/dt2814.c b/drivers/staging/comedi/drivers/dt2814.c index e1b7375..16fde06 100644 --- a/drivers/staging/comedi/drivers/dt2814.c +++ b/drivers/staging/comedi/drivers/dt2814.c @@ -99,13 +99,13 @@ static int dt2814_ai_insn_read(struct comedi_device *dev, outb(chan, dev->iobase + DT2814_CSR); for (i = 0; i < DT2814_TIMEOUT; i++) { status = inb(dev->iobase + DT2814_CSR); - printk("dt2814: status: %02x\n", status); + printk(KERN_INFO "dt2814: status: %02x\n", status); udelay(10); if (status & DT2814_FINISH) break; } if (i >= DT2814_TIMEOUT) { - printk("dt2814: status: %02x\n", status); + printk(KERN_INFO "dt2814: status: %02x\n", status); return -ETIMEDOUT; } @@ -173,7 +173,8 @@ static int dt2814_ai_cmdtest(struct comedi_device *dev, if (err) return 1; - /* step 2: make sure trigger sources are unique and mutually compatible */ + /* step 2: make sure trigger sources are + * unique and mutually compatible */ /* note that mutual compatibility is not an issue here */ if (cmd->stop_src != TRIG_TIMER && cmd->stop_src != TRIG_EXT) @@ -256,9 +257,9 @@ static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it) unsigned long iobase; iobase = it->options[0]; - printk("comedi%d: dt2814: 0x%04lx ", dev->minor, iobase); + printk(KERN_INFO "comedi%d: dt2814: 0x%04lx ", dev->minor, iobase); if (!request_region(iobase, DT2814_SIZE, "dt2814")) { - printk("I/O port conflict\n"); + printk(KERN_ERR "I/O port conflict\n"); return -EIO; } dev->iobase = iobase; @@ -267,7 +268,7 @@ static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it) outb(0, dev->iobase + DT2814_CSR); udelay(100); if (inb(dev->iobase + DT2814_CSR) & DT2814_ERR) { - printk("reset error (fatal)\n"); + printk(KERN_ERR "reset error (fatal)\n"); return -EIO; } i = inb(dev->iobase + DT2814_DATA); @@ -286,9 +287,9 @@ static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it) irq = probe_irq_off(irqs); restore_flags(flags); - if (inb(dev->iobase + DT2814_CSR) & DT2814_ERR) { - printk("error probing irq (bad) \n"); - } + if (inb(dev->iobase + DT2814_CSR) & DT2814_ERR) + printk(KERN_DEBUG "error probing irq (bad)\n"); + i = inb(dev->iobase + DT2814_DATA); i = inb(dev->iobase + DT2814_DATA); @@ -297,18 +298,18 @@ static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->irq = 0; if (irq > 0) { if (request_irq(irq, dt2814_interrupt, 0, "dt2814", dev)) { - printk("(irq %d unavailable)\n", irq); + printk(KERN_WARNING "(irq %d unavailable)\n", irq); } else { - printk("( irq = %d )\n", irq); + printk(KERN_INFO "( irq = %d )\n", irq); dev->irq = irq; } } else if (irq == 0) { - printk("(no irq)\n"); + printk(KERN_WARNING "(no irq)\n"); } else { #if 0 - printk("(probe returned multiple irqs--bad)\n"); + printk(KERN_DEBUG "(probe returned multiple irqs--bad)\n"); #else - printk("(irq probe not implemented)\n"); + printk(KERN_WARNING "(irq probe not implemented)\n"); #endif } @@ -337,14 +338,13 @@ static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it) static int dt2814_detach(struct comedi_device *dev) { - printk("comedi%d: dt2814: remove\n", dev->minor); + printk(KERN_INFO "comedi%d: dt2814: remove\n", dev->minor); - if (dev->irq) { + if (dev->irq) free_irq(dev->irq, dev); - } - if (dev->iobase) { + + if (dev->iobase) release_region(dev->iobase, DT2814_SIZE); - } return 0; } diff --git a/drivers/staging/comedi/drivers/dt282x.c b/drivers/staging/comedi/drivers/dt282x.c index e548763..fd8728c 100644 --- a/drivers/staging/comedi/drivers/dt282x.c +++ b/drivers/staging/comedi/drivers/dt282x.c @@ -45,9 +45,9 @@ Configuration options: [7] - AO 1 jumpered for 0=straight binary, 1=2's complement [8] - AI jumpered for 0=[-10,10]V, 1=[0,10], 2=[-5,5], 3=[0,5] [9] - AO 0 jumpered for 0=[-10,10]V, 1=[0,10], 2=[-5,5], 3=[0,5], - 4=[-2.5,2.5] + 4=[-2.5,2.5] [10]- A0 1 jumpered for 0=[-10,10]V, 1=[0,10], 2=[-5,5], 3=[0,5], - 4=[-2.5,2.5] + 4=[-2.5,2.5] Notes: - AO commands might be broken. @@ -155,79 +155,58 @@ Notes: #define DT2821_XCLK 0x0002 /* (R/W) external clock enable */ #define DT2821_BDINIT 0x0001 /* (W) initialize board */ -static const struct comedi_lrange range_dt282x_ai_lo_bipolar = { 4, { - RANGE(-10, - 10), - RANGE(-5, - 5), - RANGE(-2.5, - 2.5), - RANGE - (-1.25, - 1.25) - } +static const struct comedi_lrange range_dt282x_ai_lo_bipolar = { + 4, { + RANGE(-10, 10), + RANGE(-5, 5), + RANGE(-2.5, 2.5), + RANGE(-1.25, 1.25) + } }; -static const struct comedi_lrange range_dt282x_ai_lo_unipolar = { 4, { - RANGE(0, - 10), - RANGE(0, - 5), - RANGE(0, - 2.5), - RANGE(0, - 1.25) - } +static const struct comedi_lrange range_dt282x_ai_lo_unipolar = { + 4, { + RANGE(0, 10), + RANGE(0, 5), + RANGE(0, 2.5), + RANGE(0, 1.25) + } }; -static const struct comedi_lrange range_dt282x_ai_5_bipolar = { 4, { - RANGE(-5, - 5), - RANGE(-2.5, - 2.5), - RANGE(-1.25, - 1.25), - RANGE - (-0.625, - 0.625), - } +static const struct comedi_lrange range_dt282x_ai_5_bipolar = { + 4, { + RANGE(-5, 5), + RANGE(-2.5, 2.5), + RANGE(-1.25, 1.25), + RANGE(-0.625, 0.625) + } }; -static const struct comedi_lrange range_dt282x_ai_5_unipolar = { 4, { - RANGE(0, - 5), - RANGE(0, - 2.5), - RANGE(0, - 1.25), - RANGE(0, - 0.625), - } +static const struct comedi_lrange range_dt282x_ai_5_unipolar = { + 4, { + RANGE(0, 5), + RANGE(0, 2.5), + RANGE(0, 1.25), + RANGE(0, 0.625), + } }; -static const struct comedi_lrange range_dt282x_ai_hi_bipolar = { 4, { - RANGE(-10, - 10), - RANGE(-1, - 1), - RANGE(-0.1, - 0.1), - RANGE - (-0.02, - 0.02) - } +static const struct comedi_lrange range_dt282x_ai_hi_bipolar = { + 4, { + RANGE(-10, 10), + RANGE(-1, 1), + RANGE(-0.1, 0.1), + RANGE(-0.02, 0.02) + } }; -static const struct comedi_lrange range_dt282x_ai_hi_unipolar = { 4, { - RANGE(0, - 10), - RANGE(0, - 1), - RANGE(0, - 0.1), - RANGE(0, - 0.02) - } +static const struct comedi_lrange range_dt282x_ai_hi_unipolar = { + 4, { + RANGE(0, 10), + RANGE(0, 1), + RANGE(0, 0.1), + RANGE(0, 0.02) + } }; struct dt282x_board { @@ -370,7 +349,7 @@ static const struct dt282x_board boardtypes[] = { }, }; -#define n_boardtypes sizeof(boardtypes)/sizeof(struct dt282x_board) +#define n_boardtypes (sizeof(boardtypes)/sizeof(struct dt282x_board)) #define this_board ((const struct dt282x_board *)dev->board_ptr) struct dt282x_private { @@ -411,21 +390,25 @@ struct dt282x_private { #define update_adcsr(a) outw(devpriv->adcsr|(a), dev->iobase+DT2821_ADCSR) #define mux_busy() (inw(dev->iobase+DT2821_ADCSR)&DT2821_MUXBUSY) #define ad_done() (inw(dev->iobase+DT2821_ADCSR)&DT2821_ADDONE) -#define update_supcsr(a) outw(devpriv->supcsr|(a), dev->iobase+DT2821_SUPCSR) +#define update_supcsr(a) outw(devpriv->supcsr|(a), dev->iobase+DT2821_SUPCSR) /* * danger! macro abuse... a is the expression to wait on, and b is * the statement(s) to execute if it doesn't happen. */ -#define wait_for(a, b) \ - do{ \ - int _i; \ - for (_i=0;_i<DT2821_TIMEOUT;_i++){ \ - if (a){_i=0;break;} \ - udelay(5); \ - } \ - if (_i){b} \ - }while (0) +#define wait_for(a, b) \ + do { \ + int _i; \ + for (_i = 0; _i < DT2821_TIMEOUT; _i++) { \ + if (a) { \ + _i = 0; \ + break; \ + } \ + udelay(5); \ + } \ + if (_i) \ + b \ + } while (0) static int dt282x_attach(struct comedi_device *dev, struct comedi_devconfig *it); @@ -462,18 +445,16 @@ static void dt282x_munge(struct comedi_device *dev, short *buf, unsigned short sign = 1 << (boardtype.adbits - 1); int n; - if (devpriv->ad_2scomp) { + if (devpriv->ad_2scomp) sign = 1 << (boardtype.adbits - 1); - } else { + else sign = 0; - } if (nbytes % 2) comedi_error(dev, "bug! odd number of bytes from dma xfer"); n = nbytes / 2; - for (i = 0; i < n; i++) { + for (i = 0; i < n; i++) buf[i] = (buf[i] & mask) ^ sign; - } } static void dt282x_ao_dma_interrupt(struct comedi_device *dev) @@ -486,7 +467,7 @@ static void dt282x_ao_dma_interrupt(struct comedi_device *dev) update_supcsr(DT2821_CLRDMADNE); if (!s->async->prealloc_buf) { - printk("async->data disappeared. dang!\n"); + printk(KERN_ERR "async->data disappeared. dang!\n"); return; } @@ -499,7 +480,7 @@ static void dt282x_ao_dma_interrupt(struct comedi_device *dev) size = cfc_read_array_from_buffer(s, ptr, devpriv->dma_maxsize); if (size == 0) { - printk("dt282x: AO underrun\n"); + printk(KERN_ERR "dt282x: AO underrun\n"); dt282x_ao_cancel(dev, s); s->async->events |= COMEDI_CB_OVERFLOW; return; @@ -519,7 +500,7 @@ static void dt282x_ai_dma_interrupt(struct comedi_device *dev) update_supcsr(DT2821_CLRDMADNE); if (!s->async->prealloc_buf) { - printk("async->data disappeared. dang!\n"); + printk(KERN_ERR "async->data disappeared. dang!\n"); return; } @@ -540,7 +521,7 @@ static void dt282x_ai_dma_interrupt(struct comedi_device *dev) devpriv->nread -= size / 2; if (devpriv->nread < 0) { - printk("dt282x: off by one\n"); + printk(KERN_INFO "dt282x: off by one\n"); devpriv->nread = 0; } if (!devpriv->nread) { @@ -651,7 +632,7 @@ static irqreturn_t dt282x_interrupt(int irq, void *d) static int warn = 5; if (--warn <= 0) { disable_irq(dev->irq); - printk("disabling irq\n"); + printk(KERN_INFO "disabling irq\n"); } #endif comedi_error(dev, "D/A error"); @@ -666,13 +647,13 @@ static irqreturn_t dt282x_interrupt(int irq, void *d) data = (short)inw(dev->iobase + DT2821_ADDAT); data &= (1 << boardtype.adbits) - 1; - if (devpriv->ad_2scomp) { + + if (devpriv->ad_2scomp) data ^= 1 << (boardtype.adbits - 1); - } ret = comedi_buf_put(s->async, data); - if (ret == 0) { + + if (ret == 0) s->async->events |= COMEDI_CB_OVERFLOW; - } devpriv->nread--; if (!devpriv->nread) { @@ -685,7 +666,8 @@ static irqreturn_t dt282x_interrupt(int irq, void *d) } #endif comedi_event(dev, s); - /* printk("adcsr=0x%02x dacsr-0x%02x supcsr=0x%02x\n", adcsr, dacsr, supcsr); */ + /* printk("adcsr=0x%02x dacsr-0x%02x supcsr=0x%02x\n", + adcsr, dacsr, supcsr); */ return IRQ_RETVAL(handled); } @@ -776,7 +758,10 @@ static int dt282x_ai_cmdtest(struct comedi_device *dev, if (err) return 1; - /* step 2: make sure trigger sources are unique and mutually compatible */ + /* + * step 2: make sure trigger sources are unique + * and mutually compatible + */ /* note that mutual compatibility is not an issue here */ if (cmd->scan_begin_src != TRIG_FOLLOW && @@ -859,7 +844,8 @@ static int dt282x_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) if (devpriv->usedma == 0) { comedi_error(dev, - "driver requires 2 dma channels to execute command"); + "driver requires 2 dma channels" + " to execute command"); return -EIO; } @@ -1049,7 +1035,10 @@ static int dt282x_ao_cmdtest(struct comedi_device *dev, if (err) return 1; - /* step 2: make sure trigger sources are unique and mutually compatible */ + /* + * step 2: make sure trigger sources are unique + * and mutually compatible + */ /* note that mutual compatibility is not an issue here */ if (cmd->stop_src != TRIG_COUNT && cmd->stop_src != TRIG_NONE) @@ -1064,7 +1053,7 @@ static int dt282x_ao_cmdtest(struct comedi_device *dev, cmd->start_arg = 0; err++; } - if (cmd->scan_begin_arg < 5000 /* XXX unknown */ ) { + if (cmd->scan_begin_arg < 5000 /* XXX unknown */) { cmd->scan_begin_arg = 5000; err++; } @@ -1115,7 +1104,7 @@ static int dt282x_ao_inttrig(struct comedi_device *dev, size = cfc_read_array_from_buffer(s, devpriv->dma[0].buf, devpriv->dma_maxsize); if (size == 0) { - printk("dt282x: AO underrun\n"); + printk(KERN_ERR "dt282x: AO underrun\n"); return -EPIPE; } prep_ao_dma(dev, 0, size); @@ -1123,7 +1112,7 @@ static int dt282x_ao_inttrig(struct comedi_device *dev, size = cfc_read_array_from_buffer(s, devpriv->dma[1].buf, devpriv->dma_maxsize); if (size == 0) { - printk("dt282x: AO underrun\n"); + printk(KERN_ERR "dt282x: AO underrun\n"); return -EPIPE; } prep_ao_dma(dev, 1, size); @@ -1141,7 +1130,8 @@ static int dt282x_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s) if (devpriv->usedma == 0) { comedi_error(dev, - "driver requires 2 dma channels to execute command"); + "driver requires 2 dma channels" + " to execute command"); return -EIO; } @@ -1262,7 +1252,8 @@ static const struct comedi_lrange *opt_ao_range_lkup(int x) return ao_range_table[x]; } -enum { opt_iobase = 0, opt_irq, opt_dma1, opt_dma2, /* i/o base, irq, dma channels */ +enum { /* i/o base, irq, dma channels */ + opt_iobase = 0, opt_irq, opt_dma1, opt_dma2, opt_diff, /* differential */ opt_ai_twos, opt_ao0_twos, opt_ao1_twos, /* twos comp */ opt_ai_range, opt_ao0_range, opt_ao1_range, /* range */ @@ -1295,9 +1286,9 @@ static int dt282x_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (!iobase) iobase = 0x240; - printk("comedi%d: dt282x: 0x%04lx", dev->minor, iobase); + printk(KERN_INFO "comedi%d: dt282x: 0x%04lx", dev->minor, iobase); if (!request_region(iobase, DT2821_SIZE, "dt282x")) { - printk(" I/O port conflict\n"); + printk(KERN_INFO " I/O port conflict\n"); return -EBUSY; } dev->iobase = iobase; @@ -1305,7 +1296,7 @@ static int dt282x_attach(struct comedi_device *dev, struct comedi_devconfig *it) outw(DT2821_BDINIT, dev->iobase + DT2821_SUPCSR); i = inw(dev->iobase + DT2821_ADCSR); #ifdef DEBUG - printk(" fingerprint=%x,%x,%x,%x,%x", + printk(KERN_DEBUG " fingerprint=%x,%x,%x,%x,%x", inw(dev->iobase + DT2821_ADCSR), inw(dev->iobase + DT2821_CHANCSR), inw(dev->iobase + DT2821_DACSR), @@ -1323,7 +1314,7 @@ static int dt282x_attach(struct comedi_device *dev, struct comedi_devconfig *it) != DT2821_SUPCSR_VAL) || ((inw(dev->iobase + DT2821_TMRCTR) & DT2821_TMRCTR_MASK) != DT2821_TMRCTR_VAL)) { - printk(" board not found"); + printk(KERN_ERR " board not found"); return -EIO; } /* should do board test */ @@ -1344,26 +1335,25 @@ static int dt282x_attach(struct comedi_device *dev, struct comedi_devconfig *it) irq = probe_irq_off(irqs); restore_flags(flags); - if (0 /* error */ ) { - printk(" error probing irq (bad)"); - } + if (0 /* error */) + printk(KERN_ERR " error probing irq (bad)"); } #endif if (irq > 0) { - printk(" ( irq = %d )", irq); + printk(KERN_INFO " ( irq = %d )", irq); ret = request_irq(irq, dt282x_interrupt, 0, "dt282x", dev); if (ret < 0) { - printk(" failed to get irq\n"); + printk(KERN_ERR " failed to get irq\n"); return -EIO; } dev->irq = irq; } else if (irq == 0) { - printk(" (no irq)"); + printk(KERN_INFO " (no irq)"); } else { #if 0 - printk(" (probe returned multiple irqs--bad)"); + printk(KERN_INFO " (probe returned multiple irqs--bad)"); #else - printk(" (irq probe not implemented)"); + printk(KERN_INFO " (irq probe not implemented)"); #endif } @@ -1435,16 +1425,15 @@ static int dt282x_attach(struct comedi_device *dev, struct comedi_devconfig *it) s->maxdata = 1; s->range_table = &range_digital; - printk("\n"); + printk(KERN_INFO "\n"); return 0; } static void free_resources(struct comedi_device *dev) { - if (dev->irq) { + if (dev->irq) free_irq(dev->irq, dev); - } if (dev->iobase) release_region(dev->iobase, DT2821_SIZE); if (dev->private) { @@ -1461,7 +1450,7 @@ static void free_resources(struct comedi_device *dev) static int dt282x_detach(struct comedi_device *dev) { - printk("comedi%d: dt282x: remove\n", dev->minor); + printk(KERN_INFO "comedi%d: dt282x: remove\n", dev->minor); free_resources(dev); @@ -1475,7 +1464,7 @@ static int dt282x_grab_dma(struct comedi_device *dev, int dma1, int dma2) devpriv->usedma = 0; if (!dma1 && !dma2) { - printk(" (no dma)"); + printk(KERN_ERR " (no dma)"); return 0; } @@ -1503,11 +1492,11 @@ static int dt282x_grab_dma(struct comedi_device *dev, int dma1, int dma2) devpriv->dma[0].buf = (void *)__get_free_page(GFP_KERNEL | GFP_DMA); devpriv->dma[1].buf = (void *)__get_free_page(GFP_KERNEL | GFP_DMA); if (!devpriv->dma[0].buf || !devpriv->dma[1].buf) { - printk(" can't get DMA memory"); + printk(KERN_ERR " can't get DMA memory"); return -ENOMEM; } - printk(" (dma=%d,%d)", dma1, dma2); + printk(KERN_INFO " (dma=%d,%d)", dma1, dma2); devpriv->usedma = 1; diff --git a/drivers/staging/comedi/drivers/dt3000.c b/drivers/staging/comedi/drivers/dt3000.c index bbbef79..ca68789 100644 --- a/drivers/staging/comedi/drivers/dt3000.c +++ b/drivers/staging/comedi/drivers/dt3000.c @@ -314,9 +314,8 @@ static int dt3k_send_cmd(struct comedi_device *dev, unsigned int cmd) break; udelay(1); } - if ((status & DT3000_COMPLETION_MASK) == DT3000_NOERROR) { + if ((status & DT3000_COMPLETION_MASK) == DT3000_NOERROR) return 0; - } printk("dt3k_send_cmd() timeout/error status=0x%04x\n", status); @@ -359,9 +358,8 @@ static irqreturn_t dt3k_interrupt(int irq, void *d) struct comedi_subdevice *s; unsigned int status; - if (!dev->attached) { + if (!dev->attached) return IRQ_NONE; - } s = dev->subdevices + 0; status = readw(devpriv->io_addr + DPR_Intr_Flag); @@ -374,9 +372,8 @@ static irqreturn_t dt3k_interrupt(int irq, void *d) s->async->events |= COMEDI_CB_BLOCK; } - if (status & (DT3000_ADSWERR | DT3000_ADHWERR)) { + if (status & (DT3000_ADSWERR | DT3000_ADHWERR)) s->async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA; - } debug_n_ints++; if (debug_n_ints >= 10) { @@ -399,9 +396,8 @@ static void debug_intr_flags(unsigned int flags) int i; printk("dt3k: intr_flags:"); for (i = 0; i < 8; i++) { - if (flags & (1 << i)) { + if (flags & (1 << i)) printk(" %s", intr_flags[i]); - } } printk("\n"); } @@ -690,9 +686,8 @@ static int dt3k_ai_insn(struct comedi_device *dev, struct comedi_subdevice *s, /* XXX docs don't explain how to select aref */ aref = CR_AREF(insn->chanspec); - for (i = 0; i < insn->n; i++) { + for (i = 0; i < insn->n; i++) data[i] = dt3k_readsingle(dev, SUBS_AI, chan, gain); - } return i; } @@ -720,9 +715,8 @@ static int dt3k_ao_insn_read(struct comedi_device *dev, unsigned int chan; chan = CR_CHAN(insn->chanspec); - for (i = 0; i < insn->n; i++) { + for (i = 0; i < insn->n; i++) data[i] = devpriv->ao_readback[chan]; - } return i; } @@ -911,9 +905,8 @@ static int dt3000_detach(struct comedi_device *dev) if (devpriv) { if (devpriv->pci_dev) { - if (devpriv->phys_addr) { + if (devpriv->phys_addr) comedi_pci_disable(devpriv->pci_dev); - } pci_dev_put(devpriv->pci_dev); } if (devpriv->io_addr) diff --git a/drivers/staging/comedi/drivers/icp_multi.h b/drivers/staging/comedi/drivers/icp_multi.h index 8caadc6..2bb96b1 100644 --- a/drivers/staging/comedi/drivers/icp_multi.h +++ b/drivers/staging/comedi/drivers/icp_multi.h @@ -73,14 +73,13 @@ static void pci_card_list_init(unsigned short pci_vendor, char display) pcidev != NULL; pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) { if (pcidev->vendor == pci_vendor) { - inova = kmalloc(sizeof(*inova), GFP_KERNEL); + inova = kzalloc(sizeof(*inova), GFP_KERNEL); if (!inova) { printk ("icp_multi: pci_card_list_init: allocation failed\n"); pci_dev_put(pcidev); break; } - memset(inova, 0, sizeof(*inova)); inova->pcidev = pci_dev_get(pcidev); if (last) { diff --git a/drivers/staging/comedi/drivers/me_daq.c b/drivers/staging/comedi/drivers/me_daq.c index 80e192d..c8484ae 100644 --- a/drivers/staging/comedi/drivers/me_daq.c +++ b/drivers/staging/comedi/drivers/me_daq.c @@ -60,6 +60,7 @@ from http://www.comedi.org #define ME_DRIVER_NAME "me_daq" +#define PCI_VENDOR_ID_MEILHAUS 0x1402 #define ME2000_DEVICE_ID 0x2000 #define ME2600_DEVICE_ID 0x2600 diff --git a/drivers/staging/comedi/drivers/mite.c b/drivers/staging/comedi/drivers/mite.c index 188f580..99d9985 100644 --- a/drivers/staging/comedi/drivers/mite.c +++ b/drivers/staging/comedi/drivers/mite.c @@ -76,7 +76,7 @@ void mite_init(void) for (pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL); pcidev != NULL; pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) { - if (pcidev->vendor == PCI_VENDOR_ID_NATINST) { + if (pcidev->vendor == PCI_VENDOR_ID_NI) { unsigned i; mite = kzalloc(sizeof(*mite), GFP_KERNEL); diff --git a/drivers/staging/comedi/drivers/mite.h b/drivers/staging/comedi/drivers/mite.h index 9d5049f..999551f 100644 --- a/drivers/staging/comedi/drivers/mite.h +++ b/drivers/staging/comedi/drivers/mite.h @@ -27,8 +27,6 @@ #include <linux/pci.h> #include "../comedidev.h" -#define PCI_VENDOR_ID_NATINST 0x1093 - /* #define DEBUG_MITE */ #define PCIMIO_COMPAT diff --git a/drivers/staging/comedi/drivers/mpc624.c b/drivers/staging/comedi/drivers/mpc624.c index 12e72c8..9874ac3 100644 --- a/drivers/staging/comedi/drivers/mpc624.c +++ b/drivers/staging/comedi/drivers/mpc624.c @@ -40,20 +40,20 @@ Status: working Configuration Options: [0] - I/O base address [1] - convertion rate - Convertion rate RMS noise Effective Number Of Bits - 0 3.52kHz 23uV 17 - 1 1.76kHz 3.5uV 20 - 2 880Hz 2uV 21.3 - 3 440Hz 1.4uV 21.8 - 4 220Hz 1uV 22.4 - 5 110Hz 750uV 22.9 - 6 55Hz 510nV 23.4 - 7 27.5Hz 375nV 24 - 8 13.75Hz 250nV 24.4 - 9 6.875Hz 200nV 24.6 - [2] - voltage range - 0 -1.01V .. +1.01V - 1 -10.1V .. +10.1V + Convertion rate RMS noise Effective Number Of Bits + 0 3.52kHz 23uV 17 + 1 1.76kHz 3.5uV 20 + 2 880Hz 2uV 21.3 + 3 440Hz 1.4uV 21.8 + 4 220Hz 1uV 22.4 + 5 110Hz 750uV 22.9 + 6 55Hz 510nV 23.4 + 7 27.5Hz 375nV 24 + 8 13.75Hz 250nV 24.4 + 9 6.875Hz 200nV 24.6 + [2] - voltage range + 0 -1.01V .. +1.01V + 1 -10.1V .. +10.1V */ #include "../comedidev.h" @@ -65,13 +65,13 @@ Configuration Options: #define MPC624_SIZE 16 /* Offsets of different ports */ -#define MPC624_MASTER_CONTROL 0 /* not used */ -#define MPC624_GNMUXCH 1 /* Gain, Mux, Channel of ADC */ -#define MPC624_ADC 2 /* read/write to/from ADC */ -#define MPC624_EE 3 /* read/write to/from serial EEPROM via I2C */ -#define MPC624_LEDS 4 /* write to LEDs */ -#define MPC624_DIO 5 /* read/write to/from digital I/O ports */ -#define MPC624_IRQ_MASK 6 /* IRQ masking enable/disable */ +#define MPC624_MASTER_CONTROL 0 /* not used */ +#define MPC624_GNMUXCH 1 /* Gain, Mux, Channel of ADC */ +#define MPC624_ADC 2 /* read/write to/from ADC */ +#define MPC624_EE 3 /* read/write to/from serial EEPROM via I2C */ +#define MPC624_LEDS 4 /* write to LEDs */ +#define MPC624_DIO 5 /* read/write to/from digital I/O ports */ +#define MPC624_IRQ_MASK 6 /* IRQ masking enable/disable */ /* Register bits' names */ #define MPC624_ADBUSY (1<<5) @@ -109,24 +109,27 @@ Configuration Options: * ^ - Effective Number Of Bits */ -#define MPC624_SPEED_3_52_kHz (MPC624_OSR4 | MPC624_OSR0) -#define MPC624_SPEED_1_76_kHz (MPC624_OSR4 | MPC624_OSR1) -#define MPC624_SPEED_880_Hz (MPC624_OSR4 | MPC624_OSR1 | MPC624_OSR0) -#define MPC624_SPEED_440_Hz (MPC624_OSR4 | MPC624_OSR2) -#define MPC624_SPEED_220_Hz (MPC624_OSR4 | MPC624_OSR2 | MPC624_OSR0) -#define MPC624_SPEED_110_Hz (MPC624_OSR4 | MPC624_OSR2 | MPC624_OSR1) -#define MPC624_SPEED_55_Hz (MPC624_OSR4 | MPC624_OSR2 | MPC624_OSR1 | MPC624_OSR0) -#define MPC624_SPEED_27_5_Hz (MPC624_OSR4 | MPC624_OSR3) -#define MPC624_SPEED_13_75_Hz (MPC624_OSR4 | MPC624_OSR3 | MPC624_OSR0) -#define MPC624_SPEED_6_875_Hz (MPC624_OSR4 | MPC624_OSR3 | MPC624_OSR2 | MPC624_OSR1 | MPC624_OSR0) -/* ---------------------------------------------------------------------------- */ +#define MPC624_SPEED_3_52_kHz (MPC624_OSR4 | MPC624_OSR0) +#define MPC624_SPEED_1_76_kHz (MPC624_OSR4 | MPC624_OSR1) +#define MPC624_SPEED_880_Hz (MPC624_OSR4 | MPC624_OSR1 | MPC624_OSR0) +#define MPC624_SPEED_440_Hz (MPC624_OSR4 | MPC624_OSR2) +#define MPC624_SPEED_220_Hz (MPC624_OSR4 | MPC624_OSR2 | MPC624_OSR0) +#define MPC624_SPEED_110_Hz (MPC624_OSR4 | MPC624_OSR2 | MPC624_OSR1) +#define MPC624_SPEED_55_Hz \ + (MPC624_OSR4 | MPC624_OSR2 | MPC624_OSR1 | MPC624_OSR0) +#define MPC624_SPEED_27_5_Hz (MPC624_OSR4 | MPC624_OSR3) +#define MPC624_SPEED_13_75_Hz (MPC624_OSR4 | MPC624_OSR3 | MPC624_OSR0) +#define MPC624_SPEED_6_875_Hz \ + (MPC624_OSR4 | MPC624_OSR3 | MPC624_OSR2 | MPC624_OSR1 | MPC624_OSR0) +/* -------------------------------------------------------------------------- */ struct skel_private { - unsigned long int ulConvertionRate; /* set by mpc624_attach() from driver's parameters */ + /* set by mpc624_attach() from driver's parameters */ + unsigned long int ulConvertionRate; }; #define devpriv ((struct skel_private *)dev->private) -/* ---------------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------- */ static const struct comedi_lrange range_mpc624_bipolar1 = { 1, { @@ -145,11 +148,11 @@ static const struct comedi_lrange range_mpc624_bipolar10 = { } }; -/* ---------------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------- */ static int mpc624_attach(struct comedi_device *dev, struct comedi_devconfig *it); static int mpc624_detach(struct comedi_device *dev); -/* ---------------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------- */ static struct comedi_driver driver_mpc624 = { .driver_name = "mpc624", .module = THIS_MODULE, @@ -157,20 +160,20 @@ static struct comedi_driver driver_mpc624 = { .detach = mpc624_detach }; -/* ---------------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------- */ static int mpc624_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -/* ---------------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------- */ static int mpc624_attach(struct comedi_device *dev, struct comedi_devconfig *it) { struct comedi_subdevice *s; unsigned long iobase; iobase = it->options[0]; - printk("comedi%d: mpc624 [0x%04lx, ", dev->minor, iobase); + printk(KERN_INFO "comedi%d: mpc624 [0x%04lx, ", dev->minor, iobase); if (request_region(iobase, MPC624_SIZE, "mpc624") == NULL) { - printk("I/O port(s) in use\n"); + printk(KERN_ERR "I/O port(s) in use\n"); return -EIO; } @@ -184,47 +187,48 @@ static int mpc624_attach(struct comedi_device *dev, struct comedi_devconfig *it) switch (it->options[1]) { case 0: devpriv->ulConvertionRate = MPC624_SPEED_3_52_kHz; - printk("3.52 kHz, "); + printk(KERN_INFO "3.52 kHz, "); break; case 1: devpriv->ulConvertionRate = MPC624_SPEED_1_76_kHz; - printk("1.76 kHz, "); + printk(KERN_INFO "1.76 kHz, "); break; case 2: devpriv->ulConvertionRate = MPC624_SPEED_880_Hz; - printk("880 Hz, "); + printk(KERN_INFO "880 Hz, "); break; case 3: devpriv->ulConvertionRate = MPC624_SPEED_440_Hz; - printk("440 Hz, "); + printk(KERN_INFO "440 Hz, "); break; case 4: devpriv->ulConvertionRate = MPC624_SPEED_220_Hz; - printk("220 Hz, "); + printk(KERN_INFO "220 Hz, "); break; case 5: devpriv->ulConvertionRate = MPC624_SPEED_110_Hz; - printk("110 Hz, "); + printk(KERN_INFO "110 Hz, "); break; case 6: devpriv->ulConvertionRate = MPC624_SPEED_55_Hz; - printk("55 Hz, "); + printk(KERN_INFO "55 Hz, "); break; case 7: devpriv->ulConvertionRate = MPC624_SPEED_27_5_Hz; - printk("27.5 Hz, "); + printk(KERN_INFO "27.5 Hz, "); break; case 8: devpriv->ulConvertionRate = MPC624_SPEED_13_75_Hz; - printk("13.75 Hz, "); + printk(KERN_INFO "13.75 Hz, "); break; case 9: devpriv->ulConvertionRate = MPC624_SPEED_6_875_Hz; - printk("6.875 Hz, "); + printk(KERN_INFO "6.875 Hz, "); break; default: printk - ("illegal convertion rate setting! Valid numbers are 0..9. Using 9 => 6.875 Hz, "); + (KERN_ERR "illegal convertion rate setting!" + " Valid numbers are 0..9. Using 9 => 6.875 Hz, "); devpriv->ulConvertionRate = MPC624_SPEED_3_52_kHz; } @@ -239,29 +243,29 @@ static int mpc624_attach(struct comedi_device *dev, struct comedi_devconfig *it) switch (it->options[1]) { default: s->maxdata = 0x3FFFFFFF; - printk("30 bit, "); + printk(KERN_INFO "30 bit, "); } switch (it->options[1]) { case 0: s->range_table = &range_mpc624_bipolar1; - printk("1.01V]: "); + printk(KERN_INFO "1.01V]: "); break; default: s->range_table = &range_mpc624_bipolar10; - printk("10.1V]: "); + printk(KERN_INFO "10.1V]: "); } s->len_chanlist = 1; s->insn_read = mpc624_ai_rinsn; - printk("attached\n"); + printk(KERN_INFO "attached\n"); return 1; } static int mpc624_detach(struct comedi_device *dev) { - printk("comedi%d: mpc624: remove\n", dev->minor); + printk(KERN_INFO "comedi%d: mpc624: remove\n", dev->minor); if (dev->iobase) release_region(dev->iobase, MPC624_SIZE); @@ -280,11 +284,14 @@ static int mpc624_ai_rinsn(struct comedi_device *dev, unsigned long int data_in, data_out; unsigned char ucPort; - /* WARNING: We always write 0 to GNSWA bit, so the channel range is +-/10.1Vdc */ + /* + * WARNING: + * We always write 0 to GNSWA bit, so the channel range is +-/10.1Vdc + */ outb(insn->chanspec, dev->iobase + MPC624_GNMUXCH); -/* printk("Channel %d: \n", insn->chanspec); */ +/* printk("Channel %d:\n", insn->chanspec); */ if (!insn->n) { - printk("MPC624: Warning, no data to acquire\n"); + printk(KERN_INFO "MPC624: Warning, no data to acquire\n"); return 0; } @@ -306,7 +313,7 @@ static int mpc624_ai_rinsn(struct comedi_device *dev, break; } if (i == TIMEOUT) { - printk("MPC624: timeout (%dms)\n", TIMEOUT); + printk(KERN_ERR "MPC624: timeout (%dms)\n", TIMEOUT); data[n] = 0; return -ETIMEDOUT; } @@ -319,7 +326,7 @@ static int mpc624_ai_rinsn(struct comedi_device *dev, outb(0, dev->iobase + MPC624_ADC); udelay(1); - if (data_out & (1 << 31)) { /* the next bit is a 1 */ + if (data_out & (1 << 31)) { /* the next bit is a 1 */ /* Set the ADSDI line (send to MPC624) */ outb(MPC624_ADSDI, dev->iobase + MPC624_ADC); udelay(1); @@ -344,31 +351,47 @@ static int mpc624_ai_rinsn(struct comedi_device *dev, data_out <<= 1; } - /* Received 32-bit long value consist of: */ - /* 31: EOC (End Of Transmission) bit - should be 0 */ - /* 30: DMY (Dummy) bit - should be 0 */ - /* 29: SIG (Sign) bit - 1 if the voltage is positive, 0 if negative */ - /* 28: MSB (Most Significant Bit) - the first bit of convertion result */ - /* .... */ - /* 05: LSB (Least Significant Bit) - the last bit of convertion result */ - /* 04: sub-LSB - sub-LSBs are basically noise, but when */ - /* 03: sub-LSB averaged properly, they can increase convertion */ - /* 02: sub-LSB precision up to 29 bits; they can be discarded */ - /* 01: sub-LSB without loss of resolution. */ - /* 00: sub-LSB */ + /* + * Received 32-bit long value consist of: + * 31: EOC - + * (End Of Transmission) bit - should be 0 + * 30: DMY + * (Dummy) bit - should be 0 + * 29: SIG + * (Sign) bit- 1 if the voltage is positive, + * 0 if negative + * 28: MSB + * (Most Significant Bit) - the first bit of + * the conversion result + * .... + * 05: LSB + * (Least Significant Bit)- the last bit of the + * conversion result + * 04-00: sub-LSB + * - sub-LSBs are basically noise, but when + * averaged properly, they can increase conversion + * precision up to 29 bits; they can be discarded + * without loss of resolution. + */ if (data_in & MPC624_EOC_BIT) - printk("MPC624: EOC bit is set (data_in=%lu)!", + printk(KERN_INFO "MPC624:EOC bit is set (data_in=%lu)!", data_in); if (data_in & MPC624_DMY_BIT) - printk("MPC624: DMY bit is set (data_in=%lu)!", + printk(KERN_INFO "MPC624:DMY bit is set (data_in=%lu)!", data_in); - if (data_in & MPC624_SGN_BIT) { /* check the sign bit *//* The voltage is positive */ - data_in &= 0x3FFFFFFF; /* EOC and DMY should be 0, but we will mask them out just to be sure */ - data[n] = data_in; /* comedi operates on unsigned numbers, so we don't clear the SGN bit */ - /* SGN bit is still set! It's correct, since we're converting to unsigned. */ - } else { /* The voltage is negative */ - /* data_in contains a number in 30-bit two's complement code and we must deal with it */ + if (data_in & MPC624_SGN_BIT) { /* Volatge is positive */ + /* + * comedi operates on unsigned numbers, so mask off EOC + * and DMY and don't clear the SGN bit + */ + data_in &= 0x3FFFFFFF; + data[n] = data_in; + } else { /* The voltage is negative */ + /* + * data_in contains a number in 30-bit two's complement + * code and we must deal with it + */ data_in |= MPC624_SGN_BIT; data_in = ~data_in; data_in += 1; diff --git a/drivers/staging/comedi/drivers/ni_6527.c b/drivers/staging/comedi/drivers/ni_6527.c index 653b4c8..1fc76cc 100644 --- a/drivers/staging/comedi/drivers/ni_6527.c +++ b/drivers/staging/comedi/drivers/ni_6527.c @@ -107,10 +107,9 @@ static const struct ni6527_board ni6527_boards[] = { #define this_board ((const struct ni6527_board *)dev->board_ptr) static DEFINE_PCI_DEVICE_TABLE(ni6527_pci_table) = { - { - PCI_VENDOR_ID_NATINST, 0x2b10, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x2b20, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - 0} + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x2b10)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x2b20)}, + {0} }; MODULE_DEVICE_TABLE(pci, ni6527_pci_table); diff --git a/drivers/staging/comedi/drivers/ni_65xx.c b/drivers/staging/comedi/drivers/ni_65xx.c index 9a4fffe..d793f5a 100644 --- a/drivers/staging/comedi/drivers/ni_65xx.c +++ b/drivers/staging/comedi/drivers/ni_65xx.c @@ -266,30 +266,29 @@ static inline unsigned ni_65xx_total_num_ports(const struct ni_65xx_board } static DEFINE_PCI_DEVICE_TABLE(ni_65xx_pci_table) = { - { - PCI_VENDOR_ID_NATINST, 0x1710, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x7085, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x7086, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x7087, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x7088, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70a9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70c3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70c8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70c9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70cc, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70CD, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70d1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70d2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70d3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x7124, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x7125, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x7126, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x7127, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x7128, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x718b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x718c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x71c5, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - 0} + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1710)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x7085)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x7086)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x7087)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x7088)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70a9)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70c3)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70c8)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70c9)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70cc)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70CD)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70d1)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70d2)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70d3)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x7124)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x7125)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x7126)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x7127)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x7128)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x718b)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x718c)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x71c5)}, + {0} }; MODULE_DEVICE_TABLE(pci, ni_65xx_pci_table); diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index 017630f..6a6fae5 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -420,12 +420,11 @@ static const struct ni_660x_board ni_660x_boards[] = { #define NI_660X_MAX_NUM_COUNTERS (NI_660X_MAX_NUM_CHIPS * counters_per_chip) static DEFINE_PCI_DEVICE_TABLE(ni_660x_pci_table) = { - { - PCI_VENDOR_ID_NATINST, 0x2c60, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x1310, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x1360, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x2cc0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - 0} + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x2c60)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1310)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1360)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x2cc0)}, + {0} }; MODULE_DEVICE_TABLE(pci, ni_660x_pci_table); diff --git a/drivers/staging/comedi/drivers/ni_670x.c b/drivers/staging/comedi/drivers/ni_670x.c index 68221bf..44ae836 100644 --- a/drivers/staging/comedi/drivers/ni_670x.c +++ b/drivers/staging/comedi/drivers/ni_670x.c @@ -47,8 +47,6 @@ Commands are not supported. #include "mite.h" -#define PCI_VENDOR_ID_NATINST 0x1093 - #define AO_VALUE_OFFSET 0x00 #define AO_CHAN_OFFSET 0x0c #define AO_STATUS_OFFSET 0x10 @@ -91,12 +89,9 @@ static const struct ni_670x_board ni_670x_boards[] = { }; static DEFINE_PCI_DEVICE_TABLE(ni_670x_pci_table) = { - { - PCI_VENDOR_ID_NATINST, 0x2c90, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x1920, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - /*{ PCI_VENDOR_ID_NATINST, 0x0000, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },*/ - { - 0} + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x2c90)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1920)}, + {0} }; MODULE_DEVICE_TABLE(pci, ni_670x_pci_table); diff --git a/drivers/staging/comedi/drivers/ni_at_ao.c b/drivers/staging/comedi/drivers/ni_at_ao.c index 3778565..ce60224 100644 --- a/drivers/staging/comedi/drivers/ni_at_ao.c +++ b/drivers/staging/comedi/drivers/ni_at_ao.c @@ -226,7 +226,7 @@ static int atao_attach(struct comedi_device *dev, struct comedi_devconfig *it) iobase = 0x1c0; ao_unipolar = it->options[3]; - printk("comedi%d: ni_at_ao: 0x%04lx", dev->minor, iobase); + printk(KERN_INFO "comedi%d: ni_at_ao: 0x%04lx", dev->minor, iobase); if (!request_region(iobase, ATAO_SIZE, "ni_at_ao")) { printk(" I/O port conflict\n"); @@ -283,14 +283,14 @@ static int atao_attach(struct comedi_device *dev, struct comedi_devconfig *it) atao_reset(dev); - printk("\n"); + printk(KERN_INFO "\n"); return 0; } static int atao_detach(struct comedi_device *dev) { - printk("comedi%d: atao: remove\n", dev->minor); + printk(KERN_INFO "comedi%d: atao: remove\n", dev->minor); if (dev->iobase) release_region(dev->iobase, ATAO_SIZE); diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index 06dd44f..6ec77bf 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -145,6 +145,7 @@ void subdev_700_interrupt(struct comedi_device *dev, struct comedi_subdevice *s) comedi_event(dev, s); } +EXPORT_SYMBOL(subdev_700_interrupt); static int subdev_700_cb(int dir, int port, int data, unsigned long arg) { @@ -326,6 +327,7 @@ int subdev_700_init(struct comedi_device *dev, struct comedi_subdevice *s, return 0; } +EXPORT_SYMBOL(subdev_700_init); int subdev_700_init_irq(struct comedi_device *dev, struct comedi_subdevice *s, int (*cb) (int, int, int, unsigned long), @@ -345,6 +347,7 @@ int subdev_700_init_irq(struct comedi_device *dev, struct comedi_subdevice *s, return 0; } +EXPORT_SYMBOL(subdev_700_init_irq); void subdev_700_cleanup(struct comedi_device *dev, struct comedi_subdevice *s) { @@ -353,11 +356,7 @@ void subdev_700_cleanup(struct comedi_device *dev, struct comedi_subdevice *s) kfree(s->private); } - -EXPORT_SYMBOL(subdev_700_init); -EXPORT_SYMBOL(subdev_700_init_irq); EXPORT_SYMBOL(subdev_700_cleanup); -EXPORT_SYMBOL(subdev_700_interrupt); static int dio700_attach(struct comedi_device *dev, struct comedi_devconfig *it) { @@ -709,8 +708,12 @@ static struct pcmcia_device_id dio700_cs_ids[] = { PCMCIA_DEVICE_NULL }; -MODULE_LICENSE("GPL"); + MODULE_DEVICE_TABLE(pcmcia, dio700_cs_ids); +MODULE_AUTHOR("Fred Brooks <nsaspook@nsaspook.com>"); +MODULE_DESCRIPTION("Comedi driver for National Instruments " + "PCMCIA DAQCard-700 DIO"); +MODULE_LICENSE("GPL"); struct pcmcia_driver dio700_cs_driver = { .probe = dio700_cs_attach, diff --git a/drivers/staging/comedi/drivers/ni_daq_dio24.c b/drivers/staging/comedi/drivers/ni_daq_dio24.c index 7bfe08b..e4865b1 100644 --- a/drivers/staging/comedi/drivers/ni_daq_dio24.c +++ b/drivers/staging/comedi/drivers/ni_daq_dio24.c @@ -461,6 +461,10 @@ static struct pcmcia_device_id dio24_cs_ids[] = { }; MODULE_DEVICE_TABLE(pcmcia, dio24_cs_ids); +MODULE_AUTHOR("Daniel Vecino Castel <dvecino@able.es>"); +MODULE_DESCRIPTION("Comedi driver for National Instruments " + "PCMCIA DAQ-Card DIO-24"); +MODULE_LICENSE("GPL"); struct pcmcia_driver dio24_cs_driver = { .probe = dio24_cs_attach, diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c index 558e525..67c8a53 100644 --- a/drivers/staging/comedi/drivers/ni_labpc.c +++ b/drivers/staging/comedi/drivers/ni_labpc.c @@ -499,9 +499,8 @@ static struct comedi_driver driver_labpc = { #ifdef CONFIG_COMEDI_PCI static DEFINE_PCI_DEVICE_TABLE(labpc_pci_table) = { - { - PCI_VENDOR_ID_NATINST, 0x161, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - 0} + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x161)}, + {0} }; MODULE_DEVICE_TABLE(pci, labpc_pci_table); @@ -536,7 +535,7 @@ int labpc_common_attach(struct comedi_device *dev, unsigned long iobase, printk("\n"); if (iobase == 0) { - printk("io base address is zero!\n"); + printk(KERN_ERR "io base address is zero!\n"); return -EINVAL; } /* request io regions for isa boards */ diff --git a/drivers/staging/comedi/drivers/ni_labpc_cs.c b/drivers/staging/comedi/drivers/ni_labpc_cs.c index fd8d3e9..163245e 100644 --- a/drivers/staging/comedi/drivers/ni_labpc_cs.c +++ b/drivers/staging/comedi/drivers/ni_labpc_cs.c @@ -437,6 +437,9 @@ static struct pcmcia_device_id labpc_cs_ids[] = { }; MODULE_DEVICE_TABLE(pcmcia, labpc_cs_ids); +MODULE_AUTHOR("Frank Mori Hess <fmhess@users.sourceforge.net>"); +MODULE_DESCRIPTION("Comedi driver for National Instruments Lab-PC"); +MODULE_LICENSE("GPL"); struct pcmcia_driver labpc_cs_driver = { .probe = labpc_cs_attach, @@ -478,6 +481,5 @@ void __exit labpc_exit_module(void) comedi_driver_unregister(&driver_labpc_cs); } -MODULE_LICENSE("GPL"); module_init(labpc_init_module); module_exit(labpc_exit_module); diff --git a/drivers/staging/comedi/drivers/ni_mio_cs.c b/drivers/staging/comedi/drivers/ni_mio_cs.c index 1e8aeba..cedb02d 100644 --- a/drivers/staging/comedi/drivers/ni_mio_cs.c +++ b/drivers/staging/comedi/drivers/ni_mio_cs.c @@ -428,8 +428,6 @@ static int ni_getboardtype(struct comedi_device *dev, #ifdef MODULE -MODULE_LICENSE("GPL"); - static struct pcmcia_device_id ni_mio_cs_ids[] = { PCMCIA_DEVICE_MANF_CARD(0x010b, 0x010d), /* DAQCard-ai-16xe-50 */ PCMCIA_DEVICE_MANF_CARD(0x010b, 0x010c), /* DAQCard-ai-16e-4 */ @@ -440,6 +438,9 @@ static struct pcmcia_device_id ni_mio_cs_ids[] = { }; MODULE_DEVICE_TABLE(pcmcia, ni_mio_cs_ids); +MODULE_AUTHOR("David A. Schleef <ds@schleef.org>"); +MODULE_DESCRIPTION("Comedi driver for National Instruments DAQCard E series"); +MODULE_LICENSE("GPL"); struct pcmcia_driver ni_mio_cs_driver = { .probe = &cs_attach, diff --git a/drivers/staging/comedi/drivers/ni_pcidio.c b/drivers/staging/comedi/drivers/ni_pcidio.c index 9d33751..b126638 100644 --- a/drivers/staging/comedi/drivers/ni_pcidio.c +++ b/drivers/staging/comedi/drivers/ni_pcidio.c @@ -83,8 +83,6 @@ comedi_nonfree_firmware tarball available from http://www.comedi.org #define DPRINTK(format, args...) #endif -#define PCI_VENDOR_ID_NATINST 0x1093 - #define PCI_DIO_SIZE 4096 #define PCI_MITE_SIZE 4096 @@ -379,18 +377,17 @@ static const struct nidio_board nidio_boards[] = { #define this_board ((const struct nidio_board *)dev->board_ptr) static DEFINE_PCI_DEVICE_TABLE(ni_pcidio_pci_table) = { - { - PCI_VENDOR_ID_NATINST, 0x1150, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x1320, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x12b0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x0160, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x1630, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x13c0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x0400, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x1250, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x17d0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x1800, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - 0} + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1150)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1320)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x12b0)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x0160)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1630)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x13c0)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x0400)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1250)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x17d0)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1800)}, + {0} }; MODULE_DEVICE_TABLE(pci, ni_pcidio_pci_table); diff --git a/drivers/staging/comedi/drivers/ni_pcimio.c b/drivers/staging/comedi/drivers/ni_pcimio.c index 24c8b8e..577fda8 100644 --- a/drivers/staging/comedi/drivers/ni_pcimio.c +++ b/drivers/staging/comedi/drivers/ni_pcimio.c @@ -130,60 +130,59 @@ Bugs: /* The following two tables must be in the same order */ static DEFINE_PCI_DEVICE_TABLE(ni_pci_table) = { - { - PCI_VENDOR_ID_NATINST, 0x0162, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x1170, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x1180, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x1190, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x11b0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x11c0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x11d0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x1270, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x1330, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x1340, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x1350, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x14e0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x14f0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x1580, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x15b0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x1880, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x1870, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x18b0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x18c0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x2410, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x2420, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x2430, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x2890, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x28c0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x2a60, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x2a70, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x2a80, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x2ab0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x2b80, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x2b90, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x2c80, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x2ca0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70aa, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70ab, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70ac, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70af, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70b0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70b4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70b6, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70b7, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70b8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70bc, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70bd, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70bf, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70c0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x70f2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x710d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x716c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x716d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x717f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x71bc, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - PCI_VENDOR_ID_NATINST, 0x717d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { - 0} + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x0162)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1170)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1180)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1190)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x11b0)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x11c0)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x11d0)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1270)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1330)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1340)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1350)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x14e0)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x14f0)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1580)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x15b0)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1880)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x1870)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x18b0)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x18c0)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x2410)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x2420)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x2430)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x2890)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x28c0)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x2a60)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x2a70)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x2a80)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x2ab0)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x2b80)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x2b90)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x2c80)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x2ca0)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70aa)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70ab)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70ac)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70af)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70b0)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70b4)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70b6)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70b7)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70b8)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70bc)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70bd)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70bf)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70c0)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x70f2)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x710d)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x716c)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x716d)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x717f)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x71bc)}, + {PCI_DEVICE(PCI_VENDOR_ID_NI, 0x717d)}, + {0} }; MODULE_DEVICE_TABLE(pci, ni_pci_table); diff --git a/drivers/staging/comedi/drivers/plx9080.h b/drivers/staging/comedi/drivers/plx9080.h index 53bcdb7..485d63f 100644 --- a/drivers/staging/comedi/drivers/plx9080.h +++ b/drivers/staging/comedi/drivers/plx9080.h @@ -380,9 +380,9 @@ enum bigend_bits { #define MBX_ADDR_SPACE_360 0x80 /* wanXL100s/200/400 */ #define MBX_ADDR_MASK_360 (MBX_ADDR_SPACE_360-1) -static inline int plx9080_abort_dma(void *iobase, unsigned int channel) +static inline int plx9080_abort_dma(void __iomem *iobase, unsigned int channel) { - void *dma_cs_addr; + void __iomem *dma_cs_addr; uint8_t dma_status; const int timeout = 10000; unsigned int i; diff --git a/drivers/staging/comedi/drivers/quatech_daqp_cs.c b/drivers/staging/comedi/drivers/quatech_daqp_cs.c index 8b274b7..a91db6c 100644 --- a/drivers/staging/comedi/drivers/quatech_daqp_cs.c +++ b/drivers/staging/comedi/drivers/quatech_daqp_cs.c @@ -56,6 +56,8 @@ Devices: [Quatech] DAQP-208 (daqp), DAQP-308 #include <pcmcia/cisreg.h> #include <pcmcia/ds.h> +#include <linux/completion.h> + /* Maximum number of separate DAQP devices we'll allow */ #define MAX_DEV 4 @@ -67,7 +69,7 @@ struct local_info_t { enum { semaphore, buffer } interrupt_mode; - struct semaphore eos; + struct completion eos; struct comedi_device *dev; struct comedi_subdevice *s; @@ -238,14 +240,13 @@ static int daqp_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) /* Interrupt handler * * Operates in one of two modes. If local->interrupt_mode is - * 'semaphore', just signal the local->eos semaphore and return + * 'semaphore', just signal the local->eos completion and return * (one-shot mode). Otherwise (continuous mode), read data in from * the card, transfer it to the buffer provided by the higher-level * comedi kernel module, and signal various comedi callback routines, * which run pretty quick. */ - -static void daqp_interrupt(int irq, void *dev_id) +static enum irqreturn daqp_interrupt(int irq, void *dev_id) { struct local_info_t *local = (struct local_info_t *)dev_id; struct comedi_device *dev; @@ -256,39 +257,39 @@ static void daqp_interrupt(int irq, void *dev_id) if (local == NULL) { printk(KERN_WARNING "daqp_interrupt(): irq %d for unknown device.\n", irq); - return; + return IRQ_NONE; } dev = local->dev; if (dev == NULL) { printk(KERN_WARNING "daqp_interrupt(): NULL comedi_device.\n"); - return; + return IRQ_NONE; } if (!dev->attached) { printk(KERN_WARNING "daqp_interrupt(): struct comedi_device not yet attached.\n"); - return; + return IRQ_NONE; } s = local->s; if (s == NULL) { printk(KERN_WARNING "daqp_interrupt(): NULL comedi_subdevice.\n"); - return; + return IRQ_NONE; } if ((struct local_info_t *)s->private != local) { printk(KERN_WARNING "daqp_interrupt(): invalid comedi_subdevice.\n"); - return; + return IRQ_NONE; } switch (local->interrupt_mode) { case semaphore: - up(&local->eos); + complete(&local->eos); break; case buffer: @@ -340,6 +341,7 @@ static void daqp_interrupt(int irq, void *dev_id) comedi_event(dev, s); } + return IRQ_HANDLED; } /* One-shot analog data acquisition routine */ @@ -401,8 +403,7 @@ static int daqp_ai_insn_read(struct comedi_device *dev, return -1; } - /* Make sure semaphore is blocked */ - sema_init(&local->eos, 0); + init_completion(&local->eos); local->interrupt_mode = semaphore; local->dev = dev; local->s = s; @@ -413,9 +414,9 @@ static int daqp_ai_insn_read(struct comedi_device *dev, outb(DAQP_COMMAND_ARM | DAQP_COMMAND_FIFO_DATA, dev->iobase + DAQP_COMMAND); - /* Wait for interrupt service routine to unblock semaphore */ + /* Wait for interrupt service routine to unblock completion */ /* Maybe could use a timeout here, but it's interruptible */ - if (down_interruptible(&local->eos)) + if (wait_for_completion_interruptible(&local->eos)) return -EINTR; data[i] = inb(dev->iobase + DAQP_FIFO); @@ -580,7 +581,7 @@ static int daqp_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) { struct local_info_t *local = (struct local_info_t *)s->private; struct comedi_cmd *cmd = &s->async->cmd; - int counter = 100; + int counter; int scanlist_start_on_every_entry; int threshold; @@ -613,14 +614,14 @@ static int daqp_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) */ if (cmd->convert_src == TRIG_TIMER) { - int counter = daqp_ns_to_timer(&cmd->convert_arg, + counter = daqp_ns_to_timer(&cmd->convert_arg, cmd->flags & TRIG_ROUND_MASK); outb(counter & 0xff, dev->iobase + DAQP_PACER_LOW); outb((counter >> 8) & 0xff, dev->iobase + DAQP_PACER_MID); outb((counter >> 16) & 0xff, dev->iobase + DAQP_PACER_HIGH); scanlist_start_on_every_entry = 1; } else { - int counter = daqp_ns_to_timer(&cmd->scan_begin_arg, + counter = daqp_ns_to_timer(&cmd->scan_begin_arg, cmd->flags & TRIG_ROUND_MASK); outb(counter & 0xff, dev->iobase + DAQP_PACER_LOW); outb((counter >> 8) & 0xff, dev->iobase + DAQP_PACER_MID); @@ -755,7 +756,7 @@ static int daqp_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) /* Reset any pending interrupts (my card has a tendancy to require * require multiple reads on the status register to achieve this) */ - + counter = 100; while (--counter && (inb(dev->iobase + DAQP_STATUS) & DAQP_STATUS_EVENTS)) ; if (!counter) { @@ -1215,8 +1216,11 @@ static struct pcmcia_device_id daqp_cs_id_table[] = { }; MODULE_DEVICE_TABLE(pcmcia, daqp_cs_id_table); +MODULE_AUTHOR("Brent Baccala <baccala@freesoft.org>"); +MODULE_DESCRIPTION("Comedi driver for Quatech DAQP PCMCIA data capture cards"); +MODULE_LICENSE("GPL"); -struct pcmcia_driver daqp_cs_driver = { +static struct pcmcia_driver daqp_cs_driver = { .probe = daqp_cs_attach, .remove = daqp_cs_detach, .suspend = daqp_cs_suspend, diff --git a/drivers/staging/comedi/drivers/skel.c b/drivers/staging/comedi/drivers/skel.c index aba57d9..490753b 100644 --- a/drivers/staging/comedi/drivers/skel.c +++ b/drivers/staging/comedi/drivers/skel.c @@ -131,7 +131,8 @@ MODULE_DEVICE_TABLE(pci, skel_pci_table); /* this structure is for data unique to this hardware driver. If several hardware drivers keep similar information in this structure, - feel free to suggest moving the variable to the struct comedi_device struct. */ + feel free to suggest moving the variable to the struct comedi_device struct. + */ struct skel_private { int data; @@ -211,7 +212,7 @@ static int skel_attach(struct comedi_device *dev, struct comedi_devconfig *it) { struct comedi_subdevice *s; - printk("comedi%d: skel: ", dev->minor); + pr_info("comedi%d: skel: ", dev->minor); /* * If you can probe the device to determine what device in a series @@ -282,7 +283,7 @@ static int skel_attach(struct comedi_device *dev, struct comedi_devconfig *it) s->type = COMEDI_SUBD_UNUSED; } - printk("attached\n"); + pr_info("attached\n"); return 0; } @@ -297,7 +298,7 @@ static int skel_attach(struct comedi_device *dev, struct comedi_devconfig *it) */ static int skel_detach(struct comedi_device *dev) { - printk("comedi%d: skel: remove\n", dev->minor); + pr_info("comedi%d: skel: remove\n", dev->minor); return 0; } @@ -336,7 +337,7 @@ static int skel_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, if (i == TIMEOUT) { /* printk() should be used instead of printk() * whenever the code can be called from real-time. */ - printk("timeout\n"); + pr_info("timeout\n"); return -ETIMEDOUT; } @@ -397,7 +398,8 @@ static int skel_ai_cmdtest(struct comedi_device *dev, if (err) return 1; - /* step 2: make sure trigger sources are unique and mutually compatible */ + /* step 2: make sure trigger sources are unique and mutually compatible + */ /* note that mutual compatibility is not an issue here */ if (cmd->scan_begin_src != TRIG_TIMER && @@ -529,7 +531,7 @@ static int skel_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s, int i; int chan = CR_CHAN(insn->chanspec); - printk("skel_ao_winsn\n"); + pr_info("skel_ao_winsn\n"); /* Writing a list of values to an AO channel is probably not * very useful, but that's how the interface is defined. */ for (i = 0; i < insn->n; i++) { @@ -623,6 +625,7 @@ static int skel_dio_insn_config(struct comedi_device *dev, * as necessary. */ COMEDI_INITCLEANUP(driver_skel); -/* If you are writing a PCI driver you should use COMEDI_PCI_INITCLEANUP instead. -*/ +/* 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/drivers/staging/comedi/drivers/ssv_dnp.c b/drivers/staging/comedi/drivers/ssv_dnp.c index 17c92a5..18b0a83 100644 --- a/drivers/staging/comedi/drivers/ssv_dnp.c +++ b/drivers/staging/comedi/drivers/ssv_dnp.c @@ -41,14 +41,14 @@ Status: unknown /* 0..3 remain unchanged! For details about Port C Mode Register see */ /* the remarks in dnp_insn_config() below. */ -#define CSCIR 0x22 /* Chip Setup and Control Index Register */ -#define CSCDR 0x23 /* Chip Setup and Control Data Register */ -#define PAMR 0xa5 /* Port A Mode Register */ -#define PADR 0xa9 /* Port A Data Register */ -#define PBMR 0xa4 /* Port B Mode Register */ -#define PBDR 0xa8 /* Port B Data Register */ -#define PCMR 0xa3 /* Port C Mode Register */ -#define PCDR 0xa7 /* Port C Data Register */ +#define CSCIR 0x22 /* Chip Setup and Control Index Register */ +#define CSCDR 0x23 /* Chip Setup and Control Data Register */ +#define PAMR 0xa5 /* Port A Mode Register */ +#define PADR 0xa9 /* Port A Data Register */ +#define PBMR 0xa4 /* Port B Mode Register */ +#define PBDR 0xa8 /* Port B Data Register */ +#define PCMR 0xa3 /* Port C Mode Register */ +#define PCDR 0xa7 /* Port C Data Register */ /* This data structure holds information about the supported boards -------- */ @@ -59,8 +59,9 @@ struct dnp_board { int have_dio; }; -static const struct dnp_board dnp_boards[] = { /* we only support one DNP 'board' */ - { /* variant at the moment */ +/* We only support one DNP 'board' variant at the moment */ +static const struct dnp_board dnp_boards[] = { +{ .name = "dnp-1486", .ai_chans = 16, .ai_bits = 12, @@ -80,9 +81,9 @@ struct dnp_private_data { #define devpriv ((dnp_private *)dev->private) /* ------------------------------------------------------------------------- */ -/* The struct comedi_driver structure tells the Comedi core module which functions */ -/* to call to configure/deconfigure (attach/detach) the board, and also */ -/* about the kernel module that contains the device code. */ +/* The struct comedi_driver structure tells the Comedi core module which */ +/* functions to call to configure/deconfigure (attach/detach) the board, and */ +/* also about the kernel module that contains the device code. */ /* */ /* In the following section we define the API of this driver. */ /* ------------------------------------------------------------------------- */ @@ -97,7 +98,7 @@ static struct comedi_driver driver_dnp = { .detach = dnp_detach, .board_name = &dnp_boards[0].name, /* only necessary for non-PnP devs */ - .offset = sizeof(struct dnp_board), /* like ISA-PnP, PCI or PCMCIA. */ + .offset = sizeof(struct dnp_board), /* like ISA-PnP, PCI or PCMCIA */ .num_names = ARRAY_SIZE(dnp_boards), }; @@ -122,28 +123,30 @@ static int dnp_attach(struct comedi_device *dev, struct comedi_devconfig *it) struct comedi_subdevice *s; - printk("comedi%d: dnp: ", dev->minor); + printk(KERN_INFO "comedi%d: dnp: ", dev->minor); - /* Autoprobing: this should find out which board we have. Currently only */ - /* the 1486 board is supported and autoprobing is not implemented :-) */ + /* Autoprobing: this should find out which board we have. Currently */ + /* only the 1486 board is supported and autoprobing is not */ + /* implemented :-) */ /* dev->board_ptr = dnp_probe(dev); */ - /* Initialize the name of the board. We can use the "thisboard" macro now. */ + /* Initialize the name of the board. */ + /* We can use the "thisboard" macro now. */ dev->board_name = thisboard->name; - /* Allocate the private structure area. alloc_private() is a convenient */ - /* macro defined in comedidev.h. */ + /* Allocate the private structure area. alloc_private() is a */ + /* convenient macro defined in comedidev.h. */ if (alloc_private(dev, sizeof(struct dnp_private_data)) < 0) return -ENOMEM; - /* Allocate the subdevice structures. alloc_subdevice() is a convenient */ - /* macro defined in comedidev.h. */ + /* Allocate the subdevice structures. alloc_subdevice() is a */ + /* convenient macro defined in comedidev.h. */ if (alloc_subdevices(dev, 1) < 0) return -ENOMEM; s = dev->subdevices + 0; - /* digital i/o subdevice */ + /* digital i/o subdevice */ s->type = COMEDI_SUBD_DIO; s->subdev_flags = SDF_READABLE | SDF_WRITABLE; s->n_chan = 20; @@ -158,7 +161,7 @@ static int dnp_attach(struct comedi_device *dev, struct comedi_devconfig *it) * allocated for the primary 8259, so we don't need to allocate them * ourselves. */ - /* configure all ports as input (default) */ + /* configure all ports as input (default) */ outb(PAMR, CSCIR); outb(0x00, CSCDR); outb(PBMR, CSCIR); @@ -181,7 +184,7 @@ static int dnp_attach(struct comedi_device *dev, struct comedi_devconfig *it) static int dnp_detach(struct comedi_device *dev) { - /* configure all ports as input (default) */ + /* configure all ports as input (default) */ outb(PAMR, CSCIR); outb(0x00, CSCDR); outb(PBMR, CSCIR); @@ -189,8 +192,8 @@ static int dnp_detach(struct comedi_device *dev) outb(PCMR, CSCIR); outb((inb(CSCDR) & 0xAA), CSCDR); - /* announce that we are finished */ - printk("comedi%d: dnp: remove\n", dev->minor); + /* announce that we are finished */ + printk(KERN_INFO "comedi%d: dnp: remove\n", dev->minor); return 0; @@ -210,12 +213,12 @@ static int dnp_dio_insn_bits(struct comedi_device *dev, if (insn->n != 2) return -EINVAL; /* insn uses data[0] and data[1] */ - /* The insn data is a mask in data[0] and the new data in data[1], each */ - /* channel cooresponding to a bit. */ + /* The insn data is a mask in data[0] and the new data in data[1], */ + /* each channel cooresponding to a bit. */ - /* Ports A and B are straight forward: each bit corresponds to an output */ - /* pin with the same order. Port C is different: bits 0...3 correspond to */ - /* bits 4...7 of the output register (PCDR). */ + /* Ports A and B are straight forward: each bit corresponds to an */ + /* output pin with the same order. Port C is different: bits 0...3 */ + /* correspond to bits 4...7 of the output register (PCDR). */ if (data[0]) { @@ -235,7 +238,7 @@ static int dnp_dio_insn_bits(struct comedi_device *dev, | (u8) ((data[1] & 0x0F0000) >> 12), CSCDR); } - /* on return, data[1] contains the value of the digital input lines. */ + /* on return, data[1] contains the value of the digital input lines. */ outb(PADR, CSCIR); data[0] = inb(CSCDR); outb(PBDR, CSCIR); @@ -260,7 +263,8 @@ static int dnp_dio_insn_config(struct comedi_device *dev, u8 register_buffer; - int chan = CR_CHAN(insn->chanspec); /* reduces chanspec to lower 16 bits */ + /* reduces chanspec to lower 16 bits */ + int chan = CR_CHAN(insn->chanspec); switch (data[0]) { case INSN_CONFIG_DIO_OUTPUT: @@ -275,11 +279,11 @@ static int dnp_dio_insn_config(struct comedi_device *dev, return -EINVAL; break; } - /* Test: which port does the channel belong to? */ + /* Test: which port does the channel belong to? */ - /* We have to pay attention with port C: this is the meaning of PCMR: */ - /* Bit in PCMR: 7 6 5 4 3 2 1 0 */ - /* Corresponding port C pin: d 3 d 2 d 1 d 0 d= don't touch */ + /* We have to pay attention with port C: this is the meaning of PCMR: */ + /* Bit in PCMR: 7 6 5 4 3 2 1 0 */ + /* Corresponding port C pin: d 3 d 2 d 1 d 0 d= don't touch */ if ((chan >= 0) && (chan <= 7)) { /* this is port A */ @@ -289,8 +293,8 @@ static int dnp_dio_insn_config(struct comedi_device *dev, chan -= 8; outb(PBMR, CSCIR); } else if ((chan >= 16) && (chan <= 19)) { - /* this is port C; multiplication with 2 brings bits into correct */ - /* position for PCMR! */ + /* this is port C; multiplication with 2 brings bits into */ + /* correct position for PCMR! */ chan -= 16; chan *= 2; outb(PCMR, CSCIR); @@ -298,7 +302,7 @@ static int dnp_dio_insn_config(struct comedi_device *dev, return -EINVAL; } - /* read 'old' direction of the port and set bits (out=1, in=0) */ + /* read 'old' direction of the port and set bits (out=1, in=0) */ register_buffer = inb(CSCDR); if (data[0] == COMEDI_OUTPUT) register_buffer |= (1 << chan); diff --git a/drivers/staging/comedi/drivers/unioxx5.c b/drivers/staging/comedi/drivers/unioxx5.c index be1d83d..16d4c9f 100644 --- a/drivers/staging/comedi/drivers/unioxx5.c +++ b/drivers/staging/comedi/drivers/unioxx5.c @@ -285,7 +285,7 @@ static int __unioxx5_subdev_init(struct comedi_subdevice *subdev, return -EIO; } - usp = (struct unioxx5_subd_priv *)kzalloc(sizeof(*usp), GFP_KERNEL); + usp = kzalloc(sizeof(*usp), GFP_KERNEL); if (usp == NULL) { printk(KERN_ERR "comedi%d: erorr! --> out of memory!\n", minor); diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c index 8942ae4..86f035d 100644 --- a/drivers/staging/comedi/drivers/usbdux.c +++ b/drivers/staging/comedi/drivers/usbdux.c @@ -793,7 +793,7 @@ static int usbduxsub_stop(struct usbduxsub *usbduxsub) } static int usbduxsub_upload(struct usbduxsub *usbduxsub, - uint8_t * local_transfer_buffer, + uint8_t *local_transfer_buffer, unsigned int startAddr, unsigned int len) { int errcode; @@ -825,7 +825,7 @@ static int usbduxsub_upload(struct usbduxsub *usbduxsub, #define FIRMWARE_MAX_LEN 0x2000 static int firmwareUpload(struct usbduxsub *usbduxsub, - const u8 * firmwareBinary, int sizeFirmware) + const u8 *firmwareBinary, int sizeFirmware) { int ret; uint8_t *fwBuf; @@ -835,18 +835,17 @@ static int firmwareUpload(struct usbduxsub *usbduxsub, if (sizeFirmware > FIRMWARE_MAX_LEN) { dev_err(&usbduxsub->interface->dev, - "comedi_: usbdux firmware binary it too large for FX2.\n"); + "usbdux firmware binary it too large for FX2.\n"); return -ENOMEM; } /* we generate a local buffer for the firmware */ - fwBuf = kzalloc(sizeFirmware, GFP_KERNEL); + fwBuf = kmemdup(firmwareBinary, sizeFirmware, GFP_KERNEL); if (!fwBuf) { dev_err(&usbduxsub->interface->dev, "comedi_: mem alloc for firmware failed\n"); return -ENOMEM; } - memcpy(fwBuf, firmwareBinary, sizeFirmware); ret = usbduxsub_stop(usbduxsub); if (ret < 0) { @@ -1264,8 +1263,8 @@ static int usbdux_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) (this_usbduxsub->ai_interval) * 2; } this_usbduxsub->ai_timer = cmd->scan_begin_arg / (125000 * - (this_usbduxsub-> - ai_interval)); + (this_usbduxsub-> + ai_interval)); } else { /* interval always 1ms */ this_usbduxsub->ai_interval = 1; diff --git a/drivers/staging/comedi/drivers/usbduxfast.c b/drivers/staging/comedi/drivers/usbduxfast.c index e89b818..29c3c01 100644 --- a/drivers/staging/comedi/drivers/usbduxfast.c +++ b/drivers/staging/comedi/drivers/usbduxfast.c @@ -177,8 +177,8 @@ struct usbduxfastsub_s { int16_t *insnBuffer; /* input buffer for single insn */ int ifnum; /* interface number */ struct usb_interface *interface; /* interface structure */ - struct comedi_device *comedidev; /* comedi device for the interrupt - context */ + /* comedi device for the interrupt context */ + struct comedi_device *comedidev; short int ai_cmd_running; /* asynchronous command is running */ short int ai_continous; /* continous aquisition */ long int ai_sample_count; /* number of samples to acquire */ @@ -271,7 +271,8 @@ static int usbduxfast_ai_stop(struct usbduxfastsub_s *udfs, int do_unlink) udfs->ai_cmd_running = 0; if (do_unlink) - ret = usbduxfastsub_unlink_InURBs(udfs); /* stop aquistion */ + /* stop aquistion */ + ret = usbduxfastsub_unlink_InURBs(udfs); return ret; } @@ -451,13 +452,15 @@ static int usbduxfastsub_start(struct usbduxfastsub_s *udfs) /* 7f92 to zero */ local_transfer_buffer[0] = 0; - ret = usb_control_msg(udfs->usbdev, usb_sndctrlpipe(udfs->usbdev, 0), USBDUXFASTSUB_FIRMWARE, /* bRequest, "Firmware" */ - VENDOR_DIR_OUT, /* bmRequestType */ - USBDUXFASTSUB_CPUCS, /* Value */ - 0x0000, /* Index */ - local_transfer_buffer, /* address of the transfer buffer */ - 1, /* Length */ - EZTIMEOUT); /* Timeout */ + /* bRequest, "Firmware" */ + ret = usb_control_msg(udfs->usbdev, usb_sndctrlpipe(udfs->usbdev, 0), USBDUXFASTSUB_FIRMWARE, + VENDOR_DIR_OUT, /* bmRequestType */ + USBDUXFASTSUB_CPUCS, /* Value */ + 0x0000, /* Index */ + /* address of the transfer buffer */ + local_transfer_buffer, + 1, /* Length */ + EZTIMEOUT); /* Timeout */ if (ret < 0) { printk("comedi_: usbduxfast_: control msg failed (start)\n"); return ret; @@ -473,7 +476,8 @@ static int usbduxfastsub_stop(struct usbduxfastsub_s *udfs) /* 7f92 to one */ local_transfer_buffer[0] = 1; - ret = usb_control_msg(udfs->usbdev, usb_sndctrlpipe(udfs->usbdev, 0), USBDUXFASTSUB_FIRMWARE, /* bRequest, "Firmware" */ + /* bRequest, "Firmware" */ + ret = usb_control_msg(udfs->usbdev, usb_sndctrlpipe(udfs->usbdev, 0), USBDUXFASTSUB_FIRMWARE, VENDOR_DIR_OUT, /* bmRequestType */ USBDUXFASTSUB_CPUCS, /* Value */ 0x0000, /* Index */ @@ -499,13 +503,15 @@ static int usbduxfastsub_upload(struct usbduxfastsub_s *udfs, printk(KERN_DEBUG " to addr %d, first byte=%d.\n", startAddr, local_transfer_buffer[0]); #endif - ret = usb_control_msg(udfs->usbdev, usb_sndctrlpipe(udfs->usbdev, 0), USBDUXFASTSUB_FIRMWARE, /* brequest, firmware */ - VENDOR_DIR_OUT, /* bmRequestType */ - startAddr, /* value */ - 0x0000, /* index */ - local_transfer_buffer, /* our local safe buffer */ - len, /* length */ - EZTIMEOUT); /* timeout */ + /* brequest, firmware */ + ret = usb_control_msg(udfs->usbdev, usb_sndctrlpipe(udfs->usbdev, 0), USBDUXFASTSUB_FIRMWARE, + VENDOR_DIR_OUT, /* bmRequestType */ + startAddr, /* value */ + 0x0000, /* index */ + /* our local safe buffer */ + local_transfer_buffer, + len, /* length */ + EZTIMEOUT); /* timeout */ #ifdef CONFIG_COMEDI_DEBUG printk(KERN_DEBUG "comedi_: usbduxfast: result=%d\n", ret); @@ -519,7 +525,7 @@ static int usbduxfastsub_upload(struct usbduxfastsub_s *udfs, return 0; } -int usbduxfastsub_submit_InURBs(struct usbduxfastsub_s *udfs) +static int usbduxfastsub_submit_InURBs(struct usbduxfastsub_s *udfs) { int ret; @@ -1347,7 +1353,7 @@ static int usbduxfast_ai_insn_read(struct comedi_device *dev, #define FIRMWARE_MAX_LEN 0x2000 static int firmwareUpload(struct usbduxfastsub_s *usbduxfastsub, - const u8 * firmwareBinary, int sizeFirmware) + const u8 *firmwareBinary, int sizeFirmware) { int ret; uint8_t *fwBuf; @@ -1362,13 +1368,12 @@ static int firmwareUpload(struct usbduxfastsub_s *usbduxfastsub, } /* we generate a local buffer for the firmware */ - fwBuf = kzalloc(sizeFirmware, GFP_KERNEL); + fwBuf = kmemdup(firmwareBinary, sizeFirmware, GFP_KERNEL); if (!fwBuf) { dev_err(&usbduxfastsub->interface->dev, "comedi_: mem alloc for firmware failed\n"); return -ENOMEM; } - memcpy(fwBuf, firmwareBinary, sizeFirmware); ret = usbduxfastsub_stop(usbduxfastsub); if (ret < 0) { diff --git a/drivers/staging/comedi/internal.h b/drivers/staging/comedi/internal.h new file mode 100644 index 0000000..434ce34 --- /dev/null +++ b/drivers/staging/comedi/internal.h @@ -0,0 +1,12 @@ +/* + * various internal comedi functions + */ +int do_rangeinfo_ioctl(struct comedi_device *dev, + struct comedi_rangeinfo __user *arg); +int insn_inval(struct comedi_device *dev, struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data); +int comedi_alloc_board_minor(struct device *hardware_device); +void comedi_free_board_minor(unsigned minor); +void comedi_reset_async_buf(struct comedi_async *async); +int comedi_buf_alloc(struct comedi_device *dev, struct comedi_subdevice *s, + unsigned long new_size); diff --git a/drivers/staging/comedi/kcomedilib/Makefile b/drivers/staging/comedi/kcomedilib/Makefile index ffcc9ad..18ee99b 100644 --- a/drivers/staging/comedi/kcomedilib/Makefile +++ b/drivers/staging/comedi/kcomedilib/Makefile @@ -1,8 +1,3 @@ -obj-$(CONFIG_COMEDI) += kcomedilib.o +obj-$(CONFIG_COMEDI_KCOMEDILIB) += kcomedilib.o -kcomedilib-objs := \ - data.o \ - ksyms.o \ - dio.o \ - kcomedilib_main.o \ - get.o +kcomedilib-objs := kcomedilib_main.o diff --git a/drivers/staging/comedi/kcomedilib/data.c b/drivers/staging/comedi/kcomedilib/data.c deleted file mode 100644 index aefc41a..0000000 --- a/drivers/staging/comedi/kcomedilib/data.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - kcomedilib/data.c - implements comedi_data_*() functions - - COMEDI - Linux Control and Measurement Device Interface - Copyright (C) 2000 David A. Schleef <ds@schleef.org> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include "../comedi.h" -#include "../comedilib.h" -#include "../comedidev.h" - -#include <linux/string.h> -#include <linux/delay.h> - -int comedi_data_write(void *dev, unsigned int subdev, unsigned int chan, - unsigned int range, unsigned int aref, unsigned int data) -{ - struct comedi_insn insn; - - memset(&insn, 0, sizeof(insn)); - insn.insn = INSN_WRITE; - insn.n = 1; - insn.data = &data; - insn.subdev = subdev; - insn.chanspec = CR_PACK(chan, range, aref); - - return comedi_do_insn(dev, &insn); -} - -int comedi_data_read(void *dev, unsigned int subdev, unsigned int chan, - unsigned int range, unsigned int aref, unsigned int *data) -{ - struct comedi_insn insn; - - memset(&insn, 0, sizeof(insn)); - insn.insn = INSN_READ; - insn.n = 1; - insn.data = data; - insn.subdev = subdev; - insn.chanspec = CR_PACK(chan, range, aref); - - return comedi_do_insn(dev, &insn); -} - -int comedi_data_read_hint(void *dev, unsigned int subdev, - unsigned int chan, unsigned int range, - unsigned int aref) -{ - struct comedi_insn insn; - unsigned int dummy_data; - - memset(&insn, 0, sizeof(insn)); - insn.insn = INSN_READ; - insn.n = 0; - insn.data = &dummy_data; - insn.subdev = subdev; - insn.chanspec = CR_PACK(chan, range, aref); - - return comedi_do_insn(dev, &insn); -} - -int comedi_data_read_delayed(void *dev, unsigned int subdev, - unsigned int chan, unsigned int range, - unsigned int aref, unsigned int *data, - unsigned int nano_sec) -{ - int retval; - - retval = comedi_data_read_hint(dev, subdev, chan, range, aref); - if (retval < 0) - return retval; - - udelay((nano_sec + 999) / 1000); - - return comedi_data_read(dev, subdev, chan, range, aref, data); -} diff --git a/drivers/staging/comedi/kcomedilib/dio.c b/drivers/staging/comedi/kcomedilib/dio.c deleted file mode 100644 index 30192f3..0000000 --- a/drivers/staging/comedi/kcomedilib/dio.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - kcomedilib/dio.c - implements comedi_dio_*() functions - - COMEDI - Linux Control and Measurement Device Interface - Copyright (C) 2000 David A. Schleef <ds@schleef.org> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include "../comedi.h" -#include "../comedilib.h" - -#include <linux/string.h> - -int comedi_dio_config(void *dev, unsigned int subdev, unsigned int chan, - unsigned int io) -{ - struct comedi_insn insn; - - memset(&insn, 0, sizeof(insn)); - insn.insn = INSN_CONFIG; - insn.n = 1; - insn.data = &io; - insn.subdev = subdev; - insn.chanspec = CR_PACK(chan, 0, 0); - - return comedi_do_insn(dev, &insn); -} - -int comedi_dio_read(void *dev, unsigned int subdev, unsigned int chan, - unsigned int *val) -{ - struct comedi_insn insn; - - memset(&insn, 0, sizeof(insn)); - insn.insn = INSN_READ; - insn.n = 1; - insn.data = val; - insn.subdev = subdev; - insn.chanspec = CR_PACK(chan, 0, 0); - - return comedi_do_insn(dev, &insn); -} - -int comedi_dio_write(void *dev, unsigned int subdev, unsigned int chan, - unsigned int val) -{ - struct comedi_insn insn; - - memset(&insn, 0, sizeof(insn)); - insn.insn = INSN_WRITE; - insn.n = 1; - insn.data = &val; - insn.subdev = subdev; - insn.chanspec = CR_PACK(chan, 0, 0); - - return comedi_do_insn(dev, &insn); -} - -int comedi_dio_bitfield(void *dev, unsigned int subdev, unsigned int mask, - unsigned int *bits) -{ - struct comedi_insn insn; - unsigned int data[2]; - int ret; - - memset(&insn, 0, sizeof(insn)); - insn.insn = INSN_BITS; - insn.n = 2; - insn.data = data; - insn.subdev = subdev; - - data[0] = mask; - data[1] = *bits; - - ret = comedi_do_insn(dev, &insn); - - *bits = data[1]; - - return ret; -} diff --git a/drivers/staging/comedi/kcomedilib/get.c b/drivers/staging/comedi/kcomedilib/get.c deleted file mode 100644 index 6d84187..0000000 --- a/drivers/staging/comedi/kcomedilib/get.c +++ /dev/null @@ -1,293 +0,0 @@ -/* - kcomedilib/get.c - a comedlib interface for kernel modules - - COMEDI - Linux Control and Measurement Device Interface - Copyright (C) 1997-2000 David A. Schleef <ds@schleef.org> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#define __NO_VERSION__ -#include "../comedi.h" -#include "../comedilib.h" -#include "../comedidev.h" - -int comedi_get_n_subdevices(void *d) -{ - struct comedi_device *dev = (struct comedi_device *)d; - - return dev->n_subdevices; -} - -int comedi_get_version_code(void *d) -{ - return COMEDI_VERSION_CODE; -} - -const char *comedi_get_driver_name(void *d) -{ - struct comedi_device *dev = (struct comedi_device *)d; - - return dev->driver->driver_name; -} - -const char *comedi_get_board_name(void *d) -{ - struct comedi_device *dev = (struct comedi_device *)d; - - return dev->board_name; -} - -int comedi_get_subdevice_type(void *d, unsigned int subdevice) -{ - struct comedi_device *dev = (struct comedi_device *)d; - struct comedi_subdevice *s = dev->subdevices + subdevice; - - return s->type; -} - -unsigned int comedi_get_subdevice_flags(void *d, unsigned int subdevice) -{ - struct comedi_device *dev = (struct comedi_device *)d; - struct comedi_subdevice *s = dev->subdevices + subdevice; - - return s->subdev_flags; -} - -int comedi_find_subdevice_by_type(void *d, int type, unsigned int subd) -{ - struct comedi_device *dev = (struct comedi_device *)d; - - if (subd > dev->n_subdevices) - return -ENODEV; - - for (; subd < dev->n_subdevices; subd++) { - if (dev->subdevices[subd].type == type) - return subd; - } - return -1; -} - -int comedi_get_n_channels(void *d, unsigned int subdevice) -{ - struct comedi_device *dev = (struct comedi_device *)d; - struct comedi_subdevice *s = dev->subdevices + subdevice; - - return s->n_chan; -} - -int comedi_get_len_chanlist(void *d, unsigned int subdevice) -{ - struct comedi_device *dev = (struct comedi_device *)d; - struct comedi_subdevice *s = dev->subdevices + subdevice; - - return s->len_chanlist; -} - -unsigned int comedi_get_maxdata(void *d, unsigned int subdevice, - unsigned int chan) -{ - struct comedi_device *dev = (struct comedi_device *)d; - struct comedi_subdevice *s = dev->subdevices + subdevice; - - if (s->maxdata_list) - return s->maxdata_list[chan]; - - return s->maxdata; -} - -#ifdef KCOMEDILIB_DEPRECATED -int comedi_get_rangetype(void *d, unsigned int subdevice, unsigned int chan) -{ - struct comedi_device *dev = (struct comedi_device *)d; - struct comedi_subdevice *s = dev->subdevices + subdevice; - int ret; - - if (s->range_table_list) { - ret = s->range_table_list[chan]->length; - } else { - ret = s->range_table->length; - } - - ret = ret | (dev->minor << 28) | (subdevice << 24) | (chan << 16); - - return ret; -} -#endif - -int comedi_get_n_ranges(void *d, unsigned int subdevice, unsigned int chan) -{ - struct comedi_device *dev = (struct comedi_device *)d; - struct comedi_subdevice *s = dev->subdevices + subdevice; - int ret; - - if (s->range_table_list) { - ret = s->range_table_list[chan]->length; - } else { - ret = s->range_table->length; - } - - return ret; -} - -/* - * ALPHA (non-portable) -*/ -int comedi_get_krange(void *d, unsigned int subdevice, unsigned int chan, - unsigned int range, struct comedi_krange *krange) -{ - struct comedi_device *dev = (struct comedi_device *)d; - struct comedi_subdevice *s = dev->subdevices + subdevice; - const struct comedi_lrange *lr; - - if (s->range_table_list) { - lr = s->range_table_list[chan]; - } else { - lr = s->range_table; - } - if (range >= lr->length) - return -EINVAL; - - memcpy(krange, lr->range + range, sizeof(struct comedi_krange)); - - return 0; -} - -/* - * ALPHA (may be renamed) -*/ -unsigned int comedi_get_buf_head_pos(void *d, unsigned int subdevice) -{ - struct comedi_device *dev = (struct comedi_device *)d; - struct comedi_subdevice *s = dev->subdevices + subdevice; - struct comedi_async *async; - - async = s->async; - if (async == NULL) - return 0; - - return async->buf_write_count; -} - -int comedi_get_buffer_contents(void *d, unsigned int subdevice) -{ - struct comedi_device *dev = (struct comedi_device *)d; - struct comedi_subdevice *s = dev->subdevices + subdevice; - struct comedi_async *async; - unsigned int num_bytes; - - if (subdevice >= dev->n_subdevices) - return -1; - async = s->async; - if (async == NULL) - return 0; - num_bytes = comedi_buf_read_n_available(s->async); - return num_bytes; -} - -/* - * ALPHA -*/ -int comedi_set_user_int_count(void *d, unsigned int subdevice, - unsigned int buf_user_count) -{ - struct comedi_device *dev = (struct comedi_device *)d; - struct comedi_subdevice *s = dev->subdevices + subdevice; - struct comedi_async *async; - int num_bytes; - - async = s->async; - if (async == NULL) - return -1; - - num_bytes = buf_user_count - async->buf_read_count; - if (num_bytes < 0) - return -1; - comedi_buf_read_alloc(async, num_bytes); - comedi_buf_read_free(async, num_bytes); - - return 0; -} - -int comedi_mark_buffer_read(void *d, unsigned int subdevice, - unsigned int num_bytes) -{ - struct comedi_device *dev = (struct comedi_device *)d; - struct comedi_subdevice *s = dev->subdevices + subdevice; - struct comedi_async *async; - - if (subdevice >= dev->n_subdevices) - return -1; - async = s->async; - if (async == NULL) - return -1; - - comedi_buf_read_alloc(async, num_bytes); - comedi_buf_read_free(async, num_bytes); - - return 0; -} - -int comedi_mark_buffer_written(void *d, unsigned int subdevice, - unsigned int num_bytes) -{ - struct comedi_device *dev = (struct comedi_device *)d; - struct comedi_subdevice *s = dev->subdevices + subdevice; - struct comedi_async *async; - int bytes_written; - - if (subdevice >= dev->n_subdevices) - return -1; - async = s->async; - if (async == NULL) - return -1; - bytes_written = comedi_buf_write_alloc(async, num_bytes); - comedi_buf_write_free(async, bytes_written); - if (bytes_written != num_bytes) - return -1; - return 0; -} - -int comedi_get_buffer_size(void *d, unsigned int subdev) -{ - struct comedi_device *dev = (struct comedi_device *)d; - struct comedi_subdevice *s = dev->subdevices + subdev; - struct comedi_async *async; - - if (subdev >= dev->n_subdevices) - return -1; - async = s->async; - if (async == NULL) - return 0; - - return async->prealloc_bufsz; -} - -int comedi_get_buffer_offset(void *d, unsigned int subdevice) -{ - struct comedi_device *dev = (struct comedi_device *)d; - struct comedi_subdevice *s = dev->subdevices + subdevice; - struct comedi_async *async; - - if (subdevice >= dev->n_subdevices) - return -1; - async = s->async; - if (async == NULL) - return 0; - - return async->buf_read_ptr; -} diff --git a/drivers/staging/comedi/kcomedilib/kcomedilib_main.c b/drivers/staging/comedi/kcomedilib/kcomedilib_main.c index 288fef4..863aae4 100644 --- a/drivers/staging/comedi/kcomedilib/kcomedilib_main.c +++ b/drivers/staging/comedi/kcomedilib/kcomedilib_main.c @@ -31,7 +31,7 @@ #include <linux/delay.h> #include <linux/ioport.h> #include <linux/mm.h> -#include <asm/io.h> +#include <linux/io.h> #include "../comedi.h" #include "../comedilib.h" @@ -41,7 +41,7 @@ MODULE_AUTHOR("David Schleef <ds@schleef.org>"); MODULE_DESCRIPTION("Comedi kernel library"); MODULE_LICENSE("GPL"); -void *comedi_open(const char *filename) +struct comedi_device *comedi_open(const char *filename) { struct comedi_device_file_info *dev_file_info; struct comedi_device *dev; @@ -66,29 +66,11 @@ void *comedi_open(const char *filename) if (!try_module_get(dev->driver->module)) return NULL; - return (void *)dev; + return dev; } +EXPORT_SYMBOL(comedi_open); -void *comedi_open_old(unsigned int minor) -{ - struct comedi_device_file_info *dev_file_info; - struct comedi_device *dev; - - if (minor >= COMEDI_NUM_MINORS) - return NULL; - - dev_file_info = comedi_get_device_file_info(minor); - if (dev_file_info == NULL) - return NULL; - dev = dev_file_info->device; - - if (dev == NULL || !dev->attached) - return NULL; - - return (void *)dev; -} - -int comedi_close(void *d) +int comedi_close(struct comedi_device *d) { struct comedi_device *dev = (struct comedi_device *)d; @@ -96,465 +78,118 @@ int comedi_close(void *d) return 0; } +EXPORT_SYMBOL(comedi_close); -int comedi_loglevel(int newlevel) -{ - return 0; -} - -void comedi_perror(const char *message) -{ - printk("%s: unknown error\n", message); -} - -char *comedi_strerror(int err) -{ - return "unknown error"; -} - -int comedi_fileno(void *d) +static int comedi_do_insn(struct comedi_device *dev, struct comedi_insn *insn) { - struct comedi_device *dev = (struct comedi_device *)d; - - /* return something random */ - return dev->minor; -} - -int comedi_command(void *d, struct comedi_cmd *cmd) -{ - struct comedi_device *dev = (struct comedi_device *)d; - struct comedi_subdevice *s; - struct comedi_async *async; - unsigned runflags; - - if (cmd->subdev >= dev->n_subdevices) - return -ENODEV; - - s = dev->subdevices + cmd->subdev; - if (s->type == COMEDI_SUBD_UNUSED) - return -EIO; - - async = s->async; - if (async == NULL) - return -ENODEV; - - if (s->busy) - return -EBUSY; - s->busy = d; - - if (async->cb_mask & COMEDI_CB_EOS) - cmd->flags |= TRIG_WAKE_EOS; - - async->cmd = *cmd; - - runflags = SRF_RUNNING; - - comedi_set_subdevice_runflags(s, ~0, runflags); - - comedi_reset_async_buf(async); - - return s->do_cmd(dev, s); -} - -int comedi_command_test(void *d, struct comedi_cmd *cmd) -{ - struct comedi_device *dev = (struct comedi_device *)d; - struct comedi_subdevice *s; - - if (cmd->subdev >= dev->n_subdevices) - return -ENODEV; - - s = dev->subdevices + cmd->subdev; - if (s->type == COMEDI_SUBD_UNUSED) - return -EIO; - - if (s->async == NULL) - return -ENODEV; - - return s->do_cmdtest(dev, s, cmd); -} - -/* - * COMEDI_INSN - * perform an instruction - */ -int comedi_do_insn(void *d, struct comedi_insn *insn) -{ - struct comedi_device *dev = (struct comedi_device *)d; struct comedi_subdevice *s; int ret = 0; - if (insn->insn & INSN_MASK_SPECIAL) { - switch (insn->insn) { - case INSN_GTOD: - { - struct timeval tv; - - do_gettimeofday(&tv); - insn->data[0] = tv.tv_sec; - insn->data[1] = tv.tv_usec; - ret = 2; - - break; - } - case INSN_WAIT: - /* XXX isn't the value supposed to be nanosecs? */ - if (insn->n != 1 || insn->data[0] >= 100) { - ret = -EINVAL; - break; - } - udelay(insn->data[0]); - ret = 1; - break; - case INSN_INTTRIG: - if (insn->n != 1) { - ret = -EINVAL; - break; - } - if (insn->subdev >= dev->n_subdevices) { - printk("%d not usable subdevice\n", - insn->subdev); - ret = -EINVAL; - break; - } - s = dev->subdevices + insn->subdev; - if (!s->async) { - printk("no async\n"); - ret = -EINVAL; - break; - } - if (!s->async->inttrig) { - printk("no inttrig\n"); - ret = -EAGAIN; - break; - } - ret = s->async->inttrig(dev, s, insn->data[0]); - if (ret >= 0) - ret = 1; - break; - default: - ret = -EINVAL; - } - } else { - /* a subdevice instruction */ - if (insn->subdev >= dev->n_subdevices) { - ret = -EINVAL; - goto error; - } - s = dev->subdevices + insn->subdev; - - if (s->type == COMEDI_SUBD_UNUSED) { - printk("%d not useable subdevice\n", insn->subdev); - ret = -EIO; - goto error; - } - - /* XXX check lock */ - - ret = check_chanlist(s, 1, &insn->chanspec); - if (ret < 0) { - printk("bad chanspec\n"); - ret = -EINVAL; - goto error; - } - - if (s->busy) { - ret = -EBUSY; - goto error; - } - s->busy = d; - - switch (insn->insn) { - case INSN_READ: - ret = s->insn_read(dev, s, insn, insn->data); - break; - case INSN_WRITE: - ret = s->insn_write(dev, s, insn, insn->data); - break; - case INSN_BITS: - ret = s->insn_bits(dev, s, insn, insn->data); - break; - case INSN_CONFIG: - /* XXX should check instruction length */ - ret = s->insn_config(dev, s, insn, insn->data); - break; - default: - ret = -EINVAL; - break; - } - - s->busy = NULL; - } - if (ret < 0) - goto error; -#if 0 - /* XXX do we want this? -- abbotti #if'ed it out for now. */ - if (ret != insn->n) { - printk("BUG: result of insn != insn.n\n"); + /* a subdevice instruction */ + if (insn->subdev >= dev->n_subdevices) { ret = -EINVAL; goto error; } -#endif -error: - - return ret; -} - -/* - COMEDI_LOCK - lock subdevice - - arg: - subdevice number - - reads: - none - - writes: - none - - necessary locking: - - ioctl/rt lock (this type) - - lock while subdevice busy - - lock while subdevice being programmed + s = dev->subdevices + insn->subdev; -*/ -int comedi_lock(void *d, unsigned int subdevice) -{ - struct comedi_device *dev = (struct comedi_device *)d; - struct comedi_subdevice *s; - unsigned long flags; - int ret = 0; - - if (subdevice >= dev->n_subdevices) - return -EINVAL; - - s = dev->subdevices + subdevice; - - spin_lock_irqsave(&s->spin_lock, flags); - - if (s->busy) { - ret = -EBUSY; - } else { - if (s->lock) { - ret = -EBUSY; - } else { - s->lock = d; - } + if (s->type == COMEDI_SUBD_UNUSED) { + printk("%d not useable subdevice\n", insn->subdev); + ret = -EIO; + goto error; } - spin_unlock_irqrestore(&s->spin_lock, flags); - - return ret; -} + /* XXX check lock */ -/* - COMEDI_UNLOCK - unlock subdevice - - arg: - subdevice number - - reads: - none - - writes: - none - -*/ -int comedi_unlock(void *d, unsigned int subdevice) -{ - struct comedi_device *dev = (struct comedi_device *)d; - struct comedi_subdevice *s; - unsigned long flags; - struct comedi_async *async; - int ret; - - if (subdevice >= dev->n_subdevices) - return -EINVAL; - - s = dev->subdevices + subdevice; - - async = s->async; - - spin_lock_irqsave(&s->spin_lock, flags); + ret = comedi_check_chanlist(s, 1, &insn->chanspec); + if (ret < 0) { + printk("bad chanspec\n"); + ret = -EINVAL; + goto error; + } if (s->busy) { ret = -EBUSY; - } else if (s->lock && s->lock != (void *)d) { - ret = -EACCES; - } else { - s->lock = NULL; - - if (async) { - async->cb_mask = 0; - async->cb_func = NULL; - async->cb_arg = NULL; - } - - ret = 0; + goto error; + } + s->busy = dev; + + switch (insn->insn) { + case INSN_BITS: + ret = s->insn_bits(dev, s, insn, insn->data); + break; + case INSN_CONFIG: + /* XXX should check instruction length */ + ret = s->insn_config(dev, s, insn, insn->data); + break; + default: + ret = -EINVAL; + break; } - spin_unlock_irqrestore(&s->spin_lock, flags); - - return ret; -} - -/* - COMEDI_CANCEL - cancel acquisition ioctl - - arg: - subdevice number - - reads: - nothing - - writes: - nothing - -*/ -int comedi_cancel(void *d, unsigned int subdevice) -{ - struct comedi_device *dev = (struct comedi_device *)d; - struct comedi_subdevice *s; - int ret = 0; - - if (subdevice >= dev->n_subdevices) - return -EINVAL; - - s = dev->subdevices + subdevice; - - if (s->lock && s->lock != d) - return -EACCES; - -#if 0 - if (!s->busy) - return 0; - - if (s->busy != d) - return -EBUSY; -#endif - - if (!s->cancel || !s->async) - return -EINVAL; - - ret = s->cancel(dev, s); - - if (ret) - return ret; - - comedi_set_subdevice_runflags(s, SRF_RUNNING | SRF_RT, 0); - s->async->inttrig = NULL; s->busy = NULL; +error: - return 0; + return ret; } -/* - registration of callback functions - */ -int comedi_register_callback(void *d, unsigned int subdevice, - unsigned int mask, int (*cb) (unsigned int, - void *), void *arg) +int comedi_dio_config(struct comedi_device *dev, unsigned int subdev, + unsigned int chan, unsigned int io) { - struct comedi_device *dev = (struct comedi_device *)d; - struct comedi_subdevice *s; - struct comedi_async *async; - - if (subdevice >= dev->n_subdevices) - return -EINVAL; - - s = dev->subdevices + subdevice; - - async = s->async; - if (s->type == COMEDI_SUBD_UNUSED || !async) - return -EIO; + struct comedi_insn insn; - /* are we locked? (ioctl lock) */ - if (s->lock && s->lock != d) - return -EACCES; + memset(&insn, 0, sizeof(insn)); + insn.insn = INSN_CONFIG; + insn.n = 1; + insn.data = &io; + insn.subdev = subdev; + insn.chanspec = CR_PACK(chan, 0, 0); - /* are we busy? */ - if (s->busy) - return -EBUSY; - - if (!mask) { - async->cb_mask = 0; - async->cb_func = NULL; - async->cb_arg = NULL; - } else { - async->cb_mask = mask; - async->cb_func = cb; - async->cb_arg = arg; - } - - return 0; + return comedi_do_insn(dev, &insn); } +EXPORT_SYMBOL(comedi_dio_config); -int comedi_poll(void *d, unsigned int subdevice) +int comedi_dio_bitfield(struct comedi_device *dev, unsigned int subdev, + unsigned int mask, unsigned int *bits) { - struct comedi_device *dev = (struct comedi_device *)d; - struct comedi_subdevice *s = dev->subdevices; - struct comedi_async *async; - - if (subdevice >= dev->n_subdevices) - return -EINVAL; + struct comedi_insn insn; + unsigned int data[2]; + int ret; - s = dev->subdevices + subdevice; + memset(&insn, 0, sizeof(insn)); + insn.insn = INSN_BITS; + insn.n = 2; + insn.data = data; + insn.subdev = subdev; - async = s->async; - if (s->type == COMEDI_SUBD_UNUSED || !async) - return -EIO; + data[0] = mask; + data[1] = *bits; - /* are we locked? (ioctl lock) */ - if (s->lock && s->lock != d) - return -EACCES; + ret = comedi_do_insn(dev, &insn); - /* are we running? XXX wrong? */ - if (!s->busy) - return -EIO; + *bits = data[1]; - return s->poll(dev, s); + return ret; } +EXPORT_SYMBOL(comedi_dio_bitfield); -/* WARNING: not portable */ -int comedi_map(void *d, unsigned int subdevice, void *ptr) +int comedi_find_subdevice_by_type(struct comedi_device *dev, int type, + unsigned int subd) { - struct comedi_device *dev = (struct comedi_device *)d; - struct comedi_subdevice *s; - - if (subdevice >= dev->n_subdevices) - return -EINVAL; - - s = dev->subdevices + subdevice; - - if (!s->async) - return -EINVAL; - - if (ptr) - *((void **)ptr) = s->async->prealloc_buf; - - /* XXX no reference counting */ + if (subd > dev->n_subdevices) + return -ENODEV; - return 0; + for (; subd < dev->n_subdevices; subd++) { + if (dev->subdevices[subd].type == type) + return subd; + } + return -1; } +EXPORT_SYMBOL(comedi_find_subdevice_by_type); -/* WARNING: not portable */ -int comedi_unmap(void *d, unsigned int subdevice) +int comedi_get_n_channels(struct comedi_device *dev, unsigned int subdevice) { - struct comedi_device *dev = (struct comedi_device *)d; - struct comedi_subdevice *s; + struct comedi_subdevice *s = dev->subdevices + subdevice; - if (subdevice >= dev->n_subdevices) - return -EINVAL; - - s = dev->subdevices + subdevice; - - if (!s->async) - return -EINVAL; - - /* XXX no reference counting */ - - return 0; + return s->n_chan; } +EXPORT_SYMBOL(comedi_get_n_channels); diff --git a/drivers/staging/comedi/kcomedilib/ksyms.c b/drivers/staging/comedi/kcomedilib/ksyms.c deleted file mode 100644 index 8bf4471..0000000 --- a/drivers/staging/comedi/kcomedilib/ksyms.c +++ /dev/null @@ -1,146 +0,0 @@ -/* - comedi/kcomedilib/ksyms.c - a comedlib interface for kernel modules - - COMEDI - Linux Control and Measurement Device Interface - Copyright (C) 1997-2001 David A. Schleef <ds@schleef.org> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include "../comedi.h" -#include "../comedilib.h" -#include "../comedidev.h" - -#include <linux/module.h> - -#include <linux/errno.h> -#include <linux/kernel.h> -#include <linux/sched.h> -#include <linux/fcntl.h> -#include <linux/delay.h> -#include <linux/ioport.h> -#include <linux/mm.h> - -/* functions specific to kcomedilib */ - -EXPORT_SYMBOL(comedi_register_callback); -EXPORT_SYMBOL(comedi_get_krange); -EXPORT_SYMBOL(comedi_get_buf_head_pos); -EXPORT_SYMBOL(comedi_set_user_int_count); -EXPORT_SYMBOL(comedi_map); -EXPORT_SYMBOL(comedi_unmap); - -/* This list comes from user-space comedilib, to show which - * functions are not ported yet. */ - -EXPORT_SYMBOL(comedi_open); -EXPORT_SYMBOL(comedi_close); - -/* logging */ -EXPORT_SYMBOL(comedi_loglevel); -EXPORT_SYMBOL(comedi_perror); -EXPORT_SYMBOL(comedi_strerror); -/* EXPORT_SYMBOL(comedi_errno); */ -EXPORT_SYMBOL(comedi_fileno); - -/* device queries */ -EXPORT_SYMBOL(comedi_get_n_subdevices); -EXPORT_SYMBOL(comedi_get_version_code); -EXPORT_SYMBOL(comedi_get_driver_name); -EXPORT_SYMBOL(comedi_get_board_name); - -/* subdevice queries */ -EXPORT_SYMBOL(comedi_get_subdevice_type); -EXPORT_SYMBOL(comedi_find_subdevice_by_type); -EXPORT_SYMBOL(comedi_get_subdevice_flags); -EXPORT_SYMBOL(comedi_get_n_channels); -/* -* EXPORT_SYMBOL(comedi_range_is_chan_specific); -* EXPORT_SYMBOL(comedi_maxdata_is_chan_specific); -*/ - -/* channel queries */ -EXPORT_SYMBOL(comedi_get_maxdata); -#ifdef KCOMEDILIB_DEPRECATED -EXPORT_SYMBOL(comedi_get_rangetype); -#endif -EXPORT_SYMBOL(comedi_get_n_ranges); -/* EXPORT_SYMBOL(comedi_find_range); */ - -/* buffer queries */ -EXPORT_SYMBOL(comedi_get_buffer_size); -/* -* EXPORT_SYMBOL(comedi_get_max_buffer_size); -* EXPORT_SYMBOL(comedi_set_buffer_size); -*/ -EXPORT_SYMBOL(comedi_get_buffer_contents); -EXPORT_SYMBOL(comedi_get_buffer_offset); - -/* low-level stuff */ -/* -* EXPORT_SYMBOL(comedi_trigger); EXPORT_SYMBOL(comedi_do_insnlist); -*/ -EXPORT_SYMBOL(comedi_do_insn); -EXPORT_SYMBOL(comedi_lock); -EXPORT_SYMBOL(comedi_unlock); - -/* physical units */ -/* -* EXPORT_SYMBOL(comedi_to_phys); EXPORT_SYMBOL(comedi_from_phys); -*/ - -/* synchronous stuff */ -EXPORT_SYMBOL(comedi_data_read); -EXPORT_SYMBOL(comedi_data_read_hint); -EXPORT_SYMBOL(comedi_data_read_delayed); -EXPORT_SYMBOL(comedi_data_write); -EXPORT_SYMBOL(comedi_dio_config); -EXPORT_SYMBOL(comedi_dio_read); -EXPORT_SYMBOL(comedi_dio_write); -EXPORT_SYMBOL(comedi_dio_bitfield); - -/* slowly varying stuff */ -/* -* EXPORT_SYMBOL(comedi_sv_init); EXPORT_SYMBOL(comedi_sv_update); -* EXPORT_SYMBOL(comedi_sv_measure); -*/ - -/* commands */ -/* -* EXPORT_SYMBOL(comedi_get_cmd_src_mask); -* EXPORT_SYMBOL(comedi_get_cmd_generic_timed); -*/ -EXPORT_SYMBOL(comedi_cancel); -EXPORT_SYMBOL(comedi_command); -EXPORT_SYMBOL(comedi_command_test); -EXPORT_SYMBOL(comedi_poll); - -/* buffer configuration */ -EXPORT_SYMBOL(comedi_mark_buffer_read); -EXPORT_SYMBOL(comedi_mark_buffer_written); - -/* EXPORT_SYMBOL(comedi_get_range); */ -EXPORT_SYMBOL(comedi_get_len_chanlist); - -/* deprecated */ -/* -* EXPORT_SYMBOL(comedi_get_timer); -* EXPORT_SYMBOL(comedi_timed_1chan); -*/ - -/* alpha */ -/* EXPORT_SYMBOL(comedi_set_global_oor_behavior); */ diff --git a/drivers/staging/comedi/pci_ids.h b/drivers/staging/comedi/pci_ids.h deleted file mode 100644 index d979aa8..0000000 --- a/drivers/staging/comedi/pci_ids.h +++ /dev/null @@ -1,31 +0,0 @@ -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#ifndef __COMPAT_LINUX_PCI_IDS_H -#define __COMPAT_LINUX_PCI_IDS_H - -#include <linux/pci_ids.h> - -#ifndef PCI_VENDOR_ID_AMCC -#define PCI_VENDOR_ID_AMCC 0x10e8 -#endif - -#ifndef PCI_VENDOR_ID_CBOARDS -#define PCI_VENDOR_ID_CBOARDS 0x1307 -#endif - -#ifndef PCI_VENDOR_ID_QUANCOM -#define PCI_VENDOR_ID_QUANCOM 0x8008 -#endif - -#ifndef PCI_DEVICE_ID_QUANCOM_GPIB -#define PCI_DEVICE_ID_QUANCOM_GPIB 0x3302 -#endif - -#endif /* __COMPAT_LINUX_PCI_IDS_H */ diff --git a/drivers/staging/comedi/proc.c b/drivers/staging/comedi/proc.c index 5a22fe6..2aa487b 100644 --- a/drivers/staging/comedi/proc.c +++ b/drivers/staging/comedi/proc.c @@ -30,16 +30,13 @@ #define __NO_VERSION__ #include "comedidev.h" +#include "comedi_fops.h" #include <linux/proc_fs.h> -/* #include <linux/string.h> */ +#include <linux/string.h> -int comedi_read_procmem(char *buf, char **start, off_t offset, int len, - int *eof, void *data); - -extern struct comedi_driver *comedi_drivers; - -int comedi_read_procmem(char *buf, char **start, off_t offset, int len, - int *eof, void *data) +#ifdef CONFIG_PROC_FS +static int comedi_read(char *buf, char **start, off_t offset, int len, + int *eof, void *data) { int i; int devices_q = 0; @@ -49,7 +46,8 @@ int comedi_read_procmem(char *buf, char **start, off_t offset, int len, l += sprintf(buf + l, "comedi version " COMEDI_RELEASE "\n" "format string: %s\n", - "\"%2d: %-20s %-20s %4d\",i,driver_name,board_name,n_subdevices"); + "\"%2d: %-20s %-20s %4d\", i, " + "driver_name, board_name, n_subdevices"); for (i = 0; i < COMEDI_NUM_BOARD_MINORS; i++) { struct comedi_device_file_info *dev_file_info = @@ -85,18 +83,17 @@ int comedi_read_procmem(char *buf, char **start, off_t offset, int len, return l; } -#ifdef CONFIG_PROC_FS void comedi_proc_init(void) { struct proc_dir_entry *comedi_proc; - comedi_proc = create_proc_entry("comedi", S_IFREG | S_IRUGO, 0); + comedi_proc = create_proc_entry("comedi", S_IFREG | S_IRUGO, NULL); if (comedi_proc) - comedi_proc->read_proc = comedi_read_procmem; + comedi_proc->read_proc = comedi_read; } void comedi_proc_cleanup(void) { - remove_proc_entry("comedi", 0); + remove_proc_entry("comedi", NULL); } #endif diff --git a/drivers/staging/comedi/range.c b/drivers/staging/comedi/range.c index 8313dfc..148ec6f 100644 --- a/drivers/staging/comedi/range.c +++ b/drivers/staging/comedi/range.c @@ -21,15 +21,22 @@ */ +#include <linux/uaccess.h> #include "comedidev.h" -#include <asm/uaccess.h> +#include "internal.h" const struct comedi_lrange range_bipolar10 = { 1, {BIP_RANGE(10)} }; +EXPORT_SYMBOL(range_bipolar10); const struct comedi_lrange range_bipolar5 = { 1, {BIP_RANGE(5)} }; +EXPORT_SYMBOL(range_bipolar5); const struct comedi_lrange range_bipolar2_5 = { 1, {BIP_RANGE(2.5)} }; +EXPORT_SYMBOL(range_bipolar2_5); const struct comedi_lrange range_unipolar10 = { 1, {UNI_RANGE(10)} }; +EXPORT_SYMBOL(range_unipolar10); const struct comedi_lrange range_unipolar5 = { 1, {UNI_RANGE(5)} }; -const struct comedi_lrange range_unknown = { 1, {{0, 1000000, UNIT_none}} }; +EXPORT_SYMBOL(range_unipolar5); +const struct comedi_lrange range_unknown = { 1, {{0, 1000000, UNIT_none} } }; +EXPORT_SYMBOL(range_unknown); /* COMEDI_RANGEINFO @@ -44,7 +51,8 @@ const struct comedi_lrange range_unknown = { 1, {{0, 1000000, UNIT_none}} }; writes: n struct comedi_krange structures to rangeinfo->range_ptr */ -int do_rangeinfo_ioctl(struct comedi_device *dev, struct comedi_rangeinfo *arg) +int do_rangeinfo_ioctl(struct comedi_device *dev, + struct comedi_rangeinfo __user *arg) { struct comedi_rangeinfo it; int subd, chan; @@ -120,7 +128,8 @@ static int aref_invalid(struct comedi_subdevice *s, unsigned int chanspec) This function checks each element in a channel/gain list to make make sure it is valid. */ -int check_chanlist(struct comedi_subdevice *s, int n, unsigned int *chanlist) +int comedi_check_chanlist(struct comedi_subdevice *s, int n, + unsigned int *chanlist) { int i; int chan; @@ -130,14 +139,10 @@ int check_chanlist(struct comedi_subdevice *s, int n, unsigned int *chanlist) if (CR_CHAN(chanlist[i]) >= s->n_chan || CR_RANGE(chanlist[i]) >= s->range_table->length || aref_invalid(s, chanlist[i])) { - printk - ("bad chanlist[%d]=0x%08x n_chan=%d range length=%d\n", - i, chanlist[i], s->n_chan, - s->range_table->length); -#if 0 - for (i = 0; i < n; i++) - printk("[%d]=0x%08x\n", i, chanlist[i]); -#endif + printk(KERN_ERR "bad chanlist[%d]=0x%08x " + "in_chan=%d range length=%d\n", i, + chanlist[i], s->n_chan, + s->range_table->length); return -EINVAL; } } else if (s->range_table_list) { @@ -147,14 +152,15 @@ int check_chanlist(struct comedi_subdevice *s, int n, unsigned int *chanlist) CR_RANGE(chanlist[i]) >= s->range_table_list[chan]->length || aref_invalid(s, chanlist[i])) { - printk("bad chanlist[%d]=0x%08x\n", i, - chanlist[i]); + printk(KERN_ERR "bad chanlist[%d]=0x%08x\n", + i, chanlist[i]); return -EINVAL; } } } else { - printk("comedi: (bug) no range type list!\n"); + printk(KERN_ERR "comedi: (bug) no range type list!\n"); return -EINVAL; } return 0; } +EXPORT_SYMBOL(comedi_check_chanlist); diff --git a/drivers/staging/comedi/wrapper.h b/drivers/staging/comedi/wrapper.h deleted file mode 100644 index 77fc673..0000000 --- a/drivers/staging/comedi/wrapper.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - linux/wrapper.h compatibility header - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __COMPAT_LINUX_WRAPPER_H_ -#define __COMPAT_LINUX_WRAPPER_H_ - -#define mem_map_reserve(p) set_bit(PG_reserved, &((p)->flags)) -#define mem_map_unreserve(p) clear_bit(PG_reserved, &((p)->flags)) - -#endif /* __COMPAT_LINUX_WRAPPER_H_ */ |