Indented files in drivers/comedi directory using scripts/Lindent. Signed-off-by: Artem Baxtiarov <baxtiarovartem@xxxxxxxxx> --- drivers/comedi/comedi.h | 79 +- drivers/comedi/comedi_buf.c | 26 +- drivers/comedi/comedi_fops.c | 240 ++- drivers/comedi/comedi_internal.h | 7 +- drivers/comedi/comedi_pci.c | 13 +- drivers/comedi/comedi_pcmcia.c | 14 +- drivers/comedi/comedi_pcmcia.h | 2 +- drivers/comedi/comedi_usb.c | 11 +- drivers/comedi/comedidev.h | 89 +- drivers/comedi/drivers.c | 57 +- drivers/comedi/drivers/8255.c | 9 +- drivers/comedi/drivers/8255.h | 4 +- drivers/comedi/drivers/8255_pci.c | 156 +- drivers/comedi/drivers/addi_apci_1032.c | 64 +- drivers/comedi/drivers/addi_apci_1500.c | 151 +- drivers/comedi/drivers/addi_apci_1516.c | 78 +- drivers/comedi/drivers/addi_apci_1564.c | 138 +- drivers/comedi/drivers/addi_apci_16xx.c | 52 +- drivers/comedi/drivers/addi_apci_2032.c | 64 +- drivers/comedi/drivers/addi_apci_2200.c | 48 +- drivers/comedi/drivers/addi_apci_3120.c | 169 +- drivers/comedi/drivers/addi_apci_3501.c | 87 +- drivers/comedi/drivers/addi_apci_3xxx.c | 623 +++--- drivers/comedi/drivers/addi_watchdog.c | 21 +- drivers/comedi/drivers/adl_pci6208.c | 68 +- drivers/comedi/drivers/adl_pci7x3x.c | 162 +- drivers/comedi/drivers/adl_pci8164.c | 88 +- drivers/comedi/drivers/adl_pci9111.c | 128 +- drivers/comedi/drivers/adl_pci9118.c | 256 ++- drivers/comedi/drivers/adq12b.c | 80 +- drivers/comedi/drivers/adv_pci1710.c | 350 ++-- drivers/comedi/drivers/adv_pci1720.c | 61 +- drivers/comedi/drivers/adv_pci1723.c | 55 +- drivers/comedi/drivers/adv_pci1724.c | 74 +- drivers/comedi/drivers/adv_pci1760.c | 82 +- drivers/comedi/drivers/adv_pci_dio.c | 317 ++- drivers/comedi/drivers/aio_aio12_8.c | 77 +- drivers/comedi/drivers/aio_iiro_16.c | 45 +- drivers/comedi/drivers/amplc_dio200.c | 95 +- drivers/comedi/drivers/amplc_dio200.h | 2 +- drivers/comedi/drivers/amplc_dio200_common.c | 41 +- drivers/comedi/drivers/amplc_dio200_pci.c | 137 +- drivers/comedi/drivers/amplc_pc236.c | 4 +- drivers/comedi/drivers/amplc_pc236.h | 6 +- drivers/comedi/drivers/amplc_pc236_common.c | 5 +- drivers/comedi/drivers/amplc_pc263.c | 35 +- drivers/comedi/drivers/amplc_pci224.c | 126 +- drivers/comedi/drivers/amplc_pci230.c | 244 ++- drivers/comedi/drivers/amplc_pci236.c | 8 +- drivers/comedi/drivers/amplc_pci263.c | 37 +- drivers/comedi/drivers/c6xdigio.c | 55 +- drivers/comedi/drivers/cb_das16_cs.c | 128 +- drivers/comedi/drivers/cb_pcidas.c | 353 ++-- drivers/comedi/drivers/cb_pcidas64.c | 1175 ++++++----- drivers/comedi/drivers/cb_pcidda.c | 102 +- drivers/comedi/drivers/cb_pcimdas.c | 126 +- drivers/comedi/drivers/cb_pcimdda.c | 41 +- drivers/comedi/drivers/comedi_8254.c | 71 +- drivers/comedi/drivers/comedi_8254.h | 10 +- drivers/comedi/drivers/comedi_8255.c | 38 +- drivers/comedi/drivers/comedi_bond.c | 14 +- drivers/comedi/drivers/comedi_isadma.c | 11 +- drivers/comedi/drivers/comedi_isadma.h | 16 +- drivers/comedi/drivers/comedi_parport.c | 70 +- drivers/comedi/drivers/comedi_test.c | 87 +- drivers/comedi/drivers/contec_pci_dio.c | 45 +- drivers/comedi/drivers/dac02.c | 38 +- drivers/comedi/drivers/daqboard2000.c | 139 +- drivers/comedi/drivers/das08.c | 104 +- drivers/comedi/drivers/das08_cs.c | 36 +- drivers/comedi/drivers/das08_isa.c | 256 +-- drivers/comedi/drivers/das08_pci.c | 39 +- drivers/comedi/drivers/das16.c | 789 +++++--- drivers/comedi/drivers/das16m1.c | 101 +- drivers/comedi/drivers/das1800.c | 338 ++-- drivers/comedi/drivers/das6402.c | 155 +- drivers/comedi/drivers/das800.c | 232 ++- drivers/comedi/drivers/dmm32at.c | 117 +- drivers/comedi/drivers/dt2801.c | 74 +- drivers/comedi/drivers/dt2811.c | 196 +- drivers/comedi/drivers/dt2814.c | 19 +- drivers/comedi/drivers/dt2815.c | 15 +- drivers/comedi/drivers/dt2817.c | 15 +- drivers/comedi/drivers/dt282x.c | 428 ++-- drivers/comedi/drivers/dt3000.c | 217 +- drivers/comedi/drivers/dt9812.c | 109 +- drivers/comedi/drivers/dyna_pci10xx.c | 29 +- drivers/comedi/drivers/fl512.c | 55 +- drivers/comedi/drivers/gsc_hpdi.c | 68 +- drivers/comedi/drivers/icp_multi.c | 96 +- drivers/comedi/drivers/ii_pci20kc.c | 91 +- drivers/comedi/drivers/jr3_pci.c | 99 +- drivers/comedi/drivers/jr3_pci.h | 126 +- drivers/comedi/drivers/ke_counter.c | 61 +- drivers/comedi/drivers/me4000.c | 309 ++- drivers/comedi/drivers/me_daq.c | 130 +- drivers/comedi/drivers/mf6x4.c | 92 +- drivers/comedi/drivers/mite.c | 26 +- drivers/comedi/drivers/mpc624.c | 73 +- drivers/comedi/drivers/multiq3.c | 98 +- drivers/comedi/drivers/ni_6527.c | 102 +- drivers/comedi/drivers/ni_65xx.c | 296 ++- drivers/comedi/drivers/ni_660x.c | 513 +++-- drivers/comedi/drivers/ni_670x.c | 52 +- drivers/comedi/drivers/ni_at_a2150.c | 36 +- drivers/comedi/drivers/ni_at_ao.c | 77 +- drivers/comedi/drivers/ni_atmio.c | 265 ++- drivers/comedi/drivers/ni_atmio16d.c | 79 +- drivers/comedi/drivers/ni_daq_700.c | 78 +- drivers/comedi/drivers/ni_daq_dio24.c | 27 +- drivers/comedi/drivers/ni_labpc.c | 45 +- drivers/comedi/drivers/ni_labpc.h | 13 +- drivers/comedi/drivers/ni_labpc_common.c | 192 +- drivers/comedi/drivers/ni_labpc_cs.c | 32 +- drivers/comedi/drivers/ni_labpc_isadma.c | 7 + drivers/comedi/drivers/ni_labpc_pci.c | 33 +- drivers/comedi/drivers/ni_labpc_regs.h | 4 +- drivers/comedi/drivers/ni_mio_common.c | 1107 +++++------ drivers/comedi/drivers/ni_mio_cs.c | 159 +- drivers/comedi/drivers/ni_pcidio.c | 69 +- drivers/comedi/drivers/ni_pcimio.c | 1769 +++++++++-------- drivers/comedi/drivers/ni_routes.c | 30 +- drivers/comedi/drivers/ni_routes.h | 16 +- drivers/comedi/drivers/ni_stc.h | 20 +- drivers/comedi/drivers/ni_tio.c | 123 +- drivers/comedi/drivers/ni_tio.h | 38 +- drivers/comedi/drivers/ni_tiocmd.c | 35 +- drivers/comedi/drivers/ni_usb6501.c | 188 +- drivers/comedi/drivers/pcl711.c | 200 +- drivers/comedi/drivers/pcl724.c | 91 +- drivers/comedi/drivers/pcl726.c | 154 +- drivers/comedi/drivers/pcl730.c | 281 +-- drivers/comedi/drivers/pcl812.c | 750 ++++--- drivers/comedi/drivers/pcl816.c | 134 +- drivers/comedi/drivers/pcl818.c | 288 ++- drivers/comedi/drivers/pcm3724.c | 12 +- drivers/comedi/drivers/pcmad.c | 53 +- drivers/comedi/drivers/pcmda12.c | 37 +- drivers/comedi/drivers/pcmmio.c | 124 +- drivers/comedi/drivers/pcmuio.c | 66 +- drivers/comedi/drivers/plx9052.h | 4 +- drivers/comedi/drivers/plx9080.h | 10 +- drivers/comedi/drivers/quatech_daqp_cs.c | 122 +- drivers/comedi/drivers/rtd520.c | 227 ++- drivers/comedi/drivers/rti800.c | 137 +- drivers/comedi/drivers/rti802.c | 26 +- drivers/comedi/drivers/s526.c | 108 +- drivers/comedi/drivers/s626.c | 332 ++-- drivers/comedi/drivers/s626.h | 38 +- drivers/comedi/drivers/ssv_dnp.c | 21 +- .../drivers/tests/comedi_example_test.c | 4 +- drivers/comedi/drivers/tests/ni_routes_test.c | 138 +- drivers/comedi/drivers/tests/unittest.h | 4 +- drivers/comedi/drivers/usbdux.c | 199 +- drivers/comedi/drivers/usbduxfast.c | 92 +- drivers/comedi/drivers/usbduxsigma.c | 176 +- drivers/comedi/drivers/vmk80xx.c | 218 +- drivers/comedi/drivers/z8536.h | 66 +- drivers/comedi/kcomedilib/kcomedilib_main.c | 10 +- drivers/comedi/range.c | 37 +- 160 files changed, 10826 insertions(+), 10635 deletions(-) diff --git a/drivers/comedi/comedi.h b/drivers/comedi/comedi.h index b5d00a006dbb..749e4b83f26f 100644 --- a/drivers/comedi/comedi.h +++ b/drivers/comedi/comedi.h @@ -156,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 */ @@ -178,9 +178,9 @@ #define SDF_PWM_COUNTER 0x0080 /* PWM can automatically switch off */ #define SDF_PWM_HBRIDGE 0x0100 /* PWM is signed (H-bridge) */ #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_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 @@ -320,8 +320,8 @@ enum configuration_ids { INSN_CONFIG_FILTER = 24, INSN_CONFIG_CHANGE_NOTIFY = 25, - INSN_CONFIG_SERIAL_CLOCK = 26, /*ALPHA*/ - INSN_CONFIG_BIDIRECTIONAL_DATA = 27, + INSN_CONFIG_SERIAL_CLOCK = 26, /*ALPHA*/ + INSN_CONFIG_BIDIRECTIONAL_DATA = 27, INSN_CONFIG_DIO_QUERY = 28, INSN_CONFIG_PWM_OUTPUT = 29, INSN_CONFIG_GET_PWM_OUTPUT = 30, @@ -1053,7 +1053,7 @@ enum ni_common_signal_names { NI_AI_HoldCompleteEvent, NI_AI_HoldComplete, NI_AI_ExternalMUXClock, - NI_AI_STOP, /* pulse signal that occurs when a update is finished(?) */ + NI_AI_STOP, /* pulse signal that occurs when a update is finished(?) */ NI_AO_SampleClock, NI_AO_SampleClockTimebase, NI_AO_StartTrigger, @@ -1137,38 +1137,37 @@ enum ni_gpct_mode_bits { NI_GPCT_LOADING_ON_TC_BIT = 0x1000, NI_GPCT_LOADING_ON_GATE_BIT = 0x4000, NI_GPCT_COUNTING_MODE_MASK = 0x7 << NI_GPCT_COUNTING_MODE_SHIFT, - NI_GPCT_COUNTING_MODE_NORMAL_BITS = - 0x0 << NI_GPCT_COUNTING_MODE_SHIFT, + NI_GPCT_COUNTING_MODE_NORMAL_BITS = 0x0 << NI_GPCT_COUNTING_MODE_SHIFT, NI_GPCT_COUNTING_MODE_QUADRATURE_X1_BITS = - 0x1 << NI_GPCT_COUNTING_MODE_SHIFT, + 0x1 << NI_GPCT_COUNTING_MODE_SHIFT, NI_GPCT_COUNTING_MODE_QUADRATURE_X2_BITS = - 0x2 << NI_GPCT_COUNTING_MODE_SHIFT, + 0x2 << NI_GPCT_COUNTING_MODE_SHIFT, NI_GPCT_COUNTING_MODE_QUADRATURE_X4_BITS = - 0x3 << NI_GPCT_COUNTING_MODE_SHIFT, + 0x3 << NI_GPCT_COUNTING_MODE_SHIFT, NI_GPCT_COUNTING_MODE_TWO_PULSE_BITS = - 0x4 << NI_GPCT_COUNTING_MODE_SHIFT, + 0x4 << NI_GPCT_COUNTING_MODE_SHIFT, NI_GPCT_COUNTING_MODE_SYNC_SOURCE_BITS = - 0x6 << NI_GPCT_COUNTING_MODE_SHIFT, + 0x6 << NI_GPCT_COUNTING_MODE_SHIFT, NI_GPCT_INDEX_PHASE_MASK = 0x3 << NI_GPCT_INDEX_PHASE_BITSHIFT, NI_GPCT_INDEX_PHASE_LOW_A_LOW_B_BITS = - 0x0 << NI_GPCT_INDEX_PHASE_BITSHIFT, + 0x0 << NI_GPCT_INDEX_PHASE_BITSHIFT, NI_GPCT_INDEX_PHASE_LOW_A_HIGH_B_BITS = - 0x1 << NI_GPCT_INDEX_PHASE_BITSHIFT, + 0x1 << NI_GPCT_INDEX_PHASE_BITSHIFT, NI_GPCT_INDEX_PHASE_HIGH_A_LOW_B_BITS = - 0x2 << NI_GPCT_INDEX_PHASE_BITSHIFT, + 0x2 << NI_GPCT_INDEX_PHASE_BITSHIFT, NI_GPCT_INDEX_PHASE_HIGH_A_HIGH_B_BITS = - 0x3 << NI_GPCT_INDEX_PHASE_BITSHIFT, + 0x3 << NI_GPCT_INDEX_PHASE_BITSHIFT, NI_GPCT_INDEX_ENABLE_BIT = 0x400000, NI_GPCT_COUNTING_DIRECTION_MASK = - 0x3 << NI_GPCT_COUNTING_DIRECTION_SHIFT, + 0x3 << NI_GPCT_COUNTING_DIRECTION_SHIFT, NI_GPCT_COUNTING_DIRECTION_DOWN_BITS = - 0x00 << NI_GPCT_COUNTING_DIRECTION_SHIFT, + 0x00 << NI_GPCT_COUNTING_DIRECTION_SHIFT, NI_GPCT_COUNTING_DIRECTION_UP_BITS = - 0x1 << NI_GPCT_COUNTING_DIRECTION_SHIFT, + 0x1 << NI_GPCT_COUNTING_DIRECTION_SHIFT, NI_GPCT_COUNTING_DIRECTION_HW_UP_DOWN_BITS = - 0x2 << NI_GPCT_COUNTING_DIRECTION_SHIFT, + 0x2 << NI_GPCT_COUNTING_DIRECTION_SHIFT, NI_GPCT_COUNTING_DIRECTION_HW_GATE_BITS = - 0x3 << NI_GPCT_COUNTING_DIRECTION_SHIFT, + 0x3 << NI_GPCT_COUNTING_DIRECTION_SHIFT, NI_GPCT_RELOAD_SOURCE_MASK = 0xc000000, NI_GPCT_RELOAD_SOURCE_FIXED_BITS = 0x0, NI_GPCT_RELOAD_SOURCE_SWITCHING_BITS = 0x4000000, @@ -1469,7 +1468,7 @@ enum amplc_dio_clock_source { /* the following are "enhanced" clock sources for PCIe models */ AMPLC_DIO_CLK_VCC, /* clock input HIGH */ AMPLC_DIO_CLK_GND, /* clock input LOW */ - AMPLC_DIO_CLK_PAT_PRESENT, /* "pattern present" signal */ + AMPLC_DIO_CLK_PAT_PRESENT, /* "pattern present" signal */ AMPLC_DIO_CLK_20MHZ /* 20 MHz internal clock */ }; @@ -1503,14 +1502,14 @@ enum amplc_dio_gate_source { AMPLC_DIO_GAT_RESERVED6, AMPLC_DIO_GAT_RESERVED7, /* the following are "enhanced" gate sources for PCIe models */ - AMPLC_DIO_GAT_NGATN = 6, /* negated per channel gate input */ + AMPLC_DIO_GAT_NGATN = 6, /* negated per channel gate input */ /* non-negated output of counter channel minus 2 */ AMPLC_DIO_GAT_OUTNM2, - AMPLC_DIO_GAT_PAT_PRESENT, /* "pattern present" signal */ - AMPLC_DIO_GAT_PAT_OCCURRED, /* "pattern occurred" latched */ + AMPLC_DIO_GAT_PAT_PRESENT, /* "pattern present" signal */ + AMPLC_DIO_GAT_PAT_OCCURRED, /* "pattern occurred" latched */ AMPLC_DIO_GAT_PAT_GONE, /* "pattern gone away" latched */ - AMPLC_DIO_GAT_NPAT_PRESENT, /* negated "pattern present" */ - AMPLC_DIO_GAT_NPAT_OCCURRED, /* negated "pattern occurred" */ + AMPLC_DIO_GAT_NPAT_PRESENT, /* negated "pattern present" */ + AMPLC_DIO_GAT_NPAT_OCCURRED, /* negated "pattern occurred" */ AMPLC_DIO_GAT_NPAT_GONE /* negated "pattern gone away" */ }; @@ -1520,9 +1519,9 @@ enum amplc_dio_gate_source { * (ke_counter driver). */ enum ke_counter_clock_source { - KE_CLK_20MHZ, /* internal 20MHz (default) */ - KE_CLK_4MHZ, /* internal 4MHz (option) */ - KE_CLK_EXT /* external clock on pin 21 of D-Sub */ + KE_CLK_20MHZ, /* internal 20MHz (default) */ + KE_CLK_4MHZ, /* internal 4MHz (option) */ + KE_CLK_EXT /* external clock on pin 21 of D-Sub */ }; #endif /* _COMEDI_H */ diff --git a/drivers/comedi/comedi_buf.c b/drivers/comedi/comedi_buf.c index 06bfc859ab31..281d7efcf7d3 100644 --- a/drivers/comedi/comedi_buf.c +++ b/drivers/comedi/comedi_buf.c @@ -22,7 +22,7 @@ static void comedi_buf_map_kref_release(struct kref *kref) { struct comedi_buf_map *bm = - container_of(kref, struct comedi_buf_map, refcount); + container_of(kref, struct comedi_buf_map, refcount); struct comedi_buf_page *buf; unsigned int i; @@ -71,9 +71,10 @@ static void __comedi_buf_free(struct comedi_device *dev, comedi_buf_map_put(bm); } -static struct comedi_buf_map * -comedi_buf_map_alloc(struct comedi_device *dev, enum dma_data_direction dma_dir, - unsigned int n_pages) +static struct comedi_buf_map *comedi_buf_map_alloc(struct comedi_device *dev, + enum dma_data_direction + dma_dir, + unsigned int n_pages) { struct comedi_buf_map *bm; struct comedi_buf_page *buf; @@ -138,8 +139,7 @@ comedi_buf_map_alloc(struct comedi_device *dev, enum dma_data_direction dma_dir, } static void __comedi_buf_alloc(struct comedi_device *dev, - struct comedi_subdevice *s, - unsigned int n_pages) + struct comedi_subdevice *s, unsigned int n_pages) { struct comedi_async *async = s->async; struct page **pages = NULL; @@ -225,8 +225,8 @@ int comedi_buf_map_access(struct comedi_buf_map *bm, unsigned long offset, } /* returns s->async->buf_map and increments its kref refcount */ -struct comedi_buf_map * -comedi_buf_map_from_subdev_get(struct comedi_subdevice *s) +struct comedi_buf_map *comedi_buf_map_from_subdev_get(struct comedi_subdevice + *s) { struct comedi_async *async = s->async; struct comedi_buf_map *bm = NULL; @@ -356,6 +356,7 @@ unsigned int comedi_buf_write_alloc(struct comedi_subdevice *s, return nbytes; } + EXPORT_SYMBOL_GPL(comedi_buf_write_alloc); /* @@ -444,6 +445,7 @@ unsigned int comedi_buf_write_free(struct comedi_subdevice *s, return nbytes; } + EXPORT_SYMBOL_GPL(comedi_buf_write_free); /** @@ -475,6 +477,7 @@ unsigned int comedi_buf_read_n_available(struct comedi_subdevice *s) return num_bytes; } + EXPORT_SYMBOL_GPL(comedi_buf_read_n_available); /** @@ -512,6 +515,7 @@ unsigned int comedi_buf_read_alloc(struct comedi_subdevice *s, return nbytes; } + EXPORT_SYMBOL_GPL(comedi_buf_read_alloc); static unsigned int comedi_buf_read_n_allocated(struct comedi_async *async) @@ -553,6 +557,7 @@ unsigned int comedi_buf_read_free(struct comedi_subdevice *s, async->buf_read_ptr %= async->prealloc_bufsz; return nbytes; } + EXPORT_SYMBOL_GPL(comedi_buf_read_free); static void comedi_buf_memcpy_to(struct comedi_subdevice *s, @@ -649,6 +654,7 @@ unsigned int comedi_buf_write_samples(struct comedi_subdevice *s, return nbytes; } + EXPORT_SYMBOL_GPL(comedi_buf_write_samples); /** @@ -680,8 +686,7 @@ unsigned int comedi_buf_read_samples(struct comedi_subdevice *s, if (nsamples == 0) return 0; - nbytes = comedi_buf_read_alloc(s, - comedi_samples_to_bytes(s, nsamples)); + nbytes = comedi_buf_read_alloc(s, comedi_samples_to_bytes(s, nsamples)); comedi_buf_memcpy_from(s, data, nbytes); comedi_buf_read_free(s, nbytes); comedi_inc_scan_progress(s, nbytes); @@ -689,4 +694,5 @@ unsigned int comedi_buf_read_samples(struct comedi_subdevice *s, return nbytes; } + EXPORT_SYMBOL_GPL(comedi_buf_read_samples); diff --git a/drivers/comedi/comedi_fops.c b/drivers/comedi/comedi_fops.c index df77b6bf5c64..9a78e11c1c1e 100644 --- a/drivers/comedi/comedi_fops.c +++ b/drivers/comedi/comedi_fops.c @@ -72,8 +72,7 @@ struct comedi_file { static unsigned short comedi_num_legacy_minors; module_param(comedi_num_legacy_minors, ushort, 0444); MODULE_PARM_DESC(comedi_num_legacy_minors, - "number of comedi minor devices to reserve for non-auto-configured devices (default 0)" - ); + "number of comedi minor devices to reserve for non-auto-configured devices (default 0)"); unsigned int comedi_default_buf_size_kb = CONFIG_COMEDI_DEFAULT_BUF_SIZE_KB; module_param(comedi_default_buf_size_kb, uint, 0644); @@ -82,7 +81,7 @@ MODULE_PARM_DESC(comedi_default_buf_size_kb, __MODULE_STRING(CONFIG_COMEDI_DEFAULT_BUF_SIZE_KB) ")"); unsigned int comedi_default_buf_maxsize_kb = - CONFIG_COMEDI_DEFAULT_BUF_MAXSIZE_KB; + CONFIG_COMEDI_DEFAULT_BUF_MAXSIZE_KB; module_param(comedi_default_buf_maxsize_kb, uint, 0644); MODULE_PARM_DESC(comedi_default_buf_maxsize_kb, "default maximum size of asynchronous buffer in KiB (default " @@ -112,7 +111,7 @@ static void comedi_device_init(struct comedi_device *dev) static void comedi_dev_kref_release(struct kref *kref) { struct comedi_device *dev = - container_of(kref, struct comedi_device, refcount); + container_of(kref, struct comedi_device, refcount); mutex_destroy(&dev->mutex); put_device(dev->class_dev); @@ -137,6 +136,7 @@ int comedi_dev_put(struct comedi_device *dev) return kref_put(&dev->refcount, comedi_dev_kref_release); return 1; } + EXPORT_SYMBOL_GPL(comedi_dev_put); static struct comedi_device *comedi_dev_get(struct comedi_device *dev) @@ -199,8 +199,9 @@ static void comedi_free_board_dev(struct comedi_device *dev) } } -static struct comedi_subdevice * -comedi_subdevice_from_minor(const struct comedi_device *dev, unsigned int minor) +static struct comedi_subdevice *comedi_subdevice_from_minor(const struct + comedi_device * dev, + unsigned int minor) { struct comedi_subdevice *s; unsigned int i = minor - COMEDI_NUM_BOARD_MINORS; @@ -223,8 +224,8 @@ static struct comedi_device *comedi_dev_get_from_board_minor(unsigned int minor) return dev; } -static struct comedi_device * -comedi_dev_get_from_subdevice_minor(unsigned int minor) +static struct comedi_device *comedi_dev_get_from_subdevice_minor(unsigned int + minor) { struct comedi_device *dev; struct comedi_subdevice *s; @@ -256,10 +257,11 @@ struct comedi_device *comedi_dev_get_from_minor(unsigned int minor) return comedi_dev_get_from_subdevice_minor(minor); } + EXPORT_SYMBOL_GPL(comedi_dev_get_from_minor); -static struct comedi_subdevice * -comedi_read_subdevice(const struct comedi_device *dev, unsigned int minor) +static struct comedi_subdevice *comedi_read_subdevice(const struct comedi_device + *dev, unsigned int minor) { struct comedi_subdevice *s; @@ -272,8 +274,9 @@ comedi_read_subdevice(const struct comedi_device *dev, unsigned int minor) return dev->read_subdev; } -static struct comedi_subdevice * -comedi_write_subdevice(const struct comedi_device *dev, unsigned int minor) +static struct comedi_subdevice *comedi_write_subdevice(const struct + comedi_device * dev, + unsigned int minor) { struct comedi_subdevice *s; @@ -431,6 +434,7 @@ static ssize_t max_read_buffer_kb_store(struct device *csdev, comedi_dev_put(dev); return err ? err : count; } + static DEVICE_ATTR_RW(max_read_buffer_kb); static ssize_t read_buffer_kb_show(struct device *csdev, @@ -487,6 +491,7 @@ static ssize_t read_buffer_kb_store(struct device *csdev, comedi_dev_put(dev); return err ? err : count; } + static DEVICE_ATTR_RW(read_buffer_kb); static ssize_t max_write_buffer_kb_show(struct device *csdev, @@ -544,6 +549,7 @@ static ssize_t max_write_buffer_kb_store(struct device *csdev, comedi_dev_put(dev); return err ? err : count; } + static DEVICE_ATTR_RW(max_write_buffer_kb); static ssize_t write_buffer_kb_show(struct device *csdev, @@ -600,6 +606,7 @@ static ssize_t write_buffer_kb_store(struct device *csdev, comedi_dev_put(dev); return err ? err : count; } + static DEVICE_ATTR_RW(write_buffer_kb); static struct attribute *comedi_dev_attrs[] = { @@ -609,6 +616,7 @@ static struct attribute *comedi_dev_attrs[] = { &dev_attr_write_buffer_kb.attr, NULL, }; + ATTRIBUTE_GROUPS(comedi_dev); static void __comedi_clear_subdevice_runflags(struct comedi_subdevice *s, @@ -674,6 +682,7 @@ bool comedi_is_subdevice_running(struct comedi_subdevice *s) return comedi_is_runflags_running(runflags); } + EXPORT_SYMBOL_GPL(comedi_is_subdevice_running); static bool __comedi_is_subdevice_running(struct comedi_subdevice *s) @@ -702,6 +711,7 @@ void comedi_set_spriv_auto_free(struct comedi_subdevice *s) { __comedi_set_subdevice_runflags(s, COMEDI_SRF_FREE_SPRIV); } + EXPORT_SYMBOL_GPL(comedi_set_spriv_auto_free); /** @@ -723,6 +733,7 @@ void *comedi_alloc_spriv(struct comedi_subdevice *s, size_t size) comedi_set_spriv_auto_free(s); return s->private; } + EXPORT_SYMBOL_GPL(comedi_alloc_spriv); /* @@ -812,7 +823,7 @@ static int is_device_busy(struct comedi_device *dev) * nothing */ static int do_devconfig_ioctl(struct comedi_device *dev, - struct comedi_devconfig __user *arg) + struct comedi_devconfig __user *arg) { struct comedi_devconfig it; @@ -865,7 +876,7 @@ static int do_devconfig_ioctl(struct comedi_device *dev, * modified comedi_bufconfig structure */ static int do_bufconfig_ioctl(struct comedi_device *dev, - struct comedi_bufconfig __user *arg) + struct comedi_bufconfig __user *arg) { struct comedi_bufconfig bc; struct comedi_async *async; @@ -927,7 +938,7 @@ static int do_bufconfig_ioctl(struct comedi_device *dev, * comedi_devinfo structure */ static int do_devinfo_ioctl(struct comedi_device *dev, - struct comedi_devinfo __user *arg, + struct comedi_devinfo __user *arg, struct file *file) { struct comedi_subdevice *s; @@ -974,7 +985,7 @@ static int do_devinfo_ioctl(struct comedi_device *dev, * array of comedi_subdinfo structures */ static int do_subdinfo_ioctl(struct comedi_device *dev, - struct comedi_subdinfo __user *arg, void *file) + struct comedi_subdinfo __user *arg, void *file) { int ret, i; struct comedi_subdinfo *tmp, *us; @@ -1078,7 +1089,8 @@ static int do_chaninfo_ioctl(struct comedi_device *dev, for (i = 0; i < s->n_chan; i++) { int x; - x = (dev->minor << 28) | (it->subdev << 24) | (i << 16) | + x = (dev->minor << 28) | (it-> + subdev << 24) | (i << 16) | (s->range_table_list[i]->length); if (put_user(x, it->rangelist + i)) return -EFAULT; @@ -1102,7 +1114,7 @@ static int do_chaninfo_ioctl(struct comedi_device *dev, * modified comedi_bufinfo structure */ static int do_bufinfo_ioctl(struct comedi_device *dev, - struct comedi_bufinfo __user *arg, void *file) + struct comedi_bufinfo __user *arg, void *file) { struct comedi_bufinfo bi; struct comedi_subdevice *s; @@ -1240,8 +1252,9 @@ static int check_insn_config_length(struct comedi_insn *insn, * all possible cases yet */ default: - pr_warn("No check for data length of config insn id %i is implemented\n", - data[0]); + pr_warn + ("No check for data length of config insn id %i is implemented\n", + data[0]); pr_warn("Add a check to %s in %s\n", __func__, __FILE__); pr_warn("Assuming n=%i is correct\n", insn->n); return 0; @@ -1521,8 +1534,7 @@ static int parse_insn(struct comedi_device *dev, struct comedi_insn *insn, #define MAX_SAMPLES 65536 static int do_insnlist_ioctl(struct comedi_device *dev, struct comedi_insn *insns, - unsigned int n_insns, - void *file) + unsigned int n_insns, void *file) { unsigned int *data = NULL; unsigned int max_n_data_required = MIN_SAMPLES; @@ -1634,8 +1646,7 @@ static int do_insn_ioctl(struct comedi_device *dev, goto error; if (insn->insn & INSN_MASK_READ) { if (copy_to_user(insn->data, - data, - insn->n * sizeof(unsigned int))) { + data, insn->n * sizeof(unsigned int))) { ret = -EFAULT; goto error; } @@ -1701,7 +1712,7 @@ static int __comedi_get_user_cmd(struct comedi_device *dev, static int __comedi_get_user_chanlist(struct comedi_device *dev, struct comedi_subdevice *s, - unsigned int __user *user_chanlist, + unsigned int __user *user_chanlist, struct comedi_cmd *cmd) { unsigned int *chanlist; @@ -2131,8 +2142,7 @@ static long comedi_unlocked_ioctl(struct file *file, unsigned int cmd, rc = do_devconfig_ioctl(dev, (struct comedi_devconfig __user *)arg); if (rc == 0) { - if (arg == 0 && - dev->minor >= comedi_num_legacy_minors) { + if (arg == 0 && dev->minor >= comedi_num_legacy_minors) { /* * Successfully unconfigured a dynamically * allocated device. Try and remove it. @@ -2167,24 +2177,24 @@ static long comedi_unlocked_ioctl(struct file *file, unsigned int cmd, (struct comedi_subdinfo __user *)arg, file); break; - case COMEDI_CHANINFO: { - struct comedi_chaninfo it; + case COMEDI_CHANINFO:{ + struct comedi_chaninfo it; - if (copy_from_user(&it, (void __user *)arg, sizeof(it))) - rc = -EFAULT; - else - rc = do_chaninfo_ioctl(dev, &it); - break; - } - case COMEDI_RANGEINFO: { - struct comedi_rangeinfo it; + if (copy_from_user(&it, (void __user *)arg, sizeof(it))) + rc = -EFAULT; + else + rc = do_chaninfo_ioctl(dev, &it); + break; + } + case COMEDI_RANGEINFO:{ + struct comedi_rangeinfo it; - if (copy_from_user(&it, (void __user *)arg, sizeof(it))) - rc = -EFAULT; - else - rc = do_rangeinfo_ioctl(dev, &it); - break; - } + if (copy_from_user(&it, (void __user *)arg, sizeof(it))) + rc = -EFAULT; + else + rc = do_rangeinfo_ioctl(dev, &it); + break; + } case COMEDI_BUFINFO: rc = do_bufinfo_ioctl(dev, (struct comedi_bufinfo __user *)arg, @@ -2199,65 +2209,75 @@ static long comedi_unlocked_ioctl(struct file *file, unsigned int cmd, case COMEDI_CANCEL: rc = do_cancel_ioctl(dev, arg, file); break; - case COMEDI_CMD: { - struct comedi_cmd cmd; - bool copy = false; + case COMEDI_CMD:{ + struct comedi_cmd cmd; + bool copy = false; - if (copy_from_user(&cmd, (void __user *)arg, sizeof(cmd))) { - rc = -EFAULT; + if (copy_from_user + (&cmd, (void __user *)arg, sizeof(cmd))) { + rc = -EFAULT; + break; + } + rc = do_cmd_ioctl(dev, &cmd, ©, file); + if (copy + && copy_to_user((void __user *)arg, &cmd, + sizeof(cmd))) + rc = -EFAULT; break; } - rc = do_cmd_ioctl(dev, &cmd, ©, file); - if (copy && copy_to_user((void __user *)arg, &cmd, sizeof(cmd))) - rc = -EFAULT; - break; - } - case COMEDI_CMDTEST: { - struct comedi_cmd cmd; - bool copy = false; + case COMEDI_CMDTEST:{ + struct comedi_cmd cmd; + bool copy = false; - if (copy_from_user(&cmd, (void __user *)arg, sizeof(cmd))) { - rc = -EFAULT; + if (copy_from_user + (&cmd, (void __user *)arg, sizeof(cmd))) { + rc = -EFAULT; + break; + } + rc = do_cmdtest_ioctl(dev, &cmd, ©, file); + if (copy + && copy_to_user((void __user *)arg, &cmd, + sizeof(cmd))) + rc = -EFAULT; break; } - rc = do_cmdtest_ioctl(dev, &cmd, ©, file); - if (copy && copy_to_user((void __user *)arg, &cmd, sizeof(cmd))) - rc = -EFAULT; - break; - } - case COMEDI_INSNLIST: { - struct comedi_insnlist insnlist; - struct comedi_insn *insns = NULL; + case COMEDI_INSNLIST:{ + struct comedi_insnlist insnlist; + struct comedi_insn *insns = NULL; - if (copy_from_user(&insnlist, (void __user *)arg, - sizeof(insnlist))) { - rc = -EFAULT; - break; - } - insns = kcalloc(insnlist.n_insns, sizeof(*insns), GFP_KERNEL); - if (!insns) { - rc = -ENOMEM; + if (copy_from_user(&insnlist, (void __user *)arg, + sizeof(insnlist))) { + rc = -EFAULT; + break; + } + insns = + kcalloc(insnlist.n_insns, sizeof(*insns), + GFP_KERNEL); + if (!insns) { + rc = -ENOMEM; + break; + } + if (copy_from_user(insns, insnlist.insns, + sizeof(*insns) * insnlist.n_insns)) { + rc = -EFAULT; + kfree(insns); + break; + } + rc = do_insnlist_ioctl(dev, insns, insnlist.n_insns, + file); + kfree(insns); break; } - if (copy_from_user(insns, insnlist.insns, - sizeof(*insns) * insnlist.n_insns)) { - rc = -EFAULT; - kfree(insns); + case COMEDI_INSN:{ + struct comedi_insn insn; + + if (copy_from_user + (&insn, (void __user *)arg, sizeof(insn))) + rc = -EFAULT; + else + rc = do_insn_ioctl(dev, &insn, file); break; } - rc = do_insnlist_ioctl(dev, insns, insnlist.n_insns, file); - kfree(insns); - break; - } - case COMEDI_INSN: { - struct comedi_insn insn; - - if (copy_from_user(&insn, (void __user *)arg, sizeof(insn))) - rc = -EFAULT; - else - rc = do_insn_ioctl(dev, &insn, file); - break; - } case COMEDI_POLL: rc = do_poll_ioctl(dev, arg, file); break; @@ -2417,7 +2437,7 @@ static int comedi_mmap(struct file *file, struct vm_area_struct *vma) return retval; } -static __poll_t comedi_poll(struct file *file, poll_table *wait) +static __poll_t comedi_poll(struct file *file, poll_table *wait) { __poll_t mask = 0; struct comedi_file *cfp = file->private_data; @@ -2458,8 +2478,8 @@ static __poll_t comedi_poll(struct file *file, poll_table *wait) return mask; } -static ssize_t comedi_write(struct file *file, const char __user *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; @@ -2529,8 +2549,7 @@ static ssize_t comedi_write(struct file *file, const char __user *buf, retval = -ERESTARTSYS; break; } - if (s->busy != file || - !(async->cmd.flags & CMDF_WRITE)) { + if (s->busy != file || !(async->cmd.flags & CMDF_WRITE)) { retval = -EINVAL; break; } @@ -2594,8 +2613,8 @@ static ssize_t comedi_write(struct file *file, const char __user *buf, return count ? count : retval; } -static ssize_t comedi_read(struct file *file, char __user *buf, size_t nbytes, - loff_t *offset) +static ssize_t comedi_read(struct file *file, char __user *buf, size_t nbytes, + loff_t *offset) { struct comedi_subdevice *s; struct comedi_async *async; @@ -2643,7 +2662,7 @@ static ssize_t comedi_read(struct file *file, char __user *buf, size_t nbytes, if (n == 0) { unsigned int runflags = - comedi_get_subdevice_runflags(s); + comedi_get_subdevice_runflags(s); if (!comedi_is_runflags_running(runflags)) { if (comedi_is_runflags_in_error(runflags)) @@ -2663,8 +2682,7 @@ static ssize_t comedi_read(struct file *file, char __user *buf, size_t nbytes, retval = -ERESTARTSYS; break; } - if (s->busy != file || - (async->cmd.flags & CMDF_WRITE)) { + if (s->busy != file || (async->cmd.flags & CMDF_WRITE)) { retval = -EINVAL; break; } @@ -2937,7 +2955,7 @@ static int compat_rangeinfo(struct file *file, unsigned long arg) /* Copy 32-bit cmd structure to native cmd structure. */ static int get_compat_cmd(struct comedi_cmd *cmd, - struct comedi32_cmd_struct __user *cmd32) + struct comedi32_cmd_struct __user *cmd32) { struct comedi32_cmd_struct v32; @@ -2964,7 +2982,7 @@ static int get_compat_cmd(struct comedi_cmd *cmd, } /* Copy native cmd structure to 32-bit cmd structure. */ -static int put_compat_cmd(struct comedi32_cmd_struct __user *cmd32, +static int put_compat_cmd(struct comedi32_cmd_struct __user *cmd32, struct comedi_cmd *cmd) { struct comedi32_cmd_struct v32; @@ -3043,7 +3061,7 @@ static int compat_cmdtest(struct file *file, unsigned long arg) /* Copy 32-bit insn structure to native insn structure. */ static int get_compat_insn(struct comedi_insn *insn, - struct comedi32_insn_struct __user *insn32) + struct comedi32_insn_struct __user *insn32) { struct comedi32_insn_struct v32; @@ -3116,7 +3134,8 @@ static int compat_insn(struct file *file, unsigned long arg) * * Returns -ENOIOCTLCMD for unrecognised ioctl codes. */ -static long comedi_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +static long comedi_compat_ioctl(struct file *file, unsigned int cmd, + unsigned long arg) { int rc; @@ -3228,6 +3247,7 @@ void comedi_event(struct comedi_device *dev, struct comedi_subdevice *s) if (si_code) kill_fasync(&dev->async_queue, SIGIO, si_code); } + EXPORT_SYMBOL_GPL(comedi_event); /* Note: the ->mutex is pre-locked on successful return */ @@ -3325,8 +3345,7 @@ void comedi_free_subdevice_minor(struct comedi_subdevice *s) if (!s) return; - if (s->minor < COMEDI_NUM_BOARD_MINORS || - s->minor >= COMEDI_NUM_MINORS) + if (s->minor < COMEDI_NUM_BOARD_MINORS || s->minor >= COMEDI_NUM_MINORS) return; i = s->minor - COMEDI_NUM_BOARD_MINORS; @@ -3359,8 +3378,9 @@ static int __init comedi_init(void) pr_info("version " COMEDI_RELEASE " - http://www.comedi.org\n"); if (comedi_num_legacy_minors > COMEDI_NUM_BOARD_MINORS) { - pr_err("invalid value for module parameter \"comedi_num_legacy_minors\". Valid values are 0 through %i.\n", - COMEDI_NUM_BOARD_MINORS); + pr_err + ("invalid value for module parameter \"comedi_num_legacy_minors\". Valid values are 0 through %i.\n", + COMEDI_NUM_BOARD_MINORS); return -EINVAL; } @@ -3418,6 +3438,7 @@ static int __init comedi_init(void) unregister_chrdev_region(MKDEV(COMEDI_MAJOR, 0), COMEDI_NUM_MINORS); return retval; } + module_init(comedi_init); static void __exit comedi_cleanup(void) @@ -3429,6 +3450,7 @@ static void __exit comedi_cleanup(void) comedi_proc_cleanup(); } + module_exit(comedi_cleanup); MODULE_AUTHOR("https://www.comedi.org"); diff --git a/drivers/comedi/comedi_internal.h b/drivers/comedi/comedi_internal.h index 9b3631a654c8..2e6c3f22462a 100644 --- a/drivers/comedi/comedi_internal.h +++ b/drivers/comedi/comedi_internal.h @@ -17,8 +17,7 @@ struct comedi_rangeinfo; struct comedi_subdevice; struct device; -int do_rangeinfo_ioctl(struct comedi_device *dev, - struct comedi_rangeinfo *it); +int do_rangeinfo_ioctl(struct comedi_device *dev, struct comedi_rangeinfo *it); struct comedi_device *comedi_alloc_board_minor(struct device *hardware_device); void comedi_release_hardware_device(struct device *hardware_device); int comedi_alloc_subdevice_minor(struct comedi_subdevice *s); @@ -32,8 +31,8 @@ void comedi_buf_map_get(struct comedi_buf_map *bm); int comedi_buf_map_put(struct comedi_buf_map *bm); int comedi_buf_map_access(struct comedi_buf_map *bm, unsigned long offset, void *buf, int len, int write); -struct comedi_buf_map * -comedi_buf_map_from_subdev_get(struct comedi_subdevice *s); +struct comedi_buf_map *comedi_buf_map_from_subdev_get(struct comedi_subdevice + *s); unsigned int comedi_buf_write_n_available(struct comedi_subdevice *s); unsigned int comedi_buf_write_n_allocated(struct comedi_subdevice *s); void comedi_device_cancel_all(struct comedi_device *dev); diff --git a/drivers/comedi/comedi_pci.c b/drivers/comedi/comedi_pci.c index 54739af7eb71..df148e8a2d28 100644 --- a/drivers/comedi/comedi_pci.c +++ b/drivers/comedi/comedi_pci.c @@ -26,6 +26,7 @@ struct pci_dev *comedi_to_pci_dev(struct comedi_device *dev) { return dev->hw_dev ? to_pci_dev(dev->hw_dev) : NULL; } + EXPORT_SYMBOL_GPL(comedi_to_pci_dev); /** @@ -66,6 +67,7 @@ int comedi_pci_enable(struct comedi_device *dev) return rc; } + EXPORT_SYMBOL_GPL(comedi_pci_enable); /** @@ -87,6 +89,7 @@ void comedi_pci_disable(struct comedi_device *dev) } dev->ioenabled = false; } + EXPORT_SYMBOL_GPL(comedi_pci_disable); /** @@ -120,6 +123,7 @@ void comedi_pci_detach(struct comedi_device *dev) } comedi_pci_disable(dev); } + EXPORT_SYMBOL_GPL(comedi_pci_detach); /** @@ -138,11 +142,11 @@ EXPORT_SYMBOL_GPL(comedi_pci_detach); * a negative error number on failure). */ int comedi_pci_auto_config(struct pci_dev *pcidev, - struct comedi_driver *driver, - unsigned long context) + struct comedi_driver *driver, unsigned long context) { return comedi_auto_config(&pcidev->dev, driver, context); } + EXPORT_SYMBOL_GPL(comedi_pci_auto_config); /** @@ -163,6 +167,7 @@ void comedi_pci_auto_unconfig(struct pci_dev *pcidev) { comedi_auto_unconfig(&pcidev->dev); } + EXPORT_SYMBOL_GPL(comedi_pci_auto_unconfig); /** @@ -193,6 +198,7 @@ int comedi_pci_driver_register(struct comedi_driver *comedi_driver, return 0; } + EXPORT_SYMBOL_GPL(comedi_pci_driver_register); /** @@ -210,17 +216,20 @@ void comedi_pci_driver_unregister(struct comedi_driver *comedi_driver, pci_unregister_driver(pci_driver); comedi_driver_unregister(comedi_driver); } + EXPORT_SYMBOL_GPL(comedi_pci_driver_unregister); static int __init comedi_pci_init(void) { return 0; } + module_init(comedi_pci_init); static void __exit comedi_pci_exit(void) { } + module_exit(comedi_pci_exit); MODULE_AUTHOR("https://www.comedi.org"); diff --git a/drivers/comedi/comedi_pcmcia.c b/drivers/comedi/comedi_pcmcia.c index bb273bb202e6..442dbf9422b1 100644 --- a/drivers/comedi/comedi_pcmcia.c +++ b/drivers/comedi/comedi_pcmcia.c @@ -26,10 +26,10 @@ struct pcmcia_device *comedi_to_pcmcia_dev(struct comedi_device *dev) { return dev->hw_dev ? to_pcmcia_dev(dev->hw_dev) : NULL; } + EXPORT_SYMBOL_GPL(comedi_to_pcmcia_dev); -static int comedi_pcmcia_conf_check(struct pcmcia_device *link, - void *priv_data) +static int comedi_pcmcia_conf_check(struct pcmcia_device *link, void *priv_data) { if (link->config_index == 0) return -EINVAL; @@ -69,7 +69,7 @@ static int comedi_pcmcia_conf_check(struct pcmcia_device *link, * or a negative error number from pcmcia_enable_device() if it fails. */ int comedi_pcmcia_enable(struct comedi_device *dev, - int (*conf_check)(struct pcmcia_device *p_dev, + int (*conf_check)(struct pcmcia_device *p_dev, void *priv_data)) { struct pcmcia_device *link = comedi_to_pcmcia_dev(dev); @@ -87,6 +87,7 @@ int comedi_pcmcia_enable(struct comedi_device *dev, return pcmcia_enable_device(link); } + EXPORT_SYMBOL_GPL(comedi_pcmcia_enable); /** @@ -104,6 +105,7 @@ void comedi_pcmcia_disable(struct comedi_device *dev) if (link) pcmcia_disable_device(link); } + EXPORT_SYMBOL_GPL(comedi_pcmcia_disable); /** @@ -124,6 +126,7 @@ int comedi_pcmcia_auto_config(struct pcmcia_device *link, { return comedi_auto_config(&link->dev, driver, 0); } + EXPORT_SYMBOL_GPL(comedi_pcmcia_auto_config); /** @@ -144,6 +147,7 @@ void comedi_pcmcia_auto_unconfig(struct pcmcia_device *link) { comedi_auto_unconfig(&link->dev); } + EXPORT_SYMBOL_GPL(comedi_pcmcia_auto_unconfig); /** @@ -174,6 +178,7 @@ int comedi_pcmcia_driver_register(struct comedi_driver *comedi_driver, return 0; } + EXPORT_SYMBOL_GPL(comedi_pcmcia_driver_register); /** @@ -191,17 +196,20 @@ void comedi_pcmcia_driver_unregister(struct comedi_driver *comedi_driver, pcmcia_unregister_driver(pcmcia_driver); comedi_driver_unregister(comedi_driver); } + EXPORT_SYMBOL_GPL(comedi_pcmcia_driver_unregister); static int __init comedi_pcmcia_init(void) { return 0; } + module_init(comedi_pcmcia_init); static void __exit comedi_pcmcia_exit(void) { } + module_exit(comedi_pcmcia_exit); MODULE_AUTHOR("https://www.comedi.org"); diff --git a/drivers/comedi/comedi_pcmcia.h b/drivers/comedi/comedi_pcmcia.h index f2f6e779645b..ec138a2e3d70 100644 --- a/drivers/comedi/comedi_pcmcia.h +++ b/drivers/comedi/comedi_pcmcia.h @@ -18,7 +18,7 @@ struct pcmcia_device *comedi_to_pcmcia_dev(struct comedi_device *dev); int comedi_pcmcia_enable(struct comedi_device *dev, - int (*conf_check)(struct pcmcia_device *p_dev, + int (*conf_check)(struct pcmcia_device *p_dev, void *priv_data)); void comedi_pcmcia_disable(struct comedi_device *dev); diff --git a/drivers/comedi/comedi_usb.c b/drivers/comedi/comedi_usb.c index eea8ebf32ed0..a71ebdb35150 100644 --- a/drivers/comedi/comedi_usb.c +++ b/drivers/comedi/comedi_usb.c @@ -25,6 +25,7 @@ struct usb_interface *comedi_to_usb_interface(struct comedi_device *dev) { return dev->hw_dev ? to_usb_interface(dev->hw_dev) : NULL; } + EXPORT_SYMBOL_GPL(comedi_to_usb_interface); /** @@ -43,6 +44,7 @@ struct usb_device *comedi_to_usb_dev(struct comedi_device *dev) return intf ? interface_to_usbdev(intf) : NULL; } + EXPORT_SYMBOL_GPL(comedi_to_usb_dev); /** @@ -61,11 +63,11 @@ EXPORT_SYMBOL_GPL(comedi_to_usb_dev); * a negative error number on failure). */ int comedi_usb_auto_config(struct usb_interface *intf, - struct comedi_driver *driver, - unsigned long context) + struct comedi_driver *driver, unsigned long context) { return comedi_auto_config(&intf->dev, driver, context); } + EXPORT_SYMBOL_GPL(comedi_usb_auto_config); /** @@ -86,6 +88,7 @@ void comedi_usb_auto_unconfig(struct usb_interface *intf) { comedi_auto_unconfig(&intf->dev); } + EXPORT_SYMBOL_GPL(comedi_usb_auto_unconfig); /** @@ -116,6 +119,7 @@ int comedi_usb_driver_register(struct comedi_driver *comedi_driver, return 0; } + EXPORT_SYMBOL_GPL(comedi_usb_driver_register); /** @@ -133,17 +137,20 @@ void comedi_usb_driver_unregister(struct comedi_driver *comedi_driver, usb_deregister(usb_driver); comedi_driver_unregister(comedi_driver); } + EXPORT_SYMBOL_GPL(comedi_usb_driver_unregister); static int __init comedi_usb_init(void) { return 0; } + module_init(comedi_usb_init); static void __exit comedi_usb_exit(void) { } + module_exit(comedi_usb_exit); MODULE_AUTHOR("https://www.comedi.org"); diff --git a/drivers/comedi/comedidev.h b/drivers/comedi/comedidev.h index 0e1b95ef9a4d..63e877414818 100644 --- a/drivers/comedi/comedidev.h +++ b/drivers/comedi/comedidev.h @@ -177,29 +177,30 @@ struct comedi_subdevice { unsigned int *chanlist; /* driver-owned chanlist (not used) */ - int (*insn_read)(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); - int (*insn_write)(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); - int (*insn_bits)(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); - int (*insn_config)(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data); - - int (*do_cmd)(struct comedi_device *dev, struct comedi_subdevice *s); - int (*do_cmdtest)(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_cmd *cmd); - int (*poll)(struct comedi_device *dev, struct comedi_subdevice *s); - int (*cancel)(struct comedi_device *dev, struct comedi_subdevice *s); + int (*insn_read)(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, + unsigned int *data); + int (*insn_write)(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data); + int (*insn_bits)(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_insn *insn, + unsigned int *data); + int (*insn_config)(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data); + + int (*do_cmd)(struct comedi_device *dev, struct comedi_subdevice *s); + int (*do_cmdtest)(struct comedi_device *dev, + struct comedi_subdevice *s, struct comedi_cmd *cmd); + int (*poll)(struct comedi_device *dev, struct comedi_subdevice *s); + int (*cancel)(struct comedi_device *dev, struct comedi_subdevice *s); /* called when the buffer changes */ - int (*buf_change)(struct comedi_device *dev, - struct comedi_subdevice *s); + int (*buf_change)(struct comedi_device *dev, + struct comedi_subdevice *s); - void (*munge)(struct comedi_device *dev, struct comedi_subdevice *s, + void (*munge)(struct comedi_device *dev, struct comedi_subdevice *s, void *data, unsigned int num_bytes, unsigned int start_chan_index); enum dma_data_direction async_dma_dir; @@ -365,7 +366,7 @@ struct comedi_async { struct comedi_cmd cmd; wait_queue_head_t wait_head; unsigned int cb_mask; - int (*inttrig)(struct comedi_device *dev, struct comedi_subdevice *s, + int (*inttrig)(struct comedi_device *dev, struct comedi_subdevice *s, unsigned int x); }; @@ -381,15 +382,15 @@ struct comedi_async { * @COMEDI_CB_CANCEL_MASK: events that will cancel an async command */ enum comedi_cb { - COMEDI_CB_EOS = BIT(0), - COMEDI_CB_EOA = BIT(1), - COMEDI_CB_BLOCK = BIT(2), - COMEDI_CB_EOBUF = BIT(3), - COMEDI_CB_ERROR = BIT(4), - COMEDI_CB_OVERFLOW = BIT(5), + COMEDI_CB_EOS = BIT(0), + COMEDI_CB_EOA = BIT(1), + COMEDI_CB_BLOCK = BIT(2), + COMEDI_CB_EOBUF = BIT(3), + COMEDI_CB_ERROR = BIT(4), + COMEDI_CB_OVERFLOW = BIT(5), /* masks */ - COMEDI_CB_ERROR_MASK = (COMEDI_CB_ERROR | COMEDI_CB_OVERFLOW), - COMEDI_CB_CANCEL_MASK = (COMEDI_CB_EOA | COMEDI_CB_ERROR_MASK) + COMEDI_CB_ERROR_MASK = (COMEDI_CB_ERROR | COMEDI_CB_OVERFLOW), + COMEDI_CB_CANCEL_MASK = (COMEDI_CB_EOA | COMEDI_CB_ERROR_MASK) }; /** @@ -440,9 +441,9 @@ struct comedi_driver { /* public: */ const char *driver_name; struct module *module; - int (*attach)(struct comedi_device *dev, struct comedi_devconfig *it); - void (*detach)(struct comedi_device *dev); - int (*auto_attach)(struct comedi_device *dev, unsigned long context); + int (*attach)(struct comedi_device *dev, struct comedi_devconfig *it); + void (*detach)(struct comedi_device *dev); + int (*auto_attach)(struct comedi_device *dev, unsigned long context); unsigned int num_names; const char *const *board_name; int offset; @@ -572,11 +573,12 @@ struct comedi_device { struct fasync_struct *async_queue; - int (*open)(struct comedi_device *dev); - void (*close)(struct comedi_device *dev); - int (*insn_device_config)(struct comedi_device *dev, - struct comedi_insn *insn, unsigned int *data); - unsigned int (*get_valid_routes)(struct comedi_device *dev, + int (*open)(struct comedi_device *dev); + void (*close)(struct comedi_device *dev); + int (*insn_device_config)(struct comedi_device *dev, + struct comedi_insn *insn, + unsigned int *data); + unsigned int (*get_valid_routes)(struct comedi_device *dev, unsigned int n_pairs, unsigned int *pair_data); }; @@ -596,8 +598,7 @@ void *comedi_alloc_spriv(struct comedi_subdevice *s, size_t size); void comedi_set_spriv_auto_free(struct comedi_subdevice *s); int comedi_check_chanlist(struct comedi_subdevice *s, - int n, - unsigned int *chanlist); + int n, unsigned int *chanlist); /* range stuff */ @@ -987,9 +988,9 @@ unsigned int comedi_buf_read_samples(struct comedi_subdevice *s, int comedi_timeout(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, - int (*cb)(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned long context), + int (*cb)(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned long context), unsigned long context); unsigned int comedi_handle_events(struct comedi_device *dev, @@ -1021,8 +1022,8 @@ int comedi_readback_insn_read(struct comedi_device *dev, int comedi_load_firmware(struct comedi_device *dev, struct device *hw_dev, const char *name, - int (*cb)(struct comedi_device *dev, - const u8 *data, size_t size, + int (*cb)(struct comedi_device *dev, + const u8 *data, size_t size, unsigned long context), unsigned long context); diff --git a/drivers/comedi/drivers.c b/drivers/comedi/drivers.c index 750a6ff3c03c..18cdfbf1e7ac 100644 --- a/drivers/comedi/drivers.c +++ b/drivers/comedi/drivers.c @@ -56,6 +56,7 @@ int comedi_set_hw_dev(struct comedi_device *dev, struct device *hw_dev) dev->hw_dev = get_device(hw_dev); return 0; } + EXPORT_SYMBOL_GPL(comedi_set_hw_dev); static void comedi_clear_hw_dev(struct comedi_device *dev) @@ -80,6 +81,7 @@ void *comedi_alloc_devpriv(struct comedi_device *dev, size_t size) dev->private = kzalloc(size, GFP_KERNEL); return dev->private; } + EXPORT_SYMBOL_GPL(comedi_alloc_devpriv); /** @@ -118,6 +120,7 @@ int comedi_alloc_subdevices(struct comedi_device *dev, int num_subdevices) } return 0; } + EXPORT_SYMBOL_GPL(comedi_alloc_subdevices); /** @@ -152,6 +155,7 @@ int comedi_alloc_subdev_readback(struct comedi_subdevice *s) return 0; } + EXPORT_SYMBOL_GPL(comedi_alloc_subdev_readback); static void comedi_device_detach_cleanup(struct comedi_device *dev) @@ -252,8 +256,7 @@ int insn_inval(struct comedi_device *dev, struct comedi_subdevice *s, */ int comedi_readback_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); int i; @@ -266,6 +269,7 @@ int comedi_readback_insn_read(struct comedi_device *dev, return insn->n; } + EXPORT_SYMBOL_GPL(comedi_readback_insn_read); /** @@ -288,11 +292,10 @@ EXPORT_SYMBOL_GPL(comedi_readback_insn_read); int comedi_timeout(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, - int (*cb)(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context), - unsigned long context) + int (*cb)(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned long context), unsigned long context) { unsigned long timeout = jiffies + msecs_to_jiffies(COMEDI_TIMEOUT_MS); int ret; @@ -305,6 +308,7 @@ int comedi_timeout(struct comedi_device *dev, } return -ETIMEDOUT; } + EXPORT_SYMBOL_GPL(comedi_timeout); /** @@ -336,8 +340,7 @@ EXPORT_SYMBOL_GPL(comedi_timeout); int comedi_dio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, - unsigned int *data, - unsigned int mask) + unsigned int *data, unsigned int mask) { unsigned int chan_mask = 1 << CR_CHAN(insn->chanspec); @@ -363,6 +366,7 @@ int comedi_dio_insn_config(struct comedi_device *dev, return 0; } + EXPORT_SYMBOL_GPL(comedi_dio_insn_config); /** @@ -383,7 +387,7 @@ unsigned int comedi_dio_update_state(struct comedi_subdevice *s, unsigned int *data) { unsigned int chanmask = (s->n_chan < 32) ? ((1 << s->n_chan) - 1) - : 0xffffffff; + : 0xffffffff; unsigned int mask = data[0] & chanmask; unsigned int bits = data[1]; @@ -394,6 +398,7 @@ unsigned int comedi_dio_update_state(struct comedi_subdevice *s, return mask; } + EXPORT_SYMBOL_GPL(comedi_dio_update_state); /** @@ -432,6 +437,7 @@ unsigned int comedi_bytes_per_scan_cmd(struct comedi_subdevice *s, } return comedi_samples_to_bytes(s, num_samples); } + EXPORT_SYMBOL_GPL(comedi_bytes_per_scan_cmd); /** @@ -455,6 +461,7 @@ unsigned int comedi_bytes_per_scan(struct comedi_subdevice *s) return comedi_bytes_per_scan_cmd(s, cmd); } + EXPORT_SYMBOL_GPL(comedi_bytes_per_scan); static unsigned int __comedi_nscans_left(struct comedi_subdevice *s, @@ -489,8 +496,7 @@ static unsigned int __comedi_nscans_left(struct comedi_subdevice *s, * The return value will then be either the expected number of scans or the * number of scans remaining to complete the command, whichever is fewer. */ -unsigned int comedi_nscans_left(struct comedi_subdevice *s, - unsigned int nscans) +unsigned int comedi_nscans_left(struct comedi_subdevice *s, unsigned int nscans) { if (nscans == 0) { unsigned int nbytes = comedi_buf_read_n_available(s); @@ -499,6 +505,7 @@ unsigned int comedi_nscans_left(struct comedi_subdevice *s, } return __comedi_nscans_left(s, nscans); } + EXPORT_SYMBOL_GPL(comedi_nscans_left); /** @@ -525,12 +532,13 @@ unsigned int comedi_nsamples_left(struct comedi_subdevice *s, return 0; samples_left = scans_left * cmd->scan_end_arg - - comedi_bytes_to_samples(s, async->scan_progress); + comedi_bytes_to_samples(s, async->scan_progress); if (samples_left < nsamples) return samples_left; return nsamples; } + EXPORT_SYMBOL_GPL(comedi_nsamples_left); /** @@ -569,6 +577,7 @@ void comedi_inc_scan_progress(struct comedi_subdevice *s, async->events |= COMEDI_CB_EOS; } } + EXPORT_SYMBOL_GPL(comedi_inc_scan_progress); /** @@ -602,12 +611,12 @@ unsigned int comedi_handle_events(struct comedi_device *dev, return events; } + EXPORT_SYMBOL_GPL(comedi_handle_events); static int insn_rw_emulate_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct comedi_insn _insn; unsigned int chan = CR_CHAN(insn->chanspec); @@ -625,8 +634,8 @@ static int insn_rw_emulate_bits(struct comedi_device *dev, if (insn->insn == INSN_WRITE) { if (!(s->subdev_flags & SDF_WRITABLE)) return -EINVAL; - _data[0] = 1 << (chan - base_chan); /* mask */ - _data[1] = data[0] ? (1 << (chan - base_chan)) : 0; /* bits */ + _data[0] = 1 << (chan - base_chan); /* mask */ + _data[1] = data[0] ? (1 << (chan - base_chan)) : 0; /* bits */ } ret = s->insn_bits(dev, s, &_insn, _data); @@ -838,8 +847,8 @@ static void comedi_report_boards(struct comedi_driver *driv) int comedi_load_firmware(struct comedi_device *dev, struct device *device, const char *name, - int (*cb)(struct comedi_device *dev, - const u8 *data, size_t size, + int (*cb)(struct comedi_device *dev, + const u8 *data, size_t size, unsigned long context), unsigned long context) { @@ -857,6 +866,7 @@ int comedi_load_firmware(struct comedi_device *dev, return ret < 0 ? ret : 0; } + EXPORT_SYMBOL_GPL(comedi_load_firmware); /** @@ -889,6 +899,7 @@ int __comedi_request_region(struct comedi_device *dev, return 0; } + EXPORT_SYMBOL_GPL(__comedi_request_region); /** @@ -919,6 +930,7 @@ int comedi_request_region(struct comedi_device *dev, return ret; } + EXPORT_SYMBOL_GPL(comedi_request_region); /** @@ -945,6 +957,7 @@ void comedi_legacy_detach(struct comedi_device *dev) dev->iolen = 0; } } + EXPORT_SYMBOL_GPL(comedi_legacy_detach); int comedi_device_attach(struct comedi_device *dev, struct comedi_devconfig *it) @@ -992,7 +1005,7 @@ int comedi_device_attach(struct comedi_device *dev, struct comedi_devconfig *it) } dev->driver = driv; dev->board_name = dev->board_ptr ? *(const char **)dev->board_ptr - : dev->driver->driver_name; + : dev->driver->driver_name; ret = driv->attach(dev, it); if (ret >= 0) ret = comedi_device_postconfig(dev); @@ -1086,6 +1099,7 @@ int comedi_auto_config(struct device *hardware_device, } return ret; } + EXPORT_SYMBOL_GPL(comedi_auto_config); /** @@ -1110,6 +1124,7 @@ void comedi_auto_unconfig(struct device *hardware_device) return; comedi_release_hardware_device(hardware_device); } + EXPORT_SYMBOL_GPL(comedi_auto_unconfig); /** @@ -1132,6 +1147,7 @@ int comedi_driver_register(struct comedi_driver *driver) return 0; } + EXPORT_SYMBOL_GPL(comedi_driver_register); /** @@ -1181,4 +1197,5 @@ void comedi_driver_unregister(struct comedi_driver *driver) comedi_dev_put(dev); } } + EXPORT_SYMBOL_GPL(comedi_driver_unregister); diff --git a/drivers/comedi/drivers/8255.c b/drivers/comedi/drivers/8255.c index e23335c75867..09196cc53378 100644 --- a/drivers/comedi/drivers/8255.c +++ b/drivers/comedi/drivers/8255.c @@ -113,11 +113,12 @@ static void dev_8255_detach(struct comedi_device *dev) } static struct comedi_driver dev_8255_driver = { - .driver_name = "8255", - .module = THIS_MODULE, - .attach = dev_8255_attach, - .detach = dev_8255_detach, + .driver_name = "8255", + .module = THIS_MODULE, + .attach = dev_8255_attach, + .detach = dev_8255_detach, }; + module_comedi_driver(dev_8255_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/8255.h b/drivers/comedi/drivers/8255.h index ceae3ca52e60..98575605db00 100644 --- a/drivers/comedi/drivers/8255.h +++ b/drivers/comedi/drivers/8255.h @@ -28,12 +28,12 @@ struct comedi_device; struct comedi_subdevice; int subdev_8255_init(struct comedi_device *dev, struct comedi_subdevice *s, - int (*io)(struct comedi_device *dev, int dir, int port, + int (*io)(struct comedi_device *dev, int dir, int port, int data, unsigned long regbase), unsigned long regbase); int subdev_8255_mm_init(struct comedi_device *dev, struct comedi_subdevice *s, - int (*io)(struct comedi_device *dev, int dir, int port, + int (*io)(struct comedi_device *dev, int dir, int port, int data, unsigned long regbase), unsigned long regbase); diff --git a/drivers/comedi/drivers/8255_pci.c b/drivers/comedi/drivers/8255_pci.c index 5a810f0e532a..b168acf2807e 100644 --- a/drivers/comedi/drivers/8255_pci.c +++ b/drivers/comedi/drivers/8255_pci.c @@ -85,87 +85,87 @@ struct pci_8255_boardinfo { static const struct pci_8255_boardinfo pci_8255_boards[] = { [BOARD_ADLINK_PCI7224] = { - .name = "adl_pci-7224", - .dio_badr = 2, - .n_8255 = 1, - }, + .name = "adl_pci-7224", + .dio_badr = 2, + .n_8255 = 1, + }, [BOARD_ADLINK_PCI7248] = { - .name = "adl_pci-7248", - .dio_badr = 2, - .n_8255 = 2, - }, + .name = "adl_pci-7248", + .dio_badr = 2, + .n_8255 = 2, + }, [BOARD_ADLINK_PCI7296] = { - .name = "adl_pci-7296", - .dio_badr = 2, - .n_8255 = 4, - }, + .name = "adl_pci-7296", + .dio_badr = 2, + .n_8255 = 4, + }, [BOARD_CB_PCIDIO24] = { - .name = "cb_pci-dio24", - .dio_badr = 2, - .n_8255 = 1, - }, + .name = "cb_pci-dio24", + .dio_badr = 2, + .n_8255 = 1, + }, [BOARD_CB_PCIDIO24H] = { - .name = "cb_pci-dio24h", - .dio_badr = 2, - .n_8255 = 1, - }, + .name = "cb_pci-dio24h", + .dio_badr = 2, + .n_8255 = 1, + }, [BOARD_CB_PCIDIO48H_OLD] = { - .name = "cb_pci-dio48h", - .dio_badr = 1, - .n_8255 = 2, - }, + .name = "cb_pci-dio48h", + .dio_badr = 1, + .n_8255 = 2, + }, [BOARD_CB_PCIDIO48H_NEW] = { - .name = "cb_pci-dio48h", - .dio_badr = 2, - .n_8255 = 2, - }, + .name = "cb_pci-dio48h", + .dio_badr = 2, + .n_8255 = 2, + }, [BOARD_CB_PCIDIO96H] = { - .name = "cb_pci-dio96h", - .dio_badr = 2, - .n_8255 = 4, - }, + .name = "cb_pci-dio96h", + .dio_badr = 2, + .n_8255 = 4, + }, [BOARD_NI_PCIDIO96] = { - .name = "ni_pci-dio-96", - .dio_badr = 1, - .n_8255 = 4, - .has_mite = 1, - }, + .name = "ni_pci-dio-96", + .dio_badr = 1, + .n_8255 = 4, + .has_mite = 1, + }, [BOARD_NI_PCIDIO96B] = { - .name = "ni_pci-dio-96b", - .dio_badr = 1, - .n_8255 = 4, - .has_mite = 1, - }, + .name = "ni_pci-dio-96b", + .dio_badr = 1, + .n_8255 = 4, + .has_mite = 1, + }, [BOARD_NI_PXI6508] = { - .name = "ni_pxi-6508", - .dio_badr = 1, - .n_8255 = 4, - .has_mite = 1, - }, + .name = "ni_pxi-6508", + .dio_badr = 1, + .n_8255 = 4, + .has_mite = 1, + }, [BOARD_NI_PCI6503] = { - .name = "ni_pci-6503", - .dio_badr = 1, - .n_8255 = 1, - .has_mite = 1, - }, + .name = "ni_pci-6503", + .dio_badr = 1, + .n_8255 = 1, + .has_mite = 1, + }, [BOARD_NI_PCI6503B] = { - .name = "ni_pci-6503b", - .dio_badr = 1, - .n_8255 = 1, - .has_mite = 1, - }, + .name = "ni_pci-6503b", + .dio_badr = 1, + .n_8255 = 1, + .has_mite = 1, + }, [BOARD_NI_PCI6503X] = { - .name = "ni_pci-6503x", - .dio_badr = 1, - .n_8255 = 1, - .has_mite = 1, - }, + .name = "ni_pci-6503x", + .dio_badr = 1, + .n_8255 = 1, + .has_mite = 1, + }, [BOARD_NI_PXI_6503] = { - .name = "ni_pxi-6503", - .dio_badr = 1, - .n_8255 = 1, - .has_mite = 1, - }, + .name = "ni_pxi-6503", + .dio_badr = 1, + .n_8255 = 1, + .has_mite = 1, + }, }; /* ripped from mite.h and mite_setup2() to avoid mite dependency */ @@ -248,10 +248,10 @@ static int pci_8255_auto_attach(struct comedi_device *dev, } static struct comedi_driver pci_8255_driver = { - .driver_name = "8255_pci", - .module = THIS_MODULE, - .auto_attach = pci_8255_auto_attach, - .detach = comedi_pci_detach, + .driver_name = "8255_pci", + .module = THIS_MODULE, + .auto_attach = pci_8255_auto_attach, + .detach = comedi_pci_detach, }; static int pci_8255_pci_probe(struct pci_dev *dev, @@ -267,9 +267,9 @@ static const struct pci_device_id pci_8255_pci_table[] = { { PCI_VDEVICE(CB, 0x0028), BOARD_CB_PCIDIO24 }, { PCI_VDEVICE(CB, 0x0014), BOARD_CB_PCIDIO24H }, { PCI_DEVICE_SUB(PCI_VENDOR_ID_CB, 0x000b, 0x0000, 0x0000), - .driver_data = BOARD_CB_PCIDIO48H_OLD }, + .driver_data = BOARD_CB_PCIDIO48H_OLD }, { PCI_DEVICE_SUB(PCI_VENDOR_ID_CB, 0x000b, PCI_VENDOR_ID_CB, 0x000b), - .driver_data = BOARD_CB_PCIDIO48H_NEW }, + .driver_data = BOARD_CB_PCIDIO48H_NEW }, { PCI_VDEVICE(CB, 0x0017), BOARD_CB_PCIDIO96H }, { PCI_VDEVICE(NI, 0x0160), BOARD_NI_PCIDIO96 }, { PCI_VDEVICE(NI, 0x1630), BOARD_NI_PCIDIO96B }, @@ -280,14 +280,16 @@ static const struct pci_device_id pci_8255_pci_table[] = { { PCI_VDEVICE(NI, 0x1800), BOARD_NI_PXI_6503 }, { 0 } }; + MODULE_DEVICE_TABLE(pci, pci_8255_pci_table); static struct pci_driver pci_8255_pci_driver = { - .name = "8255_pci", - .id_table = pci_8255_pci_table, - .probe = pci_8255_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "8255_pci", + .id_table = pci_8255_pci_table, + .probe = pci_8255_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(pci_8255_driver, pci_8255_pci_driver); MODULE_DESCRIPTION("COMEDI - Generic PCI based 8255 Digital I/O boards"); diff --git a/drivers/comedi/drivers/addi_apci_1032.c b/drivers/comedi/drivers/addi_apci_1032.c index 81a246fbcc01..51687a72eaaf 100644 --- a/drivers/comedi/drivers/addi_apci_1032.c +++ b/drivers/comedi/drivers/addi_apci_1032.c @@ -134,7 +134,7 @@ static int apci1032_cos_insn_config(struct comedi_device *dev, APCI1032_CTRL_INT_OR)) { /* switching to 'OR' mode */ devpriv->ctrl = APCI1032_CTRL_INT_ENA | - APCI1032_CTRL_INT_OR; + APCI1032_CTRL_INT_OR; /* wipe old channels */ devpriv->mode1 = 0; devpriv->mode2 = 0; @@ -152,7 +152,7 @@ static int apci1032_cos_insn_config(struct comedi_device *dev, APCI1032_CTRL_INT_AND)) { /* switching to 'AND' mode */ devpriv->ctrl = APCI1032_CTRL_INT_ENA | - APCI1032_CTRL_INT_AND; + APCI1032_CTRL_INT_AND; /* wipe old channels */ devpriv->mode1 = 0; devpriv->mode2 = 0; @@ -178,8 +178,7 @@ static int apci1032_cos_insn_config(struct comedi_device *dev, static int apci1032_cos_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { data[1] = s->state; @@ -288,8 +287,7 @@ static irqreturn_t apci1032_interrupt(int irq, void *d) static int apci1032_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { data[1] = inl(dev->iobase + APCI1032_DI_REG); @@ -328,30 +326,30 @@ static int apci1032_auto_attach(struct comedi_device *dev, /* Allocate and Initialise DI Subdevice Structures */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 32; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = apci1032_di_insn_bits; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 32; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = apci1032_di_insn_bits; /* Change-Of-State (COS) interrupt subdevice */ s = &dev->subdevices[1]; if (dev->irq) { dev->read_subdev = s; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE | SDF_CMD_READ; - s->n_chan = 1; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_config = apci1032_cos_insn_config; - s->insn_bits = apci1032_cos_insn_bits; - s->len_chanlist = 1; - s->do_cmdtest = apci1032_cos_cmdtest; - s->do_cmd = apci1032_cos_cmd; - s->cancel = apci1032_cos_cancel; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE | SDF_CMD_READ; + s->n_chan = 1; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_config = apci1032_cos_insn_config; + s->insn_bits = apci1032_cos_insn_bits; + s->len_chanlist = 1; + s->do_cmdtest = apci1032_cos_cmdtest; + s->do_cmd = apci1032_cos_cmd; + s->cancel = apci1032_cos_cancel; } else { - s->type = COMEDI_SUBD_UNUSED; + s->type = COMEDI_SUBD_UNUSED; } return 0; @@ -365,10 +363,10 @@ static void apci1032_detach(struct comedi_device *dev) } static struct comedi_driver apci1032_driver = { - .driver_name = "addi_apci_1032", - .module = THIS_MODULE, - .auto_attach = apci1032_auto_attach, - .detach = apci1032_detach, + .driver_name = "addi_apci_1032", + .module = THIS_MODULE, + .auto_attach = apci1032_auto_attach, + .detach = apci1032_detach, }; static int apci1032_pci_probe(struct pci_dev *dev, @@ -381,14 +379,16 @@ static const struct pci_device_id apci1032_pci_table[] = { { PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x1003) }, { 0 } }; + MODULE_DEVICE_TABLE(pci, apci1032_pci_table); static struct pci_driver apci1032_pci_driver = { - .name = "addi_apci_1032", - .id_table = apci1032_pci_table, - .probe = apci1032_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "addi_apci_1032", + .id_table = apci1032_pci_table, + .probe = apci1032_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(apci1032_driver, apci1032_pci_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/addi_apci_1500.c b/drivers/comedi/drivers/addi_apci_1500.c index b04c15dcfb57..6c2c9a6ebc62 100644 --- a/drivers/comedi/drivers/addi_apci_1500.c +++ b/drivers/comedi/drivers/addi_apci_1500.c @@ -101,9 +101,8 @@ static void z8536_reset(struct comedi_device *dev) * Configure the port to allow interrupt detection. */ z8536_write(dev, Z8536_PAB_MODE_PTS_BIT | - Z8536_PAB_MODE_SB | - Z8536_PAB_MODE_PMS_DISABLE, - Z8536_PA_MODE_REG); + Z8536_PAB_MODE_SB | + Z8536_PAB_MODE_PMS_DISABLE, Z8536_PA_MODE_REG); z8536_write(dev, 0xff, Z8536_PB_DPP_REG); z8536_write(dev, 0xff, Z8536_PA_DD_REG); @@ -115,9 +114,8 @@ static void z8536_reset(struct comedi_device *dev) * diagnostic signals and bit 7 is inverted. */ z8536_write(dev, Z8536_PAB_MODE_PTS_BIT | - Z8536_PAB_MODE_SB | - Z8536_PAB_MODE_PMS_DISABLE, - Z8536_PB_MODE_REG); + Z8536_PAB_MODE_SB | + Z8536_PAB_MODE_PMS_DISABLE, Z8536_PB_MODE_REG); z8536_write(dev, 0x7f, Z8536_PB_DPP_REG); z8536_write(dev, 0xff, Z8536_PB_DD_REG); @@ -187,14 +185,13 @@ static void apci1500_timer_enable(struct comedi_device *dev, z8536_write(dev, cfg, Z8536_CFG_CTRL_REG); } -static bool apci1500_ack_irq(struct comedi_device *dev, - unsigned int reg) +static bool apci1500_ack_irq(struct comedi_device *dev, unsigned int reg) { unsigned int val; val = z8536_read(dev, reg); if ((val & Z8536_STAT_IE_IP) == Z8536_STAT_IE_IP) { - val &= 0x0f; /* preserve any write bits */ + val &= 0x0f; /* preserve any write bits */ val |= Z8536_CMD_CLR_IP_IUS; z8536_write(dev, val, reg); @@ -308,7 +305,7 @@ static int apci1500_di_inttrig_start(struct comedi_device *dev, /* Set Port A trigger mode (if enabled) and enable interrupt */ if (devpriv->pm[pa_trig] & 0xff) { pa_mode = pa_trig ? Z8536_PAB_MODE_PMS_AND - : Z8536_PAB_MODE_PMS_OR; + : Z8536_PAB_MODE_PMS_OR; val = z8536_read(dev, Z8536_PA_MODE_REG); val &= ~Z8536_PAB_MODE_PMS_MASK; @@ -327,7 +324,7 @@ static int apci1500_di_inttrig_start(struct comedi_device *dev, /* Set Port B trigger mode (if enabled) and enable interrupt */ if (devpriv->pm[pb_trig] & 0xff00) { pb_mode = pb_trig ? Z8536_PAB_MODE_PMS_AND - : Z8536_PAB_MODE_PMS_OR; + : Z8536_PAB_MODE_PMS_OR; val = z8536_read(dev, Z8536_PB_MODE_REG); val &= ~Z8536_PAB_MODE_PMS_MASK; @@ -392,17 +389,17 @@ static int apci1500_di_cmdtest(struct comedi_device *dev, /* * Internal start source triggers: * - * 0 AND mode for Port A (digital inputs 0-7) - * AND mode for Port B (digital inputs 8-13 and internal signals) + * 0 AND mode for Port A (digital inputs 0-7) + * AND mode for Port B (digital inputs 8-13 and internal signals) * - * 1 OR mode for Port A (digital inputs 0-7) - * AND mode for Port B (digital inputs 8-13 and internal signals) + * 1 OR mode for Port A (digital inputs 0-7) + * AND mode for Port B (digital inputs 8-13 and internal signals) * - * 2 AND mode for Port A (digital inputs 0-7) - * OR mode for Port B (digital inputs 8-13 and internal signals) + * 2 AND mode for Port A (digital inputs 0-7) + * OR mode for Port B (digital inputs 8-13 and internal signals) * - * 3 OR mode for Port A (digital inputs 0-7) - * OR mode for Port B (digital inputs 8-13 and internal signals) + * 3 OR mode for Port A (digital inputs 0-7) + * OR mode for Port B (digital inputs 8-13 and internal signals) */ err |= comedi_check_trigger_arg_max(&cmd->start_arg, 3); @@ -446,8 +443,7 @@ static int apci1500_di_cmdtest(struct comedi_device *dev, */ static int apci1500_di_cfg_trig(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct apci1500_private *devpriv = dev->private; unsigned int trig = data[1]; @@ -499,14 +495,14 @@ static int apci1500_di_cfg_trig(struct comedi_device *dev, case COMEDI_DIGITAL_TRIG_ENABLE_EDGES: pm |= chan_mask; /* enable channels */ pt |= chan_mask; /* enable edge detection */ - pp |= hi_mask; /* rising-edge channels */ - pp &= ~lo_mask; /* falling-edge channels */ + pp |= hi_mask; /* rising-edge channels */ + pp &= ~lo_mask; /* falling-edge channels */ break; case COMEDI_DIGITAL_TRIG_ENABLE_LEVELS: pm |= chan_mask; /* enable channels */ pt &= ~chan_mask; /* enable level detection */ - pp |= hi_mask; /* high level channels */ - pp &= ~lo_mask; /* low level channels */ + pp |= hi_mask; /* high level channels */ + pp &= ~lo_mask; /* low level channels */ break; default: return -EINVAL; @@ -545,8 +541,7 @@ static int apci1500_di_cfg_trig(struct comedi_device *dev, static int apci1500_di_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { switch (data[0]) { case INSN_CONFIG_DIGITAL_TRIG: @@ -558,8 +553,7 @@ static int apci1500_di_insn_config(struct comedi_device *dev, static int apci1500_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct apci1500_private *devpriv = dev->private; @@ -570,8 +564,7 @@ static int apci1500_di_insn_bits(struct comedi_device *dev, static int apci1500_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct apci1500_private *devpriv = dev->private; @@ -619,7 +612,7 @@ static int apci1500_timer_insn_config(struct comedi_device *dev, apci1500_ack_irq(dev, Z8536_CT_CMDSTAT_REG(chan)); } data[2] = COMEDI_COUNTER_ARMED | COMEDI_COUNTER_COUNTING | - COMEDI_COUNTER_TERMINAL_COUNT; + COMEDI_COUNTER_TERMINAL_COUNT; break; case INSN_CONFIG_SET_COUNTER_MODE: @@ -627,35 +620,29 @@ static int apci1500_timer_insn_config(struct comedi_device *dev, switch (data[1]) { case I8254_MODE0: /* Interrupt on Terminal Count */ - val = Z8536_CT_MODE_ECE | - Z8536_CT_MODE_DCS_ONESHOT; + val = Z8536_CT_MODE_ECE | Z8536_CT_MODE_DCS_ONESHOT; break; case I8254_MODE1: /* Hardware Retriggerable One-Shot */ - val = Z8536_CT_MODE_ETE | - Z8536_CT_MODE_DCS_ONESHOT; + val = Z8536_CT_MODE_ETE | Z8536_CT_MODE_DCS_ONESHOT; break; case I8254_MODE2: /* Rate Generator */ - val = Z8536_CT_MODE_CSC | - Z8536_CT_MODE_DCS_PULSE; + val = Z8536_CT_MODE_CSC | Z8536_CT_MODE_DCS_PULSE; break; case I8254_MODE3: /* Square Wave Mode */ - val = Z8536_CT_MODE_CSC | - Z8536_CT_MODE_DCS_SQRWAVE; + val = Z8536_CT_MODE_CSC | Z8536_CT_MODE_DCS_SQRWAVE; break; case I8254_MODE4: /* Software Triggered Strobe */ - val = Z8536_CT_MODE_REB | - Z8536_CT_MODE_DCS_PULSE; + val = Z8536_CT_MODE_REB | Z8536_CT_MODE_DCS_PULSE; break; case I8254_MODE5: /* Hardware Triggered Strobe (watchdog) */ val = Z8536_CT_MODE_EOE | - Z8536_CT_MODE_ETE | - Z8536_CT_MODE_REB | - Z8536_CT_MODE_DCS_PULSE; + Z8536_CT_MODE_ETE | + Z8536_CT_MODE_REB | Z8536_CT_MODE_DCS_PULSE; break; default: return -EINVAL; @@ -675,15 +662,15 @@ static int apci1500_timer_insn_config(struct comedi_device *dev, case INSN_CONFIG_GET_CLOCK_SRC: switch (devpriv->clk_src) { case 0: - data[1] = 0; /* 111.86 kHz / 2 */ + data[1] = 0; /* 111.86 kHz / 2 */ data[2] = 17879; /* 17879 ns (approx) */ break; case 1: - data[1] = 1; /* 3.49 kHz / 2 */ + data[1] = 1; /* 3.49 kHz / 2 */ data[2] = 573066; /* 573066 ns (approx) */ break; case 3: - data[1] = 2; /* 1.747 kHz / 2 */ + data[1] = 2; /* 1.747 kHz / 2 */ data[2] = 1164822; /* 1164822 ns (approx) */ break; default: @@ -794,44 +781,44 @@ static int apci1500_auto_attach(struct comedi_device *dev, /* Digital Input subdevice */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 16; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = apci1500_di_insn_bits; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 16; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = apci1500_di_insn_bits; if (dev->irq) { dev->read_subdev = s; s->subdev_flags |= SDF_CMD_READ; - s->len_chanlist = 1; - s->insn_config = apci1500_di_insn_config; - s->do_cmdtest = apci1500_di_cmdtest; - s->do_cmd = apci1500_di_cmd; - s->cancel = apci1500_di_cancel; + s->len_chanlist = 1; + s->insn_config = apci1500_di_insn_config; + s->do_cmdtest = apci1500_di_cmdtest; + s->do_cmd = apci1500_di_cmd; + s->cancel = apci1500_di_cancel; } /* Digital Output subdevice */ s = &dev->subdevices[1]; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 16; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = apci1500_do_insn_bits; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 16; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = apci1500_do_insn_bits; /* reset all the digital outputs */ outw(0x0, devpriv->addon + APCI1500_DO_REG); /* Counter/Timer(Watchdog) subdevice */ s = &dev->subdevices[2]; - s->type = COMEDI_SUBD_TIMER; - s->subdev_flags = SDF_WRITABLE | SDF_READABLE; - s->n_chan = 3; - s->maxdata = 0xffff; - s->range_table = &range_unknown; - s->insn_config = apci1500_timer_insn_config; - s->insn_write = apci1500_timer_insn_write; - s->insn_read = apci1500_timer_insn_read; + s->type = COMEDI_SUBD_TIMER; + s->subdev_flags = SDF_WRITABLE | SDF_READABLE; + s->n_chan = 3; + s->maxdata = 0xffff; + s->range_table = &range_unknown; + s->insn_config = apci1500_timer_insn_config; + s->insn_write = apci1500_timer_insn_write; + s->insn_read = apci1500_timer_insn_read; /* Enable the PCI interrupt */ if (dev->irq) { @@ -856,10 +843,10 @@ static void apci1500_detach(struct comedi_device *dev) } static struct comedi_driver apci1500_driver = { - .driver_name = "addi_apci_1500", - .module = THIS_MODULE, - .auto_attach = apci1500_auto_attach, - .detach = apci1500_detach, + .driver_name = "addi_apci_1500", + .module = THIS_MODULE, + .auto_attach = apci1500_auto_attach, + .detach = apci1500_detach, }; static int apci1500_pci_probe(struct pci_dev *dev, @@ -872,14 +859,16 @@ static const struct pci_device_id apci1500_pci_table[] = { { PCI_DEVICE(PCI_VENDOR_ID_AMCC, 0x80fc) }, { 0 } }; + MODULE_DEVICE_TABLE(pci, apci1500_pci_table); static struct pci_driver apci1500_pci_driver = { - .name = "addi_apci_1500", - .id_table = apci1500_pci_table, - .probe = apci1500_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "addi_apci_1500", + .id_table = apci1500_pci_table, + .probe = apci1500_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(apci1500_driver, apci1500_pci_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/addi_apci_1516.c b/drivers/comedi/drivers/addi_apci_1516.c index 274ec9fb030c..9075602e4780 100644 --- a/drivers/comedi/drivers/addi_apci_1516.c +++ b/drivers/comedi/drivers/addi_apci_1516.c @@ -44,20 +44,20 @@ struct apci1516_boardinfo { static const struct apci1516_boardinfo apci1516_boardtypes[] = { [BOARD_APCI1016] = { - .name = "apci1016", - .di_nchan = 16, - }, + .name = "apci1016", + .di_nchan = 16, + }, [BOARD_APCI1516] = { - .name = "apci1516", - .di_nchan = 8, - .do_nchan = 8, - .has_wdog = 1, - }, + .name = "apci1516", + .di_nchan = 8, + .do_nchan = 8, + .has_wdog = 1, + }, [BOARD_APCI2016] = { - .name = "apci2016", - .do_nchan = 16, - .has_wdog = 1, - }, + .name = "apci2016", + .do_nchan = 16, + .has_wdog = 1, + }, }; struct apci1516_private { @@ -66,8 +66,7 @@ struct apci1516_private { static int apci1516_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { data[1] = inw(dev->iobase + APCI1516_DI_REG); @@ -76,8 +75,7 @@ static int apci1516_di_insn_bits(struct comedi_device *dev, static int apci1516_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { s->state = inw(dev->iobase + APCI1516_DO_REG); @@ -138,27 +136,27 @@ static int apci1516_auto_attach(struct comedi_device *dev, /* Initialize the digital input subdevice */ s = &dev->subdevices[0]; if (board->di_nchan) { - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = board->di_nchan; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = apci1516_di_insn_bits; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = board->di_nchan; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = apci1516_di_insn_bits; } else { - s->type = COMEDI_SUBD_UNUSED; + s->type = COMEDI_SUBD_UNUSED; } /* Initialize the digital output subdevice */ s = &dev->subdevices[1]; if (board->do_nchan) { - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = board->do_nchan; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = apci1516_do_insn_bits; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = board->do_nchan; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = apci1516_do_insn_bits; } else { - s->type = COMEDI_SUBD_UNUSED; + s->type = COMEDI_SUBD_UNUSED; } /* Initialize the watchdog subdevice */ @@ -168,7 +166,7 @@ static int apci1516_auto_attach(struct comedi_device *dev, if (ret) return ret; } else { - s->type = COMEDI_SUBD_UNUSED; + s->type = COMEDI_SUBD_UNUSED; } apci1516_reset(dev); @@ -183,10 +181,10 @@ static void apci1516_detach(struct comedi_device *dev) } static struct comedi_driver apci1516_driver = { - .driver_name = "addi_apci_1516", - .module = THIS_MODULE, - .auto_attach = apci1516_auto_attach, - .detach = apci1516_detach, + .driver_name = "addi_apci_1516", + .module = THIS_MODULE, + .auto_attach = apci1516_auto_attach, + .detach = apci1516_detach, }; static int apci1516_pci_probe(struct pci_dev *dev, @@ -201,14 +199,16 @@ static const struct pci_device_id apci1516_pci_table[] = { { PCI_VDEVICE(ADDIDATA, 0x1002), BOARD_APCI2016 }, { 0 } }; + MODULE_DEVICE_TABLE(pci, apci1516_pci_table); static struct pci_driver apci1516_pci_driver = { - .name = "addi_apci_1516", - .id_table = apci1516_pci_table, - .probe = apci1516_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "addi_apci_1516", + .id_table = apci1516_pci_table, + .probe = apci1516_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(apci1516_driver, apci1516_pci_driver); MODULE_DESCRIPTION("ADDI-DATA APCI-1016/1516/2016, 16 channel DIO boards"); diff --git a/drivers/comedi/drivers/addi_apci_1564.c b/drivers/comedi/drivers/addi_apci_1564.c index 06fc7ed96200..3928e1c322d1 100644 --- a/drivers/comedi/drivers/addi_apci_1564.c +++ b/drivers/comedi/drivers/addi_apci_1564.c @@ -121,7 +121,7 @@ #define APCI1564_DI_REG 0x00 #define APCI1564_DI_INT_MODE1_REG 0x04 #define APCI1564_DI_INT_MODE2_REG 0x08 -#define APCI1564_DI_INT_MODE_MASK 0x000ffff0 /* chans [19:4] */ +#define APCI1564_DI_INT_MODE_MASK 0x000ffff0 /* chans [19:4] */ #define APCI1564_DI_INT_STATUS_REG 0x0c #define APCI1564_DI_IRQ_REG 0x10 #define APCI1564_DI_IRQ_ENA BIT(2) @@ -155,8 +155,8 @@ */ #define APCI1564_EVENT_COS BIT(31) #define APCI1564_EVENT_TIMER BIT(30) -#define APCI1564_EVENT_COUNTER(x) BIT(27 + (x)) /* counter 0-2 */ -#define APCI1564_EVENT_MASK 0xfff0000f /* all but [19:4] */ +#define APCI1564_EVENT_COUNTER(x) BIT(27 + (x)) /* counter 0-2 */ +#define APCI1564_EVENT_MASK 0xfff0000f /* all but [19:4] */ struct apci1564_private { unsigned long eeprom; /* base address of EEPROM register */ @@ -262,8 +262,7 @@ static irqreturn_t apci1564_interrupt(int irq, void *d) static int apci1564_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { data[1] = inl(dev->iobase + APCI1564_DI_REG); @@ -272,8 +271,7 @@ static int apci1564_di_insn_bits(struct comedi_device *dev, static int apci1564_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { s->state = inl(dev->iobase + APCI1564_DO_REG); @@ -287,8 +285,7 @@ static int apci1564_do_insn_bits(struct comedi_device *dev, static int apci1564_diag_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { data[1] = inl(dev->iobase + APCI1564_DO_INT_STATUS_REG) & 3; @@ -378,7 +375,7 @@ static int apci1564_cos_insn_config(struct comedi_device *dev, APCI1564_DI_IRQ_MODE)) { /* switching to 'AND' mode */ devpriv->ctrl = APCI1564_DI_IRQ_ENA | - APCI1564_DI_IRQ_MODE; + APCI1564_DI_IRQ_MODE; /* wipe old channels */ devpriv->mode1 = 0; devpriv->mode2 = 0; @@ -407,8 +404,7 @@ static int apci1564_cos_insn_config(struct comedi_device *dev, static int apci1564_cos_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { data[1] = s->state; @@ -518,7 +514,7 @@ static int apci1564_timer_insn_config(struct comedi_device *dev, if (val & ADDI_TCW_STATUS_OVERFLOW) data[1] |= COMEDI_COUNTER_TERMINAL_COUNT; data[2] = COMEDI_COUNTER_ARMED | COMEDI_COUNTER_COUNTING | - COMEDI_COUNTER_TERMINAL_COUNT; + COMEDI_COUNTER_TERMINAL_COUNT; break; case INSN_CONFIG_SET_CLOCK_SRC: if (data[2] > s->maxdata) @@ -610,7 +606,7 @@ static int apci1564_counter_insn_config(struct comedi_device *dev, if (val & ADDI_TCW_STATUS_OVERFLOW) data[1] |= COMEDI_COUNTER_TERMINAL_COUNT; data[2] = COMEDI_COUNTER_ARMED | COMEDI_COUNTER_COUNTING | - COMEDI_COUNTER_TERMINAL_COUNT; + COMEDI_COUNTER_TERMINAL_COUNT; break; default: return -EINVAL; @@ -678,7 +674,7 @@ static int apci1564_auto_attach(struct comedi_device *dev, if (APCI1564_EEPROM_TO_REV(val) == 0) { /* PLD Revision 1.0 I/O Mapping */ dev->iobase = pci_resource_start(pcidev, 1) + - APCI1564_REV1_MAIN_IOBASE; + APCI1564_REV1_MAIN_IOBASE; devpriv->timer = devpriv->eeprom + APCI1564_REV1_TIMER_IOBASE; } else { /* PLD Revision 2.x I/O Mapping */ @@ -702,65 +698,65 @@ static int apci1564_auto_attach(struct comedi_device *dev, /* Allocate and Initialise DI Subdevice Structures */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 32; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = apci1564_di_insn_bits; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 32; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = apci1564_di_insn_bits; /* Allocate and Initialise DO Subdevice Structures */ s = &dev->subdevices[1]; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 32; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = apci1564_do_insn_bits; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 32; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = apci1564_do_insn_bits; /* Change-Of-State (COS) interrupt subdevice */ s = &dev->subdevices[2]; if (dev->irq) { dev->read_subdev = s; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE | SDF_CMD_READ | SDF_LSAMPL; - s->n_chan = 1; - s->maxdata = 1; - s->range_table = &range_digital; - s->len_chanlist = 1; - s->insn_config = apci1564_cos_insn_config; - s->insn_bits = apci1564_cos_insn_bits; - s->do_cmdtest = apci1564_cos_cmdtest; - s->do_cmd = apci1564_cos_cmd; - s->cancel = apci1564_cos_cancel; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE | SDF_CMD_READ | SDF_LSAMPL; + s->n_chan = 1; + s->maxdata = 1; + s->range_table = &range_digital; + s->len_chanlist = 1; + s->insn_config = apci1564_cos_insn_config; + s->insn_bits = apci1564_cos_insn_bits; + s->do_cmdtest = apci1564_cos_cmdtest; + s->do_cmd = apci1564_cos_cmd; + s->cancel = apci1564_cos_cancel; } else { - s->type = COMEDI_SUBD_UNUSED; + s->type = COMEDI_SUBD_UNUSED; } /* Timer subdevice */ s = &dev->subdevices[3]; - s->type = COMEDI_SUBD_TIMER; - s->subdev_flags = SDF_WRITABLE | SDF_READABLE; - s->n_chan = 1; - s->maxdata = 0x0fff; - s->range_table = &range_digital; - s->insn_config = apci1564_timer_insn_config; - s->insn_write = apci1564_timer_insn_write; - s->insn_read = apci1564_timer_insn_read; + s->type = COMEDI_SUBD_TIMER; + s->subdev_flags = SDF_WRITABLE | SDF_READABLE; + s->n_chan = 1; + s->maxdata = 0x0fff; + s->range_table = &range_digital; + s->insn_config = apci1564_timer_insn_config; + s->insn_write = apci1564_timer_insn_write; + s->insn_read = apci1564_timer_insn_read; /* Counter subdevice */ s = &dev->subdevices[4]; if (devpriv->counters) { - s->type = COMEDI_SUBD_COUNTER; - s->subdev_flags = SDF_WRITABLE | SDF_READABLE | SDF_LSAMPL; - s->n_chan = 3; - s->maxdata = 0xffffffff; - s->range_table = &range_digital; - s->insn_config = apci1564_counter_insn_config; - s->insn_write = apci1564_counter_insn_write; - s->insn_read = apci1564_counter_insn_read; + s->type = COMEDI_SUBD_COUNTER; + s->subdev_flags = SDF_WRITABLE | SDF_READABLE | SDF_LSAMPL; + s->n_chan = 3; + s->maxdata = 0xffffffff; + s->range_table = &range_digital; + s->insn_config = apci1564_counter_insn_config; + s->insn_write = apci1564_counter_insn_write; + s->insn_read = apci1564_counter_insn_read; } else { - s->type = COMEDI_SUBD_UNUSED; + s->type = COMEDI_SUBD_UNUSED; } /* Initialize the watchdog subdevice */ @@ -771,12 +767,12 @@ static int apci1564_auto_attach(struct comedi_device *dev, /* Initialize the diagnostic status subdevice */ s = &dev->subdevices[6]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 2; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = apci1564_diag_insn_bits; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 2; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = apci1564_diag_insn_bits; return 0; } @@ -789,10 +785,10 @@ static void apci1564_detach(struct comedi_device *dev) } static struct comedi_driver apci1564_driver = { - .driver_name = "addi_apci_1564", - .module = THIS_MODULE, - .auto_attach = apci1564_auto_attach, - .detach = apci1564_detach, + .driver_name = "addi_apci_1564", + .module = THIS_MODULE, + .auto_attach = apci1564_auto_attach, + .detach = apci1564_detach, }; static int apci1564_pci_probe(struct pci_dev *dev, @@ -805,14 +801,16 @@ static const struct pci_device_id apci1564_pci_table[] = { { PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x1006) }, { 0 } }; + MODULE_DEVICE_TABLE(pci, apci1564_pci_table); static struct pci_driver apci1564_pci_driver = { - .name = "addi_apci_1564", - .id_table = apci1564_pci_table, - .probe = apci1564_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "addi_apci_1564", + .id_table = apci1564_pci_table, + .probe = apci1564_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(apci1564_driver, apci1564_pci_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/addi_apci_16xx.c b/drivers/comedi/drivers/addi_apci_16xx.c index c306aa41df97..d149ceffb3be 100644 --- a/drivers/comedi/drivers/addi_apci_16xx.c +++ b/drivers/comedi/drivers/addi_apci_16xx.c @@ -36,19 +36,18 @@ struct apci16xx_boardinfo { static const struct apci16xx_boardinfo apci16xx_boardtypes[] = { [BOARD_APCI1648] = { - .name = "apci1648", - .n_chan = 48, /* 2 subdevices */ - }, + .name = "apci1648", + .n_chan = 48, /* 2 subdevices */ + }, [BOARD_APCI1696] = { - .name = "apci1696", - .n_chan = 96, /* 3 subdevices */ - }, + .name = "apci1696", + .n_chan = 96, /* 3 subdevices */ + }, }; static int apci16xx_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int mask; @@ -74,8 +73,7 @@ static int apci16xx_insn_config(struct comedi_device *dev, static int apci16xx_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { if (comedi_dio_update_state(s, data)) outl(s->state, dev->iobase + APCI16XX_OUT_REG(s->index)); @@ -129,16 +127,16 @@ static int apci16xx_auto_attach(struct comedi_device *dev, /* Initialize the TTL digital i/o subdevices */ for (i = 0; i < n_subdevs; i++) { s = &dev->subdevices[i]; - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_WRITABLE | SDF_READABLE; - s->n_chan = ((i * 32) < board->n_chan) ? 32 : last; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_config = apci16xx_insn_config; - s->insn_bits = apci16xx_dio_insn_bits; + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_WRITABLE | SDF_READABLE; + s->n_chan = ((i * 32) < board->n_chan) ? 32 : last; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_config = apci16xx_insn_config; + s->insn_bits = apci16xx_dio_insn_bits; /* Default all channels to inputs */ - s->io_bits = 0; + s->io_bits = 0; outl(s->io_bits, dev->iobase + APCI16XX_DIR_REG(i)); } @@ -146,10 +144,10 @@ static int apci16xx_auto_attach(struct comedi_device *dev, } static struct comedi_driver apci16xx_driver = { - .driver_name = "addi_apci_16xx", - .module = THIS_MODULE, - .auto_attach = apci16xx_auto_attach, - .detach = comedi_pci_detach, + .driver_name = "addi_apci_16xx", + .module = THIS_MODULE, + .auto_attach = apci16xx_auto_attach, + .detach = comedi_pci_detach, }; static int apci16xx_pci_probe(struct pci_dev *dev, @@ -163,14 +161,16 @@ static const struct pci_device_id apci16xx_pci_table[] = { { PCI_VDEVICE(ADDIDATA, 0x100a), BOARD_APCI1696 }, { 0 } }; + MODULE_DEVICE_TABLE(pci, apci16xx_pci_table); static struct pci_driver apci16xx_pci_driver = { - .name = "addi_apci_16xx", - .id_table = apci16xx_pci_table, - .probe = apci16xx_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "addi_apci_16xx", + .id_table = apci16xx_pci_table, + .probe = apci16xx_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(apci16xx_driver, apci16xx_pci_driver); MODULE_DESCRIPTION("ADDI-DATA APCI-1648/1696, TTL I/O boards"); diff --git a/drivers/comedi/drivers/addi_apci_2032.c b/drivers/comedi/drivers/addi_apci_2032.c index e9a2b37a4ae0..e18de93cf47f 100644 --- a/drivers/comedi/drivers/addi_apci_2032.c +++ b/drivers/comedi/drivers/addi_apci_2032.c @@ -35,15 +35,14 @@ #define APCI2032_WDOG_REG 0x10 struct apci2032_int_private { - spinlock_t spinlock; /* protects the following members */ - bool active; /* an async command is running */ + spinlock_t spinlock; /* protects the following members */ + bool active; /* an async command is running */ unsigned char enabled_isns; /* mask of enabled interrupt channels */ }; static int apci2032_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { s->state = inl(dev->iobase + APCI2032_DO_REG); @@ -57,8 +56,7 @@ static int apci2032_do_insn_bits(struct comedi_device *dev, static int apci2032_int_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { data[1] = inl(dev->iobase + APCI2032_INT_STATUS_REG) & 3; return insn->n; @@ -108,7 +106,7 @@ static int apci2032_int_cmdtest(struct comedi_device *dev, cmd->chanlist_len); if (cmd->stop_src == TRIG_COUNT) err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); - else /* TRIG_NONE */ + else /* TRIG_NONE */ err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) @@ -249,12 +247,12 @@ static int apci2032_auto_attach(struct comedi_device *dev, /* Initialize the digital output subdevice */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 32; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = apci2032_do_insn_bits; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 32; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = apci2032_do_insn_bits; /* Initialize the watchdog subdevice */ s = &dev->subdevices[1]; @@ -264,12 +262,12 @@ static int apci2032_auto_attach(struct comedi_device *dev, /* Initialize the interrupt subdevice */ s = &dev->subdevices[2]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 2; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = apci2032_int_insn_bits; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 2; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = apci2032_int_insn_bits; if (dev->irq) { struct apci2032_int_private *subpriv; @@ -278,12 +276,12 @@ static int apci2032_auto_attach(struct comedi_device *dev, if (!subpriv) return -ENOMEM; spin_lock_init(&subpriv->spinlock); - s->private = subpriv; - s->subdev_flags = SDF_READABLE | SDF_CMD_READ | SDF_PACKED; + s->private = subpriv; + s->subdev_flags = SDF_READABLE | SDF_CMD_READ | SDF_PACKED; s->len_chanlist = 2; - s->do_cmdtest = apci2032_int_cmdtest; - s->do_cmd = apci2032_int_cmd; - s->cancel = apci2032_int_cancel; + s->do_cmdtest = apci2032_int_cmdtest; + s->do_cmd = apci2032_int_cmd; + s->cancel = apci2032_int_cancel; } return 0; @@ -299,10 +297,10 @@ static void apci2032_detach(struct comedi_device *dev) } static struct comedi_driver apci2032_driver = { - .driver_name = "addi_apci_2032", - .module = THIS_MODULE, - .auto_attach = apci2032_auto_attach, - .detach = apci2032_detach, + .driver_name = "addi_apci_2032", + .module = THIS_MODULE, + .auto_attach = apci2032_auto_attach, + .detach = apci2032_detach, }; static int apci2032_pci_probe(struct pci_dev *dev, @@ -315,14 +313,16 @@ static const struct pci_device_id apci2032_pci_table[] = { { PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x1004) }, { 0 } }; + MODULE_DEVICE_TABLE(pci, apci2032_pci_table); static struct pci_driver apci2032_pci_driver = { - .name = "addi_apci_2032", - .id_table = apci2032_pci_table, - .probe = apci2032_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "addi_apci_2032", + .id_table = apci2032_pci_table, + .probe = apci2032_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(apci2032_driver, apci2032_pci_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/addi_apci_2200.c b/drivers/comedi/drivers/addi_apci_2200.c index 4c5aee784bd9..4671808602ed 100644 --- a/drivers/comedi/drivers/addi_apci_2200.c +++ b/drivers/comedi/drivers/addi_apci_2200.c @@ -27,8 +27,7 @@ static int apci2200_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { data[1] = inw(dev->iobase + APCI2200_DI_REG); @@ -37,8 +36,7 @@ static int apci2200_di_insn_bits(struct comedi_device *dev, static int apci2200_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { s->state = inw(dev->iobase + APCI2200_DO_REG); @@ -78,21 +76,21 @@ static int apci2200_auto_attach(struct comedi_device *dev, /* Initialize the digital input subdevice */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 8; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = apci2200_di_insn_bits; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 8; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = apci2200_di_insn_bits; /* Initialize the digital output subdevice */ s = &dev->subdevices[1]; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 16; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = apci2200_do_insn_bits; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 16; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = apci2200_do_insn_bits; /* Initialize the watchdog subdevice */ s = &dev->subdevices[2]; @@ -112,10 +110,10 @@ static void apci2200_detach(struct comedi_device *dev) } static struct comedi_driver apci2200_driver = { - .driver_name = "addi_apci_2200", - .module = THIS_MODULE, - .auto_attach = apci2200_auto_attach, - .detach = apci2200_detach, + .driver_name = "addi_apci_2200", + .module = THIS_MODULE, + .auto_attach = apci2200_auto_attach, + .detach = apci2200_detach, }; static int apci2200_pci_probe(struct pci_dev *dev, @@ -128,14 +126,16 @@ static const struct pci_device_id apci2200_pci_table[] = { { PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x1005) }, { 0 } }; + MODULE_DEVICE_TABLE(pci, apci2200_pci_table); static struct pci_driver apci2200_pci_driver = { - .name = "addi_apci_2200", - .id_table = apci2200_pci_table, - .probe = apci2200_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "addi_apci_2200", + .id_table = apci2200_pci_table, + .probe = apci2200_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(apci2200_driver, apci2200_pci_driver); MODULE_DESCRIPTION("ADDI-DATA APCI-2200 Relay board, optically isolated"); diff --git a/drivers/comedi/drivers/addi_apci_3120.c b/drivers/comedi/drivers/addi_apci_3120.c index 1ed3b33d1a30..eefc78e71ca1 100644 --- a/drivers/comedi/drivers/addi_apci_3120.c +++ b/drivers/comedi/drivers/addi_apci_3120.c @@ -56,10 +56,10 @@ #define APCI3120_AO_DATA(x) ((x) << 0) #define APCI3120_TIMER_MODE_REG 0x0c #define APCI3120_TIMER_MODE(_t, _m) ((_m) << ((_t) * 2)) -#define APCI3120_TIMER_MODE0 0 /* I8254_MODE0 */ -#define APCI3120_TIMER_MODE2 1 /* I8254_MODE2 */ -#define APCI3120_TIMER_MODE4 2 /* I8254_MODE4 */ -#define APCI3120_TIMER_MODE5 3 /* I8254_MODE5 */ +#define APCI3120_TIMER_MODE0 0 /* I8254_MODE0 */ +#define APCI3120_TIMER_MODE2 1 /* I8254_MODE2 */ +#define APCI3120_TIMER_MODE4 2 /* I8254_MODE4 */ +#define APCI3120_TIMER_MODE5 3 /* I8254_MODE5 */ #define APCI3120_TIMER_MODE_MASK(_t) (3 << ((_t) * 2)) #define APCI3120_CTR0_REG 0x0d #define APCI3120_CTR0_DO_BITS(x) ((x) << 4) @@ -100,15 +100,15 @@ static const struct comedi_lrange apci3120_ai_range = { 8, { - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(2), - BIP_RANGE(1), - UNI_RANGE(10), - UNI_RANGE(5), - UNI_RANGE(2), - UNI_RANGE(1) - } + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(2), + BIP_RANGE(1), + UNI_RANGE(10), + UNI_RANGE(5), + UNI_RANGE(2), + UNI_RANGE(1) + } }; enum apci3120_boardid { @@ -124,13 +124,13 @@ struct apci3120_board { static const struct apci3120_board apci3120_boardtypes[] = { [BOARD_APCI3120] = { - .name = "apci3120", - .ai_is_16bit = 1, - .has_ao = 1, - }, + .name = "apci3120", + .ai_is_16bit = 1, + .has_ao = 1, + }, [BOARD_APCI3001] = { - .name = "apci3001", - }, + .name = "apci3001", + }, }; struct apci3120_dmabuf { @@ -267,8 +267,7 @@ static void apci3120_setup_dma(struct comedi_device *dev, */ static unsigned int apci3120_ns_to_timer(struct comedi_device *dev, unsigned int timer, - unsigned int ns, - unsigned int flags) + unsigned int ns, unsigned int flags) { struct apci3120_private *devpriv = dev->private; unsigned int prescale = (timer == 0) ? 10 : 1000; @@ -317,8 +316,7 @@ static void apci3120_timer_write(struct comedi_device *dev, /* write 16-bit value to timer (lower 16-bits of timer 2) */ outb(APCI3120_CTR0_DO_BITS(devpriv->do_bits) | - APCI3120_CTR0_TIMER_SEL(timer), - dev->iobase + APCI3120_CTR0_REG); + APCI3120_CTR0_TIMER_SEL(timer), dev->iobase + APCI3120_CTR0_REG); outw(val & 0xffff, dev->iobase + APCI3120_TIMER_REG); if (timer == 2) { @@ -338,8 +336,7 @@ static unsigned int apci3120_timer_read(struct comedi_device *dev, /* read 16-bit value from timer (lower 16-bits of timer 2) */ outb(APCI3120_CTR0_DO_BITS(devpriv->do_bits) | - APCI3120_CTR0_TIMER_SEL(timer), - dev->iobase + APCI3120_CTR0_REG); + APCI3120_CTR0_TIMER_SEL(timer), dev->iobase + APCI3120_CTR0_REG); val = inw(dev->iobase + APCI3120_TIMER_REG); if (timer == 2) { @@ -400,8 +397,7 @@ static void apci3120_set_chanlist(struct comedi_device *dev, unsigned int val; val = APCI3120_CHANLIST_MUX(chan) | - APCI3120_CHANLIST_GAIN(range) | - APCI3120_CHANLIST_INDEX(i); + APCI3120_CHANLIST_GAIN(range) | APCI3120_CHANLIST_INDEX(i); if (comedi_range_is_unipolar(s, range)) val |= APCI3120_CHANLIST_UNIPOLAR; @@ -479,8 +475,7 @@ static irqreturn_t apci3120_interrupt(int irq, void *d) status = inw(dev->iobase + APCI3120_STATUS_REG); int_amcc = inl(devpriv->amcc + AMCC_OP_REG_INTCSR); - if (!(status & APCI3120_STATUS_INT_MASK) && - !(int_amcc & ANY_S593X_INT)) { + if (!(status & APCI3120_STATUS_INT_MASK) && !(int_amcc & ANY_S593X_INT)) { dev_err(dev->class_dev, "IRQ from unknown source\n"); return IRQ_NONE; } @@ -542,7 +537,7 @@ static int apci3120_ai_cmd(struct comedi_device *dev, /* set default mode bits */ devpriv->mode = APCI3120_MODE_TIMER2_CLK_OSC | - APCI3120_MODE_TIMER2_AS_TIMER; + APCI3120_MODE_TIMER2_AS_TIMER; /* AMCC- Clear write complete interrupt (DMA) */ outl(AINT_WT_COMPLETE, devpriv->amcc + AMCC_OP_REG_INTCSR); @@ -637,7 +632,7 @@ static int apci3120_ai_cmdtest(struct comedi_device *dev, if (cmd->stop_src == TRIG_COUNT) err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); - else /* TRIG_NONE */ + else /* TRIG_NONE */ err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) @@ -689,8 +684,7 @@ static int apci3120_cancel(struct comedi_device *dev, static int apci3120_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned int status; @@ -702,8 +696,7 @@ static int apci3120_ai_eoc(struct comedi_device *dev, static int apci3120_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct apci3120_private *devpriv = dev->private; unsigned int divisor; @@ -712,7 +705,7 @@ static int apci3120_ai_insn_read(struct comedi_device *dev, /* set mode for A/D conversions by software trigger with timer 0 */ devpriv->mode = APCI3120_MODE_TIMER2_CLK_OSC | - APCI3120_MODE_TIMER2_AS_TIMER; + APCI3120_MODE_TIMER2_AS_TIMER; outb(devpriv->mode, dev->iobase + APCI3120_MODE_REG); /* load chanlist for single channel scan */ @@ -746,8 +739,7 @@ static int apci3120_ai_insn_read(struct comedi_device *dev, static int apci3120_ao_ready(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned int status; @@ -759,8 +751,7 @@ static int apci3120_ao_ready(struct comedi_device *dev, static int apci3120_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); int i; @@ -784,8 +775,7 @@ static int apci3120_ao_insn_write(struct comedi_device *dev, static int apci3120_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int status; @@ -797,8 +787,7 @@ static int apci3120_di_insn_bits(struct comedi_device *dev, static int apci3120_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct apci3120_private *devpriv = dev->private; @@ -841,7 +830,7 @@ static int apci3120_timer_insn_config(struct comedi_device *dev, case INSN_CONFIG_GET_COUNTER_STATUS: data[1] = 0; data[2] = COMEDI_COUNTER_ARMED | COMEDI_COUNTER_COUNTING | - COMEDI_COUNTER_TERMINAL_COUNT; + COMEDI_COUNTER_TERMINAL_COUNT; if (devpriv->ctrl & APCI3120_CTRL_GATE(2)) { data[1] |= COMEDI_COUNTER_ARMED; @@ -1016,64 +1005,64 @@ static int apci3120_auto_attach(struct comedi_device *dev, /* Analog Input subdevice */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_COMMON | SDF_GROUND | SDF_DIFF; - s->n_chan = 16; - s->maxdata = board->ai_is_16bit ? 0xffff : 0x0fff; - s->range_table = &apci3120_ai_range; - s->insn_read = apci3120_ai_insn_read; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_COMMON | SDF_GROUND | SDF_DIFF; + s->n_chan = 16; + s->maxdata = board->ai_is_16bit ? 0xffff : 0x0fff; + s->range_table = &apci3120_ai_range; + s->insn_read = apci3120_ai_insn_read; if (dev->irq) { dev->read_subdev = s; - s->subdev_flags |= SDF_CMD_READ; - s->len_chanlist = s->n_chan; - s->do_cmdtest = apci3120_ai_cmdtest; - s->do_cmd = apci3120_ai_cmd; - s->cancel = apci3120_cancel; + s->subdev_flags |= SDF_CMD_READ; + s->len_chanlist = s->n_chan; + s->do_cmdtest = apci3120_ai_cmdtest; + s->do_cmd = apci3120_ai_cmd; + s->cancel = apci3120_cancel; } /* Analog Output subdevice */ s = &dev->subdevices[1]; if (board->has_ao) { - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_COMMON; - s->n_chan = 8; - s->maxdata = 0x3fff; - s->range_table = &range_bipolar10; - s->insn_write = apci3120_ao_insn_write; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_COMMON; + s->n_chan = 8; + s->maxdata = 0x3fff; + s->range_table = &range_bipolar10; + s->insn_write = apci3120_ao_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) return ret; } else { - s->type = COMEDI_SUBD_UNUSED; + s->type = COMEDI_SUBD_UNUSED; } /* Digital Input subdevice */ s = &dev->subdevices[2]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 4; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = apci3120_di_insn_bits; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 4; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = apci3120_di_insn_bits; /* Digital Output subdevice */ s = &dev->subdevices[3]; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 4; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = apci3120_do_insn_bits; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 4; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = apci3120_do_insn_bits; /* Timer subdevice */ s = &dev->subdevices[4]; - s->type = COMEDI_SUBD_TIMER; - s->subdev_flags = SDF_READABLE; - s->n_chan = 1; - s->maxdata = 0x00ffffff; - s->insn_config = apci3120_timer_insn_config; - s->insn_read = apci3120_timer_insn_read; + s->type = COMEDI_SUBD_TIMER; + s->subdev_flags = SDF_READABLE; + s->n_chan = 1; + s->maxdata = 0x00ffffff; + s->insn_config = apci3120_timer_insn_config; + s->insn_read = apci3120_timer_insn_read; return 0; } @@ -1085,10 +1074,10 @@ static void apci3120_detach(struct comedi_device *dev) } static struct comedi_driver apci3120_driver = { - .driver_name = "addi_apci_3120", - .module = THIS_MODULE, - .auto_attach = apci3120_auto_attach, - .detach = apci3120_detach, + .driver_name = "addi_apci_3120", + .module = THIS_MODULE, + .auto_attach = apci3120_auto_attach, + .detach = apci3120_detach, }; static int apci3120_pci_probe(struct pci_dev *dev, @@ -1102,14 +1091,16 @@ static const struct pci_device_id apci3120_pci_table[] = { { PCI_VDEVICE(AMCC, 0x828d), BOARD_APCI3001 }, { 0 } }; + MODULE_DEVICE_TABLE(pci, apci3120_pci_table); static struct pci_driver apci3120_pci_driver = { - .name = "addi_apci_3120", - .id_table = apci3120_pci_table, - .probe = apci3120_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "addi_apci_3120", + .id_table = apci3120_pci_table, + .probe = apci3120_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(apci3120_driver, apci3120_pci_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/addi_apci_3501.c b/drivers/comedi/drivers/addi_apci_3501.c index f0c9642f3f1a..5e56a7ae05a3 100644 --- a/drivers/comedi/drivers/addi_apci_3501.c +++ b/drivers/comedi/drivers/addi_apci_3501.c @@ -87,9 +87,9 @@ struct apci3501_private { static const struct comedi_lrange apci3501_ao_range = { 2, { - BIP_RANGE(10), - UNI_RANGE(10) - } + BIP_RANGE(10), + UNI_RANGE(10) + } }; static int apci3501_wait_for_dac(struct comedi_device *dev) @@ -105,8 +105,7 @@ static int apci3501_wait_for_dac(struct comedi_device *dev) static int apci3501_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int range = CR_RANGE(insn->chanspec); @@ -116,8 +115,8 @@ static int apci3501_ao_insn_write(struct comedi_device *dev, /* * All analog output channels have the same output range. - * 14-bit bipolar: 0-10V - * 13-bit unipolar: +/-10V + * 14-bit bipolar: 0-10V + * 13-bit unipolar: +/-10V * Changing the range of one channel changes all of them! */ if (range) { @@ -154,8 +153,7 @@ static int apci3501_ao_insn_write(struct comedi_device *dev, static int apci3501_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { data[1] = inl(dev->iobase + APCI3501_DI_REG) & 0x3; @@ -164,8 +162,7 @@ static int apci3501_di_insn_bits(struct comedi_device *dev, static int apci3501_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { s->state = inl(dev->iobase + APCI3501_DO_REG); @@ -330,49 +327,49 @@ static int apci3501_auto_attach(struct comedi_device *dev, /* Initialize the analog output subdevice */ s = &dev->subdevices[0]; if (ao_n_chan) { - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_COMMON; - s->n_chan = ao_n_chan; - s->maxdata = 0x3fff; - s->range_table = &apci3501_ao_range; - s->insn_write = apci3501_ao_insn_write; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_COMMON; + s->n_chan = ao_n_chan; + s->maxdata = 0x3fff; + s->range_table = &apci3501_ao_range; + s->insn_write = apci3501_ao_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) return ret; } else { - s->type = COMEDI_SUBD_UNUSED; + s->type = COMEDI_SUBD_UNUSED; } /* Initialize the digital input subdevice */ s = &dev->subdevices[1]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 2; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = apci3501_di_insn_bits; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 2; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = apci3501_di_insn_bits; /* Initialize the digital output subdevice */ s = &dev->subdevices[2]; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 2; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = apci3501_do_insn_bits; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 2; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = apci3501_do_insn_bits; /* Timer/Watchdog subdevice */ s = &dev->subdevices[3]; - s->type = COMEDI_SUBD_UNUSED; + s->type = COMEDI_SUBD_UNUSED; /* Initialize the eeprom subdevice */ s = &dev->subdevices[4]; - s->type = COMEDI_SUBD_MEMORY; - s->subdev_flags = SDF_READABLE | SDF_INTERNAL; - s->n_chan = 256; - s->maxdata = 0xffff; - s->insn_read = apci3501_eeprom_insn_read; + s->type = COMEDI_SUBD_MEMORY; + s->subdev_flags = SDF_READABLE | SDF_INTERNAL; + s->n_chan = 256; + s->maxdata = 0xffff; + s->insn_read = apci3501_eeprom_insn_read; apci3501_reset(dev); return 0; @@ -386,10 +383,10 @@ static void apci3501_detach(struct comedi_device *dev) } static struct comedi_driver apci3501_driver = { - .driver_name = "addi_apci_3501", - .module = THIS_MODULE, - .auto_attach = apci3501_auto_attach, - .detach = apci3501_detach, + .driver_name = "addi_apci_3501", + .module = THIS_MODULE, + .auto_attach = apci3501_auto_attach, + .detach = apci3501_detach, }; static int apci3501_pci_probe(struct pci_dev *dev, @@ -402,14 +399,16 @@ static const struct pci_device_id apci3501_pci_table[] = { { PCI_DEVICE(PCI_VENDOR_ID_ADDIDATA, 0x3001) }, { 0 } }; + MODULE_DEVICE_TABLE(pci, apci3501_pci_table); static struct pci_driver apci3501_pci_driver = { - .name = "addi_apci_3501", - .id_table = apci3501_pci_table, - .probe = apci3501_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "addi_apci_3501", + .id_table = apci3501_pci_table, + .probe = apci3501_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(apci3501_driver, apci3501_pci_driver); MODULE_DESCRIPTION("ADDI-DATA APCI-3501 Analog output board"); diff --git a/drivers/comedi/drivers/addi_apci_3xxx.c b/drivers/comedi/drivers/addi_apci_3xxx.c index a90d59377e18..6a4339fdd557 100644 --- a/drivers/comedi/drivers/addi_apci_3xxx.c +++ b/drivers/comedi/drivers/addi_apci_3xxx.c @@ -24,22 +24,22 @@ static const struct comedi_lrange apci3xxx_ai_range = { 8, { - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(2), - BIP_RANGE(1), - UNI_RANGE(10), - UNI_RANGE(5), - UNI_RANGE(2), - UNI_RANGE(1) - } + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(2), + BIP_RANGE(1), + UNI_RANGE(10), + UNI_RANGE(5), + UNI_RANGE(2), + UNI_RANGE(1) + } }; static const struct comedi_lrange apci3xxx_ao_range = { 2, { - BIP_RANGE(10), - UNI_RANGE(10) - } + BIP_RANGE(10), + UNI_RANGE(10) + } }; enum apci3xxx_boardid { @@ -85,259 +85,279 @@ struct apci3xxx_boardinfo { static const struct apci3xxx_boardinfo apci3xxx_boardtypes[] = { [BOARD_APCI3000_16] = { - .name = "apci3000-16", - .ai_subdev_flags = SDF_COMMON | SDF_GROUND | SDF_DIFF, - .ai_n_chan = 16, - .ai_maxdata = 0x0fff, - .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, - .ai_min_acq_ns = 10000, - .has_ttl_io = 1, - }, + .name = "apci3000-16", + .ai_subdev_flags = + SDF_COMMON | SDF_GROUND | SDF_DIFF, + .ai_n_chan = 16, + .ai_maxdata = 0x0fff, + .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, + .ai_min_acq_ns = 10000, + .has_ttl_io = 1, + }, [BOARD_APCI3000_8] = { - .name = "apci3000-8", - .ai_subdev_flags = SDF_COMMON | SDF_GROUND | SDF_DIFF, - .ai_n_chan = 8, - .ai_maxdata = 0x0fff, - .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, - .ai_min_acq_ns = 10000, - .has_ttl_io = 1, - }, + .name = "apci3000-8", + .ai_subdev_flags = + SDF_COMMON | SDF_GROUND | SDF_DIFF, + .ai_n_chan = 8, + .ai_maxdata = 0x0fff, + .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, + .ai_min_acq_ns = 10000, + .has_ttl_io = 1, + }, [BOARD_APCI3000_4] = { - .name = "apci3000-4", - .ai_subdev_flags = SDF_COMMON | SDF_GROUND | SDF_DIFF, - .ai_n_chan = 4, - .ai_maxdata = 0x0fff, - .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, - .ai_min_acq_ns = 10000, - .has_ttl_io = 1, - }, + .name = "apci3000-4", + .ai_subdev_flags = + SDF_COMMON | SDF_GROUND | SDF_DIFF, + .ai_n_chan = 4, + .ai_maxdata = 0x0fff, + .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, + .ai_min_acq_ns = 10000, + .has_ttl_io = 1, + }, [BOARD_APCI3006_16] = { - .name = "apci3006-16", - .ai_subdev_flags = SDF_COMMON | SDF_GROUND | SDF_DIFF, - .ai_n_chan = 16, - .ai_maxdata = 0xffff, - .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, - .ai_min_acq_ns = 10000, - .has_ttl_io = 1, - }, + .name = "apci3006-16", + .ai_subdev_flags = + SDF_COMMON | SDF_GROUND | SDF_DIFF, + .ai_n_chan = 16, + .ai_maxdata = 0xffff, + .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, + .ai_min_acq_ns = 10000, + .has_ttl_io = 1, + }, [BOARD_APCI3006_8] = { - .name = "apci3006-8", - .ai_subdev_flags = SDF_COMMON | SDF_GROUND | SDF_DIFF, - .ai_n_chan = 8, - .ai_maxdata = 0xffff, - .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, - .ai_min_acq_ns = 10000, - .has_ttl_io = 1, - }, + .name = "apci3006-8", + .ai_subdev_flags = + SDF_COMMON | SDF_GROUND | SDF_DIFF, + .ai_n_chan = 8, + .ai_maxdata = 0xffff, + .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, + .ai_min_acq_ns = 10000, + .has_ttl_io = 1, + }, [BOARD_APCI3006_4] = { - .name = "apci3006-4", - .ai_subdev_flags = SDF_COMMON | SDF_GROUND | SDF_DIFF, - .ai_n_chan = 4, - .ai_maxdata = 0xffff, - .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, - .ai_min_acq_ns = 10000, - .has_ttl_io = 1, - }, + .name = "apci3006-4", + .ai_subdev_flags = + SDF_COMMON | SDF_GROUND | SDF_DIFF, + .ai_n_chan = 4, + .ai_maxdata = 0xffff, + .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, + .ai_min_acq_ns = 10000, + .has_ttl_io = 1, + }, [BOARD_APCI3010_16] = { - .name = "apci3010-16", - .ai_subdev_flags = SDF_COMMON | SDF_GROUND | SDF_DIFF, - .ai_n_chan = 16, - .ai_maxdata = 0x0fff, - .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, - .ai_min_acq_ns = 5000, - .has_dig_in = 1, - .has_dig_out = 1, - .has_ttl_io = 1, - }, + .name = "apci3010-16", + .ai_subdev_flags = + SDF_COMMON | SDF_GROUND | SDF_DIFF, + .ai_n_chan = 16, + .ai_maxdata = 0x0fff, + .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, + .ai_min_acq_ns = 5000, + .has_dig_in = 1, + .has_dig_out = 1, + .has_ttl_io = 1, + }, [BOARD_APCI3010_8] = { - .name = "apci3010-8", - .ai_subdev_flags = SDF_COMMON | SDF_GROUND | SDF_DIFF, - .ai_n_chan = 8, - .ai_maxdata = 0x0fff, - .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, - .ai_min_acq_ns = 5000, - .has_dig_in = 1, - .has_dig_out = 1, - .has_ttl_io = 1, - }, + .name = "apci3010-8", + .ai_subdev_flags = + SDF_COMMON | SDF_GROUND | SDF_DIFF, + .ai_n_chan = 8, + .ai_maxdata = 0x0fff, + .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, + .ai_min_acq_ns = 5000, + .has_dig_in = 1, + .has_dig_out = 1, + .has_ttl_io = 1, + }, [BOARD_APCI3010_4] = { - .name = "apci3010-4", - .ai_subdev_flags = SDF_COMMON | SDF_GROUND | SDF_DIFF, - .ai_n_chan = 4, - .ai_maxdata = 0x0fff, - .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, - .ai_min_acq_ns = 5000, - .has_dig_in = 1, - .has_dig_out = 1, - .has_ttl_io = 1, - }, + .name = "apci3010-4", + .ai_subdev_flags = + SDF_COMMON | SDF_GROUND | SDF_DIFF, + .ai_n_chan = 4, + .ai_maxdata = 0x0fff, + .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, + .ai_min_acq_ns = 5000, + .has_dig_in = 1, + .has_dig_out = 1, + .has_ttl_io = 1, + }, [BOARD_APCI3016_16] = { - .name = "apci3016-16", - .ai_subdev_flags = SDF_COMMON | SDF_GROUND | SDF_DIFF, - .ai_n_chan = 16, - .ai_maxdata = 0xffff, - .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, - .ai_min_acq_ns = 5000, - .has_dig_in = 1, - .has_dig_out = 1, - .has_ttl_io = 1, - }, + .name = "apci3016-16", + .ai_subdev_flags = + SDF_COMMON | SDF_GROUND | SDF_DIFF, + .ai_n_chan = 16, + .ai_maxdata = 0xffff, + .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, + .ai_min_acq_ns = 5000, + .has_dig_in = 1, + .has_dig_out = 1, + .has_ttl_io = 1, + }, [BOARD_APCI3016_8] = { - .name = "apci3016-8", - .ai_subdev_flags = SDF_COMMON | SDF_GROUND | SDF_DIFF, - .ai_n_chan = 8, - .ai_maxdata = 0xffff, - .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, - .ai_min_acq_ns = 5000, - .has_dig_in = 1, - .has_dig_out = 1, - .has_ttl_io = 1, - }, + .name = "apci3016-8", + .ai_subdev_flags = + SDF_COMMON | SDF_GROUND | SDF_DIFF, + .ai_n_chan = 8, + .ai_maxdata = 0xffff, + .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, + .ai_min_acq_ns = 5000, + .has_dig_in = 1, + .has_dig_out = 1, + .has_ttl_io = 1, + }, [BOARD_APCI3016_4] = { - .name = "apci3016-4", - .ai_subdev_flags = SDF_COMMON | SDF_GROUND | SDF_DIFF, - .ai_n_chan = 4, - .ai_maxdata = 0xffff, - .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, - .ai_min_acq_ns = 5000, - .has_dig_in = 1, - .has_dig_out = 1, - .has_ttl_io = 1, - }, + .name = "apci3016-4", + .ai_subdev_flags = + SDF_COMMON | SDF_GROUND | SDF_DIFF, + .ai_n_chan = 4, + .ai_maxdata = 0xffff, + .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, + .ai_min_acq_ns = 5000, + .has_dig_in = 1, + .has_dig_out = 1, + .has_ttl_io = 1, + }, [BOARD_APCI3100_16_4] = { - .name = "apci3100-16-4", - .ai_subdev_flags = SDF_COMMON | SDF_GROUND | SDF_DIFF, - .ai_n_chan = 16, - .ai_maxdata = 0x0fff, - .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, - .ai_min_acq_ns = 10000, - .has_ao = 1, - .has_ttl_io = 1, - }, + .name = "apci3100-16-4", + .ai_subdev_flags = + SDF_COMMON | SDF_GROUND | SDF_DIFF, + .ai_n_chan = 16, + .ai_maxdata = 0x0fff, + .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, + .ai_min_acq_ns = 10000, + .has_ao = 1, + .has_ttl_io = 1, + }, [BOARD_APCI3100_8_4] = { - .name = "apci3100-8-4", - .ai_subdev_flags = SDF_COMMON | SDF_GROUND | SDF_DIFF, - .ai_n_chan = 8, - .ai_maxdata = 0x0fff, - .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, - .ai_min_acq_ns = 10000, - .has_ao = 1, - .has_ttl_io = 1, - }, + .name = "apci3100-8-4", + .ai_subdev_flags = + SDF_COMMON | SDF_GROUND | SDF_DIFF, + .ai_n_chan = 8, + .ai_maxdata = 0x0fff, + .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, + .ai_min_acq_ns = 10000, + .has_ao = 1, + .has_ttl_io = 1, + }, [BOARD_APCI3106_16_4] = { - .name = "apci3106-16-4", - .ai_subdev_flags = SDF_COMMON | SDF_GROUND | SDF_DIFF, - .ai_n_chan = 16, - .ai_maxdata = 0xffff, - .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, - .ai_min_acq_ns = 10000, - .has_ao = 1, - .has_ttl_io = 1, - }, + .name = "apci3106-16-4", + .ai_subdev_flags = + SDF_COMMON | SDF_GROUND | SDF_DIFF, + .ai_n_chan = 16, + .ai_maxdata = 0xffff, + .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, + .ai_min_acq_ns = 10000, + .has_ao = 1, + .has_ttl_io = 1, + }, [BOARD_APCI3106_8_4] = { - .name = "apci3106-8-4", - .ai_subdev_flags = SDF_COMMON | SDF_GROUND | SDF_DIFF, - .ai_n_chan = 8, - .ai_maxdata = 0xffff, - .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, - .ai_min_acq_ns = 10000, - .has_ao = 1, - .has_ttl_io = 1, - }, + .name = "apci3106-8-4", + .ai_subdev_flags = + SDF_COMMON | SDF_GROUND | SDF_DIFF, + .ai_n_chan = 8, + .ai_maxdata = 0xffff, + .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, + .ai_min_acq_ns = 10000, + .has_ao = 1, + .has_ttl_io = 1, + }, [BOARD_APCI3110_16_4] = { - .name = "apci3110-16-4", - .ai_subdev_flags = SDF_COMMON | SDF_GROUND | SDF_DIFF, - .ai_n_chan = 16, - .ai_maxdata = 0x0fff, - .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, - .ai_min_acq_ns = 5000, - .has_ao = 1, - .has_dig_in = 1, - .has_dig_out = 1, - .has_ttl_io = 1, - }, + .name = "apci3110-16-4", + .ai_subdev_flags = + SDF_COMMON | SDF_GROUND | SDF_DIFF, + .ai_n_chan = 16, + .ai_maxdata = 0x0fff, + .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, + .ai_min_acq_ns = 5000, + .has_ao = 1, + .has_dig_in = 1, + .has_dig_out = 1, + .has_ttl_io = 1, + }, [BOARD_APCI3110_8_4] = { - .name = "apci3110-8-4", - .ai_subdev_flags = SDF_COMMON | SDF_GROUND | SDF_DIFF, - .ai_n_chan = 8, - .ai_maxdata = 0x0fff, - .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, - .ai_min_acq_ns = 5000, - .has_ao = 1, - .has_dig_in = 1, - .has_dig_out = 1, - .has_ttl_io = 1, - }, + .name = "apci3110-8-4", + .ai_subdev_flags = + SDF_COMMON | SDF_GROUND | SDF_DIFF, + .ai_n_chan = 8, + .ai_maxdata = 0x0fff, + .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, + .ai_min_acq_ns = 5000, + .has_ao = 1, + .has_dig_in = 1, + .has_dig_out = 1, + .has_ttl_io = 1, + }, [BOARD_APCI3116_16_4] = { - .name = "apci3116-16-4", - .ai_subdev_flags = SDF_COMMON | SDF_GROUND | SDF_DIFF, - .ai_n_chan = 16, - .ai_maxdata = 0xffff, - .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, - .ai_min_acq_ns = 5000, - .has_ao = 1, - .has_dig_in = 1, - .has_dig_out = 1, - .has_ttl_io = 1, - }, + .name = "apci3116-16-4", + .ai_subdev_flags = + SDF_COMMON | SDF_GROUND | SDF_DIFF, + .ai_n_chan = 16, + .ai_maxdata = 0xffff, + .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, + .ai_min_acq_ns = 5000, + .has_ao = 1, + .has_dig_in = 1, + .has_dig_out = 1, + .has_ttl_io = 1, + }, [BOARD_APCI3116_8_4] = { - .name = "apci3116-8-4", - .ai_subdev_flags = SDF_COMMON | SDF_GROUND | SDF_DIFF, - .ai_n_chan = 8, - .ai_maxdata = 0xffff, - .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, - .ai_min_acq_ns = 5000, - .has_ao = 1, - .has_dig_in = 1, - .has_dig_out = 1, - .has_ttl_io = 1, - }, + .name = "apci3116-8-4", + .ai_subdev_flags = + SDF_COMMON | SDF_GROUND | SDF_DIFF, + .ai_n_chan = 8, + .ai_maxdata = 0xffff, + .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, + .ai_min_acq_ns = 5000, + .has_ao = 1, + .has_dig_in = 1, + .has_dig_out = 1, + .has_ttl_io = 1, + }, [BOARD_APCI3003] = { - .name = "apci3003", - .ai_subdev_flags = SDF_DIFF, - .ai_n_chan = 4, - .ai_maxdata = 0xffff, - .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US | - CONV_UNIT_NS, - .ai_min_acq_ns = 2500, - .has_dig_in = 1, - .has_dig_out = 1, - }, + .name = "apci3003", + .ai_subdev_flags = SDF_DIFF, + .ai_n_chan = 4, + .ai_maxdata = 0xffff, + .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US | + CONV_UNIT_NS, + .ai_min_acq_ns = 2500, + .has_dig_in = 1, + .has_dig_out = 1, + }, [BOARD_APCI3002_16] = { - .name = "apci3002-16", - .ai_subdev_flags = SDF_DIFF, - .ai_n_chan = 16, - .ai_maxdata = 0xffff, - .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, - .ai_min_acq_ns = 5000, - .has_dig_in = 1, - .has_dig_out = 1, - }, + .name = "apci3002-16", + .ai_subdev_flags = SDF_DIFF, + .ai_n_chan = 16, + .ai_maxdata = 0xffff, + .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, + .ai_min_acq_ns = 5000, + .has_dig_in = 1, + .has_dig_out = 1, + }, [BOARD_APCI3002_8] = { - .name = "apci3002-8", - .ai_subdev_flags = SDF_DIFF, - .ai_n_chan = 8, - .ai_maxdata = 0xffff, - .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, - .ai_min_acq_ns = 5000, - .has_dig_in = 1, - .has_dig_out = 1, - }, + .name = "apci3002-8", + .ai_subdev_flags = SDF_DIFF, + .ai_n_chan = 8, + .ai_maxdata = 0xffff, + .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, + .ai_min_acq_ns = 5000, + .has_dig_in = 1, + .has_dig_out = 1, + }, [BOARD_APCI3002_4] = { - .name = "apci3002-4", - .ai_subdev_flags = SDF_DIFF, - .ai_n_chan = 4, - .ai_maxdata = 0xffff, - .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, - .ai_min_acq_ns = 5000, - .has_dig_in = 1, - .has_dig_out = 1, - }, + .name = "apci3002-4", + .ai_subdev_flags = SDF_DIFF, + .ai_n_chan = 4, + .ai_maxdata = 0xffff, + .ai_conv_units = CONV_UNIT_MS | CONV_UNIT_US, + .ai_min_acq_ns = 5000, + .has_dig_in = 1, + .has_dig_out = 1, + }, [BOARD_APCI3500] = { - .name = "apci3500", - .has_ao = 1, - .has_ttl_io = 1, - }, + .name = "apci3500", + .has_ao = 1, + .has_ttl_io = 1, + }, }; struct apci3xxx_private { @@ -399,8 +419,7 @@ static int apci3xxx_ai_setup(struct comedi_device *dev, unsigned int chanspec) writel(delay_mode, dev->mmio + 4); /* Make the configuration */ - val = (range & 3) | ((range >> 2) << 6) | - ((aref == AREF_DIFF) << 7); + val = (range & 3) | ((range >> 2) << 6) | ((aref == AREF_DIFF) << 7); writel(val, dev->mmio + 0); /* Channel selection */ @@ -418,8 +437,7 @@ static int apci3xxx_ai_setup(struct comedi_device *dev, unsigned int chanspec) static int apci3xxx_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned int status; @@ -431,8 +449,7 @@ static int apci3xxx_ai_eoc(struct comedi_device *dev, static int apci3xxx_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { int ret; int i; @@ -546,7 +563,7 @@ static int apci3xxx_ai_cmdtest(struct comedi_device *dev, if (cmd->stop_src == TRIG_COUNT) err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); - else /* TRIG_NONE */ + else /* TRIG_NONE */ err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) @@ -595,8 +612,7 @@ static int apci3xxx_ai_cancel(struct comedi_device *dev, static int apci3xxx_ao_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned int status; @@ -608,8 +624,7 @@ static int apci3xxx_ao_eoc(struct comedi_device *dev, static int apci3xxx_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int range = CR_RANGE(insn->chanspec); @@ -638,8 +653,7 @@ static int apci3xxx_ao_insn_write(struct comedi_device *dev, static int apci3xxx_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { data[1] = inl(dev->iobase + 32) & 0xf; @@ -648,8 +662,7 @@ static int apci3xxx_di_insn_bits(struct comedi_device *dev, static int apci3xxx_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { s->state = inl(dev->iobase + 48) & 0xf; @@ -696,8 +709,7 @@ static int apci3xxx_dio_insn_config(struct comedi_device *dev, static int apci3xxx_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int mask; unsigned int val; @@ -789,8 +801,7 @@ static int apci3xxx_auto_attach(struct comedi_device *dev, } n_subdevices = (board->ai_n_chan ? 0 : 1) + board->has_ao + - board->has_dig_in + board->has_dig_out + - board->has_ttl_io; + board->has_dig_in + board->has_dig_out + board->has_ttl_io; ret = comedi_alloc_subdevices(dev, n_subdevices); if (ret) return ret; @@ -800,12 +811,12 @@ static int apci3xxx_auto_attach(struct comedi_device *dev, /* Analog Input subdevice */ if (board->ai_n_chan) { s = &dev->subdevices[subdev]; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | board->ai_subdev_flags; - s->n_chan = board->ai_n_chan; - s->maxdata = board->ai_maxdata; - s->range_table = &apci3xxx_ai_range; - s->insn_read = apci3xxx_ai_insn_read; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | board->ai_subdev_flags; + s->n_chan = board->ai_n_chan; + s->maxdata = board->ai_maxdata; + s->range_table = &apci3xxx_ai_range; + s->insn_read = apci3xxx_ai_insn_read; if (dev->irq) { /* * FIXME: The hardware supports multiple scan modes @@ -826,11 +837,11 @@ static int apci3xxx_auto_attach(struct comedi_device *dev, * For now, limit the chanlist to a single channel. */ dev->read_subdev = s; - s->subdev_flags |= SDF_CMD_READ; - s->len_chanlist = 1; - s->do_cmdtest = apci3xxx_ai_cmdtest; - s->do_cmd = apci3xxx_ai_cmd; - s->cancel = apci3xxx_ai_cancel; + s->subdev_flags |= SDF_CMD_READ; + s->len_chanlist = 1; + s->do_cmdtest = apci3xxx_ai_cmdtest; + s->do_cmd = apci3xxx_ai_cmd; + s->cancel = apci3xxx_ai_cancel; } subdev++; @@ -839,12 +850,12 @@ static int apci3xxx_auto_attach(struct comedi_device *dev, /* Analog Output subdevice */ if (board->has_ao) { s = &dev->subdevices[subdev]; - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_COMMON; - s->n_chan = 4; - s->maxdata = 0x0fff; - s->range_table = &apci3xxx_ao_range; - s->insn_write = apci3xxx_ao_insn_write; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_COMMON; + s->n_chan = 4; + s->maxdata = 0x0fff; + s->range_table = &apci3xxx_ao_range; + s->insn_write = apci3xxx_ao_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) @@ -856,12 +867,12 @@ static int apci3xxx_auto_attach(struct comedi_device *dev, /* Digital Input subdevice */ if (board->has_dig_in) { s = &dev->subdevices[subdev]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 4; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = apci3xxx_di_insn_bits; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 4; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = apci3xxx_di_insn_bits; subdev++; } @@ -869,12 +880,12 @@ static int apci3xxx_auto_attach(struct comedi_device *dev, /* Digital Output subdevice */ if (board->has_dig_out) { s = &dev->subdevices[subdev]; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 4; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = apci3xxx_do_insn_bits; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 4; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = apci3xxx_do_insn_bits; subdev++; } @@ -882,14 +893,14 @@ static int apci3xxx_auto_attach(struct comedi_device *dev, /* TTL Digital I/O subdevice */ if (board->has_ttl_io) { s = &dev->subdevices[subdev]; - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 24; - s->maxdata = 1; - s->io_bits = 0xff; /* channels 0-7 are always outputs */ - s->range_table = &range_digital; - s->insn_config = apci3xxx_dio_insn_config; - s->insn_bits = apci3xxx_dio_insn_bits; + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 24; + s->maxdata = 1; + s->io_bits = 0xff; /* channels 0-7 are always outputs */ + s->range_table = &range_digital; + s->insn_config = apci3xxx_dio_insn_config; + s->insn_bits = apci3xxx_dio_insn_bits; subdev++; } @@ -906,10 +917,10 @@ static void apci3xxx_detach(struct comedi_device *dev) } static struct comedi_driver apci3xxx_driver = { - .driver_name = "addi_apci_3xxx", - .module = THIS_MODULE, - .auto_attach = apci3xxx_auto_attach, - .detach = apci3xxx_detach, + .driver_name = "addi_apci_3xxx", + .module = THIS_MODULE, + .auto_attach = apci3xxx_auto_attach, + .detach = apci3xxx_detach, }; static int apci3xxx_pci_probe(struct pci_dev *dev, @@ -946,14 +957,16 @@ static const struct pci_device_id apci3xxx_pci_table[] = { { PCI_VDEVICE(ADDIDATA, 0x3024), BOARD_APCI3500 }, { 0 } }; + MODULE_DEVICE_TABLE(pci, apci3xxx_pci_table); static struct pci_driver apci3xxx_pci_driver = { - .name = "addi_apci_3xxx", - .id_table = apci3xxx_pci_table, - .probe = apci3xxx_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "addi_apci_3xxx", + .id_table = apci3xxx_pci_table, + .probe = apci3xxx_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(apci3xxx_driver, apci3xxx_pci_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/addi_watchdog.c b/drivers/comedi/drivers/addi_watchdog.c index 69b323fb869f..8d1c875a5fb2 100644 --- a/drivers/comedi/drivers/addi_watchdog.c +++ b/drivers/comedi/drivers/addi_watchdog.c @@ -61,8 +61,7 @@ static int addi_watchdog_insn_config(struct comedi_device *dev, static int addi_watchdog_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct addi_watchdog_private *spriv = s->private; int i; @@ -100,6 +99,7 @@ void addi_watchdog_reset(unsigned long iobase) outl(0x0, iobase + ADDI_TCW_CTRL_REG); outl(0x0, iobase + ADDI_TCW_RELOAD_REG); } + EXPORT_SYMBOL_GPL(addi_watchdog_reset); int addi_watchdog_init(struct comedi_subdevice *s, unsigned long iobase) @@ -112,27 +112,30 @@ int addi_watchdog_init(struct comedi_subdevice *s, unsigned long iobase) spriv->iobase = iobase; - s->type = COMEDI_SUBD_TIMER; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 1; - s->maxdata = 0xff; - s->insn_config = addi_watchdog_insn_config; - s->insn_read = addi_watchdog_insn_read; - s->insn_write = addi_watchdog_insn_write; + s->type = COMEDI_SUBD_TIMER; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 1; + s->maxdata = 0xff; + s->insn_config = addi_watchdog_insn_config; + s->insn_read = addi_watchdog_insn_read; + s->insn_write = addi_watchdog_insn_write; return 0; } + EXPORT_SYMBOL_GPL(addi_watchdog_init); static int __init addi_watchdog_module_init(void) { return 0; } + module_init(addi_watchdog_module_init); static void __exit addi_watchdog_module_exit(void) { } + module_exit(addi_watchdog_module_exit); MODULE_DESCRIPTION("ADDI-DATA Watchdog subdevice"); diff --git a/drivers/comedi/drivers/adl_pci6208.c b/drivers/comedi/drivers/adl_pci6208.c index 9ae4cc523dd4..379de3c0d532 100644 --- a/drivers/comedi/drivers/adl_pci6208.c +++ b/drivers/comedi/drivers/adl_pci6208.c @@ -41,8 +41,7 @@ static int pci6208_ao_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned int status; @@ -54,8 +53,7 @@ static int pci6208_ao_eoc(struct comedi_device *dev, static int pci6208_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); int ret; @@ -81,8 +79,7 @@ static int pci6208_ao_insn_write(struct comedi_device *dev, static int pci6208_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int val; @@ -96,8 +93,7 @@ static int pci6208_di_insn_bits(struct comedi_device *dev, static int pci6208_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { if (comedi_dio_update_state(s, data)) outw(s->state, dev->iobase + PCI6208_DIO); @@ -126,12 +122,12 @@ static int pci6208_auto_attach(struct comedi_device *dev, s = &dev->subdevices[0]; /* analog output subdevice */ - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 16; /* Only 8 usable on PCI-6208 */ - s->maxdata = 0xffff; - s->range_table = &range_bipolar10; - s->insn_write = pci6208_ao_insn_write; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 16; /* Only 8 usable on PCI-6208 */ + s->maxdata = 0xffff; + s->range_table = &range_bipolar10; + s->insn_write = pci6208_ao_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) @@ -139,21 +135,21 @@ static int pci6208_auto_attach(struct comedi_device *dev, s = &dev->subdevices[1]; /* digital input subdevice */ - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 4; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = pci6208_di_insn_bits; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 4; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = pci6208_di_insn_bits; s = &dev->subdevices[2]; /* digital output subdevice */ - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 4; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = pci6208_do_insn_bits; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 4; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = pci6208_do_insn_bits; /* * Get the read back signals from the digital outputs @@ -161,16 +157,16 @@ static int pci6208_auto_attach(struct comedi_device *dev, */ val = inw(dev->iobase + PCI6208_DIO); val = (val & PCI6208_DIO_DO_MASK) >> PCI6208_DIO_DO_SHIFT; - s->state = val; + s->state = val; return 0; } static struct comedi_driver adl_pci6208_driver = { - .driver_name = "adl_pci6208", - .module = THIS_MODULE, - .auto_attach = pci6208_auto_attach, - .detach = comedi_pci_detach, + .driver_name = "adl_pci6208", + .module = THIS_MODULE, + .auto_attach = pci6208_auto_attach, + .detach = comedi_pci_detach, }; static int adl_pci6208_pci_probe(struct pci_dev *dev, @@ -186,14 +182,16 @@ static const struct pci_device_id adl_pci6208_pci_table[] = { 0x9999, 0x6208) }, { 0 } }; + MODULE_DEVICE_TABLE(pci, adl_pci6208_pci_table); static struct pci_driver adl_pci6208_pci_driver = { - .name = "adl_pci6208", - .id_table = adl_pci6208_pci_table, - .probe = adl_pci6208_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "adl_pci6208", + .id_table = adl_pci6208_pci_table, + .probe = adl_pci6208_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(adl_pci6208_driver, adl_pci6208_pci_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/adl_pci7x3x.c b/drivers/comedi/drivers/adl_pci7x3x.c index 8fc45638ff59..cd771c26d16a 100644 --- a/drivers/comedi/drivers/adl_pci7x3x.c +++ b/drivers/comedi/drivers/adl_pci7x3x.c @@ -83,38 +83,38 @@ struct adl_pci7x3x_boardinfo { static const struct adl_pci7x3x_boardinfo adl_pci7x3x_boards[] = { [BOARD_PCI7230] = { - .name = "adl_pci7230", - .nsubdevs = 4, /* IDI, IDO, IRQ_IDI0, IRQ_IDI1 */ - .di_nchan = 16, - .do_nchan = 16, - .irq_nchan = 2, - }, + .name = "adl_pci7230", + .nsubdevs = 4, /* IDI, IDO, IRQ_IDI0, IRQ_IDI1 */ + .di_nchan = 16, + .do_nchan = 16, + .irq_nchan = 2, + }, [BOARD_PCI7233] = { - .name = "adl_pci7233", - .nsubdevs = 1, - .di_nchan = 32, - }, + .name = "adl_pci7233", + .nsubdevs = 1, + .di_nchan = 32, + }, [BOARD_PCI7234] = { - .name = "adl_pci7234", - .nsubdevs = 1, - .do_nchan = 32, - }, + .name = "adl_pci7234", + .nsubdevs = 1, + .do_nchan = 32, + }, [BOARD_PCI7432] = { - .name = "adl_pci7432", - .nsubdevs = 2, - .di_nchan = 32, - .do_nchan = 32, - }, + .name = "adl_pci7432", + .nsubdevs = 2, + .di_nchan = 32, + .do_nchan = 32, + }, [BOARD_PCI7433] = { - .name = "adl_pci7433", - .nsubdevs = 2, - .di_nchan = 64, - }, + .name = "adl_pci7433", + .nsubdevs = 2, + .di_nchan = 64, + }, [BOARD_PCI7434] = { - .name = "adl_pci7434", - .nsubdevs = 2, - .do_nchan = 64, - } + .name = "adl_pci7434", + .nsubdevs = 2, + .do_nchan = 64, + } }; struct adl_pci7x3x_dev_private_data { @@ -123,7 +123,7 @@ struct adl_pci7x3x_dev_private_data { }; struct adl_pci7x3x_sd_private_data { - spinlock_t subd_slock; /* spin-lock for cmd_running */ + spinlock_t subd_slock; /* spin-lock for cmd_running */ unsigned long port_offset; short int cmd_running; }; @@ -173,12 +173,12 @@ static irqreturn_t adl_pci7x3x_interrupt(int irq, void *p_device) } spin_unlock_irqrestore(&dev->spinlock, cpu_flags); - /* SubDev 2, 3 = Isolated DigIn , on "SCSI2" jack!*/ + /* SubDev 2, 3 = Isolated DigIn , on "SCSI2" jack! */ - if (li1stat) /* 0x0005 LINTi1 is Enabled && IDI0 is 1 */ + if (li1stat) /* 0x0005 LINTi1 is Enabled && IDI0 is 1 */ process_irq(dev, 2, intcsr); - if (li2stat) /* 0x0028 LINTi2 is Enabled && IDI1 is 1 */ + if (li2stat) /* 0x0028 LINTi2 is Enabled && IDI1 is 1 */ process_irq(dev, 3, intcsr); return IRQ_RETVAL(li1stat || li2stat); @@ -333,7 +333,7 @@ static int adl_pci7x3x_reset(struct comedi_device *dev) struct adl_pci7x3x_dev_private_data *dev_private = dev->private; /* disable Interrupts */ - dev_private->int_ctrl = 0x00; /* Disable PCI + LINTi2 + LINTi1 */ + dev_private->int_ctrl = 0x00; /* Disable PCI + LINTi2 + LINTi1 */ outl(dev_private->int_ctrl, dev_private->lcr_io_base + PLX9052_INTCSR); return 0; @@ -398,14 +398,14 @@ static int adl_pci7x3x_auto_attach(struct comedi_device *dev, s = &dev->subdevices[subdev]; /* Isolated digital inputs 0 to 15/31 */ - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = nchan; - s->maxdata = 1; - s->insn_bits = adl_pci7x3x_di_insn_bits; - s->range_table = &range_digital; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = nchan; + s->maxdata = 1; + s->insn_bits = adl_pci7x3x_di_insn_bits; + s->range_table = &range_digital; - s->private = (void *)PCI7X3X_DIO_REG; + s->private = (void *)PCI7X3X_DIO_REG; subdev++; @@ -413,14 +413,14 @@ static int adl_pci7x3x_auto_attach(struct comedi_device *dev, if (nchan) { s = &dev->subdevices[subdev]; /* Isolated digital inputs 32 to 63 */ - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = nchan; - s->maxdata = 1; - s->insn_bits = adl_pci7x3x_di_insn_bits; - s->range_table = &range_digital; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = nchan; + s->maxdata = 1; + s->insn_bits = adl_pci7x3x_di_insn_bits; + s->range_table = &range_digital; - s->private = (void *)PCI743X_DIO_REG; + s->private = (void *)PCI743X_DIO_REG; subdev++; } @@ -431,14 +431,14 @@ static int adl_pci7x3x_auto_attach(struct comedi_device *dev, s = &dev->subdevices[subdev]; /* Isolated digital outputs 0 to 15/31 */ - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = nchan; - s->maxdata = 1; - s->insn_bits = adl_pci7x3x_do_insn_bits; - s->range_table = &range_digital; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = nchan; + s->maxdata = 1; + s->insn_bits = adl_pci7x3x_do_insn_bits; + s->range_table = &range_digital; - s->private = (void *)PCI7X3X_DIO_REG; + s->private = (void *)PCI7X3X_DIO_REG; subdev++; @@ -446,14 +446,14 @@ static int adl_pci7x3x_auto_attach(struct comedi_device *dev, if (nchan) { s = &dev->subdevices[subdev]; /* Isolated digital outputs 32 to 63 */ - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = nchan; - s->maxdata = 1; - s->insn_bits = adl_pci7x3x_do_insn_bits; - s->range_table = &range_digital; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = nchan; + s->maxdata = 1; + s->insn_bits = adl_pci7x3x_do_insn_bits; + s->range_table = &range_digital; - s->private = (void *)PCI743X_DIO_REG; + s->private = (void *)PCI743X_DIO_REG; subdev++; } @@ -466,12 +466,12 @@ static int adl_pci7x3x_auto_attach(struct comedi_device *dev, s = &dev->subdevices[subdev]; /* Isolated digital inputs 0 or 1 */ - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = nchan; - s->maxdata = 1; - s->insn_bits = adl_pci7x3x_dirq_insn_bits; - s->range_table = &range_digital; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = nchan; + s->maxdata = 1; + s->insn_bits = adl_pci7x3x_dirq_insn_bits; + s->range_table = &range_digital; sd_priv = comedi_alloc_spriv(s, sizeof(*sd_priv)); if (!sd_priv) @@ -483,12 +483,12 @@ static int adl_pci7x3x_auto_attach(struct comedi_device *dev, if (dev->irq) { dev->read_subdev = s; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE | SDF_CMD_READ; - s->len_chanlist = 1; - s->do_cmdtest = adl_pci7x3x_asy_cmdtest; - s->do_cmd = adl_pci7x3x_asy_cmd; - s->cancel = adl_pci7x3x_asy_cancel; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE | SDF_CMD_READ; + s->len_chanlist = 1; + s->do_cmdtest = adl_pci7x3x_asy_cmdtest; + s->do_cmd = adl_pci7x3x_asy_cmd; + s->cancel = adl_pci7x3x_asy_cancel; } subdev++; @@ -505,10 +505,10 @@ static void adl_pci7x3x_detach(struct comedi_device *dev) } static struct comedi_driver adl_pci7x3x_driver = { - .driver_name = "adl_pci7x3x", - .module = THIS_MODULE, - .auto_attach = adl_pci7x3x_auto_attach, - .detach = adl_pci7x3x_detach, + .driver_name = "adl_pci7x3x", + .module = THIS_MODULE, + .auto_attach = adl_pci7x3x_auto_attach, + .detach = adl_pci7x3x_detach, }; static int adl_pci7x3x_pci_probe(struct pci_dev *dev, @@ -527,14 +527,16 @@ static const struct pci_device_id adl_pci7x3x_pci_table[] = { { PCI_VDEVICE(ADLINK, 0x7434), BOARD_PCI7434 }, { 0 } }; + MODULE_DEVICE_TABLE(pci, adl_pci7x3x_pci_table); static struct pci_driver adl_pci7x3x_pci_driver = { - .name = "adl_pci7x3x", - .id_table = adl_pci7x3x_pci_table, - .probe = adl_pci7x3x_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "adl_pci7x3x", + .id_table = adl_pci7x3x_pci_table, + .probe = adl_pci7x3x_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(adl_pci7x3x_driver, adl_pci7x3x_pci_driver); MODULE_DESCRIPTION("ADLINK PCI-723x/743x Isolated Digital I/O boards"); diff --git a/drivers/comedi/drivers/adl_pci8164.c b/drivers/comedi/drivers/adl_pci8164.c index d5e1bda81557..cea94c12ad94 100644 --- a/drivers/comedi/drivers/adl_pci8164.c +++ b/drivers/comedi/drivers/adl_pci8164.c @@ -30,8 +30,7 @@ static int adl_pci8164_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned long offset = (unsigned long)s->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -45,8 +44,7 @@ static int adl_pci8164_insn_read(struct comedi_device *dev, static int adl_pci8164_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned long offset = (unsigned long)s->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -76,56 +74,56 @@ static int adl_pci8164_auto_attach(struct comedi_device *dev, /* read MSTS register / write CMD register for each axis (channel) */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_PROC; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 4; - s->maxdata = 0xffff; - s->len_chanlist = 4; - s->insn_read = adl_pci8164_insn_read; - s->insn_write = adl_pci8164_insn_write; - s->private = (void *)PCI8164_CMD_MSTS_REG; + s->type = COMEDI_SUBD_PROC; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 4; + s->maxdata = 0xffff; + s->len_chanlist = 4; + s->insn_read = adl_pci8164_insn_read; + s->insn_write = adl_pci8164_insn_write; + s->private = (void *)PCI8164_CMD_MSTS_REG; /* read SSTS register / write OTP register for each axis (channel) */ s = &dev->subdevices[1]; - s->type = COMEDI_SUBD_PROC; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 4; - s->maxdata = 0xffff; - s->len_chanlist = 4; - s->insn_read = adl_pci8164_insn_read; - s->insn_write = adl_pci8164_insn_write; - s->private = (void *)PCI8164_OTP_SSTS_REG; + s->type = COMEDI_SUBD_PROC; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 4; + s->maxdata = 0xffff; + s->len_chanlist = 4; + s->insn_read = adl_pci8164_insn_read; + s->insn_write = adl_pci8164_insn_write; + s->private = (void *)PCI8164_OTP_SSTS_REG; /* read/write BUF0 register for each axis (channel) */ s = &dev->subdevices[2]; - s->type = COMEDI_SUBD_PROC; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 4; - s->maxdata = 0xffff; - s->len_chanlist = 4; - s->insn_read = adl_pci8164_insn_read; - s->insn_write = adl_pci8164_insn_write; - s->private = (void *)PCI8164_BUF0_REG; + s->type = COMEDI_SUBD_PROC; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 4; + s->maxdata = 0xffff; + s->len_chanlist = 4; + s->insn_read = adl_pci8164_insn_read; + s->insn_write = adl_pci8164_insn_write; + s->private = (void *)PCI8164_BUF0_REG; /* read/write BUF1 register for each axis (channel) */ s = &dev->subdevices[3]; - s->type = COMEDI_SUBD_PROC; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 4; - s->maxdata = 0xffff; - s->len_chanlist = 4; - s->insn_read = adl_pci8164_insn_read; - s->insn_write = adl_pci8164_insn_write; - s->private = (void *)PCI8164_BUF1_REG; + s->type = COMEDI_SUBD_PROC; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 4; + s->maxdata = 0xffff; + s->len_chanlist = 4; + s->insn_read = adl_pci8164_insn_read; + s->insn_write = adl_pci8164_insn_write; + s->private = (void *)PCI8164_BUF1_REG; return 0; } static struct comedi_driver adl_pci8164_driver = { - .driver_name = "adl_pci8164", - .module = THIS_MODULE, - .auto_attach = adl_pci8164_auto_attach, - .detach = comedi_pci_detach, + .driver_name = "adl_pci8164", + .module = THIS_MODULE, + .auto_attach = adl_pci8164_auto_attach, + .detach = comedi_pci_detach, }; static int adl_pci8164_pci_probe(struct pci_dev *dev, @@ -139,14 +137,16 @@ static const struct pci_device_id adl_pci8164_pci_table[] = { { PCI_DEVICE(PCI_VENDOR_ID_ADLINK, 0x8164) }, { 0 } }; + MODULE_DEVICE_TABLE(pci, adl_pci8164_pci_table); static struct pci_driver adl_pci8164_pci_driver = { - .name = "adl_pci8164", - .id_table = adl_pci8164_pci_table, - .probe = adl_pci8164_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "adl_pci8164", + .id_table = adl_pci8164_pci_table, + .probe = adl_pci8164_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(adl_pci8164_driver, adl_pci8164_pci_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/adl_pci9111.c b/drivers/comedi/drivers/adl_pci9111.c index a062c5ab20e9..bf0f9ac52ec2 100644 --- a/drivers/comedi/drivers/adl_pci9111.c +++ b/drivers/comedi/drivers/adl_pci9111.c @@ -96,12 +96,12 @@ static const struct comedi_lrange pci9111_ai_range = { 5, { - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(2.5), - BIP_RANGE(1.25), - BIP_RANGE(0.625) - } + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(2.5), + BIP_RANGE(1.25), + BIP_RANGE(0.625) + } }; struct pci9111_private_data { @@ -248,8 +248,7 @@ static int pci9111_ai_do_cmd_test(struct comedi_device *dev, err |= comedi_check_trigger_src(&cmd->convert_src, TRIG_TIMER | TRIG_EXT); err |= comedi_check_trigger_src(&cmd->scan_end_src, TRIG_COUNT); - err |= comedi_check_trigger_src(&cmd->stop_src, - TRIG_COUNT | TRIG_NONE); + err |= comedi_check_trigger_src(&cmd->stop_src, TRIG_COUNT | TRIG_NONE); if (err) return 1; @@ -276,15 +275,15 @@ static int pci9111_ai_do_cmd_test(struct comedi_device *dev, if (cmd->convert_src == TRIG_TIMER) { err |= comedi_check_trigger_arg_min(&cmd->convert_arg, - PCI9111_AI_ACQUISITION_PERIOD_MIN_NS); - } else { /* TRIG_EXT */ + PCI9111_AI_ACQUISITION_PERIOD_MIN_NS); + } else { /* TRIG_EXT */ err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); } if (cmd->scan_begin_src == TRIG_TIMER) { err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, - PCI9111_AI_ACQUISITION_PERIOD_MIN_NS); - } else { /* TRIG_FOLLOW || TRIG_EXT */ + PCI9111_AI_ACQUISITION_PERIOD_MIN_NS); + } else { /* TRIG_FOLLOW || TRIG_EXT */ err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); } @@ -293,7 +292,7 @@ static int pci9111_ai_do_cmd_test(struct comedi_device *dev, if (cmd->stop_src == TRIG_COUNT) err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); - else /* TRIG_NONE */ + else /* TRIG_NONE */ err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) @@ -368,9 +367,10 @@ static int pci9111_ai_do_cmd(struct comedi_device *dev, if (cmd->scan_begin_src == TRIG_TIMER) { dev_private->scan_delay = (cmd->scan_begin_arg / - (cmd->convert_arg * cmd->chanlist_len)) - 1; + (cmd->convert_arg * + cmd->chanlist_len)) - 1; } - } else { /* TRIG_EXT */ + } else { /* TRIG_EXT */ trig |= PCI9111_AI_TRIG_CTRL_ETIS; pci9111_fifo_reset(dev); pci9111_interrupt_source_set(dev, irq_on_fifo_half_full, @@ -382,7 +382,7 @@ static int pci9111_ai_do_cmd(struct comedi_device *dev, dev_private->chunk_counter = 0; dev_private->chunk_num_samples = cmd->chanlist_len * - (1 + dev_private->scan_delay); + (1 + dev_private->scan_delay); return 0; } @@ -423,7 +423,7 @@ static void pci9111_handle_fifo_half_full(struct comedi_device *dev, while (pos < samples) { if (devpriv->chunk_counter < cmd->chanlist_len) { to_read = cmd->chanlist_len - - devpriv->chunk_counter; + devpriv->chunk_counter; if (to_read > samples - pos) to_read = samples - pos; @@ -431,7 +431,7 @@ static void pci9111_handle_fifo_half_full(struct comedi_device *dev, comedi_buf_write_samples(s, buf + pos, to_read); } else { to_read = devpriv->chunk_num_samples - - devpriv->chunk_counter; + devpriv->chunk_counter; if (to_read > samples - pos) to_read = samples - pos; @@ -515,8 +515,7 @@ static irqreturn_t pci9111_interrupt(int irq, void *p_device) static int pci9111_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned int status; @@ -568,8 +567,7 @@ static int pci9111_ai_insn_read(struct comedi_device *dev, static int pci9111_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int val = s->readback[chan]; @@ -586,8 +584,7 @@ static int pci9111_ao_insn_write(struct comedi_device *dev, static int pci9111_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { data[1] = inw(dev->iobase + PCI9111_DIO_REG); @@ -596,8 +593,7 @@ static int pci9111_di_insn_bits(struct comedi_device *dev, static int pci9111_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { if (comedi_dio_update_state(s, data)) outw(s->state, dev->iobase + PCI9111_DIO_REG); @@ -658,50 +654,50 @@ static int pci9111_auto_attach(struct comedi_device *dev, return ret; s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_COMMON; - s->n_chan = 16; - s->maxdata = 0xffff; - s->range_table = &pci9111_ai_range; - s->insn_read = pci9111_ai_insn_read; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_COMMON; + s->n_chan = 16; + s->maxdata = 0xffff; + s->range_table = &pci9111_ai_range; + s->insn_read = pci9111_ai_insn_read; if (dev->irq) { dev->read_subdev = s; - s->subdev_flags |= SDF_CMD_READ; - s->len_chanlist = s->n_chan; - s->do_cmdtest = pci9111_ai_do_cmd_test; - s->do_cmd = pci9111_ai_do_cmd; - s->cancel = pci9111_ai_cancel; - s->munge = pci9111_ai_munge; + s->subdev_flags |= SDF_CMD_READ; + s->len_chanlist = s->n_chan; + s->do_cmdtest = pci9111_ai_do_cmd_test; + s->do_cmd = pci9111_ai_do_cmd; + s->cancel = pci9111_ai_cancel; + s->munge = pci9111_ai_munge; } s = &dev->subdevices[1]; - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE | SDF_COMMON; - s->n_chan = 1; - s->maxdata = 0x0fff; - s->len_chanlist = 1; - s->range_table = &range_bipolar10; - s->insn_write = pci9111_ao_insn_write; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE | SDF_COMMON; + s->n_chan = 1; + s->maxdata = 0x0fff; + s->len_chanlist = 1; + s->range_table = &range_bipolar10; + s->insn_write = pci9111_ao_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) return ret; s = &dev->subdevices[2]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 16; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = pci9111_di_insn_bits; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 16; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = pci9111_di_insn_bits; s = &dev->subdevices[3]; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 16; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = pci9111_do_insn_bits; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 16; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = pci9111_do_insn_bits; return 0; } @@ -714,10 +710,10 @@ static void pci9111_detach(struct comedi_device *dev) } static struct comedi_driver adl_pci9111_driver = { - .driver_name = "adl_pci9111", - .module = THIS_MODULE, - .auto_attach = pci9111_auto_attach, - .detach = pci9111_detach, + .driver_name = "adl_pci9111", + .module = THIS_MODULE, + .auto_attach = pci9111_auto_attach, + .detach = pci9111_detach, }; static int pci9111_pci_probe(struct pci_dev *dev, @@ -732,14 +728,16 @@ static const struct pci_device_id pci9111_pci_table[] = { /* { PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI9111_HG_DEVICE_ID) }, */ { 0 } }; + MODULE_DEVICE_TABLE(pci, pci9111_pci_table); static struct pci_driver adl_pci9111_pci_driver = { - .name = "adl_pci9111", - .id_table = pci9111_pci_table, - .probe = pci9111_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "adl_pci9111", + .id_table = pci9111_pci_table, + .probe = pci9111_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(adl_pci9111_driver, adl_pci9111_pci_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/adl_pci9118.c b/drivers/comedi/drivers/adl_pci9118.c index cda3a4267dca..d761154ad5c1 100644 --- a/drivers/comedi/drivers/adl_pci9118.c +++ b/drivers/comedi/drivers/adl_pci9118.c @@ -138,28 +138,28 @@ static const struct comedi_lrange pci9118_ai_range = { 8, { - BIP_RANGE(5), - BIP_RANGE(2.5), - BIP_RANGE(1.25), - BIP_RANGE(0.625), - UNI_RANGE(10), - UNI_RANGE(5), - UNI_RANGE(2.5), - UNI_RANGE(1.25) - } + BIP_RANGE(5), + BIP_RANGE(2.5), + BIP_RANGE(1.25), + BIP_RANGE(0.625), + UNI_RANGE(10), + UNI_RANGE(5), + UNI_RANGE(2.5), + UNI_RANGE(1.25) + } }; static const struct comedi_lrange pci9118hg_ai_range = { 8, { - BIP_RANGE(5), - BIP_RANGE(0.5), - BIP_RANGE(0.05), - BIP_RANGE(0.005), - UNI_RANGE(10), - UNI_RANGE(1), - UNI_RANGE(0.1), - UNI_RANGE(0.01) - } + BIP_RANGE(5), + BIP_RANGE(0.5), + BIP_RANGE(0.05), + BIP_RANGE(0.005), + UNI_RANGE(10), + UNI_RANGE(1), + UNI_RANGE(0.1), + UNI_RANGE(0.01) + } }; enum pci9118_boardid { @@ -176,16 +176,16 @@ struct pci9118_boardinfo { static const struct pci9118_boardinfo pci9118_boards[] = { [BOARD_PCI9118DG] = { - .name = "pci9118dg", - }, + .name = "pci9118dg", + }, [BOARD_PCI9118HG] = { - .name = "pci9118hg", - .is_hg = 1, - }, + .name = "pci9118hg", + .is_hg = 1, + }, [BOARD_PCI9118HR] = { - .name = "pci9118hr", - .ai_is_16bit = 1, - }, + .name = "pci9118hr", + .ai_is_16bit = 1, + }, }; struct pci9118_dmabuf { @@ -205,7 +205,7 @@ struct pci9118_private { unsigned char ai_ctrl; unsigned char int_ctrl; unsigned char ai_cfg; - unsigned int ai_do; /* what do AI? 0=nothing, 1 to 4 mode */ + unsigned int ai_do; /* what do AI? 0=nothing, 1 to 4 mode */ unsigned int ai_n_realscanlen; /* * what we must transfer for one * outgoing scan include front/back adds @@ -220,16 +220,16 @@ struct pci9118_private { * before scan to satisfy DMA? */ unsigned int ai_flags; - char ai12_startstop; /* - * measure can start/stop - * on external trigger - */ - unsigned int dma_actbuf; /* which buffer is used now */ + char ai12_startstop; /* + * measure can start/stop + * on external trigger + */ + unsigned int dma_actbuf; /* which buffer is used now */ struct pci9118_dmabuf dmabuf[2]; - int softsshdelay; /* - * >0 use software S&H, - * numer is requested delay in ns - */ + int softsshdelay; /* + * >0 use software S&H, + * numer is requested delay in ns + */ unsigned char softsshsample; /* * polarity of S&H signal * in sample state @@ -357,7 +357,7 @@ static void pci9118_set_chanlist(struct comedi_device *dev, /* insert channels for S&H */ if (frontadd) { val = PCI9118_AI_CHANLIST_CHAN(chan0) | - PCI9118_AI_CHANLIST_RANGE(range0); + PCI9118_AI_CHANLIST_RANGE(range0); ssh = devpriv->softsshsample; for (i = 0; i < frontadd; i++) { outl(val | ssh, dev->iobase + PCI9118_AI_CHANLIST_REG); @@ -371,14 +371,14 @@ static void pci9118_set_chanlist(struct comedi_device *dev, unsigned int range = CR_RANGE(chanlist[i]); val = PCI9118_AI_CHANLIST_CHAN(chan) | - PCI9118_AI_CHANLIST_RANGE(range); + PCI9118_AI_CHANLIST_RANGE(range); outl(val | ssh, dev->iobase + PCI9118_AI_CHANLIST_REG); } /* insert channels to fit onto 32bit DMA */ if (backadd) { val = PCI9118_AI_CHANLIST_CHAN(chan0) | - PCI9118_AI_CHANLIST_RANGE(range0); + PCI9118_AI_CHANLIST_RANGE(range0); for (i = 0; i < backadd; i++) outl(val | ssh, dev->iobase + PCI9118_AI_CHANLIST_REG); } @@ -394,7 +394,7 @@ static void pci9118_ai_mode4_switch(struct comedi_device *dev, struct pci9118_dmabuf *dmabuf = &devpriv->dmabuf[next_buf]; devpriv->ai_cfg = PCI9118_AI_CFG_PDTRG | PCI9118_AI_CFG_PETRG | - PCI9118_AI_CFG_AM; + PCI9118_AI_CFG_AM; outl(devpriv->ai_cfg, dev->iobase + PCI9118_AI_CFG_REG); comedi_8254_load(dev->pacer, 0, dmabuf->hw >> 1, I8254_MODE0 | I8254_BINARY); @@ -538,7 +538,7 @@ static void pci9118_calc_divisors(struct comedi_device *dev, *div1 = *tim2 / pacer->osc_base; /* convert timer (burst) */ *div2 = *tim1 / pacer->osc_base; /* scan timer */ - *div2 = *div2 / *div1; /* major timer is c1*c2 */ + *div2 = *div2 / *div1; /* major timer is c1*c2 */ if (*div2 < chans) *div2 = chans; @@ -782,8 +782,7 @@ static void pci9118_ai_cmd_start(struct comedi_device *dev) } static int pci9118_ai_inttrig(struct comedi_device *dev, - struct comedi_subdevice *s, - unsigned int trig_num) + struct comedi_subdevice *s, unsigned int trig_num) { struct comedi_cmd *cmd = &s->async->cmd; @@ -806,7 +805,7 @@ static int pci9118_ai_setup_dma(struct comedi_device *dev, unsigned int dmalen0 = dmabuf0->size; unsigned int dmalen1 = dmabuf1->size; unsigned int scan_bytes = devpriv->ai_n_realscanlen * - comedi_bytes_per_sample(s); + comedi_bytes_per_sample(s); /* isn't output buff smaller that our DMA buff? */ if (dmalen0 > s->async->prealloc_bufsz) { @@ -825,7 +824,7 @@ static int pci9118_ai_setup_dma(struct comedi_device *dev, devpriv->ai_flags &= (~CMDF_WAKE_EOS); dev_info(dev->class_dev, "WAR: DMA0 buf too short, can't support CMDF_WAKE_EOS (%d<%d)\n", - dmalen0, scan_bytes); + dmalen0, scan_bytes); } else { /* short first DMA buffer to one scan */ dmalen0 = scan_bytes; @@ -878,8 +877,7 @@ static int pci9118_ai_setup_dma(struct comedi_device *dev, if (!devpriv->ai_neverending) { unsigned long long scanlen; - scanlen = (unsigned long long)scan_bytes * - cmd->stop_arg; + scanlen = (unsigned long long)scan_bytes * cmd->stop_arg; /* fits whole measure into one DMA buffer? */ if (dmalen0 > scanlen) { @@ -909,7 +907,7 @@ static int pci9118_ai_setup_dma(struct comedi_device *dev, pci9118_amcc_dma_ena(dev, true); outl(inl(devpriv->iobase_a + AMCC_OP_REG_INTCSR) | EN_A2P_TRANSFERS, devpriv->iobase_a + AMCC_OP_REG_INTCSR); - /* allow bus mastering */ + /* allow bus mastering */ return 0; } @@ -947,21 +945,19 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) devpriv->ai_add_back = 0; if (devpriv->master) { devpriv->usedma = 1; - if ((cmd->flags & CMDF_WAKE_EOS) && - (cmd->scan_end_arg == 1)) { + if ((cmd->flags & CMDF_WAKE_EOS) && (cmd->scan_end_arg == 1)) { if (cmd->convert_src == TRIG_NOW) devpriv->ai_add_back = 1; if (cmd->convert_src == TRIG_TIMER) { devpriv->usedma = 0; - /* - * use INT transfer if scanlist - * have only one channel - */ + /* + * use INT transfer if scanlist + * have only one channel + */ } } if ((cmd->flags & CMDF_WAKE_EOS) && - (cmd->scan_end_arg & 1) && - (cmd->scan_end_arg > 1)) { + (cmd->scan_end_arg & 1) && (cmd->scan_end_arg > 1)) { if (cmd->scan_begin_src == TRIG_FOLLOW) { devpriv->usedma = 0; /* @@ -974,7 +970,7 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) devpriv->ai_add_back = 1; } } - } else { /* interrupt transfer don't need any correction */ + } else { /* interrupt transfer don't need any correction */ devpriv->usedma = 0; } @@ -985,7 +981,7 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) if (cmd->convert_src == TRIG_NOW && devpriv->softsshdelay) { devpriv->ai_add_front = 2; if ((devpriv->usedma == 1) && (devpriv->ai_add_back == 1)) { - /* move it to front */ + /* move it to front */ devpriv->ai_add_front++; devpriv->ai_add_back = 0; } @@ -995,25 +991,25 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) if (devpriv->softsshdelay % cmd->convert_arg) addchans++; if (addchans > (devpriv->ai_add_front - 1)) { - /* uff, still short */ + /* uff, still short */ devpriv->ai_add_front = addchans + 1; if (devpriv->usedma == 1) if ((devpriv->ai_add_front + cmd->chanlist_len + devpriv->ai_add_back) & 1) devpriv->ai_add_front++; - /* round up to 32 bit */ + /* round up to 32 bit */ } } /* well, we now know what must be all added */ scanlen = devpriv->ai_add_front + cmd->chanlist_len + - devpriv->ai_add_back; + devpriv->ai_add_back; /* * what we must take from card in real to have cmd->scan_end_arg * on output? */ devpriv->ai_n_realscanlen = scanlen * - (cmd->scan_end_arg / cmd->chanlist_len); + (cmd->scan_end_arg / cmd->chanlist_len); if (scanlen > s->len_chanlist) { dev_err(dev->class_dev, @@ -1030,8 +1026,7 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) /* Determine acquisition mode and calculate timing */ devpriv->ai_do = 0; - if (cmd->scan_begin_src != TRIG_TIMER && - cmd->convert_src == TRIG_TIMER) { + if (cmd->scan_begin_src != TRIG_TIMER && cmd->convert_src == TRIG_TIMER) { /* cascaded timers 1 and 2 are used for convert timing */ if (cmd->scan_begin_src == TRIG_EXT) devpriv->ai_do = 4; @@ -1061,8 +1056,7 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) } } - if (cmd->scan_begin_src == TRIG_TIMER && - cmd->convert_src != TRIG_EXT) { + if (cmd->scan_begin_src == TRIG_TIMER && cmd->convert_src != TRIG_EXT) { if (!devpriv->usedma) { dev_err(dev->class_dev, "cmd->scan_begin_src=TRIG_TIMER works only with bus mastering!\n"); @@ -1077,8 +1071,7 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) devpriv->ai_flags, devpriv->ai_n_realscanlen, &pacer->divisor1, - &pacer->divisor2, - devpriv->ai_add_front); + &pacer->divisor2, devpriv->ai_add_front); devpriv->ai_ctrl |= PCI9118_AI_CTRL_TMRTR; devpriv->ai_cfg |= PCI9118_AI_CFG_BM | PCI9118_AI_CFG_BS; @@ -1088,8 +1081,7 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) dev->iobase + PCI9118_AI_BURST_NUM_REG); } - if (cmd->scan_begin_src == TRIG_FOLLOW && - cmd->convert_src == TRIG_EXT) { + if (cmd->scan_begin_src == TRIG_FOLLOW && cmd->convert_src == TRIG_EXT) { /* external trigger conversion */ devpriv->ai_do = 3; @@ -1242,7 +1234,7 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev, if (cmd->stop_src == TRIG_COUNT) err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); - else /* TRIG_NONE */ + else /* TRIG_NONE */ err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); err |= comedi_check_trigger_arg_min(&cmd->chanlist_len, 1); @@ -1276,12 +1268,13 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev, cmd->convert_src == TRIG_NOW) { if (cmd->convert_arg == 0) { arg = devpriv->ai_ns_min * - (cmd->scan_end_arg + 2); + (cmd->scan_end_arg + 2); } else { arg = cmd->convert_arg * cmd->chanlist_len; } - err |= comedi_check_trigger_arg_min( - &cmd->scan_begin_arg, arg); + err |= + comedi_check_trigger_arg_min(&cmd->scan_begin_arg, + arg); } } @@ -1301,8 +1294,7 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev, static int pci9118_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned int status; @@ -1320,18 +1312,17 @@ static void pci9118_ai_start_conv(struct comedi_device *dev) static int pci9118_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct pci9118_private *devpriv = dev->private; unsigned int val; int ret; int i; - /* - * Configure analog input based on the chanspec. - * Acqusition is software controlled without interrupts. - */ + /* + * Configure analog input based on the chanspec. + * Acqusition is software controlled without interrupts. + */ pci9118_set_chanlist(dev, s, 1, &insn->chanspec, 0, 0); /* set default config (disable burst and triggers) */ @@ -1359,8 +1350,7 @@ static int pci9118_ai_insn_read(struct comedi_device *dev, static int pci9118_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int val = s->readback[chan]; @@ -1377,8 +1367,7 @@ static int pci9118_ao_insn_write(struct comedi_device *dev, static int pci9118_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { /* * The digital inputs and outputs share the read register. @@ -1392,8 +1381,7 @@ static int pci9118_di_insn_bits(struct comedi_device *dev, static int pci9118_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { /* * The digital outputs are set with the same register that @@ -1566,7 +1554,7 @@ static int pci9118_common_attach(struct comedi_device *dev, pci_read_config_word(pcidev, PCI_COMMAND, &u16w); pci_write_config_word(pcidev, PCI_COMMAND, u16w | 64); - /* Enable parity check for parity error */ + /* Enable parity check for parity error */ ret = comedi_alloc_subdevices(dev, 4); if (ret) @@ -1574,21 +1562,20 @@ static int pci9118_common_attach(struct comedi_device *dev, /* Analog Input subdevice */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_COMMON | SDF_GROUND | SDF_DIFF; - s->n_chan = (devpriv->usemux) ? ext_mux : 16; - s->maxdata = board->ai_is_16bit ? 0xffff : 0x0fff; - s->range_table = board->is_hg ? &pci9118hg_ai_range - : &pci9118_ai_range; - s->insn_read = pci9118_ai_insn_read; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_COMMON | SDF_GROUND | SDF_DIFF; + s->n_chan = (devpriv->usemux) ? ext_mux : 16; + s->maxdata = board->ai_is_16bit ? 0xffff : 0x0fff; + s->range_table = board->is_hg ? &pci9118hg_ai_range : &pci9118_ai_range; + s->insn_read = pci9118_ai_insn_read; if (dev->irq) { dev->read_subdev = s; - s->subdev_flags |= SDF_CMD_READ; - s->len_chanlist = 255; - s->do_cmdtest = pci9118_ai_cmdtest; - s->do_cmd = pci9118_ai_cmd; - s->cancel = pci9118_ai_cancel; - s->munge = pci9118_ai_munge; + s->subdev_flags |= SDF_CMD_READ; + s->len_chanlist = 255; + s->do_cmdtest = pci9118_ai_cmdtest; + s->do_cmd = pci9118_ai_cmd; + s->cancel = pci9118_ai_cancel; + s->munge = pci9118_ai_munge; } if (s->maxdata == 0xffff) { @@ -1607,12 +1594,12 @@ static int pci9118_common_attach(struct comedi_device *dev, /* Analog Output subdevice */ s = &dev->subdevices[1]; - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_COMMON; - s->n_chan = 2; - s->maxdata = 0x0fff; - s->range_table = &range_bipolar10; - s->insn_write = pci9118_ao_insn_write; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_COMMON; + s->n_chan = 2; + s->maxdata = 0x0fff; + s->range_table = &range_bipolar10; + s->insn_write = pci9118_ao_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) @@ -1624,21 +1611,21 @@ static int pci9118_common_attach(struct comedi_device *dev, /* Digital Input subdevice */ s = &dev->subdevices[2]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 4; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = pci9118_di_insn_bits; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 4; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = pci9118_di_insn_bits; /* Digital Output subdevice */ s = &dev->subdevices[3]; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 4; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = pci9118_do_insn_bits; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 4; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = pci9118_do_insn_bits; /* get the current state of the digital outputs */ s->state = inl(dev->iobase + PCI9118_DIO_REG) >> 4; @@ -1663,8 +1650,7 @@ static int pci9118_attach(struct comedi_device *dev, return pci9118_common_attach(dev, ext_mux, softsshdelay); } -static int pci9118_auto_attach(struct comedi_device *dev, - unsigned long context) +static int pci9118_auto_attach(struct comedi_device *dev, unsigned long context) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); const struct pci9118_boardinfo *board = NULL; @@ -1697,14 +1683,14 @@ static void pci9118_detach(struct comedi_device *dev) } static struct comedi_driver adl_pci9118_driver = { - .driver_name = "adl_pci9118", - .module = THIS_MODULE, - .attach = pci9118_attach, - .auto_attach = pci9118_auto_attach, - .detach = pci9118_detach, - .num_names = ARRAY_SIZE(pci9118_boards), - .board_name = &pci9118_boards[0].name, - .offset = sizeof(struct pci9118_boardinfo), + .driver_name = "adl_pci9118", + .module = THIS_MODULE, + .attach = pci9118_attach, + .auto_attach = pci9118_auto_attach, + .detach = pci9118_detach, + .num_names = ARRAY_SIZE(pci9118_boards), + .board_name = &pci9118_boards[0].name, + .offset = sizeof(struct pci9118_boardinfo), }; static int adl_pci9118_pci_probe(struct pci_dev *dev, @@ -1721,14 +1707,16 @@ static const struct pci_device_id adl_pci9118_pci_table[] = { /* { PCI_VDEVICE(AMCC, 0x80d9), BOARD_PCI9118HR }, */ { 0 } }; + MODULE_DEVICE_TABLE(pci, adl_pci9118_pci_table); static struct pci_driver adl_pci9118_pci_driver = { - .name = "adl_pci9118", - .id_table = adl_pci9118_pci_table, - .probe = adl_pci9118_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "adl_pci9118", + .id_table = adl_pci9118_pci_table, + .probe = adl_pci9118_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(adl_pci9118_driver, adl_pci9118_pci_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/adq12b.c b/drivers/comedi/drivers/adq12b.c index d719f76709ef..441fff021816 100644 --- a/drivers/comedi/drivers/adq12b.c +++ b/drivers/comedi/drivers/adq12b.c @@ -70,20 +70,20 @@ /* available ranges through the PGA gains */ static const struct comedi_lrange range_adq12b_ai_bipolar = { 4, { - BIP_RANGE(5), - BIP_RANGE(2), - BIP_RANGE(1), - BIP_RANGE(0.5) - } + BIP_RANGE(5), + BIP_RANGE(2), + BIP_RANGE(1), + BIP_RANGE(0.5) + } }; static const struct comedi_lrange range_adq12b_ai_unipolar = { 4, { - UNI_RANGE(5), - UNI_RANGE(2), - UNI_RANGE(1), - UNI_RANGE(0.5) - } + UNI_RANGE(5), + UNI_RANGE(2), + UNI_RANGE(1), + UNI_RANGE(0.5) + } }; struct adq12b_private { @@ -92,8 +92,7 @@ struct adq12b_private { static int adq12b_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned char status; @@ -105,8 +104,7 @@ static int adq12b_ai_eoc(struct comedi_device *dev, static int adq12b_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct adq12b_private *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -151,8 +149,7 @@ static int adq12b_di_insn_bits(struct comedi_device *dev, static int adq12b_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int mask; unsigned int chan; @@ -196,46 +193,47 @@ static int adq12b_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* Analog Input subdevice */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_AI; + s->type = COMEDI_SUBD_AI; if (it->options[2]) { - s->subdev_flags = SDF_READABLE | SDF_DIFF; - s->n_chan = 8; + s->subdev_flags = SDF_READABLE | SDF_DIFF; + s->n_chan = 8; } else { - s->subdev_flags = SDF_READABLE | SDF_GROUND; - s->n_chan = 16; + s->subdev_flags = SDF_READABLE | SDF_GROUND; + s->n_chan = 16; } - s->maxdata = 0xfff; - s->range_table = it->options[1] ? &range_adq12b_ai_unipolar - : &range_adq12b_ai_bipolar; - s->insn_read = adq12b_ai_insn_read; + s->maxdata = 0xfff; + s->range_table = it->options[1] ? &range_adq12b_ai_unipolar + : &range_adq12b_ai_bipolar; + s->insn_read = adq12b_ai_insn_read; /* Digital Input subdevice */ s = &dev->subdevices[1]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 5; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = adq12b_di_insn_bits; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 5; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = adq12b_di_insn_bits; /* Digital Output subdevice */ s = &dev->subdevices[2]; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 8; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = adq12b_do_insn_bits; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 8; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = adq12b_do_insn_bits; return 0; } static struct comedi_driver adq12b_driver = { - .driver_name = "adq12b", - .module = THIS_MODULE, - .attach = adq12b_attach, - .detach = comedi_legacy_detach, + .driver_name = "adq12b", + .module = THIS_MODULE, + .attach = adq12b_attach, + .detach = comedi_legacy_detach, }; + module_comedi_driver(adq12b_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/adv_pci1710.c b/drivers/comedi/drivers/adv_pci1710.c index 090607760be6..a2e6a322a1c9 100644 --- a/drivers/comedi/drivers/adv_pci1710.c +++ b/drivers/comedi/drivers/adv_pci1710.c @@ -64,7 +64,7 @@ #define PCI171X_CTRL_SW BIT(0) /* 1=enable software trigger source */ #define PCI171X_CLRINT_REG 0x08 /* W: clear interrupts request */ #define PCI171X_CLRFIFO_REG 0x09 /* W: clear FIFO */ -#define PCI171X_DA_REG(x) (0x0a + ((x) * 2)) /* W: D/A register */ +#define PCI171X_DA_REG(x) (0x0a + ((x) * 2)) /* W: D/A register */ #define PCI171X_DAREF_REG 0x0e /* W: D/A reference control */ #define PCI171X_DAREF(c, r) (((r) & 0x3) << ((c) * 2)) #define PCI171X_DAREF_MASK(c) PCI171X_DAREF((c), 0x3) @@ -74,51 +74,51 @@ static const struct comedi_lrange pci1710_ai_range = { 9, { - BIP_RANGE(5), /* gain 1 (0x00) */ - BIP_RANGE(2.5), /* gain 2 (0x01) */ - BIP_RANGE(1.25), /* gain 4 (0x02) */ - BIP_RANGE(0.625), /* gain 8 (0x03) */ - BIP_RANGE(10), /* gain 0.5 (0x04) */ - UNI_RANGE(10), /* gain 1 (0x00 | UNI) */ - UNI_RANGE(5), /* gain 2 (0x01 | UNI) */ - UNI_RANGE(2.5), /* gain 4 (0x02 | UNI) */ - UNI_RANGE(1.25) /* gain 8 (0x03 | UNI) */ - } + BIP_RANGE(5), /* gain 1 (0x00) */ + BIP_RANGE(2.5), /* gain 2 (0x01) */ + BIP_RANGE(1.25), /* gain 4 (0x02) */ + BIP_RANGE(0.625), /* gain 8 (0x03) */ + BIP_RANGE(10), /* gain 0.5 (0x04) */ + UNI_RANGE(10), /* gain 1 (0x00 | UNI) */ + UNI_RANGE(5), /* gain 2 (0x01 | UNI) */ + UNI_RANGE(2.5), /* gain 4 (0x02 | UNI) */ + UNI_RANGE(1.25) /* gain 8 (0x03 | UNI) */ + } }; static const struct comedi_lrange pci1710hg_ai_range = { 12, { - BIP_RANGE(5), /* gain 1 (0x00) */ - BIP_RANGE(0.5), /* gain 10 (0x01) */ - BIP_RANGE(0.05), /* gain 100 (0x02) */ - BIP_RANGE(0.005), /* gain 1000 (0x03) */ - BIP_RANGE(10), /* gain 0.5 (0x04) */ - BIP_RANGE(1), /* gain 5 (0x05) */ - BIP_RANGE(0.1), /* gain 50 (0x06) */ - BIP_RANGE(0.01), /* gain 500 (0x07) */ - UNI_RANGE(10), /* gain 1 (0x00 | UNI) */ - UNI_RANGE(1), /* gain 10 (0x01 | UNI) */ - UNI_RANGE(0.1), /* gain 100 (0x02 | UNI) */ - UNI_RANGE(0.01) /* gain 1000 (0x03 | UNI) */ - } + BIP_RANGE(5), /* gain 1 (0x00) */ + BIP_RANGE(0.5), /* gain 10 (0x01) */ + BIP_RANGE(0.05), /* gain 100 (0x02) */ + BIP_RANGE(0.005), /* gain 1000 (0x03) */ + BIP_RANGE(10), /* gain 0.5 (0x04) */ + BIP_RANGE(1), /* gain 5 (0x05) */ + BIP_RANGE(0.1), /* gain 50 (0x06) */ + BIP_RANGE(0.01), /* gain 500 (0x07) */ + UNI_RANGE(10), /* gain 1 (0x00 | UNI) */ + UNI_RANGE(1), /* gain 10 (0x01 | UNI) */ + UNI_RANGE(0.1), /* gain 100 (0x02 | UNI) */ + UNI_RANGE(0.01) /* gain 1000 (0x03 | UNI) */ + } }; static const struct comedi_lrange pci1711_ai_range = { 5, { - BIP_RANGE(10), /* gain 1 (0x00) */ - BIP_RANGE(5), /* gain 2 (0x01) */ - BIP_RANGE(2.5), /* gain 4 (0x02) */ - BIP_RANGE(1.25), /* gain 8 (0x03) */ - BIP_RANGE(0.625) /* gain 16 (0x04) */ - } + BIP_RANGE(10), /* gain 1 (0x00) */ + BIP_RANGE(5), /* gain 2 (0x01) */ + BIP_RANGE(2.5), /* gain 4 (0x02) */ + BIP_RANGE(1.25), /* gain 8 (0x03) */ + BIP_RANGE(0.625) /* gain 16 (0x04) */ + } }; static const struct comedi_lrange pci171x_ao_range = { 3, { - UNI_RANGE(5), /* internal -5V ref */ - UNI_RANGE(10), /* internal -10V ref */ - RANGE_ext(0, 1) /* external -Vref (+/-10V max) */ - } + UNI_RANGE(5), /* internal -5V ref */ + UNI_RANGE(10), /* internal -10V ref */ + RANGE_ext(0, 1) /* external -Vref (+/-10V max) */ + } }; enum pci1710_boardid { @@ -139,31 +139,31 @@ struct boardtype { static const struct boardtype boardtypes[] = { [BOARD_PCI1710] = { - .name = "pci1710", - .ai_range = &pci1710_ai_range, - .has_ao = 1, - }, + .name = "pci1710", + .ai_range = &pci1710_ai_range, + .has_ao = 1, + }, [BOARD_PCI1710HG] = { - .name = "pci1710hg", - .ai_range = &pci1710hg_ai_range, - .has_ao = 1, - }, + .name = "pci1710hg", + .ai_range = &pci1710hg_ai_range, + .has_ao = 1, + }, [BOARD_PCI1711] = { - .name = "pci1711", - .ai_range = &pci1711_ai_range, - .is_pci1711 = 1, - .has_ao = 1, - }, + .name = "pci1711", + .ai_range = &pci1711_ai_range, + .is_pci1711 = 1, + .has_ao = 1, + }, [BOARD_PCI1713] = { - .name = "pci1713", - .ai_range = &pci1710_ai_range, - .is_pci1713 = 1, - }, + .name = "pci1713", + .ai_range = &pci1710_ai_range, + .is_pci1713 = 1, + }, [BOARD_PCI1731] = { - .name = "pci1731", - .ai_range = &pci1711_ai_range, - .is_pci1711 = 1, - }, + .name = "pci1731", + .ai_range = &pci1711_ai_range, + .is_pci1711 = 1, + }, }; struct pci1710_private { @@ -247,8 +247,7 @@ static int pci1710_ai_check_chanlist(struct comedi_device *dev, static void pci1710_ai_setup_chanlist(struct comedi_device *dev, struct comedi_subdevice *s, unsigned int *chanlist, - unsigned int n_chan, - unsigned int seglen) + unsigned int n_chan, unsigned int seglen) { struct pci1710_private *devpriv = dev->private; unsigned int first_chan = CR_CHAN(chanlist[0]); @@ -275,19 +274,18 @@ static void pci1710_ai_setup_chanlist(struct comedi_device *dev, devpriv->act_chanlist[i] = chan; } - for ( ; i < n_chan; i++) /* store remainder of channel list */ + for (; i < n_chan; i++) /* store remainder of channel list */ devpriv->act_chanlist[i] = CR_CHAN(chanlist[i]); /* select channel interval to scan */ devpriv->mux_scan = PCI171X_MUX_CHANL(first_chan) | - PCI171X_MUX_CHANH(last_chan); + PCI171X_MUX_CHANH(last_chan); outw(devpriv->mux_scan, dev->iobase + PCI171X_MUX_REG); } static int pci1710_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned int status; @@ -299,8 +297,7 @@ static int pci1710_ai_eoc(struct comedi_device *dev, static int pci1710_ai_read_sample(struct comedi_device *dev, struct comedi_subdevice *s, - unsigned int cur_chan, - unsigned short *val) + unsigned int cur_chan, unsigned short *val) { const struct boardtype *board = dev->board_ptr; struct pci1710_private *devpriv = dev->private; @@ -328,8 +325,7 @@ static int pci1710_ai_read_sample(struct comedi_device *dev, static int pci1710_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct pci1710_private *devpriv = dev->private; int ret = 0; @@ -497,7 +493,7 @@ static irqreturn_t pci1710_irq_handler(int irq, void *d) if (devpriv->ai_et) { /* Switch from initial TRIG_EXT to TRIG_xxx. */ devpriv->ai_et = 0; devpriv->ctrl &= PCI171X_CTRL_CNT0; - devpriv->ctrl |= PCI171X_CTRL_SW; /* set software trigger */ + devpriv->ctrl |= PCI171X_CTRL_SW; /* set software trigger */ outw(devpriv->ctrl, dev->iobase + PCI171X_CTRL_REG); devpriv->ctrl = devpriv->ctrl_ext; outb(0, dev->iobase + PCI171X_CLRFIFO_REG); @@ -552,7 +548,7 @@ static int pci1710_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) if (cmd->start_src == TRIG_NOW) comedi_8254_pacer_enable(dev->pacer, 1, 2, true); - } else { /* TRIG_EXT */ + } else { /* TRIG_EXT */ devpriv->ctrl |= PCI171X_CTRL_EXT | PCI171X_CTRL_IRQEN; outw(devpriv->ctrl, dev->iobase + PCI171X_CTRL_REG); } @@ -596,7 +592,7 @@ static int pci1710_ai_cmdtest(struct comedi_device *dev, if (cmd->convert_src == TRIG_TIMER) err |= comedi_check_trigger_arg_min(&cmd->convert_arg, 10000); - else /* TRIG_FOLLOW */ + else /* TRIG_FOLLOW */ err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, @@ -604,7 +600,7 @@ static int pci1710_ai_cmdtest(struct comedi_device *dev, if (cmd->stop_src == TRIG_COUNT) err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); - else /* TRIG_NONE */ + else /* TRIG_NONE */ err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) @@ -634,8 +630,7 @@ static int pci1710_ai_cmdtest(struct comedi_device *dev, static int pci1710_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct pci1710_private *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -659,8 +654,7 @@ static int pci1710_ao_insn_write(struct comedi_device *dev, static int pci1710_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { data[1] = inw(dev->iobase + PCI171X_DI_REG); @@ -669,8 +663,7 @@ static int pci1710_di_insn_bits(struct comedi_device *dev, static int pci1710_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { if (comedi_dio_update_state(s, data)) outw(s->state, dev->iobase + PCI171X_DO_REG); @@ -742,8 +735,7 @@ static void pci1710_reset(struct comedi_device *dev) outw(0, dev->iobase + PCI171X_DO_REG); } -static int pci1710_auto_attach(struct comedi_device *dev, - unsigned long context) +static int pci1710_auto_attach(struct comedi_device *dev, unsigned long context) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); const struct boardtype *board = NULL; @@ -801,21 +793,21 @@ static int pci1710_auto_attach(struct comedi_device *dev, /* Analog Input subdevice */ s = &dev->subdevices[subdev++]; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_GROUND; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_GROUND; if (!board->is_pci1711) - s->subdev_flags |= SDF_DIFF; - s->n_chan = board->is_pci1713 ? 32 : 16; - s->maxdata = 0x0fff; - s->range_table = board->ai_range; - s->insn_read = pci1710_ai_insn_read; + s->subdev_flags |= SDF_DIFF; + s->n_chan = board->is_pci1713 ? 32 : 16; + s->maxdata = 0x0fff; + s->range_table = board->ai_range; + s->insn_read = pci1710_ai_insn_read; if (dev->irq) { dev->read_subdev = s; - s->subdev_flags |= SDF_CMD_READ; - s->len_chanlist = s->n_chan; - s->do_cmdtest = pci1710_ai_cmdtest; - s->do_cmd = pci1710_ai_cmd; - s->cancel = pci1710_ai_cancel; + s->subdev_flags |= SDF_CMD_READ; + s->len_chanlist = s->n_chan; + s->do_cmdtest = pci1710_ai_cmdtest; + s->do_cmd = pci1710_ai_cmd; + s->cancel = pci1710_ai_cancel; } /* find the value needed to adjust for unipolar gain codes */ @@ -829,12 +821,12 @@ static int pci1710_auto_attach(struct comedi_device *dev, if (board->has_ao) { /* Analog Output subdevice */ s = &dev->subdevices[subdev++]; - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE | SDF_GROUND; - s->n_chan = 2; - s->maxdata = 0x0fff; - s->range_table = &pci171x_ao_range; - s->insn_write = pci1710_ao_insn_write; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE | SDF_GROUND; + s->n_chan = 2; + s->maxdata = 0x0fff; + s->range_table = &pci171x_ao_range; + s->insn_write = pci1710_ao_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) @@ -844,21 +836,21 @@ static int pci1710_auto_attach(struct comedi_device *dev, if (!board->is_pci1713) { /* Digital Input subdevice */ s = &dev->subdevices[subdev++]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 16; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = pci1710_di_insn_bits; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 16; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = pci1710_di_insn_bits; /* Digital Output subdevice */ s = &dev->subdevices[subdev++]; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 16; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = pci1710_do_insn_bits; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 16; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = pci1710_do_insn_bits; /* Counter subdevice (8254) */ s = &dev->subdevices[subdev++]; @@ -878,10 +870,10 @@ static int pci1710_auto_attach(struct comedi_device *dev, } static struct comedi_driver adv_pci1710_driver = { - .driver_name = "adv_pci1710", - .module = THIS_MODULE, - .auto_attach = pci1710_auto_attach, - .detach = comedi_pci_detach, + .driver_name = "adv_pci1710", + .module = THIS_MODULE, + .auto_attach = pci1710_auto_attach, + .detach = comedi_pci_detach, }; static int adv_pci1710_pci_probe(struct pci_dev *dev, @@ -893,69 +885,97 @@ static int adv_pci1710_pci_probe(struct pci_dev *dev, static const struct pci_device_id adv_pci1710_pci_table[] = { { - PCI_DEVICE_SUB(PCI_VENDOR_ID_ADVANTECH, 0x1710, - PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050), - .driver_data = BOARD_PCI1710, - }, { - PCI_DEVICE_SUB(PCI_VENDOR_ID_ADVANTECH, 0x1710, - PCI_VENDOR_ID_ADVANTECH, 0x0000), - .driver_data = BOARD_PCI1710, - }, { - PCI_DEVICE_SUB(PCI_VENDOR_ID_ADVANTECH, 0x1710, - PCI_VENDOR_ID_ADVANTECH, 0xb100), - .driver_data = BOARD_PCI1710, - }, { - PCI_DEVICE_SUB(PCI_VENDOR_ID_ADVANTECH, 0x1710, - PCI_VENDOR_ID_ADVANTECH, 0xb200), - .driver_data = BOARD_PCI1710, - }, { - PCI_DEVICE_SUB(PCI_VENDOR_ID_ADVANTECH, 0x1710, - PCI_VENDOR_ID_ADVANTECH, 0xc100), - .driver_data = BOARD_PCI1710, - }, { - PCI_DEVICE_SUB(PCI_VENDOR_ID_ADVANTECH, 0x1710, - PCI_VENDOR_ID_ADVANTECH, 0xc200), - .driver_data = BOARD_PCI1710, - }, { - PCI_DEVICE_SUB(PCI_VENDOR_ID_ADVANTECH, 0x1710, 0x1000, 0xd100), - .driver_data = BOARD_PCI1710, - }, { - PCI_DEVICE_SUB(PCI_VENDOR_ID_ADVANTECH, 0x1710, - PCI_VENDOR_ID_ADVANTECH, 0x0002), - .driver_data = BOARD_PCI1710HG, - }, { - PCI_DEVICE_SUB(PCI_VENDOR_ID_ADVANTECH, 0x1710, - PCI_VENDOR_ID_ADVANTECH, 0xb102), - .driver_data = BOARD_PCI1710HG, - }, { - PCI_DEVICE_SUB(PCI_VENDOR_ID_ADVANTECH, 0x1710, - PCI_VENDOR_ID_ADVANTECH, 0xb202), - .driver_data = BOARD_PCI1710HG, - }, { - PCI_DEVICE_SUB(PCI_VENDOR_ID_ADVANTECH, 0x1710, - PCI_VENDOR_ID_ADVANTECH, 0xc102), - .driver_data = BOARD_PCI1710HG, - }, { - PCI_DEVICE_SUB(PCI_VENDOR_ID_ADVANTECH, 0x1710, - PCI_VENDOR_ID_ADVANTECH, 0xc202), - .driver_data = BOARD_PCI1710HG, - }, { - PCI_DEVICE_SUB(PCI_VENDOR_ID_ADVANTECH, 0x1710, 0x1000, 0xd102), - .driver_data = BOARD_PCI1710HG, - }, + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADVANTECH, 0x1710, + PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050), + .driver_data = BOARD_PCI1710, + }, { + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADVANTECH, 0x1710, + PCI_VENDOR_ID_ADVANTECH, 0x0000), + .driver_data = BOARD_PCI1710, + }, { + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADVANTECH, 0x1710, + PCI_VENDOR_ID_ADVANTECH, 0xb100), + .driver_data = BOARD_PCI1710, + }, { + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADVANTECH, 0x1710, + PCI_VENDOR_ID_ADVANTECH, 0xb200), + .driver_data = BOARD_PCI1710, + }, { + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADVANTECH, 0x1710, + PCI_VENDOR_ID_ADVANTECH, 0xc100), + .driver_data = BOARD_PCI1710, + }, { + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADVANTECH, + 0x1710, + PCI_VENDOR_ID_ADVANTECH, + 0xc200), + .driver_data = BOARD_PCI1710, + }, { + PCI_DEVICE_SUB(PCI_VENDOR_ID_ADVANTECH, + 0x1710, 0x1000, 0xd100), + .driver_data = BOARD_PCI1710, + }, { + PCI_DEVICE_SUB + (PCI_VENDOR_ID_ADVANTECH, 0x1710, + PCI_VENDOR_ID_ADVANTECH, 0x0002), + .driver_data = BOARD_PCI1710HG, + }, { + PCI_DEVICE_SUB + (PCI_VENDOR_ID_ADVANTECH, + 0x1710, + PCI_VENDOR_ID_ADVANTECH, + 0xb102), + .driver_data = BOARD_PCI1710HG, + }, { + PCI_DEVICE_SUB + (PCI_VENDOR_ID_ADVANTECH, + 0x1710, + PCI_VENDOR_ID_ADVANTECH, + 0xb202), + .driver_data = + BOARD_PCI1710HG, + }, { + PCI_DEVICE_SUB + (PCI_VENDOR_ID_ADVANTECH, + 0x1710, + PCI_VENDOR_ID_ADVANTECH, + 0xc102), + .driver_data = + BOARD_PCI1710HG, + }, { + PCI_DEVICE_SUB + (PCI_VENDOR_ID_ADVANTECH, + 0x1710, + PCI_VENDOR_ID_ADVANTECH, + 0xc202), + .driver_data = + BOARD_PCI1710HG, + }, { + PCI_DEVICE_SUB + (PCI_VENDOR_ID_ADVANTECH, + 0x1710, + 0x1000, + 0xd102), + . + driver_data + = + BOARD_PCI1710HG, + }, { PCI_VDEVICE(ADVANTECH, 0x1711), BOARD_PCI1711 }, { PCI_VDEVICE(ADVANTECH, 0x1713), BOARD_PCI1713 }, { PCI_VDEVICE(ADVANTECH, 0x1731), BOARD_PCI1731 }, { 0 } }; + MODULE_DEVICE_TABLE(pci, adv_pci1710_pci_table); static struct pci_driver adv_pci1710_pci_driver = { - .name = "adv_pci1710", - .id_table = adv_pci1710_pci_table, - .probe = adv_pci1710_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "adv_pci1710", + .id_table = adv_pci1710_pci_table, + .probe = adv_pci1710_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(adv_pci1710_driver, adv_pci1710_pci_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/adv_pci1720.c b/drivers/comedi/drivers/adv_pci1720.c index 2fcd7e8e7d85..89877e8564af 100644 --- a/drivers/comedi/drivers/adv_pci1720.c +++ b/drivers/comedi/drivers/adv_pci1720.c @@ -60,17 +60,16 @@ static const struct comedi_lrange pci1720_ao_range = { 4, { - UNI_RANGE(5), - UNI_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(10) - } + UNI_RANGE(5), + UNI_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(10) + } }; static int pci1720_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int range = CR_RANGE(insn->chanspec); @@ -101,16 +100,14 @@ static int pci1720_ao_insn_write(struct comedi_device *dev, static int pci1720_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { data[1] = inb(dev->iobase + PCI1720_BOARDID_REG); return insn->n; } -static int pci1720_auto_attach(struct comedi_device *dev, - unsigned long context) +static int pci1720_auto_attach(struct comedi_device *dev, unsigned long context) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); struct comedi_subdevice *s; @@ -127,12 +124,12 @@ static int pci1720_auto_attach(struct comedi_device *dev, /* Analog Output subdevice */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 4; - s->maxdata = 0x0fff; - s->range_table = &pci1720_ao_range; - s->insn_write = pci1720_ao_insn_write; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 4; + s->maxdata = 0x0fff; + s->range_table = &pci1720_ao_range; + s->insn_write = pci1720_ao_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) @@ -140,12 +137,12 @@ static int pci1720_auto_attach(struct comedi_device *dev, /* Digital Input subdevice (BoardID SW1) */ s = &dev->subdevices[1]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 4; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = pci1720_di_insn_bits; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 4; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = pci1720_di_insn_bits; /* disable synchronized output, channels update when written */ outb(0, dev->iobase + PCI1720_SYNC_CTRL_REG); @@ -154,10 +151,10 @@ static int pci1720_auto_attach(struct comedi_device *dev, } static struct comedi_driver adv_pci1720_driver = { - .driver_name = "adv_pci1720", - .module = THIS_MODULE, - .auto_attach = pci1720_auto_attach, - .detach = comedi_pci_detach, + .driver_name = "adv_pci1720", + .module = THIS_MODULE, + .auto_attach = pci1720_auto_attach, + .detach = comedi_pci_detach, }; static int adv_pci1720_pci_probe(struct pci_dev *dev, @@ -171,14 +168,16 @@ static const struct pci_device_id adv_pci1720_pci_table[] = { { PCI_DEVICE(PCI_VENDOR_ID_ADVANTECH, 0x1720) }, { 0 } }; + MODULE_DEVICE_TABLE(pci, adv_pci1720_pci_table); static struct pci_driver adv_pci1720_pci_driver = { - .name = "adv_pci1720", - .id_table = adv_pci1720_pci_table, - .probe = adv_pci1720_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "adv_pci1720", + .id_table = adv_pci1720_pci_table, + .probe = adv_pci1720_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(adv_pci1720_driver, adv_pci1720_pci_driver); MODULE_AUTHOR("H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>"); diff --git a/drivers/comedi/drivers/adv_pci1723.c b/drivers/comedi/drivers/adv_pci1723.c index 23660a9fdb9c..926c6c3aedbe 100644 --- a/drivers/comedi/drivers/adv_pci1723.c +++ b/drivers/comedi/drivers/adv_pci1723.c @@ -77,8 +77,7 @@ static int pci1723_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); int i; @@ -95,12 +94,11 @@ static int pci1723_ao_insn_write(struct comedi_device *dev, static int pci1723_dio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int mask = (chan < 8) ? 0x00ff : 0xff00; - unsigned short mode = 0x0000; /* assume output */ + unsigned short mode = 0x0000; /* assume output */ int ret; ret = comedi_dio_insn_config(dev, s, insn, data, mask); @@ -118,8 +116,7 @@ static int pci1723_dio_insn_config(struct comedi_device *dev, static int pci1723_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { if (comedi_dio_update_state(s, data)) outw(s->state, dev->iobase + PCI1723_DIO_DATA_REG); @@ -148,12 +145,12 @@ static int pci1723_auto_attach(struct comedi_device *dev, return ret; s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_COMMON; - s->n_chan = 8; - s->maxdata = 0xffff; - s->range_table = &range_bipolar10; - s->insn_write = pci1723_ao_insn_write; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_COMMON; + s->n_chan = 8; + s->maxdata = 0xffff; + s->range_table = &range_bipolar10; + s->insn_write = pci1723_ao_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) @@ -175,13 +172,13 @@ static int pci1723_auto_attach(struct comedi_device *dev, outw(PCI1723_SYNC_CTRL_ASYNC, dev->iobase + PCI1723_SYNC_CTRL_REG); s = &dev->subdevices[1]; - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 16; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_config = pci1723_dio_insn_config; - s->insn_bits = pci1723_dio_insn_bits; + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 16; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_config = pci1723_dio_insn_config; + s->insn_bits = pci1723_dio_insn_bits; /* get initial DIO direction and state */ val = inw(dev->iobase + PCI1723_DIO_CTRL_REG); @@ -195,10 +192,10 @@ static int pci1723_auto_attach(struct comedi_device *dev, } static struct comedi_driver adv_pci1723_driver = { - .driver_name = "adv_pci1723", - .module = THIS_MODULE, - .auto_attach = pci1723_auto_attach, - .detach = comedi_pci_detach, + .driver_name = "adv_pci1723", + .module = THIS_MODULE, + .auto_attach = pci1723_auto_attach, + .detach = comedi_pci_detach, }; static int adv_pci1723_pci_probe(struct pci_dev *dev, @@ -212,14 +209,16 @@ static const struct pci_device_id adv_pci1723_pci_table[] = { { PCI_DEVICE(PCI_VENDOR_ID_ADVANTECH, 0x1723) }, { 0 } }; + MODULE_DEVICE_TABLE(pci, adv_pci1723_pci_table); static struct pci_driver adv_pci1723_pci_driver = { - .name = "adv_pci1723", - .id_table = adv_pci1723_pci_table, - .probe = adv_pci1723_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "adv_pci1723", + .id_table = adv_pci1723_pci_table, + .probe = adv_pci1723_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(adv_pci1723_driver, adv_pci1723_pci_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/adv_pci1724.c b/drivers/comedi/drivers/adv_pci1724.c index e8ab573c839f..638fea60aa71 100644 --- a/drivers/comedi/drivers/adv_pci1724.c +++ b/drivers/comedi/drivers/adv_pci1724.c @@ -57,23 +57,22 @@ #define PCI1724_SYNC_CTRL_DACSTAT BIT(1) #define PCI1724_SYNC_CTRL_SYN BIT(0) #define PCI1724_EEPROM_CTRL_REG 0x08 -#define PCI1724_SYNC_TRIG_REG 0x0c /* any value works */ +#define PCI1724_SYNC_TRIG_REG 0x0c /* any value works */ #define PCI1724_BOARD_ID_REG 0x10 #define PCI1724_BOARD_ID_MASK (0xf << 0) static const struct comedi_lrange adv_pci1724_ao_ranges = { 4, { - BIP_RANGE(10), - RANGE_mA(0, 20), - RANGE_mA(4, 20), - RANGE_unitless(0, 1) - } + BIP_RANGE(10), + RANGE_mA(0, 20), + RANGE_mA(4, 20), + RANGE_unitless(0, 1) + } }; static int adv_pci1724_dac_idle(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned int status; @@ -85,8 +84,7 @@ static int adv_pci1724_dac_idle(struct comedi_device *dev, static int adv_pci1724_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned long mode = (unsigned long)s->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -138,13 +136,13 @@ static int adv_pci1724_auto_attach(struct comedi_device *dev, /* Analog Output subdevice */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_GROUND; - s->n_chan = 32; - s->maxdata = 0x3fff; - s->range_table = &adv_pci1724_ao_ranges; - s->insn_write = adv_pci1724_insn_write; - s->private = (void *)PCI1724_DAC_CTRL_MODE_NORMAL; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_GROUND; + s->n_chan = 32; + s->maxdata = 0x3fff; + s->range_table = &adv_pci1724_ao_ranges; + s->insn_write = adv_pci1724_insn_write; + s->private = (void *)PCI1724_DAC_CTRL_MODE_NORMAL; ret = comedi_alloc_subdev_readback(s); if (ret) @@ -152,12 +150,12 @@ static int adv_pci1724_auto_attach(struct comedi_device *dev, /* Offset Calibration subdevice */ s = &dev->subdevices[1]; - s->type = COMEDI_SUBD_CALIB; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_INTERNAL; - s->n_chan = 32; - s->maxdata = 0x3fff; - s->insn_write = adv_pci1724_insn_write; - s->private = (void *)PCI1724_DAC_CTRL_MODE_OFFSET; + s->type = COMEDI_SUBD_CALIB; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_INTERNAL; + s->n_chan = 32; + s->maxdata = 0x3fff; + s->insn_write = adv_pci1724_insn_write; + s->private = (void *)PCI1724_DAC_CTRL_MODE_OFFSET; ret = comedi_alloc_subdev_readback(s); if (ret) @@ -165,21 +163,21 @@ static int adv_pci1724_auto_attach(struct comedi_device *dev, /* Gain Calibration subdevice */ s = &dev->subdevices[2]; - s->type = COMEDI_SUBD_CALIB; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_INTERNAL; - s->n_chan = 32; - s->maxdata = 0x3fff; - s->insn_write = adv_pci1724_insn_write; - s->private = (void *)PCI1724_DAC_CTRL_MODE_GAIN; + s->type = COMEDI_SUBD_CALIB; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_INTERNAL; + s->n_chan = 32; + s->maxdata = 0x3fff; + s->insn_write = adv_pci1724_insn_write; + s->private = (void *)PCI1724_DAC_CTRL_MODE_GAIN; return comedi_alloc_subdev_readback(s); } static struct comedi_driver adv_pci1724_driver = { - .driver_name = "adv_pci1724", - .module = THIS_MODULE, - .auto_attach = adv_pci1724_auto_attach, - .detach = comedi_pci_detach, + .driver_name = "adv_pci1724", + .module = THIS_MODULE, + .auto_attach = adv_pci1724_auto_attach, + .detach = comedi_pci_detach, }; static int adv_pci1724_pci_probe(struct pci_dev *dev, @@ -193,14 +191,16 @@ static const struct pci_device_id adv_pci1724_pci_table[] = { { PCI_DEVICE(PCI_VENDOR_ID_ADVANTECH, 0x1724) }, { 0 } }; + MODULE_DEVICE_TABLE(pci, adv_pci1724_pci_table); static struct pci_driver adv_pci1724_pci_driver = { - .name = "adv_pci1724", - .id_table = adv_pci1724_pci_table, - .probe = adv_pci1724_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "adv_pci1724", + .id_table = adv_pci1724_pci_table, + .probe = adv_pci1724_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(adv_pci1724_driver, adv_pci1724_pci_driver); MODULE_AUTHOR("Frank Mori Hess <fmh6jj@xxxxxxxxx>"); diff --git a/drivers/comedi/drivers/adv_pci1760.c b/drivers/comedi/drivers/adv_pci1760.c index 6de8ab97d346..64c38f7cd36e 100644 --- a/drivers/comedi/drivers/adv_pci1760.c +++ b/drivers/comedi/drivers/adv_pci1760.c @@ -62,9 +62,9 @@ #define PCI1760_CMD_GET_STATUS 0x03 /* Read current status */ #define PCI1760_CMD_GET_FW_VER 0x0e /* Read firmware version */ #define PCI1760_CMD_GET_HW_VER 0x0f /* Read hardware version */ -#define PCI1760_CMD_SET_PWM_HI(x) (0x10 + (x) * 2) /* Set "hi" period */ -#define PCI1760_CMD_SET_PWM_LO(x) (0x11 + (x) * 2) /* Set "lo" period */ -#define PCI1760_CMD_SET_PWM_CNT(x) (0x14 + (x)) /* Set burst count */ +#define PCI1760_CMD_SET_PWM_HI(x) (0x10 + (x) * 2) /* Set "hi" period */ +#define PCI1760_CMD_SET_PWM_LO(x) (0x11 + (x) * 2) /* Set "lo" period */ +#define PCI1760_CMD_SET_PWM_CNT(x) (0x14 + (x)) /* Set burst count */ #define PCI1760_CMD_ENA_PWM 0x1f /* Enable PWM outputs */ #define PCI1760_CMD_ENA_FILT 0x20 /* Enable input filter */ #define PCI1760_CMD_ENA_PAT_MATCH 0x21 /* Enable input pattern match */ @@ -77,10 +77,10 @@ #define PCI1760_CMD_ENA_CNT_MATCH 0x2b /* Enable counter match */ #define PCI1760_CMD_SET_CNT_EDGE 0x2c /* Set counter edge */ #define PCI1760_CMD_GET_CNT 0x2f /* Reads counter value */ -#define PCI1760_CMD_SET_HI_SAMP(x) (0x30 + (x)) /* Set "hi" sample time */ -#define PCI1760_CMD_SET_LO_SAMP(x) (0x38 + (x)) /* Set "lo" sample time */ -#define PCI1760_CMD_SET_CNT(x) (0x40 + (x)) /* Set counter reset val */ -#define PCI1760_CMD_SET_CNT_MATCH(x) (0x48 + (x)) /* Set counter match val */ +#define PCI1760_CMD_SET_HI_SAMP(x) (0x30 + (x)) /* Set "hi" sample time */ +#define PCI1760_CMD_SET_LO_SAMP(x) (0x38 + (x)) /* Set "lo" sample time */ +#define PCI1760_CMD_SET_CNT(x) (0x40 + (x)) /* Set counter reset val */ +#define PCI1760_CMD_SET_CNT_MATCH(x) (0x48 + (x)) /* Set counter match val */ #define PCI1760_CMD_GET_INT_FLAGS 0x60 /* Read interrupt flags */ #define PCI1760_CMD_GET_INT_FLAGS_MATCH BIT(0) #define PCI1760_CMD_GET_INT_FLAGS_COS BIT(1) @@ -110,7 +110,7 @@ static int pci1760_send_cmd(struct comedi_device *dev, if (inb(dev->iobase + PCI1760_IMB_REG(2)) == cmd) { /* command success; return the feedback data */ return inb(dev->iobase + PCI1760_IMB_REG(0)) | - (inb(dev->iobase + PCI1760_IMB_REG(1)) << 8); + (inb(dev->iobase + PCI1760_IMB_REG(1)) << 8); } cpu_relax(); } while (time_before(jiffies, timeout)); @@ -148,8 +148,7 @@ static int pci1760_cmd(struct comedi_device *dev, static int pci1760_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { data[1] = inb(dev->iobase + PCI1760_IMB_REG(3)); @@ -158,8 +157,7 @@ static int pci1760_di_insn_bits(struct comedi_device *dev, static int pci1760_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { int ret; @@ -219,8 +217,7 @@ static int pci1760_pwm_enable(struct comedi_device *dev, static int pci1760_pwm_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); int hi_div; @@ -336,8 +333,7 @@ static void pci1760_reset(struct comedi_device *dev) pci1760_cmd(dev, PCI1760_CMD_SET_PAT_MATCH, 0); } -static int pci1760_auto_attach(struct comedi_device *dev, - unsigned long context) +static int pci1760_auto_attach(struct comedi_device *dev, unsigned long context) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); struct comedi_subdevice *s; @@ -356,47 +352,47 @@ static int pci1760_auto_attach(struct comedi_device *dev, /* Digital Input subdevice */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 8; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = pci1760_di_insn_bits; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 8; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = pci1760_di_insn_bits; /* Digital Output subdevice */ s = &dev->subdevices[1]; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 8; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = pci1760_do_insn_bits; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 8; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = pci1760_do_insn_bits; /* get the current state of the outputs */ ret = pci1760_cmd(dev, PCI1760_CMD_GET_DO, 0); if (ret < 0) return ret; - s->state = ret; + s->state = ret; /* PWM subdevice */ s = &dev->subdevices[2]; - s->type = COMEDI_SUBD_PWM; - s->subdev_flags = SDF_PWM_COUNTER; - s->n_chan = 2; - s->insn_config = pci1760_pwm_insn_config; + s->type = COMEDI_SUBD_PWM; + s->subdev_flags = SDF_PWM_COUNTER; + s->n_chan = 2; + s->insn_config = pci1760_pwm_insn_config; /* Counter subdevice */ s = &dev->subdevices[3]; - s->type = COMEDI_SUBD_UNUSED; + s->type = COMEDI_SUBD_UNUSED; return 0; } static struct comedi_driver pci1760_driver = { - .driver_name = "adv_pci1760", - .module = THIS_MODULE, - .auto_attach = pci1760_auto_attach, - .detach = comedi_pci_detach, + .driver_name = "adv_pci1760", + .module = THIS_MODULE, + .auto_attach = pci1760_auto_attach, + .detach = comedi_pci_detach, }; static int pci1760_pci_probe(struct pci_dev *dev, @@ -409,14 +405,16 @@ static const struct pci_device_id pci1760_pci_table[] = { { PCI_DEVICE(PCI_VENDOR_ID_ADVANTECH, 0x1760) }, { 0 } }; + MODULE_DEVICE_TABLE(pci, pci1760_pci_table); static struct pci_driver pci1760_pci_driver = { - .name = "adv_pci1760", - .id_table = pci1760_pci_table, - .probe = pci1760_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "adv_pci1760", + .id_table = pci1760_pci_table, + .probe = pci1760_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(pci1760_driver, pci1760_pci_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/adv_pci_dio.c b/drivers/comedi/drivers/adv_pci_dio.c index 54c7419c8ca6..6fbb02b29803 100644 --- a/drivers/comedi/drivers/adv_pci_dio.c +++ b/drivers/comedi/drivers/adv_pci_dio.c @@ -39,20 +39,20 @@ #define PCI173X_INT_FLAG_REG 0x0010 /* R: status */ #define PCI173X_INT_CLR_REG 0x0010 /* W: clear */ -#define PCI173X_INT_IDI0 0x01 /* IDI0 edge occurred */ -#define PCI173X_INT_IDI1 0x02 /* IDI1 edge occurred */ -#define PCI173X_INT_DI0 0x04 /* DI0 edge occurred */ -#define PCI173X_INT_DI1 0x08 /* DI1 edge occurred */ +#define PCI173X_INT_IDI0 0x01 /* IDI0 edge occurred */ +#define PCI173X_INT_IDI1 0x02 /* IDI1 edge occurred */ +#define PCI173X_INT_DI0 0x04 /* DI0 edge occurred */ +#define PCI173X_INT_DI1 0x08 /* DI1 edge occurred */ /* PCI-1739U, PCI-1750, PCI1751 interrupt control registers */ #define PCI1750_INT_REG 0x20 /* R/W: status/control */ /* PCI-1753, PCI-1753E interrupt control registers */ -#define PCI1753_INT_REG(x) (0x10 + (x)) /* R/W: control group 0 to 3 */ -#define PCI1753E_INT_REG(x) (0x30 + (x)) /* R/W: control group 0 to 3 */ +#define PCI1753_INT_REG(x) (0x10 + (x)) /* R/W: control group 0 to 3 */ +#define PCI1753E_INT_REG(x) (0x30 + (x)) /* R/W: control group 0 to 3 */ /* PCI-1754, PCI-1756 interrupt control registers */ -#define PCI1754_INT_REG(x) (0x08 + (x) * 2) /* R/W: control group 0 to 3 */ +#define PCI1754_INT_REG(x) (0x08 + (x) * 2) /* R/W: control group 0 to 3 */ /* PCI-1752, PCI-1756 special registers */ #define PCI1752_CFC_REG 0x12 /* R/W: channel freeze function */ @@ -95,8 +95,8 @@ struct diosubd_data { }; struct dio_irq_subd_data { - unsigned short int_en; /* interrupt enable/status bit */ - unsigned long addr; /* PCI address offset */ + unsigned short int_en; /* interrupt enable/status bit */ + unsigned long addr; /* PCI address offset */ }; struct dio_boardtype { @@ -113,114 +113,114 @@ struct dio_boardtype { static const struct dio_boardtype boardtypes[] = { [TYPE_PCI1730] = { - .name = "pci1730", - /* DI, IDI, DO, IDO, ID, IRQ_DI0, IRQ_DI1, IRQ_IDI0, IRQ_IDI1 */ - .nsubdevs = 9, - .sdi[0] = { 16, 0x02, }, /* DI 0-15 */ - .sdi[1] = { 16, 0x00, }, /* ISO DI 0-15 */ - .sdo[0] = { 16, 0x02, }, /* DO 0-15 */ - .sdo[1] = { 16, 0x00, }, /* ISO DO 0-15 */ - .id_reg = 0x04, - .sdirq[0] = { PCI173X_INT_DI0, 0x02, }, /* DI 0 */ - .sdirq[1] = { PCI173X_INT_DI1, 0x02, }, /* DI 1 */ - .sdirq[2] = { PCI173X_INT_IDI0, 0x00, }, /* ISO DI 0 */ - .sdirq[3] = { PCI173X_INT_IDI1, 0x00, }, /* ISO DI 1 */ - }, + .name = "pci1730", + /* DI, IDI, DO, IDO, ID, IRQ_DI0, IRQ_DI1, IRQ_IDI0, IRQ_IDI1 */ + .nsubdevs = 9, + .sdi[0] = { 16, 0x02,}, /* DI 0-15 */ + .sdi[1] = { 16, 0x00,}, /* ISO DI 0-15 */ + .sdo[0] = { 16, 0x02,}, /* DO 0-15 */ + .sdo[1] = { 16, 0x00,}, /* ISO DO 0-15 */ + .id_reg = 0x04, + .sdirq[0] = { PCI173X_INT_DI0, 0x02,}, /* DI 0 */ + .sdirq[1] = { PCI173X_INT_DI1, 0x02,}, /* DI 1 */ + .sdirq[2] = { PCI173X_INT_IDI0, 0x00,}, /* ISO DI 0 */ + .sdirq[3] = { PCI173X_INT_IDI1, 0x00,}, /* ISO DI 1 */ + }, [TYPE_PCI1733] = { - .name = "pci1733", - .nsubdevs = 2, - .sdi[1] = { 32, 0x00, }, /* ISO DI 0-31 */ - .id_reg = 0x04, - }, + .name = "pci1733", + .nsubdevs = 2, + .sdi[1] = { 32, 0x00,}, /* ISO DI 0-31 */ + .id_reg = 0x04, + }, [TYPE_PCI1734] = { - .name = "pci1734", - .nsubdevs = 2, - .sdo[1] = { 32, 0x00, }, /* ISO DO 0-31 */ - .id_reg = 0x04, - }, + .name = "pci1734", + .nsubdevs = 2, + .sdo[1] = { 32, 0x00,}, /* ISO DO 0-31 */ + .id_reg = 0x04, + }, [TYPE_PCI1735] = { - .name = "pci1735", - .nsubdevs = 4, - .sdi[0] = { 32, 0x00, }, /* DI 0-31 */ - .sdo[0] = { 32, 0x00, }, /* DO 0-31 */ - .id_reg = 0x08, - .timer_regbase = 0x04, - }, + .name = "pci1735", + .nsubdevs = 4, + .sdi[0] = { 32, 0x00,}, /* DI 0-31 */ + .sdo[0] = { 32, 0x00,}, /* DO 0-31 */ + .id_reg = 0x08, + .timer_regbase = 0x04, + }, [TYPE_PCI1736] = { - .name = "pci1736", - .nsubdevs = 3, - .sdi[1] = { 16, 0x00, }, /* ISO DI 0-15 */ - .sdo[1] = { 16, 0x00, }, /* ISO DO 0-15 */ - .id_reg = 0x04, - }, + .name = "pci1736", + .nsubdevs = 3, + .sdi[1] = { 16, 0x00,}, /* ISO DI 0-15 */ + .sdo[1] = { 16, 0x00,}, /* ISO DO 0-15 */ + .id_reg = 0x04, + }, [TYPE_PCI1739] = { - .name = "pci1739", - .nsubdevs = 3, - .sdio[0] = { 2, 0x00, }, /* 8255 DIO */ - .id_reg = 0x08, - }, + .name = "pci1739", + .nsubdevs = 3, + .sdio[0] = { 2, 0x00,}, /* 8255 DIO */ + .id_reg = 0x08, + }, [TYPE_PCI1750] = { - .name = "pci1750", - .nsubdevs = 2, - .sdi[1] = { 16, 0x00, }, /* ISO DI 0-15 */ - .sdo[1] = { 16, 0x00, }, /* ISO DO 0-15 */ - }, + .name = "pci1750", + .nsubdevs = 2, + .sdi[1] = { 16, 0x00,}, /* ISO DI 0-15 */ + .sdo[1] = { 16, 0x00,}, /* ISO DO 0-15 */ + }, [TYPE_PCI1751] = { - .name = "pci1751", - .nsubdevs = 3, - .sdio[0] = { 2, 0x00, }, /* 8255 DIO */ - .timer_regbase = 0x18, - }, + .name = "pci1751", + .nsubdevs = 3, + .sdio[0] = { 2, 0x00,}, /* 8255 DIO */ + .timer_regbase = 0x18, + }, [TYPE_PCI1752] = { - .name = "pci1752", - .nsubdevs = 3, - .sdo[0] = { 32, 0x00, }, /* DO 0-31 */ - .sdo[1] = { 32, 0x04, }, /* DO 32-63 */ - .id_reg = 0x10, - .is_16bit = 1, - }, + .name = "pci1752", + .nsubdevs = 3, + .sdo[0] = { 32, 0x00,}, /* DO 0-31 */ + .sdo[1] = { 32, 0x04,}, /* DO 32-63 */ + .id_reg = 0x10, + .is_16bit = 1, + }, [TYPE_PCI1753] = { - .name = "pci1753", - .nsubdevs = 4, - .sdio[0] = { 4, 0x00, }, /* 8255 DIO */ - }, + .name = "pci1753", + .nsubdevs = 4, + .sdio[0] = { 4, 0x00,}, /* 8255 DIO */ + }, [TYPE_PCI1753E] = { - .name = "pci1753e", - .nsubdevs = 8, - .sdio[0] = { 4, 0x00, }, /* 8255 DIO */ - .sdio[1] = { 4, 0x20, }, /* 8255 DIO */ - }, + .name = "pci1753e", + .nsubdevs = 8, + .sdio[0] = { 4, 0x00,}, /* 8255 DIO */ + .sdio[1] = { 4, 0x20,}, /* 8255 DIO */ + }, [TYPE_PCI1754] = { - .name = "pci1754", - .nsubdevs = 3, - .sdi[0] = { 32, 0x00, }, /* DI 0-31 */ - .sdi[1] = { 32, 0x04, }, /* DI 32-63 */ - .id_reg = 0x10, - .is_16bit = 1, - }, + .name = "pci1754", + .nsubdevs = 3, + .sdi[0] = { 32, 0x00,}, /* DI 0-31 */ + .sdi[1] = { 32, 0x04,}, /* DI 32-63 */ + .id_reg = 0x10, + .is_16bit = 1, + }, [TYPE_PCI1756] = { - .name = "pci1756", - .nsubdevs = 3, - .sdi[1] = { 32, 0x00, }, /* DI 0-31 */ - .sdo[1] = { 32, 0x04, }, /* DO 0-31 */ - .id_reg = 0x10, - .is_16bit = 1, - }, + .name = "pci1756", + .nsubdevs = 3, + .sdi[1] = { 32, 0x00,}, /* DI 0-31 */ + .sdo[1] = { 32, 0x04,}, /* DO 0-31 */ + .id_reg = 0x10, + .is_16bit = 1, + }, [TYPE_PCI1761] = { - .name = "pci1761", - .nsubdevs = 3, - .sdi[1] = { 8, 0x01 }, /* ISO DI 0-7 */ - .sdo[1] = { 8, 0x00 }, /* RELAY DO 0-7 */ - .id_reg = 0x02, - }, + .name = "pci1761", + .nsubdevs = 3, + .sdi[1] = { 8, 0x01}, /* ISO DI 0-7 */ + .sdo[1] = { 8, 0x00}, /* RELAY DO 0-7 */ + .id_reg = 0x02, + }, [TYPE_PCI1762] = { - .name = "pci1762", - .nsubdevs = 3, - .sdi[1] = { 16, 0x02, }, /* ISO DI 0-15 */ - .sdo[1] = { 16, 0x00, }, /* ISO DO 0-15 */ - .id_reg = 0x04, - .is_16bit = 1, - }, + .name = "pci1762", + .nsubdevs = 3, + .sdi[1] = { 16, 0x02,}, /* ISO DI 0-15 */ + .sdo[1] = { 16, 0x00,}, /* ISO DO 0-15 */ + .id_reg = 0x04, + .is_16bit = 1, + }, }; struct pci_dio_dev_private_data { @@ -231,7 +231,7 @@ struct pci_dio_dev_private_data { }; struct pci_dio_sd_private_data { - spinlock_t subd_slock; /* spin-lock for cmd_running */ + spinlock_t subd_slock; /* spin-lock for cmd_running */ unsigned long port_offset; short int cmd_running; }; @@ -407,8 +407,7 @@ static int pci_dio_insn_bits_dirq_b(struct comedi_device *dev, static int pci_dio_insn_bits_di_b(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned long reg = (unsigned long)s->private; unsigned long iobase = dev->iobase + reg; @@ -426,8 +425,7 @@ static int pci_dio_insn_bits_di_b(struct comedi_device *dev, static int pci_dio_insn_bits_di_w(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned long reg = (unsigned long)s->private; unsigned long iobase = dev->iobase + reg; @@ -441,8 +439,7 @@ static int pci_dio_insn_bits_di_w(struct comedi_device *dev, static int pci_dio_insn_bits_do_b(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned long reg = (unsigned long)s->private; unsigned long iobase = dev->iobase + reg; @@ -464,8 +461,7 @@ static int pci_dio_insn_bits_do_b(struct comedi_device *dev, static int pci_dio_insn_bits_do_w(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned long reg = (unsigned long)s->private; unsigned long iobase = dev->iobase + reg; @@ -546,8 +542,7 @@ static int pci_dio_reset(struct comedi_device *dev, unsigned long cardtype) return 0; } -static int pci_dio_auto_attach(struct comedi_device *dev, - unsigned long context) +static int pci_dio_auto_attach(struct comedi_device *dev, unsigned long context) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); const struct dio_boardtype *board = NULL; @@ -595,15 +590,14 @@ static int pci_dio_auto_attach(struct comedi_device *dev, if (d->chans) { s = &dev->subdevices[subdev++]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = d->chans; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = board->is_16bit - ? pci_dio_insn_bits_di_w - : pci_dio_insn_bits_di_b; - s->private = (void *)d->addr; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = d->chans; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = board->is_16bit + ? pci_dio_insn_bits_di_w : pci_dio_insn_bits_di_b; + s->private = (void *)d->addr; } } @@ -612,15 +606,14 @@ static int pci_dio_auto_attach(struct comedi_device *dev, if (d->chans) { s = &dev->subdevices[subdev++]; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = d->chans; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = board->is_16bit - ? pci_dio_insn_bits_do_w - : pci_dio_insn_bits_do_b; - s->private = (void *)d->addr; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = d->chans; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = board->is_16bit + ? pci_dio_insn_bits_do_w : pci_dio_insn_bits_do_b; + s->private = (void *)d->addr; /* reset all outputs to 0 */ if (board->is_16bit) { @@ -653,14 +646,14 @@ static int pci_dio_auto_attach(struct comedi_device *dev, if (board->id_reg) { s = &dev->subdevices[subdev++]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE | SDF_INTERNAL; - s->n_chan = 4; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = board->is_16bit ? pci_dio_insn_bits_di_w - : pci_dio_insn_bits_di_b; - s->private = (void *)board->id_reg; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE | SDF_INTERNAL; + s->n_chan = 4; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = board->is_16bit ? pci_dio_insn_bits_di_w + : pci_dio_insn_bits_di_b; + s->private = (void *)board->id_reg; } if (board->timer_regbase) { @@ -675,19 +668,19 @@ static int pci_dio_auto_attach(struct comedi_device *dev, comedi_8254_subdevice_init(s, dev->pacer); } - dev_private->irq_subd = subdev; /* first interrupt subdevice index */ + dev_private->irq_subd = subdev; /* first interrupt subdevice index */ for (i = 0; i < PCI_DIO_MAX_IRQ_SUBDEVS; ++i) { struct pci_dio_sd_private_data *sd_priv = NULL; const struct dio_irq_subd_data *d = &board->sdirq[i]; if (d->int_en) { s = &dev->subdevices[subdev++]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 1; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = pci_dio_insn_bits_dirq_b; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 1; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = pci_dio_insn_bits_dirq_b; sd_priv = comedi_alloc_spriv(s, sizeof(*sd_priv)); if (!sd_priv) return -ENOMEM; @@ -698,12 +691,12 @@ static int pci_dio_auto_attach(struct comedi_device *dev, if (dev->irq) { dev->read_subdev = s; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE | SDF_CMD_READ; - s->len_chanlist = 1; - s->do_cmdtest = pci_dio_asy_cmdtest; - s->do_cmd = pci_dio_asy_cmd; - s->cancel = pci_dio_asy_cancel; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE | SDF_CMD_READ; + s->len_chanlist = 1; + s->do_cmdtest = pci_dio_asy_cmdtest; + s->do_cmd = pci_dio_asy_cmd; + s->cancel = pci_dio_asy_cancel; } } } @@ -722,10 +715,10 @@ static void pci_dio_detach(struct comedi_device *dev) } static struct comedi_driver adv_pci_dio_driver = { - .driver_name = "adv_pci_dio", - .module = THIS_MODULE, - .auto_attach = pci_dio_auto_attach, - .detach = pci_dio_detach, + .driver_name = "adv_pci_dio", + .module = THIS_MODULE, + .auto_attach = pci_dio_auto_attach, + .detach = pci_dio_detach, }; static unsigned long pci_dio_override_cardtype(struct pci_dev *pcidev, @@ -786,14 +779,16 @@ static const struct pci_device_id adv_pci_dio_pci_table[] = { { PCI_VDEVICE(ADVANTECH, 0x1762), TYPE_PCI1762 }, { 0 } }; + MODULE_DEVICE_TABLE(pci, adv_pci_dio_pci_table); static struct pci_driver adv_pci_dio_pci_driver = { - .name = "adv_pci_dio", - .id_table = adv_pci_dio_pci_table, - .probe = adv_pci_dio_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "adv_pci_dio", + .id_table = adv_pci_dio_pci_table, + .probe = adv_pci_dio_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(adv_pci_dio_driver, adv_pci_dio_pci_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/aio_aio12_8.c b/drivers/comedi/drivers/aio_aio12_8.c index 4829115921a3..a17ba0f36cf3 100644 --- a/drivers/comedi/drivers/aio_aio12_8.c +++ b/drivers/comedi/drivers/aio_aio12_8.c @@ -69,11 +69,11 @@ static const struct comedi_lrange aio_aio12_8_range = { 4, { - UNI_RANGE(5), - BIP_RANGE(5), - UNI_RANGE(10), - BIP_RANGE(10) - } + UNI_RANGE(5), + BIP_RANGE(5), + UNI_RANGE(10), + BIP_RANGE(10) + } }; struct aio12_8_boardtype { @@ -84,22 +84,21 @@ struct aio12_8_boardtype { static const struct aio12_8_boardtype board_types[] = { { - .name = "aio_aio12_8", - .has_ai = 1, - .has_ao = 1, - }, { - .name = "aio_ai12_8", - .has_ai = 1, - }, { - .name = "aio_ao12_4", - .has_ao = 1, - }, + .name = "aio_aio12_8", + .has_ai = 1, + .has_ao = 1, + }, { + .name = "aio_ai12_8", + .has_ai = 1, + }, { + .name = "aio_ao12_4", + .has_ao = 1, + }, }; static int aio_aio12_8_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned int status; @@ -111,8 +110,7 @@ static int aio_aio12_8_ai_eoc(struct comedi_device *dev, static int aio_aio12_8_ai_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int range = CR_RANGE(insn->chanspec); @@ -126,7 +124,7 @@ static int aio_aio12_8_ai_read(struct comedi_device *dev, * at the desired range of the requested channel. */ control = AIO12_8_ADC_MODE_NORMAL | AIO12_8_ADC_ACQ_3USEC | - AIO12_8_ADC_RANGE(range) | AIO12_8_ADC_CHAN(chan); + AIO12_8_ADC_RANGE(range) | AIO12_8_ADC_CHAN(chan); /* Read status to clear EOC latch */ inb(dev->iobase + AIO12_8_STATUS_REG); @@ -219,12 +217,12 @@ static int aio_aio12_8_attach(struct comedi_device *dev, /* Analog Input subdevice */ s = &dev->subdevices[0]; if (board->has_ai) { - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF; - s->n_chan = 8; - s->maxdata = 0x0fff; - s->range_table = &aio_aio12_8_range; - s->insn_read = aio_aio12_8_ai_read; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF; + s->n_chan = 8; + s->maxdata = 0x0fff; + s->range_table = &aio_aio12_8_range; + s->insn_read = aio_aio12_8_ai_read; } else { s->type = COMEDI_SUBD_UNUSED; } @@ -232,12 +230,12 @@ static int aio_aio12_8_attach(struct comedi_device *dev, /* Analog Output subdevice */ s = &dev->subdevices[1]; if (board->has_ao) { - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE | SDF_GROUND; - s->n_chan = 4; - s->maxdata = 0x0fff; - s->range_table = &aio_aio12_8_range; - s->insn_write = aio_aio12_8_ao_insn_write; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE | SDF_GROUND; + s->n_chan = 4; + s->maxdata = 0x0fff; + s->range_table = &aio_aio12_8_range; + s->insn_write = aio_aio12_8_ao_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) @@ -262,14 +260,15 @@ static int aio_aio12_8_attach(struct comedi_device *dev, } static struct comedi_driver aio_aio12_8_driver = { - .driver_name = "aio_aio12_8", - .module = THIS_MODULE, - .attach = aio_aio12_8_attach, - .detach = comedi_legacy_detach, - .board_name = &board_types[0].name, - .num_names = ARRAY_SIZE(board_types), - .offset = sizeof(struct aio12_8_boardtype), + .driver_name = "aio_aio12_8", + .module = THIS_MODULE, + .attach = aio_aio12_8_attach, + .detach = comedi_legacy_detach, + .board_name = &board_types[0].name, + .num_names = ARRAY_SIZE(board_types), + .offset = sizeof(struct aio12_8_boardtype), }; + module_comedi_driver(aio_aio12_8_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/aio_iiro_16.c b/drivers/comedi/drivers/aio_iiro_16.c index fe3876235075..251efbc6cdc9 100644 --- a/drivers/comedi/drivers/aio_iiro_16.c +++ b/drivers/comedi/drivers/aio_iiro_16.c @@ -191,43 +191,44 @@ static int aio_iiro_16_attach(struct comedi_device *dev, /* Digital Output subdevice */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 16; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = aio_iiro_16_do_insn_bits; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 16; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = aio_iiro_16_do_insn_bits; /* get the initial state of the relays */ s->state = inb(dev->iobase + AIO_IIRO_16_RELAY_0_7) | - (inb(dev->iobase + AIO_IIRO_16_RELAY_8_15) << 8); + (inb(dev->iobase + AIO_IIRO_16_RELAY_8_15) << 8); /* Digital Input subdevice */ s = &dev->subdevices[1]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 16; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = aio_iiro_16_di_insn_bits; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 16; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = aio_iiro_16_di_insn_bits; if (dev->irq) { dev->read_subdev = s; - s->subdev_flags |= SDF_CMD_READ | SDF_LSAMPL; - s->len_chanlist = 1; - s->do_cmdtest = aio_iiro_16_cos_cmdtest; - s->do_cmd = aio_iiro_16_cos_cmd; - s->cancel = aio_iiro_16_cos_cancel; + s->subdev_flags |= SDF_CMD_READ | SDF_LSAMPL; + s->len_chanlist = 1; + s->do_cmdtest = aio_iiro_16_cos_cmdtest; + s->do_cmd = aio_iiro_16_cos_cmd; + s->cancel = aio_iiro_16_cos_cancel; } return 0; } static struct comedi_driver aio_iiro_16_driver = { - .driver_name = "aio_iiro_16", - .module = THIS_MODULE, - .attach = aio_iiro_16_attach, - .detach = comedi_legacy_detach, + .driver_name = "aio_iiro_16", + .module = THIS_MODULE, + .attach = aio_iiro_16_attach, + .detach = comedi_legacy_detach, }; + module_comedi_driver(aio_iiro_16_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/amplc_dio200.c b/drivers/comedi/drivers/amplc_dio200.c index fa19c9e7c56b..0fb3c77988fc 100644 --- a/drivers/comedi/drivers/amplc_dio200.c +++ b/drivers/comedi/drivers/amplc_dio200.c @@ -194,48 +194,44 @@ */ static const struct dio200_board dio200_isa_boards[] = { { - .name = "pc212e", - .n_subdevs = 6, - .sdtype = { - sd_8255, sd_8254, sd_8254, sd_8254, sd_8254, sd_intr - }, - .sdinfo = { 0x00, 0x08, 0x0c, 0x10, 0x14, 0x3f }, - .has_int_sce = true, - .has_clk_gat_sce = true, - }, { - .name = "pc214e", - .n_subdevs = 4, - .sdtype = { - sd_8255, sd_8255, sd_8254, sd_intr - }, - .sdinfo = { 0x00, 0x08, 0x10, 0x01 }, - }, { - .name = "pc215e", - .n_subdevs = 5, - .sdtype = { - sd_8255, sd_8255, sd_8254, sd_8254, sd_intr - }, - .sdinfo = { 0x00, 0x08, 0x10, 0x14, 0x3f }, - .has_int_sce = true, - .has_clk_gat_sce = true, - }, { - .name = "pc218e", - .n_subdevs = 7, - .sdtype = { - sd_8254, sd_8254, sd_8255, sd_8254, sd_8254, sd_intr - }, - .sdinfo = { 0x00, 0x04, 0x08, 0x0c, 0x10, 0x14, 0x3f }, - .has_int_sce = true, - .has_clk_gat_sce = true, - }, { - .name = "pc272e", - .n_subdevs = 4, - .sdtype = { - sd_8255, sd_8255, sd_8255, sd_intr - }, - .sdinfo = { 0x00, 0x08, 0x10, 0x3f }, - .has_int_sce = true, - }, + .name = "pc212e", + .n_subdevs = 6, + .sdtype = { + sd_8255, sd_8254, sd_8254, sd_8254, sd_8254, sd_intr}, + .sdinfo = { 0x00, 0x08, 0x0c, 0x10, 0x14, 0x3f}, + .has_int_sce = true, + .has_clk_gat_sce = true, + }, { + .name = "pc214e", + .n_subdevs = 4, + .sdtype = { + sd_8255, sd_8255, sd_8254, sd_intr}, + .sdinfo = { 0x00, 0x08, 0x10, 0x01}, + }, { + .name = "pc215e", + .n_subdevs = 5, + .sdtype = { + sd_8255, sd_8255, sd_8254, sd_8254, sd_intr}, + .sdinfo = { 0x00, 0x08, 0x10, 0x14, 0x3f}, + .has_int_sce = true, + .has_clk_gat_sce = true, + }, { + .name = "pc218e", + .n_subdevs = 7, + .sdtype = { + sd_8254, sd_8254, sd_8255, sd_8254, sd_8254, + sd_intr}, + .sdinfo = { 0x00, 0x04, 0x08, 0x0c, 0x10, 0x14, 0x3f}, + .has_int_sce = true, + .has_clk_gat_sce = true, + }, { + .name = "pc272e", + .n_subdevs = 4, + .sdtype = { + sd_8255, sd_8255, sd_8255, sd_intr}, + .sdinfo = { 0x00, 0x08, 0x10, 0x3f}, + .has_int_sce = true, + }, }; static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it) @@ -250,14 +246,15 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it) } static struct comedi_driver amplc_dio200_driver = { - .driver_name = "amplc_dio200", - .module = THIS_MODULE, - .attach = dio200_attach, - .detach = comedi_legacy_detach, - .board_name = &dio200_isa_boards[0].name, - .offset = sizeof(struct dio200_board), - .num_names = ARRAY_SIZE(dio200_isa_boards), + .driver_name = "amplc_dio200", + .module = THIS_MODULE, + .attach = dio200_attach, + .detach = comedi_legacy_detach, + .board_name = &dio200_isa_boards[0].name, + .offset = sizeof(struct dio200_board), + .num_names = ARRAY_SIZE(dio200_isa_boards), }; + module_comedi_driver(amplc_dio200_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/amplc_dio200.h b/drivers/comedi/drivers/amplc_dio200.h index 745baaf940ee..6c0255eeced9 100644 --- a/drivers/comedi/drivers/amplc_dio200.h +++ b/drivers/comedi/drivers/amplc_dio200.h @@ -34,7 +34,7 @@ struct dio200_board { unsigned char sdinfo[DIO200_MAX_SUBDEVS]; /* depends on sdtype */ unsigned int has_int_sce:1; /* has interrupt enable/status reg */ unsigned int has_clk_gat_sce:1; /* has clock/gate selection registers */ - unsigned int is_pcie:1; /* has enhanced features */ + unsigned int is_pcie:1; /* has enhanced features */ }; int amplc_dio200_common_attach(struct comedi_device *dev, unsigned int irq, diff --git a/drivers/comedi/drivers/amplc_dio200_common.c b/drivers/comedi/drivers/amplc_dio200_common.c index a3454130d5f8..ad3d65f362b6 100644 --- a/drivers/comedi/drivers/amplc_dio200_common.c +++ b/drivers/comedi/drivers/amplc_dio200_common.c @@ -43,7 +43,7 @@ static unsigned char clk_gat_sce(unsigned int which, unsigned int chan, unsigned int source) { return (which << 5) | (chan << 3) | - ((source & 030) << 3) | (source & 007); + ((source & 030) << 3) | (source & 007); } /* @@ -76,7 +76,7 @@ static const unsigned int ts_clock_period[TS_CONFIG_MAX_CLK_SRC + 1] = { }; struct dio200_subdev_8255 { - unsigned int ofs; /* DIO base offset */ + unsigned int ofs; /* DIO base offset */ }; struct dio200_subdev_intr { @@ -381,7 +381,7 @@ static int dio200_subdev_intr_cmdtest(struct comedi_device *dev, if (cmd->stop_src == TRIG_COUNT) err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); - else /* TRIG_NONE */ + else /* TRIG_NONE */ err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) @@ -407,7 +407,7 @@ static int dio200_subdev_intr_cmd(struct comedi_device *dev, if (cmd->start_src == TRIG_INT) s->async->inttrig = dio200_inttrig_start_intr; - else /* TRIG_NOW */ + else /* TRIG_NOW */ dio200_start_intr(dev, s); spin_unlock_irqrestore(&subpriv->spinlock, flags); @@ -417,8 +417,7 @@ static int dio200_subdev_intr_cmd(struct comedi_device *dev, static int dio200_subdev_intr_init(struct comedi_device *dev, struct comedi_subdevice *s, - unsigned int offset, - unsigned int valid_isns) + unsigned int offset, unsigned int valid_isns) { const struct dio200_board *board = dev->board_ptr; struct dio200_subdev_intr *subpriv; @@ -471,8 +470,7 @@ static irqreturn_t dio200_interrupt(int irq, void *d) static void dio200_subdev_8254_set_gate_src(struct comedi_device *dev, struct comedi_subdevice *s, - unsigned int chan, - unsigned int src) + unsigned int chan, unsigned int src) { unsigned int offset = dio200_subdev_8254_offset(dev, s); @@ -613,8 +611,7 @@ static void dio200_subdev_8255_set_dir(struct comedi_device *dev, static int dio200_subdev_8255_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct dio200_subdev_8255 *subpriv = s->private; unsigned int mask; @@ -727,7 +724,7 @@ static void dio200_subdev_timer_get_clock_src(struct comedi_device *dev, clk = dio200_read32(dev, DIO200_TS_CONFIG) & TS_CONFIG_CLK_SRC_MASK; *src = clk; *period = (clk < ARRAY_SIZE(ts_clock_period)) ? - ts_clock_period[clk] : 0; + ts_clock_period[clk] : 0; } static int dio200_subdev_timer_set_clock_src(struct comedi_device *dev, @@ -770,6 +767,7 @@ void amplc_dio200_set_enhance(struct comedi_device *dev, unsigned char val) { dio200_write8(dev, DIO200_ENHANCE, val); } + EXPORT_SYMBOL_GPL(amplc_dio200_set_enhance); int amplc_dio200_common_attach(struct comedi_device *dev, unsigned int irq, @@ -789,15 +787,13 @@ int amplc_dio200_common_attach(struct comedi_device *dev, unsigned int irq, switch (board->sdtype[n]) { case sd_8254: /* counter subdevice (8254) */ - ret = dio200_subdev_8254_init(dev, s, - board->sdinfo[n]); + ret = dio200_subdev_8254_init(dev, s, board->sdinfo[n]); if (ret < 0) return ret; break; case sd_8255: /* digital i/o subdevice (8255) */ - ret = dio200_subdev_8255_init(dev, s, - board->sdinfo[n]); + ret = dio200_subdev_8255_init(dev, s, board->sdinfo[n]); if (ret < 0) return ret; break; @@ -815,12 +811,12 @@ int amplc_dio200_common_attach(struct comedi_device *dev, unsigned int irq, } break; case sd_timer: - s->type = COMEDI_SUBD_TIMER; - s->subdev_flags = SDF_READABLE | SDF_LSAMPL; - s->n_chan = 1; - s->maxdata = 0xffffffff; - s->insn_read = dio200_subdev_timer_read; - s->insn_config = dio200_subdev_timer_config; + s->type = COMEDI_SUBD_TIMER; + s->subdev_flags = SDF_READABLE | SDF_LSAMPL; + s->n_chan = 1; + s->maxdata = 0xffffffff; + s->insn_read = dio200_subdev_timer_read; + s->insn_config = dio200_subdev_timer_config; break; default: s->type = COMEDI_SUBD_UNUSED; @@ -840,17 +836,20 @@ int amplc_dio200_common_attach(struct comedi_device *dev, unsigned int irq, return 0; } + EXPORT_SYMBOL_GPL(amplc_dio200_common_attach); static int __init amplc_dio200_common_init(void) { return 0; } + module_init(amplc_dio200_common_init); static void __exit amplc_dio200_common_exit(void) { } + module_exit(amplc_dio200_common_exit); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/amplc_dio200_pci.c b/drivers/comedi/drivers/amplc_dio200_pci.c index 1bd7a42c8464..c3ac8dfdb924 100644 --- a/drivers/comedi/drivers/amplc_dio200_pci.c +++ b/drivers/comedi/drivers/amplc_dio200_pci.c @@ -233,71 +233,67 @@ enum dio200_pci_model { static const struct dio200_board dio200_pci_boards[] = { [pci215_model] = { - .name = "pci215", - .mainbar = 2, - .n_subdevs = 5, - .sdtype = { - sd_8255, sd_8255, sd_8254, sd_8254, sd_intr - }, - .sdinfo = { 0x00, 0x08, 0x10, 0x14, 0x3f }, - .has_int_sce = true, - .has_clk_gat_sce = true, - }, + .name = "pci215", + .mainbar = 2, + .n_subdevs = 5, + .sdtype = { + sd_8255, sd_8255, sd_8254, sd_8254, + sd_intr}, + .sdinfo = { 0x00, 0x08, 0x10, 0x14, 0x3f}, + .has_int_sce = true, + .has_clk_gat_sce = true, + }, [pci272_model] = { - .name = "pci272", - .mainbar = 2, - .n_subdevs = 4, - .sdtype = { - sd_8255, sd_8255, sd_8255, sd_intr - }, - .sdinfo = { 0x00, 0x08, 0x10, 0x3f }, - .has_int_sce = true, - }, + .name = "pci272", + .mainbar = 2, + .n_subdevs = 4, + .sdtype = { + sd_8255, sd_8255, sd_8255, sd_intr}, + .sdinfo = { 0x00, 0x08, 0x10, 0x3f}, + .has_int_sce = true, + }, [pcie215_model] = { - .name = "pcie215", - .mainbar = 1, - .n_subdevs = 8, - .sdtype = { - sd_8255, sd_none, sd_8255, sd_none, - sd_8254, sd_8254, sd_timer, sd_intr - }, - .sdinfo = { - 0x00, 0x00, 0x08, 0x00, 0x10, 0x14, 0x00, 0x3f - }, - .has_int_sce = true, - .has_clk_gat_sce = true, - .is_pcie = true, - }, + .name = "pcie215", + .mainbar = 1, + .n_subdevs = 8, + .sdtype = { + sd_8255, sd_none, sd_8255, sd_none, + sd_8254, sd_8254, sd_timer, sd_intr}, + .sdinfo = { + 0x00, 0x00, 0x08, 0x00, 0x10, 0x14, 0x00, + 0x3f}, + .has_int_sce = true, + .has_clk_gat_sce = true, + .is_pcie = true, + }, [pcie236_model] = { - .name = "pcie236", - .mainbar = 1, - .n_subdevs = 8, - .sdtype = { - sd_8255, sd_none, sd_none, sd_none, - sd_8254, sd_8254, sd_timer, sd_intr - }, - .sdinfo = { - 0x00, 0x00, 0x00, 0x00, 0x10, 0x14, 0x00, 0x3f - }, - .has_int_sce = true, - .has_clk_gat_sce = true, - .is_pcie = true, - }, + .name = "pcie236", + .mainbar = 1, + .n_subdevs = 8, + .sdtype = { + sd_8255, sd_none, sd_none, sd_none, + sd_8254, sd_8254, sd_timer, sd_intr}, + .sdinfo = { + 0x00, 0x00, 0x00, 0x00, 0x10, 0x14, 0x00, + 0x3f}, + .has_int_sce = true, + .has_clk_gat_sce = true, + .is_pcie = true, + }, [pcie296_model] = { - .name = "pcie296", - .mainbar = 1, - .n_subdevs = 8, - .sdtype = { - sd_8255, sd_8255, sd_8255, sd_8255, - sd_8254, sd_8254, sd_timer, sd_intr - }, - .sdinfo = { - 0x00, 0x04, 0x08, 0x0c, 0x10, 0x14, 0x00, 0x3f - }, - .has_int_sce = true, - .has_clk_gat_sce = true, - .is_pcie = true, - }, + .name = "pcie296", + .mainbar = 1, + .n_subdevs = 8, + .sdtype = { + sd_8255, sd_8255, sd_8255, sd_8255, + sd_8254, sd_8254, sd_timer, sd_intr}, + .sdinfo = { + 0x00, 0x04, 0x08, 0x0c, 0x10, 0x14, 0x00, + 0x3f}, + .has_int_sce = true, + .has_clk_gat_sce = true, + .is_pcie = true, + }, }; /* @@ -379,10 +375,10 @@ static int dio200_pci_auto_attach(struct comedi_device *dev, } static struct comedi_driver dio200_pci_comedi_driver = { - .driver_name = "amplc_dio200_pci", - .module = THIS_MODULE, - .auto_attach = dio200_pci_auto_attach, - .detach = comedi_pci_detach, + .driver_name = "amplc_dio200_pci", + .module = THIS_MODULE, + .auto_attach = dio200_pci_auto_attach, + .detach = comedi_pci_detach, }; static const struct pci_device_id dio200_pci_table[] = { @@ -391,7 +387,7 @@ static const struct pci_device_id dio200_pci_table[] = { { PCI_VDEVICE(AMPLICON, 0x0011), pcie236_model }, { PCI_VDEVICE(AMPLICON, 0x0012), pcie215_model }, { PCI_VDEVICE(AMPLICON, 0x0014), pcie296_model }, - {0} + { 0 } }; MODULE_DEVICE_TABLE(pci, dio200_pci_table); @@ -403,11 +399,12 @@ static int dio200_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) } static struct pci_driver dio200_pci_pci_driver = { - .name = "amplc_dio200_pci", - .id_table = dio200_pci_table, - .probe = dio200_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "amplc_dio200_pci", + .id_table = dio200_pci_table, + .probe = dio200_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(dio200_pci_comedi_driver, dio200_pci_pci_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/amplc_pc236.c b/drivers/comedi/drivers/amplc_pc236.c index c377af1d5246..51568c33c698 100644 --- a/drivers/comedi/drivers/amplc_pc236.c +++ b/drivers/comedi/drivers/amplc_pc236.c @@ -55,8 +55,8 @@ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it) static const struct pc236_board pc236_boards[] = { { - .name = "pc36at", - }, + .name = "pc36at", + }, }; static struct comedi_driver amplc_pc236_driver = { diff --git a/drivers/comedi/drivers/amplc_pc236.h b/drivers/comedi/drivers/amplc_pc236.h index 7e72729f7492..8d55af8549fe 100644 --- a/drivers/comedi/drivers/amplc_pc236.h +++ b/drivers/comedi/drivers/amplc_pc236.h @@ -18,12 +18,12 @@ struct comedi_device; struct pc236_board { const char *name; - void (*intr_update_cb)(struct comedi_device *dev, bool enable); - bool (*intr_chk_clr_cb)(struct comedi_device *dev); + void (*intr_update_cb)(struct comedi_device *dev, bool enable); + bool (*intr_chk_clr_cb)(struct comedi_device *dev); }; struct pc236_private { - unsigned long lcr_iobase; /* PLX PCI9052 config registers in PCIBAR1 */ + unsigned long lcr_iobase; /* PLX PCI9052 config registers in PCIBAR1 */ bool enable_irq; }; diff --git a/drivers/comedi/drivers/amplc_pc236_common.c b/drivers/comedi/drivers/amplc_pc236_common.c index 981d281e87a1..f354c4514a55 100644 --- a/drivers/comedi/drivers/amplc_pc236_common.c +++ b/drivers/comedi/drivers/amplc_pc236_common.c @@ -166,7 +166,7 @@ int amplc_pc236_common_attach(struct comedi_device *dev, unsigned long iobase, s->maxdata = 1; s->range_table = &range_digital; s->insn_bits = pc236_intr_insn; - s->len_chanlist = 1; + s->len_chanlist = 1; s->do_cmdtest = pc236_intr_cmdtest; s->do_cmd = pc236_intr_cmd; s->cancel = pc236_intr_cancel; @@ -175,17 +175,20 @@ int amplc_pc236_common_attach(struct comedi_device *dev, unsigned long iobase, return 0; } + EXPORT_SYMBOL_GPL(amplc_pc236_common_attach); static int __init amplc_pc236_common_init(void) { return 0; } + module_init(amplc_pc236_common_init); static void __exit amplc_pc236_common_exit(void) { } + module_exit(amplc_pc236_common_exit); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/amplc_pc263.c b/drivers/comedi/drivers/amplc_pc263.c index 68da6098ee84..e9dc252659b8 100644 --- a/drivers/comedi/drivers/amplc_pc263.c +++ b/drivers/comedi/drivers/amplc_pc263.c @@ -37,14 +37,13 @@ struct pc263_board { static const struct pc263_board pc263_boards[] = { { - .name = "pc263", - }, + .name = "pc263", + }, }; static int pc263_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { if (comedi_dio_update_state(s, data)) { outb(s->state & 0xff, dev->iobase + PC263_DO_0_7_REG); @@ -71,28 +70,28 @@ static int pc263_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* Digital Output subdevice */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 16; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = pc263_do_insn_bits; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 16; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = pc263_do_insn_bits; /* read initial relay state */ s->state = inb(dev->iobase + PC263_DO_0_7_REG) | - (inb(dev->iobase + PC263_DO_8_15_REG) << 8); + (inb(dev->iobase + PC263_DO_8_15_REG) << 8); return 0; } static struct comedi_driver amplc_pc263_driver = { - .driver_name = "amplc_pc263", - .module = THIS_MODULE, - .attach = pc263_attach, - .detach = comedi_legacy_detach, - .board_name = &pc263_boards[0].name, - .offset = sizeof(struct pc263_board), - .num_names = ARRAY_SIZE(pc263_boards), + .driver_name = "amplc_pc263", + .module = THIS_MODULE, + .attach = pc263_attach, + .detach = comedi_legacy_detach, + .board_name = &pc263_boards[0].name, + .offset = sizeof(struct pc263_board), + .num_names = ARRAY_SIZE(pc263_boards), }; module_comedi_driver(amplc_pc263_driver); diff --git a/drivers/comedi/drivers/amplc_pci224.c b/drivers/comedi/drivers/amplc_pci224.c index bcf6d61af863..7a306cb0c206 100644 --- a/drivers/comedi/drivers/amplc_pci224.c +++ b/drivers/comedi/drivers/amplc_pci224.c @@ -151,12 +151,12 @@ /* (r/w) FIFO interrupt trigger level (most values are not very useful). */ #define PCI224_DACCON_FIFOINTR(x) (((x) & 0x7) << 9) #define PCI224_DACCON_FIFOINTR_MASK PCI224_DACCON_FIFOINTR(7) -#define PCI224_DACCON_FIFOINTR_EMPTY PCI224_DACCON_FIFOINTR(0) /* empty */ -#define PCI224_DACCON_FIFOINTR_NEMPTY PCI224_DACCON_FIFOINTR(1) /* !empty */ -#define PCI224_DACCON_FIFOINTR_NHALF PCI224_DACCON_FIFOINTR(2) /* !half */ -#define PCI224_DACCON_FIFOINTR_HALF PCI224_DACCON_FIFOINTR(3) /* half */ -#define PCI224_DACCON_FIFOINTR_NFULL PCI224_DACCON_FIFOINTR(4) /* !full */ -#define PCI224_DACCON_FIFOINTR_FULL PCI224_DACCON_FIFOINTR(5) /* full */ +#define PCI224_DACCON_FIFOINTR_EMPTY PCI224_DACCON_FIFOINTR(0) /* empty */ +#define PCI224_DACCON_FIFOINTR_NEMPTY PCI224_DACCON_FIFOINTR(1) /* !empty */ +#define PCI224_DACCON_FIFOINTR_NHALF PCI224_DACCON_FIFOINTR(2) /* !half */ +#define PCI224_DACCON_FIFOINTR_HALF PCI224_DACCON_FIFOINTR(3) /* half */ +#define PCI224_DACCON_FIFOINTR_NFULL PCI224_DACCON_FIFOINTR(4) /* !full */ +#define PCI224_DACCON_FIFOINTR_FULL PCI224_DACCON_FIFOINTR(5) /* full */ /* (r-o) FIFO fill level. */ #define PCI224_DACCON_FIFOFL(x) (((x) & 0x7) << 12) #define PCI224_DACCON_FIFOFL_MASK PCI224_DACCON_FIFOFL(7) @@ -265,19 +265,19 @@ static unsigned int pci224_gat_config(unsigned int chan, unsigned int src) */ static const struct comedi_lrange range_pci224 = { 10, { - /* jumper LK1 in position 1-2 (factory default) */ - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(2.5), - BIP_RANGE(1.25), - UNI_RANGE(10), - UNI_RANGE(5), - UNI_RANGE(2.5), - UNI_RANGE(1.25), - /* jumper LK1 in position 2-3 */ - RANGE_ext(-1, 1), /* bipolar [-Vext,+Vext] */ - RANGE_ext(0, 1), /* unipolar [0,+Vext] */ - } + /* jumper LK1 in position 1-2 (factory default) */ + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(2.5), + BIP_RANGE(1.25), + UNI_RANGE(10), + UNI_RANGE(5), + UNI_RANGE(2.5), + UNI_RANGE(1.25), + /* jumper LK1 in position 2-3 */ + RANGE_ext(-1, 1), /* bipolar [-Vext,+Vext] */ + RANGE_ext(0, 1), /* unipolar [0,+Vext] */ + } }; static const unsigned short hwrange_pci224[10] = { @@ -309,15 +309,15 @@ static const unsigned char range_check_pci224[10] = { */ static const struct comedi_lrange range_pci234 = { 4, { - /* LK1: 1-2 (fact def), LK2/3/4/5: 2-3 (fac def) */ - BIP_RANGE(10), - /* LK1: 1-2 (fact def), LK2/3/4/5: 1-2 */ - BIP_RANGE(5), - /* LK1: 2-3, LK2/3/4/5: 2-3 (fac def) */ - RANGE_ext(-2, 2), /* bipolar [-2*Vext,+2*Vext] */ - /* LK1: 2-3, LK2/3/4/5: 1-2 */ - RANGE_ext(-1, 1), /* bipolar [-Vext,+Vext] */ - } + /* LK1: 1-2 (fact def), LK2/3/4/5: 2-3 (fac def) */ + BIP_RANGE(10), + /* LK1: 1-2 (fact def), LK2/3/4/5: 1-2 */ + BIP_RANGE(5), + /* LK1: 2-3, LK2/3/4/5: 2-3 (fac def) */ + RANGE_ext(-2, 2), /* bipolar [-2*Vext,+2*Vext] */ + /* LK1: 2-3, LK2/3/4/5: 1-2 */ + RANGE_ext(-1, 1), /* bipolar [-Vext,+Vext] */ + } }; /* N.B. PCI234 ignores the polarity bit, but software uses it. */ @@ -350,21 +350,21 @@ struct pci224_board { static const struct pci224_board pci224_boards[] = { [pci224_model] = { - .name = "pci224", - .ao_chans = 16, - .ao_bits = 12, - .ao_range = &range_pci224, - .ao_hwrange = &hwrange_pci224[0], - .ao_range_check = &range_check_pci224[0], - }, + .name = "pci224", + .ao_chans = 16, + .ao_bits = 12, + .ao_range = &range_pci224, + .ao_hwrange = &hwrange_pci224[0], + .ao_range_check = &range_check_pci224[0], + }, [pci234_model] = { - .name = "pci234", - .ao_chans = 4, - .ao_bits = 16, - .ao_range = &range_pci234, - .ao_hwrange = &hwrange_pci234[0], - .ao_range_check = &range_check_pci234[0], - }, + .name = "pci234", + .ao_chans = 4, + .ao_bits = 16, + .ao_range = &range_pci234, + .ao_hwrange = &hwrange_pci234[0], + .ao_range_check = &range_check_pci234[0], + }, }; struct pci224_private { @@ -417,8 +417,7 @@ pci224_ao_set_data(struct comedi_device *dev, int chan, int range, static int pci224_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int range = CR_RANGE(insn->chanspec); @@ -469,9 +468,9 @@ static void pci224_ao_stop(struct comedi_device *dev, /* Reconfigure DAC for insn_write usage. */ outw(0, dev->iobase + PCI224_DACCEN); /* Disable channels. */ devpriv->daccon = - COMBINE(devpriv->daccon, - PCI224_DACCON_TRIG_SW | PCI224_DACCON_FIFOINTR_EMPTY, - PCI224_DACCON_TRIG_MASK | PCI224_DACCON_FIFOINTR_MASK); + COMBINE(devpriv->daccon, + PCI224_DACCON_TRIG_SW | PCI224_DACCON_FIFOINTR_EMPTY, + PCI224_DACCON_TRIG_MASK | PCI224_DACCON_FIFOINTR_MASK); outw(devpriv->daccon | PCI224_DACCON_FIFORESET, dev->iobase + PCI224_DACCON); } @@ -888,7 +887,7 @@ static int pci224_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s) spin_lock_irqsave(&devpriv->ao_spinlock, flags); if (cmd->start_src == TRIG_INT) { s->async->inttrig = pci224_ao_inttrig_start; - } else { /* TRIG_EXT */ + } else { /* TRIG_EXT */ /* Enable external interrupt trigger to start acquisition. */ devpriv->intsce |= PCI224_INTR_EXT; outb(devpriv->intsce, devpriv->iobase1 + PCI224_INT_SCE); @@ -1034,9 +1033,8 @@ pci224_auto_attach(struct comedi_device *dev, unsigned long context_model) /* Allocate buffer to hold AO channel scan order. */ devpriv->ao_scan_order = - kmalloc_array(board->ao_chans, - sizeof(devpriv->ao_scan_order[0]), - GFP_KERNEL); + kmalloc_array(board->ao_chans, + sizeof(devpriv->ao_scan_order[0]), GFP_KERNEL); if (!devpriv->ao_scan_order) return -ENOMEM; @@ -1049,7 +1047,7 @@ pci224_auto_attach(struct comedi_device *dev, unsigned long context_model) outw(0, dev->iobase + PCI224_DACCEN); outw(0, dev->iobase + PCI224_FIFOSIZ); devpriv->daccon = PCI224_DACCON_TRIG_SW | PCI224_DACCON_POLAR_BI | - PCI224_DACCON_FIFOENAB | PCI224_DACCON_FIFOINTR_EMPTY; + PCI224_DACCON_FIFOENAB | PCI224_DACCON_FIFOINTR_EMPTY; outw(devpriv->daccon | PCI224_DACCON_FIFORESET, dev->iobase + PCI224_DACCON); @@ -1107,13 +1105,13 @@ static void pci224_detach(struct comedi_device *dev) } static struct comedi_driver amplc_pci224_driver = { - .driver_name = "amplc_pci224", - .module = THIS_MODULE, - .detach = pci224_detach, - .auto_attach = pci224_auto_attach, - .board_name = &pci224_boards[0].name, - .offset = sizeof(struct pci224_board), - .num_names = ARRAY_SIZE(pci224_boards), + .driver_name = "amplc_pci224", + .module = THIS_MODULE, + .detach = pci224_detach, + .auto_attach = pci224_auto_attach, + .board_name = &pci224_boards[0].name, + .offset = sizeof(struct pci224_board), + .num_names = ARRAY_SIZE(pci224_boards), }; static int amplc_pci224_pci_probe(struct pci_dev *dev, @@ -1128,14 +1126,16 @@ static const struct pci_device_id amplc_pci224_pci_table[] = { { PCI_VDEVICE(AMPLICON, 0x0008), pci234_model }, { 0 } }; + MODULE_DEVICE_TABLE(pci, amplc_pci224_pci_table); static struct pci_driver amplc_pci224_pci_driver = { - .name = "amplc_pci224", - .id_table = amplc_pci224_pci_table, - .probe = amplc_pci224_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "amplc_pci224", + .id_table = amplc_pci224_pci_table, + .probe = amplc_pci224_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(amplc_pci224_driver, amplc_pci224_pci_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/amplc_pci230.c b/drivers/comedi/drivers/amplc_pci230.c index 8911dc2bd2c6..dab6828d98c7 100644 --- a/drivers/comedi/drivers/amplc_pci230.c +++ b/drivers/comedi/drivers/amplc_pci230.c @@ -229,49 +229,49 @@ * DACCON read-write values. */ #define PCI230_DAC_OR(x) (((x) & 0x1) << 0) -#define PCI230_DAC_OR_UNI PCI230_DAC_OR(0) /* Output unipolar */ -#define PCI230_DAC_OR_BIP PCI230_DAC_OR(1) /* Output bipolar */ +#define PCI230_DAC_OR_UNI PCI230_DAC_OR(0) /* Output unipolar */ +#define PCI230_DAC_OR_BIP PCI230_DAC_OR(1) /* Output bipolar */ #define PCI230_DAC_OR_MASK PCI230_DAC_OR(1) /* * The following applies only if DAC FIFO support is enabled in the EXTFUNC * register (and only for PCI230+ hardware version 2 onwards). */ -#define PCI230P2_DAC_FIFO_EN BIT(8) /* FIFO enable */ +#define PCI230P2_DAC_FIFO_EN BIT(8) /* FIFO enable */ /* * The following apply only if the DAC FIFO is enabled (and only for PCI230+ * hardware version 2 onwards). */ #define PCI230P2_DAC_TRIG(x) (((x) & 0x7) << 2) -#define PCI230P2_DAC_TRIG_NONE PCI230P2_DAC_TRIG(0) /* none */ -#define PCI230P2_DAC_TRIG_SW PCI230P2_DAC_TRIG(1) /* soft trig */ -#define PCI230P2_DAC_TRIG_EXTP PCI230P2_DAC_TRIG(2) /* ext + edge */ -#define PCI230P2_DAC_TRIG_EXTN PCI230P2_DAC_TRIG(3) /* ext - edge */ -#define PCI230P2_DAC_TRIG_Z2CT0 PCI230P2_DAC_TRIG(4) /* Z2 CT0 out */ -#define PCI230P2_DAC_TRIG_Z2CT1 PCI230P2_DAC_TRIG(5) /* Z2 CT1 out */ -#define PCI230P2_DAC_TRIG_Z2CT2 PCI230P2_DAC_TRIG(6) /* Z2 CT2 out */ +#define PCI230P2_DAC_TRIG_NONE PCI230P2_DAC_TRIG(0) /* none */ +#define PCI230P2_DAC_TRIG_SW PCI230P2_DAC_TRIG(1) /* soft trig */ +#define PCI230P2_DAC_TRIG_EXTP PCI230P2_DAC_TRIG(2) /* ext + edge */ +#define PCI230P2_DAC_TRIG_EXTN PCI230P2_DAC_TRIG(3) /* ext - edge */ +#define PCI230P2_DAC_TRIG_Z2CT0 PCI230P2_DAC_TRIG(4) /* Z2 CT0 out */ +#define PCI230P2_DAC_TRIG_Z2CT1 PCI230P2_DAC_TRIG(5) /* Z2 CT1 out */ +#define PCI230P2_DAC_TRIG_Z2CT2 PCI230P2_DAC_TRIG(6) /* Z2 CT2 out */ #define PCI230P2_DAC_TRIG_MASK PCI230P2_DAC_TRIG(7) -#define PCI230P2_DAC_FIFO_WRAP BIT(7) /* FIFO wraparound mode */ +#define PCI230P2_DAC_FIFO_WRAP BIT(7) /* FIFO wraparound mode */ #define PCI230P2_DAC_INT_FIFO(x) (((x) & 7) << 9) -#define PCI230P2_DAC_INT_FIFO_EMPTY PCI230P2_DAC_INT_FIFO(0) /* empty */ -#define PCI230P2_DAC_INT_FIFO_NEMPTY PCI230P2_DAC_INT_FIFO(1) /* !empty */ -#define PCI230P2_DAC_INT_FIFO_NHALF PCI230P2_DAC_INT_FIFO(2) /* !half */ -#define PCI230P2_DAC_INT_FIFO_HALF PCI230P2_DAC_INT_FIFO(3) /* half */ -#define PCI230P2_DAC_INT_FIFO_NFULL PCI230P2_DAC_INT_FIFO(4) /* !full */ -#define PCI230P2_DAC_INT_FIFO_FULL PCI230P2_DAC_INT_FIFO(5) /* full */ +#define PCI230P2_DAC_INT_FIFO_EMPTY PCI230P2_DAC_INT_FIFO(0) /* empty */ +#define PCI230P2_DAC_INT_FIFO_NEMPTY PCI230P2_DAC_INT_FIFO(1) /* !empty */ +#define PCI230P2_DAC_INT_FIFO_NHALF PCI230P2_DAC_INT_FIFO(2) /* !half */ +#define PCI230P2_DAC_INT_FIFO_HALF PCI230P2_DAC_INT_FIFO(3) /* half */ +#define PCI230P2_DAC_INT_FIFO_NFULL PCI230P2_DAC_INT_FIFO(4) /* !full */ +#define PCI230P2_DAC_INT_FIFO_FULL PCI230P2_DAC_INT_FIFO(5) /* full */ #define PCI230P2_DAC_INT_FIFO_MASK PCI230P2_DAC_INT_FIFO(7) /* * DACCON read-only values. */ -#define PCI230_DAC_BUSY BIT(1) /* DAC busy. */ +#define PCI230_DAC_BUSY BIT(1) /* DAC busy. */ /* * The following apply only if the DAC FIFO is enabled (and only for PCI230+ * hardware version 2 onwards). */ -#define PCI230P2_DAC_FIFO_UNDERRUN_LATCHED BIT(5) /* Underrun error */ -#define PCI230P2_DAC_FIFO_EMPTY BIT(13) /* FIFO empty */ -#define PCI230P2_DAC_FIFO_FULL BIT(14) /* FIFO full */ -#define PCI230P2_DAC_FIFO_HALF BIT(15) /* FIFO half full */ +#define PCI230P2_DAC_FIFO_UNDERRUN_LATCHED BIT(5) /* Underrun error */ +#define PCI230P2_DAC_FIFO_EMPTY BIT(13) /* FIFO empty */ +#define PCI230P2_DAC_FIFO_FULL BIT(14) /* FIFO full */ +#define PCI230P2_DAC_FIFO_HALF BIT(15) /* FIFO half full */ /* * DACCON write-only, transient values. @@ -280,8 +280,8 @@ * The following apply only if the DAC FIFO is enabled (and only for PCI230+ * hardware version 2 onwards). */ -#define PCI230P2_DAC_FIFO_UNDERRUN_CLEAR BIT(5) /* Clear underrun */ -#define PCI230P2_DAC_FIFO_RESET BIT(12) /* FIFO reset */ +#define PCI230P2_DAC_FIFO_UNDERRUN_CLEAR BIT(5) /* Clear underrun */ +#define PCI230P2_DAC_FIFO_RESET BIT(12) /* FIFO reset */ /* * PCI230+ hardware version 2 DAC FIFO levels. @@ -299,47 +299,47 @@ * ADCCON read/write values. */ #define PCI230_ADC_TRIG(x) (((x) & 0x7) << 0) -#define PCI230_ADC_TRIG_NONE PCI230_ADC_TRIG(0) /* none */ -#define PCI230_ADC_TRIG_SW PCI230_ADC_TRIG(1) /* soft trig */ -#define PCI230_ADC_TRIG_EXTP PCI230_ADC_TRIG(2) /* ext + edge */ -#define PCI230_ADC_TRIG_EXTN PCI230_ADC_TRIG(3) /* ext - edge */ -#define PCI230_ADC_TRIG_Z2CT0 PCI230_ADC_TRIG(4) /* Z2 CT0 out*/ -#define PCI230_ADC_TRIG_Z2CT1 PCI230_ADC_TRIG(5) /* Z2 CT1 out */ -#define PCI230_ADC_TRIG_Z2CT2 PCI230_ADC_TRIG(6) /* Z2 CT2 out */ +#define PCI230_ADC_TRIG_NONE PCI230_ADC_TRIG(0) /* none */ +#define PCI230_ADC_TRIG_SW PCI230_ADC_TRIG(1) /* soft trig */ +#define PCI230_ADC_TRIG_EXTP PCI230_ADC_TRIG(2) /* ext + edge */ +#define PCI230_ADC_TRIG_EXTN PCI230_ADC_TRIG(3) /* ext - edge */ +#define PCI230_ADC_TRIG_Z2CT0 PCI230_ADC_TRIG(4) /* Z2 CT0 out */ +#define PCI230_ADC_TRIG_Z2CT1 PCI230_ADC_TRIG(5) /* Z2 CT1 out */ +#define PCI230_ADC_TRIG_Z2CT2 PCI230_ADC_TRIG(6) /* Z2 CT2 out */ #define PCI230_ADC_TRIG_MASK PCI230_ADC_TRIG(7) #define PCI230_ADC_IR(x) (((x) & 0x1) << 3) -#define PCI230_ADC_IR_UNI PCI230_ADC_IR(0) /* Input unipolar */ -#define PCI230_ADC_IR_BIP PCI230_ADC_IR(1) /* Input bipolar */ +#define PCI230_ADC_IR_UNI PCI230_ADC_IR(0) /* Input unipolar */ +#define PCI230_ADC_IR_BIP PCI230_ADC_IR(1) /* Input bipolar */ #define PCI230_ADC_IR_MASK PCI230_ADC_IR(1) #define PCI230_ADC_IM(x) (((x) & 0x1) << 4) -#define PCI230_ADC_IM_SE PCI230_ADC_IM(0) /* single ended */ -#define PCI230_ADC_IM_DIF PCI230_ADC_IM(1) /* differential */ +#define PCI230_ADC_IM_SE PCI230_ADC_IM(0) /* single ended */ +#define PCI230_ADC_IM_DIF PCI230_ADC_IM(1) /* differential */ #define PCI230_ADC_IM_MASK PCI230_ADC_IM(1) -#define PCI230_ADC_FIFO_EN BIT(8) /* FIFO enable */ +#define PCI230_ADC_FIFO_EN BIT(8) /* FIFO enable */ #define PCI230_ADC_INT_FIFO(x) (((x) & 0x7) << 9) -#define PCI230_ADC_INT_FIFO_EMPTY PCI230_ADC_INT_FIFO(0) /* empty */ -#define PCI230_ADC_INT_FIFO_NEMPTY PCI230_ADC_INT_FIFO(1) /* !empty */ -#define PCI230_ADC_INT_FIFO_NHALF PCI230_ADC_INT_FIFO(2) /* !half */ -#define PCI230_ADC_INT_FIFO_HALF PCI230_ADC_INT_FIFO(3) /* half */ -#define PCI230_ADC_INT_FIFO_NFULL PCI230_ADC_INT_FIFO(4) /* !full */ -#define PCI230_ADC_INT_FIFO_FULL PCI230_ADC_INT_FIFO(5) /* full */ -#define PCI230P_ADC_INT_FIFO_THRESH PCI230_ADC_INT_FIFO(7) /* threshold */ +#define PCI230_ADC_INT_FIFO_EMPTY PCI230_ADC_INT_FIFO(0) /* empty */ +#define PCI230_ADC_INT_FIFO_NEMPTY PCI230_ADC_INT_FIFO(1) /* !empty */ +#define PCI230_ADC_INT_FIFO_NHALF PCI230_ADC_INT_FIFO(2) /* !half */ +#define PCI230_ADC_INT_FIFO_HALF PCI230_ADC_INT_FIFO(3) /* half */ +#define PCI230_ADC_INT_FIFO_NFULL PCI230_ADC_INT_FIFO(4) /* !full */ +#define PCI230_ADC_INT_FIFO_FULL PCI230_ADC_INT_FIFO(5) /* full */ +#define PCI230P_ADC_INT_FIFO_THRESH PCI230_ADC_INT_FIFO(7) /* threshold */ #define PCI230_ADC_INT_FIFO_MASK PCI230_ADC_INT_FIFO(7) /* * ADCCON write-only, transient values. */ -#define PCI230_ADC_FIFO_RESET BIT(12) /* FIFO reset */ -#define PCI230_ADC_GLOB_RESET BIT(13) /* Global reset */ +#define PCI230_ADC_FIFO_RESET BIT(12) /* FIFO reset */ +#define PCI230_ADC_GLOB_RESET BIT(13) /* Global reset */ /* * ADCCON read-only values. */ -#define PCI230_ADC_BUSY BIT(15) /* ADC busy */ -#define PCI230_ADC_FIFO_EMPTY BIT(12) /* FIFO empty */ -#define PCI230_ADC_FIFO_FULL BIT(13) /* FIFO full */ -#define PCI230_ADC_FIFO_HALF BIT(14) /* FIFO half full */ -#define PCI230_ADC_FIFO_FULL_LATCHED BIT(5) /* FIFO overrun occurred */ +#define PCI230_ADC_BUSY BIT(15) /* ADC busy */ +#define PCI230_ADC_FIFO_EMPTY BIT(12) /* FIFO empty */ +#define PCI230_ADC_FIFO_FULL BIT(13) /* FIFO full */ +#define PCI230_ADC_FIFO_HALF BIT(14) /* FIFO half full */ +#define PCI230_ADC_FIFO_FULL_LATCHED BIT(5) /* FIFO overrun occurred */ /* * PCI230 ADC FIFO levels. @@ -443,37 +443,37 @@ struct pci230_board { unsigned short id; unsigned char ai_bits; unsigned char ao_bits; - unsigned char min_hwver; /* Minimum hardware version supported. */ + unsigned char min_hwver; /* Minimum hardware version supported. */ unsigned int have_dio:1; }; static const struct pci230_board pci230_boards[] = { { - .name = "pci230+", - .id = PCI_DEVICE_ID_PCI230, - .ai_bits = 16, - .ao_bits = 12, - .have_dio = true, - .min_hwver = 1, - }, + .name = "pci230+", + .id = PCI_DEVICE_ID_PCI230, + .ai_bits = 16, + .ao_bits = 12, + .have_dio = true, + .min_hwver = 1, + }, { - .name = "pci260+", - .id = PCI_DEVICE_ID_PCI260, - .ai_bits = 16, - .min_hwver = 1, - }, + .name = "pci260+", + .id = PCI_DEVICE_ID_PCI260, + .ai_bits = 16, + .min_hwver = 1, + }, { - .name = "pci230", - .id = PCI_DEVICE_ID_PCI230, - .ai_bits = 12, - .ao_bits = 12, - .have_dio = true, - }, + .name = "pci230", + .id = PCI_DEVICE_ID_PCI230, + .ai_bits = 12, + .ao_bits = 12, + .have_dio = true, + }, { - .name = "pci260", - .id = PCI_DEVICE_ID_PCI260, - .ai_bits = 12, - }, + .name = "pci260", + .id = PCI_DEVICE_ID_PCI260, + .ai_bits = 12, + }, }; struct pci230_private { @@ -481,15 +481,15 @@ struct pci230_private { spinlock_t res_spinlock; /* Shared resources spin lock */ spinlock_t ai_stop_spinlock; /* Spin lock for stopping AI command */ spinlock_t ao_stop_spinlock; /* Spin lock for stopping AO command */ - unsigned long daqio; /* PCI230's DAQ I/O space */ - int intr_cpuid; /* ID of CPU running ISR */ - unsigned short hwver; /* Hardware version (for '+' models) */ - unsigned short adccon; /* ADCCON register value */ - unsigned short daccon; /* DACCON register value */ + unsigned long daqio; /* PCI230's DAQ I/O space */ + int intr_cpuid; /* ID of CPU running ISR */ + unsigned short hwver; /* Hardware version (for '+' models) */ + unsigned short adccon; /* ADCCON register value */ + unsigned short daccon; /* DACCON register value */ unsigned short adcfifothresh; /* ADC FIFO threshold (PCI230+/260+) */ - unsigned short adcg; /* ADCG register value */ - unsigned char ier; /* Interrupt enable bits */ - unsigned char res_owned[NUM_OWNERS]; /* Owned resources */ + unsigned short adcg; /* ADCG register value */ + unsigned char ier; /* Interrupt enable bits */ + unsigned char res_owned[NUM_OWNERS]; /* Owned resources */ unsigned int intr_running:1; /* Flag set in interrupt routine */ unsigned int ai_bipolar:1; /* Flag AI range is bipolar */ unsigned int ao_bipolar:1; /* Flag AO range is bipolar */ @@ -499,24 +499,24 @@ struct pci230_private { /* PCI230 clock source periods in ns */ static const unsigned int pci230_timebase[8] = { - [CLK_10MHZ] = I8254_OSC_BASE_10MHZ, - [CLK_1MHZ] = I8254_OSC_BASE_1MHZ, - [CLK_100KHZ] = I8254_OSC_BASE_100KHZ, - [CLK_10KHZ] = I8254_OSC_BASE_10KHZ, - [CLK_1KHZ] = I8254_OSC_BASE_1KHZ, + [CLK_10MHZ] = I8254_OSC_BASE_10MHZ, + [CLK_1MHZ] = I8254_OSC_BASE_1MHZ, + [CLK_100KHZ] = I8254_OSC_BASE_100KHZ, + [CLK_10KHZ] = I8254_OSC_BASE_10KHZ, + [CLK_1KHZ] = I8254_OSC_BASE_1KHZ, }; /* PCI230 analogue input range table */ static const struct comedi_lrange pci230_ai_range = { 7, { - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(2.5), - BIP_RANGE(1.25), - UNI_RANGE(10), - UNI_RANGE(5), - UNI_RANGE(2.5) - } + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(2.5), + BIP_RANGE(1.25), + UNI_RANGE(10), + UNI_RANGE(5), + UNI_RANGE(2.5) + } }; /* PCI230 analogue gain bits for each input range. */ @@ -525,9 +525,9 @@ static const unsigned char pci230_ai_gain[7] = { 0, 1, 2, 3, 1, 2, 3 }; /* PCI230 analogue output range table */ static const struct comedi_lrange pci230_ao_range = { 2, { - UNI_RANGE(10), - BIP_RANGE(10) - } + UNI_RANGE(10), + BIP_RANGE(10) + } }; static unsigned short pci230_ai_read(struct comedi_device *dev) @@ -707,8 +707,7 @@ static void pci230_cancel_ct(struct comedi_device *dev, unsigned int ct) static int pci230_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { struct pci230_private *devpriv = dev->private; unsigned int status; @@ -778,7 +777,7 @@ static int pci230_ai_insn_read(struct comedi_device *dev, adccon |= PCI230_ADC_IM_SE; } devpriv->adcg = (devpriv->adcg & ~(3 << gainshift)) | - (pci230_ai_gain[range] << gainshift); + (pci230_ai_gain[range] << gainshift); if (devpriv->ai_bipolar) adccon |= PCI230_ADC_IR_BIP; else @@ -821,8 +820,7 @@ static int pci230_ai_insn_read(struct comedi_device *dev, static int pci230_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct pci230_private *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -977,7 +975,7 @@ static int pci230_ao_cmdtest(struct comedi_device *dev, if (cmd->stop_src == TRIG_COUNT) err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); - else /* TRIG_NONE */ + else /* TRIG_NONE */ err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) @@ -1118,8 +1116,7 @@ static bool pci230_handle_ao_fifo(struct comedi_device *dev, * (otherwise there will be loads of "DAC FIFO not half full" * interrupts). */ - if (num_scans == 0 && - (dacstat & PCI230P2_DAC_FIFO_HALF) == 0) { + if (num_scans == 0 && (dacstat & PCI230P2_DAC_FIFO_HALF) == 0) { dev_err(dev->class_dev, "AO buffer underrun\n"); events |= COMEDI_CB_OVERFLOW | COMEDI_CB_ERROR; } @@ -1340,8 +1337,8 @@ static int pci230_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s) * N.B. DAC FIFO interrupts are currently disabled. */ daccon |= PCI230P2_DAC_FIFO_EN | PCI230P2_DAC_FIFO_RESET | - PCI230P2_DAC_FIFO_UNDERRUN_CLEAR | - PCI230P2_DAC_TRIG_NONE | PCI230P2_DAC_INT_FIFO_NHALF; + PCI230P2_DAC_FIFO_UNDERRUN_CLEAR | + PCI230P2_DAC_TRIG_NONE | PCI230P2_DAC_INT_FIFO_NHALF; } /* Set DACCON. */ @@ -1359,8 +1356,7 @@ static int pci230_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s) outb(pci230_gat_config(1, GAT_GND), dev->iobase + PCI230_ZGAT_SCE); pci230_ct_setup_ns_mode(dev, 1, I8254_MODE3, - cmd->scan_begin_arg, - cmd->flags); + cmd->scan_begin_arg, cmd->flags); } /* N.B. cmd->start_src == TRIG_INT */ @@ -1641,7 +1637,7 @@ static int pci230_ai_cmdtest(struct comedi_device *dev, if (cmd->stop_src == TRIG_COUNT) err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); - else /* TRIG_NONE */ + else /* TRIG_NONE */ err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (cmd->scan_begin_src == TRIG_EXT) { @@ -2171,7 +2167,7 @@ static int pci230_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) adcen |= 1 << chan; } devpriv->adcg = (devpriv->adcg & ~(3 << gainshift)) | - (pci230_ai_gain[range] << gainshift); + (pci230_ai_gain[range] << gainshift); } /* Set channel scan list. */ @@ -2243,7 +2239,7 @@ static int pci230_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) zgat = pci230_gat_config(0, GAT_VCC); outb(zgat, dev->iobase + PCI230_ZGAT_SCE); pci230_ct_setup_ns_mode(dev, 0, I8254_MODE1, - ((u64)cmd->convert_arg * + ((u64) cmd->convert_arg * cmd->scan_end_arg), CMDF_ROUND_UP); if (cmd->scan_begin_src == TRIG_TIMER) { @@ -2264,7 +2260,7 @@ static int pci230_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) if (cmd->start_src == TRIG_INT) s->async->inttrig = pci230_ai_inttrig_start; - else /* TRIG_NOW */ + else /* TRIG_NOW */ pci230_ai_start(dev, s); return 0; @@ -2412,7 +2408,7 @@ static int pci230_auto_attach(struct comedi_device *dev, dev->board_name, dev->iobase, devpriv->daqio); /* Read bits of DACCON register - only the output range. */ devpriv->daccon = inw(devpriv->daqio + PCI230_DACCON) & - PCI230_DAC_OR_MASK; + PCI230_DAC_OR_MASK; /* * Read hardware version register and set extended function register * if they exist. @@ -2464,7 +2460,7 @@ static int pci230_auto_attach(struct comedi_device *dev, /* Set ADC to a reasonable state. */ devpriv->adcg = 0; devpriv->adccon = PCI230_ADC_TRIG_NONE | PCI230_ADC_IM_SE | - PCI230_ADC_IR_BIP; + PCI230_ADC_IR_BIP; outw(BIT(0), devpriv->daqio + PCI230_ADCEN); outw(devpriv->adcg, devpriv->daqio + PCI230_ADCG); outw(devpriv->adccon | PCI230_ADC_FIFO_RESET, @@ -2542,10 +2538,10 @@ static int pci230_auto_attach(struct comedi_device *dev, } static struct comedi_driver amplc_pci230_driver = { - .driver_name = "amplc_pci230", - .module = THIS_MODULE, - .auto_attach = pci230_auto_attach, - .detach = comedi_pci_detach, + .driver_name = "amplc_pci230", + .module = THIS_MODULE, + .auto_attach = pci230_auto_attach, + .detach = comedi_pci_detach, }; static int amplc_pci230_pci_probe(struct pci_dev *dev, @@ -2560,14 +2556,16 @@ static const struct pci_device_id amplc_pci230_pci_table[] = { { PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_PCI260) }, { 0 } }; + MODULE_DEVICE_TABLE(pci, amplc_pci230_pci_table); static struct pci_driver amplc_pci230_pci_driver = { - .name = "amplc_pci230", - .id_table = amplc_pci230_pci_table, - .probe = amplc_pci230_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "amplc_pci230", + .id_table = amplc_pci230_pci_table, + .probe = amplc_pci230_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(amplc_pci230_driver, amplc_pci230_pci_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/amplc_pci236.c b/drivers/comedi/drivers/amplc_pci236.c index e7f6fa4d101a..c2ade02ab6c1 100644 --- a/drivers/comedi/drivers/amplc_pci236.c +++ b/drivers/comedi/drivers/amplc_pci236.c @@ -131,10 +131,10 @@ static int amplc_pci236_pci_probe(struct pci_dev *dev, } static struct pci_driver amplc_pci236_pci_driver = { - .name = "amplc_pci236", - .id_table = pci236_pci_table, - .probe = &lc_pci236_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "amplc_pci236", + .id_table = pci236_pci_table, + .probe = &lc_pci236_pci_probe, + .remove = comedi_pci_auto_unconfig, }; module_comedi_pci_driver(amplc_pci236_driver, amplc_pci236_pci_driver); diff --git a/drivers/comedi/drivers/amplc_pci263.c b/drivers/comedi/drivers/amplc_pci263.c index 9217973f1141..f40a67cbed20 100644 --- a/drivers/comedi/drivers/amplc_pci263.c +++ b/drivers/comedi/drivers/amplc_pci263.c @@ -33,8 +33,7 @@ static int pci263_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { if (comedi_dio_update_state(s, data)) { outb(s->state & 0xff, dev->iobase + PCI263_DO_0_7_REG); @@ -64,31 +63,32 @@ static int pci263_auto_attach(struct comedi_device *dev, /* Digital Output subdevice */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 16; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = pci263_do_insn_bits; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 16; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = pci263_do_insn_bits; /* read initial relay state */ s->state = inb(dev->iobase + PCI263_DO_0_7_REG) | - (inb(dev->iobase + PCI263_DO_8_15_REG) << 8); + (inb(dev->iobase + PCI263_DO_8_15_REG) << 8); return 0; } static struct comedi_driver amplc_pci263_driver = { - .driver_name = "amplc_pci263", - .module = THIS_MODULE, - .auto_attach = pci263_auto_attach, - .detach = comedi_pci_detach, + .driver_name = "amplc_pci263", + .module = THIS_MODULE, + .auto_attach = pci263_auto_attach, + .detach = comedi_pci_detach, }; static const struct pci_device_id pci263_pci_table[] = { { PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, 0x000c) }, - {0} + { 0 } }; + MODULE_DEVICE_TABLE(pci, pci263_pci_table); static int amplc_pci263_pci_probe(struct pci_dev *dev, @@ -99,11 +99,12 @@ static int amplc_pci263_pci_probe(struct pci_dev *dev, } static struct pci_driver amplc_pci263_pci_driver = { - .name = "amplc_pci263", - .id_table = pci263_pci_table, - .probe = &lc_pci263_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "amplc_pci263", + .id_table = pci263_pci_table, + .probe = &lc_pci263_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(amplc_pci263_driver, amplc_pci263_pci_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/c6xdigio.c b/drivers/comedi/drivers/c6xdigio.c index 786fd15698df..73aeb1532f7b 100644 --- a/drivers/comedi/drivers/c6xdigio.c +++ b/drivers/comedi/drivers/c6xdigio.c @@ -55,7 +55,7 @@ static int c6xdigio_chk_status(struct comedi_device *dev, unsigned long context) if ((status & 0x80) != context) return 0; timeout++; - } while (timeout < C6XDIGIO_TIME_OUT); + } while (timeout < C6XDIGIO_TIME_OUT); return -EBUSY; } @@ -69,8 +69,7 @@ static int c6xdigio_write_data(struct comedi_device *dev, static int c6xdigio_get_encoder_bits(struct comedi_device *dev, unsigned int *bits, - unsigned int cmd, - unsigned int status) + unsigned int cmd, unsigned int status) { unsigned int val; @@ -108,8 +107,7 @@ static void c6xdigio_pwm_write(struct comedi_device *dev, c6xdigio_write_data(dev, 0x00, 0x80); } -static int c6xdigio_encoder_read(struct comedi_device *dev, - unsigned int chan) +static int c6xdigio_encoder_read(struct comedi_device *dev, unsigned int chan) { unsigned int cmd = C6XDIGIO_DATA_ENCODER | C6XDIGIO_DATA_CHAN(chan); unsigned int val = 0; @@ -148,8 +146,7 @@ static int c6xdigio_encoder_read(struct comedi_device *dev, static int c6xdigio_pwm_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int val = (s->state >> (16 * chan)) & 0xffff; @@ -174,8 +171,7 @@ static int c6xdigio_pwm_insn_write(struct comedi_device *dev, static int c6xdigio_pwm_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int val; @@ -225,10 +221,10 @@ static void c6xdigio_init(struct comedi_device *dev) static const struct pnp_device_id c6xdigio_pnp_tbl[] = { /* Standard LPT Printer Port */ - {.id = "PNP0400", .driver_data = 0}, + {.id = "PNP0400", .driver_data = 0 }, /* ECP Printer Port */ - {.id = "PNP0401", .driver_data = 0}, - {} + {.id = "PNP0401", .driver_data = 0 }, + { } }; static struct pnp_driver c6xdigio_pnp_driver = { @@ -255,22 +251,22 @@ static int c6xdigio_attach(struct comedi_device *dev, s = &dev->subdevices[0]; /* pwm output subdevice */ - s->type = COMEDI_SUBD_PWM; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 2; - s->maxdata = 500; - s->range_table = &range_unknown; - s->insn_write = c6xdigio_pwm_insn_write; - s->insn_read = c6xdigio_pwm_insn_read; + s->type = COMEDI_SUBD_PWM; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 2; + s->maxdata = 500; + s->range_table = &range_unknown; + s->insn_write = c6xdigio_pwm_insn_write; + s->insn_read = c6xdigio_pwm_insn_read; s = &dev->subdevices[1]; /* encoder (counter) subdevice */ - s->type = COMEDI_SUBD_COUNTER; - s->subdev_flags = SDF_READABLE | SDF_LSAMPL; - s->n_chan = 2; - s->maxdata = 0xffffff; - s->range_table = &range_unknown; - s->insn_read = c6xdigio_encoder_insn_read; + s->type = COMEDI_SUBD_COUNTER; + s->subdev_flags = SDF_READABLE | SDF_LSAMPL; + s->n_chan = 2; + s->maxdata = 0xffffff; + s->range_table = &range_unknown; + s->insn_read = c6xdigio_encoder_insn_read; /* I will call this init anyway but more than likely the DSP board */ /* will not be connected when device driver is loaded. */ @@ -286,11 +282,12 @@ static void c6xdigio_detach(struct comedi_device *dev) } static struct comedi_driver c6xdigio_driver = { - .driver_name = "c6xdigio", - .module = THIS_MODULE, - .attach = c6xdigio_attach, - .detach = c6xdigio_detach, + .driver_name = "c6xdigio", + .module = THIS_MODULE, + .attach = c6xdigio_attach, + .detach = c6xdigio_detach, }; + module_comedi_driver(c6xdigio_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/cb_das16_cs.c b/drivers/comedi/drivers/cb_das16_cs.c index a5d171e71c33..e74140e49a7b 100644 --- a/drivers/comedi/drivers/cb_das16_cs.c +++ b/drivers/comedi/drivers/cb_das16_cs.c @@ -43,7 +43,7 @@ DAS16CS_AI_MUX_LO_CHAN(x)) #define DAS16CS_MISC1_REG 0x04 #define DAS16CS_MISC1_INTE BIT(15) /* 1=enable; 0=disable */ -#define DAS16CS_MISC1_INT_SRC(x) (((x) & 0x7) << 12) /* interrupt src */ +#define DAS16CS_MISC1_INT_SRC(x) (((x) & 0x7) << 12) /* interrupt src */ #define DAS16CS_MISC1_INT_SRC_NONE DAS16CS_MISC1_INT_SRC(0) #define DAS16CS_MISC1_INT_SRC_PACER DAS16CS_MISC1_INT_SRC(1) #define DAS16CS_MISC1_INT_SRC_EXT DAS16CS_MISC1_INT_SRC(2) @@ -52,7 +52,7 @@ #define DAS16CS_MISC1_INT_SRC_EOS DAS16CS_MISC1_INT_SRC(5) #define DAS16CS_MISC1_INT_SRC_MASK DAS16CS_MISC1_INT_SRC(7) #define DAS16CS_MISC1_OVR BIT(10) /* ro - 1=FIFO overflow */ -#define DAS16CS_MISC1_AI_CONV(x) (((x) & 0x3) << 8) /* AI convert src */ +#define DAS16CS_MISC1_AI_CONV(x) (((x) & 0x3) << 8) /* AI convert src */ #define DAS16CS_MISC1_AI_CONV_SW DAS16CS_MISC1_AI_CONV(0) #define DAS16CS_MISC1_AI_CONV_EXT_NEG DAS16CS_MISC1_AI_CONV(1) #define DAS16CS_MISC1_AI_CONV_EXT_POS DAS16CS_MISC1_AI_CONV(2) @@ -61,7 +61,7 @@ #define DAS16CS_MISC1_EOC BIT(7) /* ro - 0=busy; 1=ready */ #define DAS16CS_MISC1_SEDIFF BIT(5) /* 0=diff; 1=se */ #define DAS16CS_MISC1_INTB BIT(4) /* ro - 0=latched; 1=cleared */ -#define DAS16CS_MISC1_MA_MASK (0xf << 0) /* ro - current ai mux */ +#define DAS16CS_MISC1_MA_MASK (0xf << 0) /* ro - current ai mux */ #define DAS16CS_MISC1_DAC1CS BIT(3) /* wo - DAC1 chip select */ #define DAS16CS_MISC1_DACCLK BIT(2) /* wo - Serial DAC clock */ #define DAS16CS_MISC1_DACSD BIT(1) /* wo - Serial DAC data */ @@ -69,11 +69,11 @@ #define DAS16CS_MISC1_DAC_MASK (0x0f << 0) #define DAS16CS_MISC2_REG 0x06 #define DAS16CS_MISC2_BME BIT(14) /* 1=burst enable; 0=disable */ -#define DAS16CS_MISC2_AI_GAIN(x) (((x) & 0xf) << 8) /* AI gain */ -#define DAS16CS_MISC2_AI_GAIN_1 DAS16CS_MISC2_AI_GAIN(4) /* +/-10V */ -#define DAS16CS_MISC2_AI_GAIN_2 DAS16CS_MISC2_AI_GAIN(0) /* +/-5V */ -#define DAS16CS_MISC2_AI_GAIN_4 DAS16CS_MISC2_AI_GAIN(1) /* +/-2.5V */ -#define DAS16CS_MISC2_AI_GAIN_8 DAS16CS_MISC2_AI_GAIN(2) /* +-1.25V */ +#define DAS16CS_MISC2_AI_GAIN(x) (((x) & 0xf) << 8) /* AI gain */ +#define DAS16CS_MISC2_AI_GAIN_1 DAS16CS_MISC2_AI_GAIN(4) /* +/-10V */ +#define DAS16CS_MISC2_AI_GAIN_2 DAS16CS_MISC2_AI_GAIN(0) /* +/-5V */ +#define DAS16CS_MISC2_AI_GAIN_4 DAS16CS_MISC2_AI_GAIN(1) /* +/-2.5V */ +#define DAS16CS_MISC2_AI_GAIN_8 DAS16CS_MISC2_AI_GAIN(2) /* +-1.25V */ #define DAS16CS_MISC2_AI_GAIN_MASK DAS16CS_MISC2_AI_GAIN(0xf) #define DAS16CS_MISC2_UDIR BIT(7) /* 1=dio7:4 output; 0=input */ #define DAS16CS_MISC2_LDIR BIT(6) /* 1=dio3:0 output; 0=input */ @@ -96,17 +96,17 @@ struct das16cs_board { static const struct das16cs_board das16cs_boards[] = { { - .name = "PC-CARD DAS16/16-AO", - .device_id = 0x0039, - .has_ao = 1, - .has_4dio = 1, - }, { - .name = "PCM-DAS16s/16", - .device_id = 0x4009, - }, { - .name = "PC-CARD DAS16/16", - .device_id = 0x0000, /* unknown */ - }, + .name = "PC-CARD DAS16/16-AO", + .device_id = 0x0039, + .has_ao = 1, + .has_4dio = 1, + }, { + .name = "PCM-DAS16s/16", + .device_id = 0x4009, + }, { + .name = "PC-CARD DAS16/16", + .device_id = 0x0000, /* unknown */ + }, }; struct das16cs_private { @@ -116,17 +116,16 @@ struct das16cs_private { static const struct comedi_lrange das16cs_ai_range = { 4, { - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(2.5), - BIP_RANGE(1.25), - } + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(2.5), + BIP_RANGE(1.25), + } }; static int das16cs_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned int status; @@ -138,8 +137,7 @@ static int das16cs_ai_eoc(struct comedi_device *dev, static int das16cs_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct das16cs_private *devpriv = dev->private; int chan = CR_CHAN(insn->chanspec); @@ -153,7 +151,7 @@ static int das16cs_ai_insn_read(struct comedi_device *dev, /* disable interrupts, software convert */ devpriv->misc1 &= ~(DAS16CS_MISC1_INTE | DAS16CS_MISC1_INT_SRC_MASK | - DAS16CS_MISC1_AI_CONV_MASK); + DAS16CS_MISC1_AI_CONV_MASK); if (aref == AREF_DIFF) devpriv->misc1 &= ~DAS16CS_MISC1_SEDIFF; else @@ -192,8 +190,7 @@ static int das16cs_ai_insn_read(struct comedi_device *dev, static int das16cs_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct das16cs_private *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -243,8 +240,7 @@ static int das16cs_ao_insn_write(struct comedi_device *dev, static int das16cs_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { if (comedi_dio_update_state(s, data)) outw(s->state, dev->iobase + DAS16CS_DIO_REG); @@ -256,8 +252,7 @@ static int das16cs_dio_insn_bits(struct comedi_device *dev, static int das16cs_dio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct das16cs_private *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -338,8 +333,7 @@ static const void *das16cs_find_boardinfo(struct comedi_device *dev, return NULL; } -static int das16cs_auto_attach(struct comedi_device *dev, - unsigned long context) +static int das16cs_auto_attach(struct comedi_device *dev, unsigned long context) { struct pcmcia_device *link = comedi_to_pcmcia_dev(dev); const struct das16cs_board *board; @@ -376,39 +370,39 @@ static int das16cs_auto_attach(struct comedi_device *dev, /* Analog Input subdevice */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF; - s->n_chan = 16; - s->maxdata = 0xffff; - s->range_table = &das16cs_ai_range; - s->insn_read = das16cs_ai_insn_read; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF; + s->n_chan = 16; + s->maxdata = 0xffff; + s->range_table = &das16cs_ai_range; + s->insn_read = das16cs_ai_insn_read; /* Analog Output subdevice */ s = &dev->subdevices[1]; if (board->has_ao) { - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 2; - s->maxdata = 0xffff; - s->range_table = &range_bipolar10; - s->insn_write = &das16cs_ao_insn_write; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 2; + s->maxdata = 0xffff; + s->range_table = &range_bipolar10; + s->insn_write = &das16cs_ao_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) return ret; } else { - s->type = COMEDI_SUBD_UNUSED; + s->type = COMEDI_SUBD_UNUSED; } /* Digital I/O subdevice */ s = &dev->subdevices[2]; - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = board->has_4dio ? 4 : 8; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = das16cs_dio_insn_bits; - s->insn_config = das16cs_dio_insn_config; + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = board->has_4dio ? 4 : 8; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = das16cs_dio_insn_bits; + s->insn_config = das16cs_dio_insn_config; /* Counter subdevice (8254) */ s = &dev->subdevices[3]; @@ -424,10 +418,10 @@ static int das16cs_auto_attach(struct comedi_device *dev, } static struct comedi_driver driver_das16cs = { - .driver_name = "cb_das16_cs", - .module = THIS_MODULE, - .auto_attach = das16cs_auto_attach, - .detach = comedi_pcmcia_disable, + .driver_name = "cb_das16_cs", + .module = THIS_MODULE, + .auto_attach = das16cs_auto_attach, + .detach = comedi_pcmcia_disable, }; static int das16cs_pcmcia_attach(struct pcmcia_device *link) @@ -440,15 +434,17 @@ static const struct pcmcia_device_id das16cs_id_table[] = { PCMCIA_DEVICE_MANF_CARD(0x01c5, 0x4009), PCMCIA_DEVICE_NULL }; + MODULE_DEVICE_TABLE(pcmcia, das16cs_id_table); static struct pcmcia_driver das16cs_driver = { - .name = "cb_das16_cs", - .owner = THIS_MODULE, - .id_table = das16cs_id_table, - .probe = das16cs_pcmcia_attach, - .remove = comedi_pcmcia_auto_unconfig, + .name = "cb_das16_cs", + .owner = THIS_MODULE, + .id_table = das16cs_id_table, + .probe = das16cs_pcmcia_attach, + .remove = comedi_pcmcia_auto_unconfig, }; + module_comedi_pcmcia_driver(driver_das16cs, das16cs_driver); MODULE_AUTHOR("David A. Schleef <ds@xxxxxxxxxxx>"); diff --git a/drivers/comedi/drivers/cb_pcidas.c b/drivers/comedi/drivers/cb_pcidas.c index 2f20bd56ec6c..30113a85ef72 100644 --- a/drivers/comedi/drivers/cb_pcidas.c +++ b/drivers/comedi/drivers/cb_pcidas.c @@ -69,11 +69,11 @@ */ #define PCIDAS_CTRL_REG 0x00 /* INTERRUPT / ADC FIFO register */ #define PCIDAS_CTRL_INT(x) (((x) & 0x3) << 0) -#define PCIDAS_CTRL_INT_NONE PCIDAS_CTRL_INT(0) /* no int selected */ -#define PCIDAS_CTRL_INT_EOS PCIDAS_CTRL_INT(1) /* int on end of scan */ -#define PCIDAS_CTRL_INT_FHF PCIDAS_CTRL_INT(2) /* int on fifo half full */ -#define PCIDAS_CTRL_INT_FNE PCIDAS_CTRL_INT(3) /* int on fifo not empty */ -#define PCIDAS_CTRL_INT_MASK PCIDAS_CTRL_INT(3) /* mask of int select bits */ +#define PCIDAS_CTRL_INT_NONE PCIDAS_CTRL_INT(0) /* no int selected */ +#define PCIDAS_CTRL_INT_EOS PCIDAS_CTRL_INT(1) /* int on end of scan */ +#define PCIDAS_CTRL_INT_FHF PCIDAS_CTRL_INT(2) /* int on fifo half full */ +#define PCIDAS_CTRL_INT_FNE PCIDAS_CTRL_INT(3) /* int on fifo not empty */ +#define PCIDAS_CTRL_INT_MASK PCIDAS_CTRL_INT(3) /* mask of int select bits */ #define PCIDAS_CTRL_INTE BIT(2) /* int enable */ #define PCIDAS_CTRL_DAHFIE BIT(3) /* dac half full int enable */ #define PCIDAS_CTRL_EOAIE BIT(4) /* end of acq. int enable */ @@ -101,20 +101,20 @@ #define PCIDAS_AI_SE BIT(10) /* Inputs in single-ended mode */ #define PCIDAS_AI_UNIP BIT(11) /* Analog front-end unipolar mode */ #define PCIDAS_AI_PACER(x) (((x) & 0x3) << 12) -#define PCIDAS_AI_PACER_SW PCIDAS_AI_PACER(0) /* software pacer */ -#define PCIDAS_AI_PACER_INT PCIDAS_AI_PACER(1) /* int. pacer */ -#define PCIDAS_AI_PACER_EXTN PCIDAS_AI_PACER(2) /* ext. falling edge */ -#define PCIDAS_AI_PACER_EXTP PCIDAS_AI_PACER(3) /* ext. rising edge */ -#define PCIDAS_AI_PACER_MASK PCIDAS_AI_PACER(3) /* pacer source bits */ +#define PCIDAS_AI_PACER_SW PCIDAS_AI_PACER(0) /* software pacer */ +#define PCIDAS_AI_PACER_INT PCIDAS_AI_PACER(1) /* int. pacer */ +#define PCIDAS_AI_PACER_EXTN PCIDAS_AI_PACER(2) /* ext. falling edge */ +#define PCIDAS_AI_PACER_EXTP PCIDAS_AI_PACER(3) /* ext. rising edge */ +#define PCIDAS_AI_PACER_MASK PCIDAS_AI_PACER(3) /* pacer source bits */ #define PCIDAS_AI_EOC BIT(14) /* adc not busy */ #define PCIDAS_TRIG_REG 0x04 /* TRIGGER CONTROL/STATUS register */ #define PCIDAS_TRIG_SEL(x) (((x) & 0x3) << 0) -#define PCIDAS_TRIG_SEL_NONE PCIDAS_TRIG_SEL(0) /* no start trigger */ -#define PCIDAS_TRIG_SEL_SW PCIDAS_TRIG_SEL(1) /* software start trigger */ -#define PCIDAS_TRIG_SEL_EXT PCIDAS_TRIG_SEL(2) /* ext. start trigger */ -#define PCIDAS_TRIG_SEL_ANALOG PCIDAS_TRIG_SEL(3) /* ext. analog trigger */ -#define PCIDAS_TRIG_SEL_MASK PCIDAS_TRIG_SEL(3) /* start trigger mask */ +#define PCIDAS_TRIG_SEL_NONE PCIDAS_TRIG_SEL(0) /* no start trigger */ +#define PCIDAS_TRIG_SEL_SW PCIDAS_TRIG_SEL(1) /* software start trigger */ +#define PCIDAS_TRIG_SEL_EXT PCIDAS_TRIG_SEL(2) /* ext. start trigger */ +#define PCIDAS_TRIG_SEL_ANALOG PCIDAS_TRIG_SEL(3) /* ext. analog trigger */ +#define PCIDAS_TRIG_SEL_MASK PCIDAS_TRIG_SEL(3) /* start trigger mask */ #define PCIDAS_TRIG_POL BIT(2) /* invert trigger (1602 only) */ #define PCIDAS_TRIG_MODE BIT(3) /* edge/level triggered (1602 only) */ #define PCIDAS_TRIG_EN BIT(4) /* enable external start trigger */ @@ -133,12 +133,12 @@ #define PCIDAS_AO_EMPTY BIT(0) /* fifo empty, write clear (1602) */ #define PCIDAS_AO_DACEN BIT(1) /* dac enable */ #define PCIDAS_AO_START BIT(2) /* start/arm fifo (1602) */ -#define PCIDAS_AO_PACER(x) (((x) & 0x3) << 3) /* (1602) */ -#define PCIDAS_AO_PACER_SW PCIDAS_AO_PACER(0) /* software pacer */ -#define PCIDAS_AO_PACER_INT PCIDAS_AO_PACER(1) /* int. pacer */ -#define PCIDAS_AO_PACER_EXTN PCIDAS_AO_PACER(2) /* ext. falling edge */ -#define PCIDAS_AO_PACER_EXTP PCIDAS_AO_PACER(3) /* ext. rising edge */ -#define PCIDAS_AO_PACER_MASK PCIDAS_AO_PACER(3) /* pacer source bits */ +#define PCIDAS_AO_PACER(x) (((x) & 0x3) << 3) /* (1602) */ +#define PCIDAS_AO_PACER_SW PCIDAS_AO_PACER(0) /* software pacer */ +#define PCIDAS_AO_PACER_INT PCIDAS_AO_PACER(1) /* int. pacer */ +#define PCIDAS_AO_PACER_EXTN PCIDAS_AO_PACER(2) /* ext. falling edge */ +#define PCIDAS_AO_PACER_EXTP PCIDAS_AO_PACER(3) /* ext. rising edge */ +#define PCIDAS_AO_PACER_MASK PCIDAS_AO_PACER(3) /* pacer source bits */ #define PCIDAS_AO_CHAN_EN(c) BIT(5 + ((c) & 0x1)) #define PCIDAS_AO_CHAN_MASK (PCIDAS_AO_CHAN_EN(0) | PCIDAS_AO_CHAN_EN(1)) #define PCIDAS_AO_UPDATE_BOTH BIT(7) /* update both dacs */ @@ -168,39 +168,39 @@ /* analog input ranges for most boards */ static const struct comedi_lrange cb_pcidas_ranges = { 8, { - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(2.5), - BIP_RANGE(1.25), - UNI_RANGE(10), - UNI_RANGE(5), - UNI_RANGE(2.5), - UNI_RANGE(1.25) - } + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(2.5), + BIP_RANGE(1.25), + UNI_RANGE(10), + UNI_RANGE(5), + UNI_RANGE(2.5), + UNI_RANGE(1.25) + } }; /* pci-das1001 input ranges */ static const struct comedi_lrange cb_pcidas_alt_ranges = { 8, { - BIP_RANGE(10), - BIP_RANGE(1), - BIP_RANGE(0.1), - BIP_RANGE(0.01), - UNI_RANGE(10), - UNI_RANGE(1), - UNI_RANGE(0.1), - UNI_RANGE(0.01) - } + BIP_RANGE(10), + BIP_RANGE(1), + BIP_RANGE(0.1), + BIP_RANGE(0.01), + UNI_RANGE(10), + UNI_RANGE(1), + UNI_RANGE(0.1), + UNI_RANGE(0.01) + } }; /* analog output ranges */ static const struct comedi_lrange cb_pcidas_ao_ranges = { 4, { - BIP_RANGE(5), - BIP_RANGE(10), - UNI_RANGE(5), - UNI_RANGE(10) - } + BIP_RANGE(5), + BIP_RANGE(10), + UNI_RANGE(5), + UNI_RANGE(10) + } }; enum cb_pcidas_boardid { @@ -219,9 +219,9 @@ struct cb_pcidas_board { int ai_speed; /* fastest conversion period in ns */ int ao_scan_speed; /* analog output scan speed for 1602 series */ int fifo_size; /* number of samples fifo can hold */ - unsigned int is_16bit; /* ai/ao is 1=16-bit; 0=12-bit */ + unsigned int is_16bit; /* ai/ao is 1=16-bit; 0=12-bit */ unsigned int use_alt_range:1; /* use alternate ai range table */ - unsigned int has_ao:1; /* has 2 analog output channels */ + unsigned int has_ao:1; /* has 2 analog output channels */ unsigned int has_ao_fifo:1; /* analog output has fifo */ unsigned int has_ad8402:1; /* trimpot type 1=AD8402; 0=AD7376 */ unsigned int has_dac08:1; @@ -230,64 +230,64 @@ struct cb_pcidas_board { static const struct cb_pcidas_board cb_pcidas_boards[] = { [BOARD_PCIDAS1602_16] = { - .name = "pci-das1602/16", - .ai_speed = 5000, - .ao_scan_speed = 10000, - .fifo_size = 512, - .is_16bit = 1, - .has_ao = 1, - .has_ao_fifo = 1, - .has_ad8402 = 1, - .has_dac08 = 1, - .is_1602 = 1, - }, + .name = "pci-das1602/16", + .ai_speed = 5000, + .ao_scan_speed = 10000, + .fifo_size = 512, + .is_16bit = 1, + .has_ao = 1, + .has_ao_fifo = 1, + .has_ad8402 = 1, + .has_dac08 = 1, + .is_1602 = 1, + }, [BOARD_PCIDAS1200] = { - .name = "pci-das1200", - .ai_speed = 3200, - .fifo_size = 1024, - .has_ao = 1, - }, + .name = "pci-das1200", + .ai_speed = 3200, + .fifo_size = 1024, + .has_ao = 1, + }, [BOARD_PCIDAS1602_12] = { - .name = "pci-das1602/12", - .ai_speed = 3200, - .ao_scan_speed = 4000, - .fifo_size = 1024, - .has_ao = 1, - .has_ao_fifo = 1, - .is_1602 = 1, - }, + .name = "pci-das1602/12", + .ai_speed = 3200, + .ao_scan_speed = 4000, + .fifo_size = 1024, + .has_ao = 1, + .has_ao_fifo = 1, + .is_1602 = 1, + }, [BOARD_PCIDAS1200_JR] = { - .name = "pci-das1200/jr", - .ai_speed = 3200, - .fifo_size = 1024, - }, + .name = "pci-das1200/jr", + .ai_speed = 3200, + .fifo_size = 1024, + }, [BOARD_PCIDAS1602_16_JR] = { - .name = "pci-das1602/16/jr", - .ai_speed = 5000, - .fifo_size = 512, - .is_16bit = 1, - .has_ad8402 = 1, - .has_dac08 = 1, - .is_1602 = 1, - }, + .name = "pci-das1602/16/jr", + .ai_speed = 5000, + .fifo_size = 512, + .is_16bit = 1, + .has_ad8402 = 1, + .has_dac08 = 1, + .is_1602 = 1, + }, [BOARD_PCIDAS1000] = { - .name = "pci-das1000", - .ai_speed = 4000, - .fifo_size = 1024, - }, + .name = "pci-das1000", + .ai_speed = 4000, + .fifo_size = 1024, + }, [BOARD_PCIDAS1001] = { - .name = "pci-das1001", - .ai_speed = 6800, - .fifo_size = 1024, - .use_alt_range = 1, - .has_ao = 1, - }, + .name = "pci-das1001", + .ai_speed = 6800, + .fifo_size = 1024, + .use_alt_range = 1, + .has_ao = 1, + }, [BOARD_PCIDAS1002] = { - .name = "pci-das1002", - .ai_speed = 6800, - .fifo_size = 1024, - .has_ao = 1, - }, + .name = "pci-das1002", + .ai_speed = 6800, + .fifo_size = 1024, + .has_ao = 1, + }, }; struct cb_pcidas_private { @@ -309,8 +309,7 @@ struct cb_pcidas_private { static int cb_pcidas_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { struct cb_pcidas_private *devpriv = dev->private; unsigned int status; @@ -323,8 +322,7 @@ static int cb_pcidas_ai_eoc(struct comedi_device *dev, static int cb_pcidas_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct cb_pcidas_private *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -387,8 +385,7 @@ static int cb_pcidas_ai_insn_config(struct comedi_device *dev, case INSN_CONFIG_ALT_SOURCE: if (source >= 8) { dev_err(dev->class_dev, - "invalid calibration source: %i\n", - source); + "invalid calibration source: %i\n", source); return -EINVAL; } devpriv->calib_src = source; @@ -451,7 +448,7 @@ static int cb_pcidas_ao_fifo_insn_write(struct comedi_device *dev, devpriv->ao_ctrl &= ~(PCIDAS_AO_CHAN_MASK | PCIDAS_AO_RANGE_MASK(chan) | PCIDAS_AO_PACER_MASK); devpriv->ao_ctrl |= PCIDAS_AO_DACEN | PCIDAS_AO_RANGE(chan, range) | - PCIDAS_AO_CHAN_EN(chan) | PCIDAS_AO_START; + PCIDAS_AO_CHAN_EN(chan) | PCIDAS_AO_START; outw(devpriv->ao_ctrl, devpriv->pcibar1 + PCIDAS_AO_REG); spin_unlock_irqrestore(&dev->spinlock, flags); @@ -586,8 +583,7 @@ static void cb_pcidas_dac08_write(struct comedi_device *dev, unsigned int val) /* latch the new value into the caldac */ outw(val, devpriv->pcibar1 + PCIDAS_CALIB_REG); udelay(1); - outw(val | PCIDAS_CALIB_DAC08_SEL, - devpriv->pcibar1 + PCIDAS_CALIB_REG); + outw(val | PCIDAS_CALIB_DAC08_SEL, devpriv->pcibar1 + PCIDAS_CALIB_REG); udelay(1); outw(val, devpriv->pcibar1 + PCIDAS_CALIB_REG); udelay(1); @@ -724,7 +720,7 @@ static int cb_pcidas_ai_cmdtest(struct comedi_device *dev, if ((cmd->start_arg & (CR_FLAGS_MASK & ~(CR_EDGE | CR_INVERT))) != 0) { cmd->start_arg &= ~(CR_FLAGS_MASK & - ~(CR_EDGE | CR_INVERT)); + ~(CR_EDGE | CR_INVERT)); err |= -EINVAL; } if (!board->is_1602 && (cmd->start_arg & CR_INVERT)) { @@ -750,7 +746,7 @@ static int cb_pcidas_ai_cmdtest(struct comedi_device *dev, if (cmd->stop_src == TRIG_COUNT) err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); - else /* TRIG_NONE */ + else /* TRIG_NONE */ err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) @@ -802,8 +798,8 @@ static int cb_pcidas_ai_cmd(struct comedi_device *dev, /* set mux limits, gain and pacer source */ bits = PCIDAS_AI_FIRST(CR_CHAN(cmd->chanlist[0])) | - PCIDAS_AI_LAST(CR_CHAN(cmd->chanlist[cmd->chanlist_len - 1])) | - PCIDAS_AI_GAIN(range0); + PCIDAS_AI_LAST(CR_CHAN(cmd->chanlist[cmd->chanlist_len - 1])) | + PCIDAS_AI_GAIN(range0); /* set unipolar/bipolar */ if (comedi_range_is_unipolar(s, range0)) bits |= PCIDAS_AI_UNIP; @@ -818,8 +814,7 @@ static int cb_pcidas_ai_cmd(struct comedi_device *dev, outw(bits, devpriv->pcibar1 + PCIDAS_AI_REG); /* load counters */ - if (cmd->scan_begin_src == TRIG_TIMER || - cmd->convert_src == TRIG_TIMER) { + if (cmd->scan_begin_src == TRIG_TIMER || cmd->convert_src == TRIG_TIMER) { comedi_8254_update_divisors(dev->pacer); comedi_8254_pacer_enable(dev->pacer, 1, 2, true); } @@ -851,7 +846,7 @@ static int cb_pcidas_ai_cmd(struct comedi_device *dev, bits = 0; if (cmd->start_src == TRIG_NOW) { bits |= PCIDAS_TRIG_SEL_SW; - } else { /* TRIG_EXT */ + } else { /* TRIG_EXT */ bits |= PCIDAS_TRIG_SEL_EXT | PCIDAS_TRIG_EN | PCIDAS_TRIG_CLR; if (board->is_1602) { if (cmd->start_arg & CR_INVERT) @@ -930,7 +925,7 @@ static int cb_pcidas_ao_cmdtest(struct comedi_device *dev, if (cmd->stop_src == TRIG_COUNT) err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); - else /* TRIG_NONE */ + else /* TRIG_NONE */ err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) @@ -1169,7 +1164,7 @@ static unsigned int cb_pcidas_ai_interrupt(struct comedi_device *dev, /* break if fifo is empty */ if ((inw(devpriv->pcibar1 + PCIDAS_CTRL_REG) & - PCIDAS_CTRL_ADNE) == 0) + PCIDAS_CTRL_ADNE) == 0) break; val = inw(devpriv->pcibar2 + PCIDAS_AI_DATA_REG); comedi_buf_write_samples(s, &val, 1); @@ -1258,7 +1253,7 @@ static int cb_pcidas_auto_attach(struct comedi_device *dev, board = &cb_pcidas_boards[context]; if (!board) return -ENODEV; - dev->board_ptr = board; + dev->board_ptr = board; dev->board_name = board->name; devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv)); @@ -1277,8 +1272,7 @@ static int cb_pcidas_auto_attach(struct comedi_device *dev, devpriv->pcibar4 = pci_resource_start(pcidev, 4); /* disable and clear interrupts on amcc s5933 */ - outl(INTCSR_INBOX_INTR_STATUS, - devpriv->amcc + AMCC_OP_REG_INTCSR); + outl(INTCSR_INBOX_INTR_STATUS, devpriv->amcc + AMCC_OP_REG_INTCSR); ret = request_irq(pcidev->irq, cb_pcidas_interrupt, IRQF_SHARED, "cb_pcidas", dev); @@ -1306,34 +1300,34 @@ static int cb_pcidas_auto_attach(struct comedi_device *dev, /* Analog Input subdevice */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF; - s->n_chan = 16; - s->maxdata = board->is_16bit ? 0xffff : 0x0fff; - s->range_table = board->use_alt_range ? &cb_pcidas_alt_ranges - : &cb_pcidas_ranges; - s->insn_read = cb_pcidas_ai_insn_read; - s->insn_config = cb_pcidas_ai_insn_config; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF; + s->n_chan = 16; + s->maxdata = board->is_16bit ? 0xffff : 0x0fff; + s->range_table = board->use_alt_range ? &cb_pcidas_alt_ranges + : &cb_pcidas_ranges; + s->insn_read = cb_pcidas_ai_insn_read; + s->insn_config = cb_pcidas_ai_insn_config; if (dev->irq) { dev->read_subdev = s; - s->subdev_flags |= SDF_CMD_READ; - s->len_chanlist = s->n_chan; - s->do_cmd = cb_pcidas_ai_cmd; - s->do_cmdtest = cb_pcidas_ai_cmdtest; - s->cancel = cb_pcidas_ai_cancel; + s->subdev_flags |= SDF_CMD_READ; + s->len_chanlist = s->n_chan; + s->do_cmd = cb_pcidas_ai_cmd; + s->do_cmdtest = cb_pcidas_ai_cmdtest; + s->cancel = cb_pcidas_ai_cancel; } /* Analog Output subdevice */ s = &dev->subdevices[1]; if (board->has_ao) { - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE | SDF_GROUND; - s->n_chan = 2; - s->maxdata = board->is_16bit ? 0xffff : 0x0fff; - s->range_table = &cb_pcidas_ao_ranges; - s->insn_write = (board->has_ao_fifo) - ? cb_pcidas_ao_fifo_insn_write - : cb_pcidas_ao_nofifo_insn_write; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE | SDF_GROUND; + s->n_chan = 2; + s->maxdata = board->is_16bit ? 0xffff : 0x0fff; + s->range_table = &cb_pcidas_ao_ranges; + s->insn_write = (board->has_ao_fifo) + ? cb_pcidas_ao_fifo_insn_write + : cb_pcidas_ao_nofifo_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) @@ -1341,14 +1335,14 @@ static int cb_pcidas_auto_attach(struct comedi_device *dev, if (dev->irq && board->has_ao_fifo) { dev->write_subdev = s; - s->subdev_flags |= SDF_CMD_WRITE; - s->len_chanlist = s->n_chan; - s->do_cmdtest = cb_pcidas_ao_cmdtest; - s->do_cmd = cb_pcidas_ao_cmd; - s->cancel = cb_pcidas_ao_cancel; + s->subdev_flags |= SDF_CMD_WRITE; + s->len_chanlist = s->n_chan; + s->do_cmdtest = cb_pcidas_ao_cmdtest; + s->do_cmd = cb_pcidas_ao_cmd; + s->cancel = cb_pcidas_ao_cancel; } } else { - s->type = COMEDI_SUBD_UNUSED; + s->type = COMEDI_SUBD_UNUSED; } /* 8255 */ @@ -1359,19 +1353,19 @@ static int cb_pcidas_auto_attach(struct comedi_device *dev, /* Memory subdevice - serial EEPROM */ s = &dev->subdevices[3]; - s->type = COMEDI_SUBD_MEMORY; - s->subdev_flags = SDF_READABLE | SDF_INTERNAL; - s->n_chan = 256; - s->maxdata = 0xff; - s->insn_read = cb_pcidas_eeprom_insn_read; + s->type = COMEDI_SUBD_MEMORY; + s->subdev_flags = SDF_READABLE | SDF_INTERNAL; + s->n_chan = 256; + s->maxdata = 0xff; + s->insn_read = cb_pcidas_eeprom_insn_read; /* Calibration subdevice - 8800 caldac */ s = &dev->subdevices[4]; - s->type = COMEDI_SUBD_CALIB; - s->subdev_flags = SDF_WRITABLE | SDF_INTERNAL; - s->n_chan = 8; - s->maxdata = 0xff; - s->insn_write = cb_pcidas_caldac_insn_write; + s->type = COMEDI_SUBD_CALIB; + s->subdev_flags = SDF_WRITABLE | SDF_INTERNAL; + s->n_chan = 8; + s->maxdata = 0xff; + s->insn_write = cb_pcidas_caldac_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) @@ -1387,22 +1381,22 @@ static int cb_pcidas_auto_attach(struct comedi_device *dev, /* Calibration subdevice - trim potentiometer */ s = &dev->subdevices[5]; - s->type = COMEDI_SUBD_CALIB; - s->subdev_flags = SDF_WRITABLE | SDF_INTERNAL; + s->type = COMEDI_SUBD_CALIB; + s->subdev_flags = SDF_WRITABLE | SDF_INTERNAL; if (board->has_ad8402) { /* * pci-das1602/16 have an AD8402 trimpot: * chan 0 : adc gain * chan 1 : adc postgain offset */ - s->n_chan = 2; - s->maxdata = 0xff; + s->n_chan = 2; + s->maxdata = 0xff; } else { /* all other boards have an AD7376 trimpot */ - s->n_chan = 1; - s->maxdata = 0x7f; + s->n_chan = 1; + s->maxdata = 0x7f; } - s->insn_write = cb_pcidas_trimpot_insn_write; + s->insn_write = cb_pcidas_trimpot_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) @@ -1416,11 +1410,11 @@ static int cb_pcidas_auto_attach(struct comedi_device *dev, /* Calibration subdevice - pci-das1602/16 pregain offset (dac08) */ s = &dev->subdevices[6]; if (board->has_dac08) { - s->type = COMEDI_SUBD_CALIB; - s->subdev_flags = SDF_WRITABLE | SDF_INTERNAL; - s->n_chan = 1; - s->maxdata = 0xff; - s->insn_write = cb_pcidas_dac08_insn_write; + s->type = COMEDI_SUBD_CALIB; + s->subdev_flags = SDF_WRITABLE | SDF_INTERNAL; + s->n_chan = 1; + s->maxdata = 0xff; + s->insn_write = cb_pcidas_dac08_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) @@ -1431,14 +1425,14 @@ static int cb_pcidas_auto_attach(struct comedi_device *dev, s->readback[i] = s->maxdata / 2; } } else { - s->type = COMEDI_SUBD_UNUSED; + s->type = COMEDI_SUBD_UNUSED; } /* make sure mailbox 4 is empty */ inl(devpriv->amcc + AMCC_OP_REG_IMB4); /* Set bits to enable incoming mailbox interrupts on amcc s5933. */ devpriv->amcc_intcsr = INTCSR_INBOX_BYTE(3) | INTCSR_INBOX_SELECT(3) | - INTCSR_INBOX_FULL_INT; + INTCSR_INBOX_FULL_INT; /* clear and enable interrupt on amcc s5933 */ outl(devpriv->amcc_intcsr | INTCSR_INBOX_INTR_STATUS, devpriv->amcc + AMCC_OP_REG_INTCSR); @@ -1460,17 +1454,16 @@ static void cb_pcidas_detach(struct comedi_device *dev) } static struct comedi_driver cb_pcidas_driver = { - .driver_name = "cb_pcidas", - .module = THIS_MODULE, - .auto_attach = cb_pcidas_auto_attach, - .detach = cb_pcidas_detach, + .driver_name = "cb_pcidas", + .module = THIS_MODULE, + .auto_attach = cb_pcidas_auto_attach, + .detach = cb_pcidas_detach, }; static int cb_pcidas_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) { - return comedi_pci_auto_config(dev, &cb_pcidas_driver, - id->driver_data); + return comedi_pci_auto_config(dev, &cb_pcidas_driver, id->driver_data); } static const struct pci_device_id cb_pcidas_pci_table[] = { @@ -1484,14 +1477,16 @@ static const struct pci_device_id cb_pcidas_pci_table[] = { { PCI_VDEVICE(CB, 0x001b), BOARD_PCIDAS1002 }, { 0 } }; + MODULE_DEVICE_TABLE(pci, cb_pcidas_pci_table); static struct pci_driver cb_pcidas_pci_driver = { - .name = "cb_pcidas", - .id_table = cb_pcidas_pci_table, - .probe = cb_pcidas_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "cb_pcidas", + .id_table = cb_pcidas_pci_table, + .probe = cb_pcidas_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(cb_pcidas_driver, cb_pcidas_pci_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/cb_pcidas64.c b/drivers/comedi/drivers/cb_pcidas64.c index 41a8fea7f48a..3457e85c118f 100644 --- a/drivers/comedi/drivers/cb_pcidas64.c +++ b/drivers/comedi/drivers/cb_pcidas64.c @@ -95,8 +95,8 @@ static const int max_counter_value = 0xffffff; /* devpriv->main_iobase registers */ enum write_only_registers { - INTR_ENABLE_REG = 0x0, /* interrupt enable register */ - HW_CONFIG_REG = 0x2, /* hardware config register */ + INTR_ENABLE_REG = 0x0, /* interrupt enable register */ + HW_CONFIG_REG = 0x2, /* hardware config register */ DAQ_SYNC_REG = 0xc, DAQ_ATRIG_LOW_4020_REG = 0xc, ADC_CONTROL0_REG = 0x10, /* adc control register 0 */ @@ -205,7 +205,7 @@ enum hw_config_contents { INTERNAL_CLOCK_4020_BITS = 0x1, /* use 40 MHz internal master clock */ BNC_CLOCK_4020_BITS = 0x2, /* use BNC input for master clock */ EXT_CLOCK_4020_BITS = 0x3, /* use dio input for master clock */ - EXT_QUEUE_BIT = 0x200, /* use external channel/gain queue */ + EXT_QUEUE_BIT = 0x200, /* use external channel/gain queue */ /* use 225 nanosec strobe when loading dac instead of 50 nanosec */ SLOW_DAC_BIT = 0x400, /* @@ -215,9 +215,9 @@ enum hw_config_contents { HW_CONFIG_DUMMY_BITS = 0x2000, /* bit selects channels 1/0 for analog input/output, otherwise 0/1 */ DMA_CH_SELECT_BIT = 0x8000, - FIFO_SIZE_REG = 0x4, /* allows adjustment of fifo sizes */ + FIFO_SIZE_REG = 0x4, /* allows adjustment of fifo sizes */ DAC_FIFO_SIZE_MASK = 0xff00, /* bits that set dac fifo size */ - DAC_FIFO_BITS = 0xf800, /* 8k sample ao fifo */ + DAC_FIFO_BITS = 0xf800, /* 8k sample ao fifo */ }; enum daq_atrig_low_4020_contents { @@ -255,12 +255,12 @@ enum adc_control1_contents { ADC_QUEUE_CONFIG_BIT = 0x1, CONVERT_POLARITY_BIT = 0x10, EOC_POLARITY_BIT = 0x20, - ADC_SW_GATE_BIT = 0x40, /* software gate of adc */ - ADC_DITHER_BIT = 0x200, /* turn on extra noise for dithering */ + ADC_SW_GATE_BIT = 0x40, /* software gate of adc */ + ADC_DITHER_BIT = 0x200, /* turn on extra noise for dithering */ RETRIGGER_BIT = 0x800, ADC_LO_CHANNEL_4020_MASK = 0x300, ADC_HI_CHANNEL_4020_MASK = 0xc00, - TWO_CHANNEL_4020_BITS = 0x1000, /* two channel mode for 4020 */ + TWO_CHANNEL_4020_BITS = 0x1000, /* two channel mode for 4020 */ FOUR_CHANNEL_4020_BITS = 0x2000, /* four channel mode for 4020 */ CHANNEL_MODE_4020_MASK = 0x3000, ADC_MODE_MASK = 0xf000, @@ -285,7 +285,7 @@ enum calibration_contents { SELECT_8800_BIT = 0x1, SELECT_8402_64XX_BIT = 0x2, SELECT_1590_60XX_BIT = 0x2, - CAL_EN_64XX_BIT = 0x40, /* calibration enable for 64xx series */ + CAL_EN_64XX_BIT = 0x40, /* calibration enable for 64xx series */ SERIAL_DATA_IN_BIT = 0x80, SERIAL_CLOCK_BIT = 0x100, CAL_EN_60XX_BIT = 0x200, /* calibration enable for 60xx series */ @@ -315,7 +315,7 @@ static inline u16 adc_convert_chan_4020_bits(unsigned int channel) }; enum adc_queue_load_contents { - UNIP_BIT = 0x800, /* unipolar/bipolar bit */ + UNIP_BIT = 0x800, /* unipolar/bipolar bit */ ADC_SE_DIFF_BIT = 0x1000, /* single-ended/ differential bit */ /* non-referenced single-ended (common-mode input) */ ADC_COMMON_BIT = 0x2000, @@ -418,15 +418,15 @@ static inline u8 attenuate_bit(unsigned int channel) /* analog input ranges for 64xx boards */ static const struct comedi_lrange ai_ranges_64xx = { 8, { - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(2.5), - BIP_RANGE(1.25), - UNI_RANGE(10), - UNI_RANGE(5), - UNI_RANGE(2.5), - UNI_RANGE(1.25) - } + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(2.5), + BIP_RANGE(1.25), + UNI_RANGE(10), + UNI_RANGE(5), + UNI_RANGE(2.5), + UNI_RANGE(1.25) + } }; static const u8 ai_range_code_64xx[8] = { @@ -437,14 +437,14 @@ static const u8 ai_range_code_64xx[8] = { /* analog input ranges for 64-Mx boards */ static const struct comedi_lrange ai_ranges_64_mx = { 7, { - BIP_RANGE(5), - BIP_RANGE(2.5), - BIP_RANGE(1.25), - BIP_RANGE(0.625), - UNI_RANGE(5), - UNI_RANGE(2.5), - UNI_RANGE(1.25) - } + BIP_RANGE(5), + BIP_RANGE(2.5), + BIP_RANGE(1.25), + BIP_RANGE(0.625), + UNI_RANGE(5), + UNI_RANGE(2.5), + UNI_RANGE(1.25) + } }; static const u8 ai_range_code_64_mx[7] = { @@ -455,11 +455,11 @@ static const u8 ai_range_code_64_mx[7] = { /* analog input ranges for 60xx boards */ static const struct comedi_lrange ai_ranges_60xx = { 4, { - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(0.5), - BIP_RANGE(0.05) - } + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(0.5), + BIP_RANGE(0.05) + } }; static const u8 ai_range_code_60xx[4] = { @@ -469,47 +469,47 @@ static const u8 ai_range_code_60xx[4] = { /* analog input ranges for 6030, etc boards */ static const struct comedi_lrange ai_ranges_6030 = { 14, { - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(2), - BIP_RANGE(1), - BIP_RANGE(0.5), - BIP_RANGE(0.2), - BIP_RANGE(0.1), - UNI_RANGE(10), - UNI_RANGE(5), - UNI_RANGE(2), - UNI_RANGE(1), - UNI_RANGE(0.5), - UNI_RANGE(0.2), - UNI_RANGE(0.1) - } + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(2), + BIP_RANGE(1), + BIP_RANGE(0.5), + BIP_RANGE(0.2), + BIP_RANGE(0.1), + UNI_RANGE(10), + UNI_RANGE(5), + UNI_RANGE(2), + UNI_RANGE(1), + UNI_RANGE(0.5), + UNI_RANGE(0.2), + UNI_RANGE(0.1) + } }; static const u8 ai_range_code_6030[14] = { - 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, /* bip 10, 5, 2, 1, 0.5, 0.2, 0.1 */ - 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf /* uni 10, 5, 2, 1, 0.5, 0.2, 0.1 */ + 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, /* bip 10, 5, 2, 1, 0.5, 0.2, 0.1 */ + 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf /* uni 10, 5, 2, 1, 0.5, 0.2, 0.1 */ }; /* analog input ranges for 6052, etc boards */ static const struct comedi_lrange ai_ranges_6052 = { 15, { - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(2.5), - BIP_RANGE(1), - BIP_RANGE(0.5), - BIP_RANGE(0.25), - BIP_RANGE(0.1), - BIP_RANGE(0.05), - UNI_RANGE(10), - UNI_RANGE(5), - UNI_RANGE(2), - UNI_RANGE(1), - UNI_RANGE(0.5), - UNI_RANGE(0.2), - UNI_RANGE(0.1) - } + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(2.5), + BIP_RANGE(1), + BIP_RANGE(0.5), + BIP_RANGE(0.25), + BIP_RANGE(0.1), + BIP_RANGE(0.05), + UNI_RANGE(10), + UNI_RANGE(5), + UNI_RANGE(2), + UNI_RANGE(1), + UNI_RANGE(0.5), + UNI_RANGE(0.2), + UNI_RANGE(0.1) + } }; static const u8 ai_range_code_6052[15] = { @@ -520,19 +520,19 @@ static const u8 ai_range_code_6052[15] = { /* analog input ranges for 4020 board */ static const struct comedi_lrange ai_ranges_4020 = { 2, { - BIP_RANGE(5), - BIP_RANGE(1) - } + BIP_RANGE(5), + BIP_RANGE(1) + } }; /* analog output ranges */ static const struct comedi_lrange ao_ranges_64xx = { 4, { - BIP_RANGE(5), - BIP_RANGE(10), - UNI_RANGE(5), - UNI_RANGE(10) - } + BIP_RANGE(5), + BIP_RANGE(10), + UNI_RANGE(5), + UNI_RANGE(10) + } }; static const int ao_range_code_64xx[] = { @@ -548,9 +548,9 @@ static const int ao_range_code_60xx[] = { static const struct comedi_lrange ao_ranges_6030 = { 2, { - BIP_RANGE(10), - UNI_RANGE(10) - } + BIP_RANGE(10), + UNI_RANGE(10) + } }; static const int ao_range_code_6030[] = { @@ -560,9 +560,9 @@ static const int ao_range_code_6030[] = { static const struct comedi_lrange ao_ranges_4020 = { 2, { - BIP_RANGE(5), - BIP_RANGE(10) - } + BIP_RANGE(5), + BIP_RANGE(10) + } }; static const int ao_range_code_4020[] = { @@ -672,421 +672,421 @@ static const int bytes_in_sample = 2; static const struct pcidas64_board pcidas64_boards[] = { [BOARD_PCIDAS6402_16] = { - .name = "pci-das6402/16", - .ai_se_chans = 64, - .ai_bits = 16, - .ai_speed = 5000, - .ao_nchan = 2, - .ao_bits = 16, - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, - .ai_range_table = &ai_ranges_64xx, - .ai_range_code = ai_range_code_64xx, - .ao_range_table = &ao_ranges_64xx, - .ao_range_code = ao_range_code_64xx, - .ai_fifo = &ai_fifo_64xx, - .has_8255 = 1, - }, + .name = "pci-das6402/16", + .ai_se_chans = 64, + .ai_bits = 16, + .ai_speed = 5000, + .ao_nchan = 2, + .ao_bits = 16, + .ao_scan_speed = 10000, + .layout = LAYOUT_64XX, + .ai_range_table = &ai_ranges_64xx, + .ai_range_code = ai_range_code_64xx, + .ao_range_table = &ao_ranges_64xx, + .ao_range_code = ao_range_code_64xx, + .ai_fifo = &ai_fifo_64xx, + .has_8255 = 1, + }, [BOARD_PCIDAS6402_12] = { - .name = "pci-das6402/12", /* XXX check */ - .ai_se_chans = 64, - .ai_bits = 12, - .ai_speed = 5000, - .ao_nchan = 2, - .ao_bits = 12, - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, - .ai_range_table = &ai_ranges_64xx, - .ai_range_code = ai_range_code_64xx, - .ao_range_table = &ao_ranges_64xx, - .ao_range_code = ao_range_code_64xx, - .ai_fifo = &ai_fifo_64xx, - .has_8255 = 1, - }, + .name = "pci-das6402/12", /* XXX check */ + .ai_se_chans = 64, + .ai_bits = 12, + .ai_speed = 5000, + .ao_nchan = 2, + .ao_bits = 12, + .ao_scan_speed = 10000, + .layout = LAYOUT_64XX, + .ai_range_table = &ai_ranges_64xx, + .ai_range_code = ai_range_code_64xx, + .ao_range_table = &ao_ranges_64xx, + .ao_range_code = ao_range_code_64xx, + .ai_fifo = &ai_fifo_64xx, + .has_8255 = 1, + }, [BOARD_PCIDAS64_M1_16] = { - .name = "pci-das64/m1/16", - .ai_se_chans = 64, - .ai_bits = 16, - .ai_speed = 1000, - .ao_nchan = 2, - .ao_bits = 16, - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, - .ai_range_table = &ai_ranges_64_mx, - .ai_range_code = ai_range_code_64_mx, - .ao_range_table = &ao_ranges_64xx, - .ao_range_code = ao_range_code_64xx, - .ai_fifo = &ai_fifo_64xx, - .has_8255 = 1, - }, + .name = "pci-das64/m1/16", + .ai_se_chans = 64, + .ai_bits = 16, + .ai_speed = 1000, + .ao_nchan = 2, + .ao_bits = 16, + .ao_scan_speed = 10000, + .layout = LAYOUT_64XX, + .ai_range_table = &ai_ranges_64_mx, + .ai_range_code = ai_range_code_64_mx, + .ao_range_table = &ao_ranges_64xx, + .ao_range_code = ao_range_code_64xx, + .ai_fifo = &ai_fifo_64xx, + .has_8255 = 1, + }, [BOARD_PCIDAS64_M2_16] = { - .name = "pci-das64/m2/16", - .ai_se_chans = 64, - .ai_bits = 16, - .ai_speed = 500, - .ao_nchan = 2, - .ao_bits = 16, - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, - .ai_range_table = &ai_ranges_64_mx, - .ai_range_code = ai_range_code_64_mx, - .ao_range_table = &ao_ranges_64xx, - .ao_range_code = ao_range_code_64xx, - .ai_fifo = &ai_fifo_64xx, - .has_8255 = 1, - }, + .name = "pci-das64/m2/16", + .ai_se_chans = 64, + .ai_bits = 16, + .ai_speed = 500, + .ao_nchan = 2, + .ao_bits = 16, + .ao_scan_speed = 10000, + .layout = LAYOUT_64XX, + .ai_range_table = &ai_ranges_64_mx, + .ai_range_code = ai_range_code_64_mx, + .ao_range_table = &ao_ranges_64xx, + .ao_range_code = ao_range_code_64xx, + .ai_fifo = &ai_fifo_64xx, + .has_8255 = 1, + }, [BOARD_PCIDAS64_M3_16] = { - .name = "pci-das64/m3/16", - .ai_se_chans = 64, - .ai_bits = 16, - .ai_speed = 333, - .ao_nchan = 2, - .ao_bits = 16, - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, - .ai_range_table = &ai_ranges_64_mx, - .ai_range_code = ai_range_code_64_mx, - .ao_range_table = &ao_ranges_64xx, - .ao_range_code = ao_range_code_64xx, - .ai_fifo = &ai_fifo_64xx, - .has_8255 = 1, - }, + .name = "pci-das64/m3/16", + .ai_se_chans = 64, + .ai_bits = 16, + .ai_speed = 333, + .ao_nchan = 2, + .ao_bits = 16, + .ao_scan_speed = 10000, + .layout = LAYOUT_64XX, + .ai_range_table = &ai_ranges_64_mx, + .ai_range_code = ai_range_code_64_mx, + .ao_range_table = &ao_ranges_64xx, + .ao_range_code = ao_range_code_64xx, + .ai_fifo = &ai_fifo_64xx, + .has_8255 = 1, + }, [BOARD_PCIDAS6013] = { - .name = "pci-das6013", - .ai_se_chans = 16, - .ai_bits = 16, - .ai_speed = 5000, - .ao_nchan = 0, - .ao_bits = 16, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_60xx, - .ai_range_code = ai_range_code_60xx, - .ao_range_table = &range_bipolar10, - .ao_range_code = ao_range_code_60xx, - .ai_fifo = &ai_fifo_60xx, - .has_8255 = 0, - }, + .name = "pci-das6013", + .ai_se_chans = 16, + .ai_bits = 16, + .ai_speed = 5000, + .ao_nchan = 0, + .ao_bits = 16, + .layout = LAYOUT_60XX, + .ai_range_table = &ai_ranges_60xx, + .ai_range_code = ai_range_code_60xx, + .ao_range_table = &range_bipolar10, + .ao_range_code = ao_range_code_60xx, + .ai_fifo = &ai_fifo_60xx, + .has_8255 = 0, + }, [BOARD_PCIDAS6014] = { - .name = "pci-das6014", - .ai_se_chans = 16, - .ai_bits = 16, - .ai_speed = 5000, - .ao_nchan = 2, - .ao_bits = 16, - .ao_scan_speed = 100000, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_60xx, - .ai_range_code = ai_range_code_60xx, - .ao_range_table = &range_bipolar10, - .ao_range_code = ao_range_code_60xx, - .ai_fifo = &ai_fifo_60xx, - .has_8255 = 0, - }, + .name = "pci-das6014", + .ai_se_chans = 16, + .ai_bits = 16, + .ai_speed = 5000, + .ao_nchan = 2, + .ao_bits = 16, + .ao_scan_speed = 100000, + .layout = LAYOUT_60XX, + .ai_range_table = &ai_ranges_60xx, + .ai_range_code = ai_range_code_60xx, + .ao_range_table = &range_bipolar10, + .ao_range_code = ao_range_code_60xx, + .ai_fifo = &ai_fifo_60xx, + .has_8255 = 0, + }, [BOARD_PCIDAS6023] = { - .name = "pci-das6023", - .ai_se_chans = 16, - .ai_bits = 12, - .ai_speed = 5000, - .ao_nchan = 0, - .ao_scan_speed = 100000, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_60xx, - .ai_range_code = ai_range_code_60xx, - .ao_range_table = &range_bipolar10, - .ao_range_code = ao_range_code_60xx, - .ai_fifo = &ai_fifo_60xx, - .has_8255 = 1, - }, + .name = "pci-das6023", + .ai_se_chans = 16, + .ai_bits = 12, + .ai_speed = 5000, + .ao_nchan = 0, + .ao_scan_speed = 100000, + .layout = LAYOUT_60XX, + .ai_range_table = &ai_ranges_60xx, + .ai_range_code = ai_range_code_60xx, + .ao_range_table = &range_bipolar10, + .ao_range_code = ao_range_code_60xx, + .ai_fifo = &ai_fifo_60xx, + .has_8255 = 1, + }, [BOARD_PCIDAS6025] = { - .name = "pci-das6025", - .ai_se_chans = 16, - .ai_bits = 12, - .ai_speed = 5000, - .ao_nchan = 2, - .ao_bits = 12, - .ao_scan_speed = 100000, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_60xx, - .ai_range_code = ai_range_code_60xx, - .ao_range_table = &range_bipolar10, - .ao_range_code = ao_range_code_60xx, - .ai_fifo = &ai_fifo_60xx, - .has_8255 = 1, - }, + .name = "pci-das6025", + .ai_se_chans = 16, + .ai_bits = 12, + .ai_speed = 5000, + .ao_nchan = 2, + .ao_bits = 12, + .ao_scan_speed = 100000, + .layout = LAYOUT_60XX, + .ai_range_table = &ai_ranges_60xx, + .ai_range_code = ai_range_code_60xx, + .ao_range_table = &range_bipolar10, + .ao_range_code = ao_range_code_60xx, + .ai_fifo = &ai_fifo_60xx, + .has_8255 = 1, + }, [BOARD_PCIDAS6030] = { - .name = "pci-das6030", - .ai_se_chans = 16, - .ai_bits = 16, - .ai_speed = 10000, - .ao_nchan = 2, - .ao_bits = 16, - .ao_scan_speed = 10000, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_6030, - .ai_range_code = ai_range_code_6030, - .ao_range_table = &ao_ranges_6030, - .ao_range_code = ao_range_code_6030, - .ai_fifo = &ai_fifo_60xx, - .has_8255 = 0, - }, + .name = "pci-das6030", + .ai_se_chans = 16, + .ai_bits = 16, + .ai_speed = 10000, + .ao_nchan = 2, + .ao_bits = 16, + .ao_scan_speed = 10000, + .layout = LAYOUT_60XX, + .ai_range_table = &ai_ranges_6030, + .ai_range_code = ai_range_code_6030, + .ao_range_table = &ao_ranges_6030, + .ao_range_code = ao_range_code_6030, + .ai_fifo = &ai_fifo_60xx, + .has_8255 = 0, + }, [BOARD_PCIDAS6031] = { - .name = "pci-das6031", - .ai_se_chans = 64, - .ai_bits = 16, - .ai_speed = 10000, - .ao_nchan = 2, - .ao_bits = 16, - .ao_scan_speed = 10000, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_6030, - .ai_range_code = ai_range_code_6030, - .ao_range_table = &ao_ranges_6030, - .ao_range_code = ao_range_code_6030, - .ai_fifo = &ai_fifo_60xx, - .has_8255 = 0, - }, + .name = "pci-das6031", + .ai_se_chans = 64, + .ai_bits = 16, + .ai_speed = 10000, + .ao_nchan = 2, + .ao_bits = 16, + .ao_scan_speed = 10000, + .layout = LAYOUT_60XX, + .ai_range_table = &ai_ranges_6030, + .ai_range_code = ai_range_code_6030, + .ao_range_table = &ao_ranges_6030, + .ao_range_code = ao_range_code_6030, + .ai_fifo = &ai_fifo_60xx, + .has_8255 = 0, + }, [BOARD_PCIDAS6032] = { - .name = "pci-das6032", - .ai_se_chans = 16, - .ai_bits = 16, - .ai_speed = 10000, - .ao_nchan = 0, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_6030, - .ai_range_code = ai_range_code_6030, - .ai_fifo = &ai_fifo_60xx, - .has_8255 = 0, - }, + .name = "pci-das6032", + .ai_se_chans = 16, + .ai_bits = 16, + .ai_speed = 10000, + .ao_nchan = 0, + .layout = LAYOUT_60XX, + .ai_range_table = &ai_ranges_6030, + .ai_range_code = ai_range_code_6030, + .ai_fifo = &ai_fifo_60xx, + .has_8255 = 0, + }, [BOARD_PCIDAS6033] = { - .name = "pci-das6033", - .ai_se_chans = 64, - .ai_bits = 16, - .ai_speed = 10000, - .ao_nchan = 0, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_6030, - .ai_range_code = ai_range_code_6030, - .ai_fifo = &ai_fifo_60xx, - .has_8255 = 0, - }, + .name = "pci-das6033", + .ai_se_chans = 64, + .ai_bits = 16, + .ai_speed = 10000, + .ao_nchan = 0, + .layout = LAYOUT_60XX, + .ai_range_table = &ai_ranges_6030, + .ai_range_code = ai_range_code_6030, + .ai_fifo = &ai_fifo_60xx, + .has_8255 = 0, + }, [BOARD_PCIDAS6034] = { - .name = "pci-das6034", - .ai_se_chans = 16, - .ai_bits = 16, - .ai_speed = 5000, - .ao_nchan = 0, - .ao_scan_speed = 0, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_60xx, - .ai_range_code = ai_range_code_60xx, - .ai_fifo = &ai_fifo_60xx, - .has_8255 = 0, - }, + .name = "pci-das6034", + .ai_se_chans = 16, + .ai_bits = 16, + .ai_speed = 5000, + .ao_nchan = 0, + .ao_scan_speed = 0, + .layout = LAYOUT_60XX, + .ai_range_table = &ai_ranges_60xx, + .ai_range_code = ai_range_code_60xx, + .ai_fifo = &ai_fifo_60xx, + .has_8255 = 0, + }, [BOARD_PCIDAS6035] = { - .name = "pci-das6035", - .ai_se_chans = 16, - .ai_bits = 16, - .ai_speed = 5000, - .ao_nchan = 2, - .ao_bits = 12, - .ao_scan_speed = 100000, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_60xx, - .ai_range_code = ai_range_code_60xx, - .ao_range_table = &range_bipolar10, - .ao_range_code = ao_range_code_60xx, - .ai_fifo = &ai_fifo_60xx, - .has_8255 = 0, - }, + .name = "pci-das6035", + .ai_se_chans = 16, + .ai_bits = 16, + .ai_speed = 5000, + .ao_nchan = 2, + .ao_bits = 12, + .ao_scan_speed = 100000, + .layout = LAYOUT_60XX, + .ai_range_table = &ai_ranges_60xx, + .ai_range_code = ai_range_code_60xx, + .ao_range_table = &range_bipolar10, + .ao_range_code = ao_range_code_60xx, + .ai_fifo = &ai_fifo_60xx, + .has_8255 = 0, + }, [BOARD_PCIDAS6036] = { - .name = "pci-das6036", - .ai_se_chans = 16, - .ai_bits = 16, - .ai_speed = 5000, - .ao_nchan = 2, - .ao_bits = 16, - .ao_scan_speed = 100000, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_60xx, - .ai_range_code = ai_range_code_60xx, - .ao_range_table = &range_bipolar10, - .ao_range_code = ao_range_code_60xx, - .ai_fifo = &ai_fifo_60xx, - .has_8255 = 0, - }, + .name = "pci-das6036", + .ai_se_chans = 16, + .ai_bits = 16, + .ai_speed = 5000, + .ao_nchan = 2, + .ao_bits = 16, + .ao_scan_speed = 100000, + .layout = LAYOUT_60XX, + .ai_range_table = &ai_ranges_60xx, + .ai_range_code = ai_range_code_60xx, + .ao_range_table = &range_bipolar10, + .ao_range_code = ao_range_code_60xx, + .ai_fifo = &ai_fifo_60xx, + .has_8255 = 0, + }, [BOARD_PCIDAS6040] = { - .name = "pci-das6040", - .ai_se_chans = 16, - .ai_bits = 12, - .ai_speed = 2000, - .ao_nchan = 2, - .ao_bits = 12, - .ao_scan_speed = 1000, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_6052, - .ai_range_code = ai_range_code_6052, - .ao_range_table = &ao_ranges_6030, - .ao_range_code = ao_range_code_6030, - .ai_fifo = &ai_fifo_60xx, - .has_8255 = 0, - }, + .name = "pci-das6040", + .ai_se_chans = 16, + .ai_bits = 12, + .ai_speed = 2000, + .ao_nchan = 2, + .ao_bits = 12, + .ao_scan_speed = 1000, + .layout = LAYOUT_60XX, + .ai_range_table = &ai_ranges_6052, + .ai_range_code = ai_range_code_6052, + .ao_range_table = &ao_ranges_6030, + .ao_range_code = ao_range_code_6030, + .ai_fifo = &ai_fifo_60xx, + .has_8255 = 0, + }, [BOARD_PCIDAS6052] = { - .name = "pci-das6052", - .ai_se_chans = 16, - .ai_bits = 16, - .ai_speed = 3333, - .ao_nchan = 2, - .ao_bits = 16, - .ao_scan_speed = 3333, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_6052, - .ai_range_code = ai_range_code_6052, - .ao_range_table = &ao_ranges_6030, - .ao_range_code = ao_range_code_6030, - .ai_fifo = &ai_fifo_60xx, - .has_8255 = 0, - }, + .name = "pci-das6052", + .ai_se_chans = 16, + .ai_bits = 16, + .ai_speed = 3333, + .ao_nchan = 2, + .ao_bits = 16, + .ao_scan_speed = 3333, + .layout = LAYOUT_60XX, + .ai_range_table = &ai_ranges_6052, + .ai_range_code = ai_range_code_6052, + .ao_range_table = &ao_ranges_6030, + .ao_range_code = ao_range_code_6030, + .ai_fifo = &ai_fifo_60xx, + .has_8255 = 0, + }, [BOARD_PCIDAS6070] = { - .name = "pci-das6070", - .ai_se_chans = 16, - .ai_bits = 12, - .ai_speed = 800, - .ao_nchan = 2, - .ao_bits = 12, - .ao_scan_speed = 1000, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_6052, - .ai_range_code = ai_range_code_6052, - .ao_range_table = &ao_ranges_6030, - .ao_range_code = ao_range_code_6030, - .ai_fifo = &ai_fifo_60xx, - .has_8255 = 0, - }, + .name = "pci-das6070", + .ai_se_chans = 16, + .ai_bits = 12, + .ai_speed = 800, + .ao_nchan = 2, + .ao_bits = 12, + .ao_scan_speed = 1000, + .layout = LAYOUT_60XX, + .ai_range_table = &ai_ranges_6052, + .ai_range_code = ai_range_code_6052, + .ao_range_table = &ao_ranges_6030, + .ao_range_code = ao_range_code_6030, + .ai_fifo = &ai_fifo_60xx, + .has_8255 = 0, + }, [BOARD_PCIDAS6071] = { - .name = "pci-das6071", - .ai_se_chans = 64, - .ai_bits = 12, - .ai_speed = 800, - .ao_nchan = 2, - .ao_bits = 12, - .ao_scan_speed = 1000, - .layout = LAYOUT_60XX, - .ai_range_table = &ai_ranges_6052, - .ai_range_code = ai_range_code_6052, - .ao_range_table = &ao_ranges_6030, - .ao_range_code = ao_range_code_6030, - .ai_fifo = &ai_fifo_60xx, - .has_8255 = 0, - }, + .name = "pci-das6071", + .ai_se_chans = 64, + .ai_bits = 12, + .ai_speed = 800, + .ao_nchan = 2, + .ao_bits = 12, + .ao_scan_speed = 1000, + .layout = LAYOUT_60XX, + .ai_range_table = &ai_ranges_6052, + .ai_range_code = ai_range_code_6052, + .ao_range_table = &ao_ranges_6030, + .ao_range_code = ao_range_code_6030, + .ai_fifo = &ai_fifo_60xx, + .has_8255 = 0, + }, [BOARD_PCIDAS4020_12] = { - .name = "pci-das4020/12", - .ai_se_chans = 4, - .ai_bits = 12, - .ai_speed = 50, - .ao_bits = 12, - .ao_nchan = 2, - .ao_scan_speed = 0, /* no hardware pacing on ao */ - .layout = LAYOUT_4020, - .ai_range_table = &ai_ranges_4020, - .ao_range_table = &ao_ranges_4020, - .ao_range_code = ao_range_code_4020, - .ai_fifo = &ai_fifo_4020, - .has_8255 = 1, - }, + .name = "pci-das4020/12", + .ai_se_chans = 4, + .ai_bits = 12, + .ai_speed = 50, + .ao_bits = 12, + .ao_nchan = 2, + .ao_scan_speed = 0, /* no hardware pacing on ao */ + .layout = LAYOUT_4020, + .ai_range_table = &ai_ranges_4020, + .ao_range_table = &ao_ranges_4020, + .ao_range_code = ao_range_code_4020, + .ai_fifo = &ai_fifo_4020, + .has_8255 = 1, + }, #if 0 /* The device id for these boards is unknown */ [BOARD_PCIDAS6402_16_JR] = { - .name = "pci-das6402/16/jr", - .ai_se_chans = 64, - .ai_bits = 16, - .ai_speed = 5000, - .ao_nchan = 0, - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, - .ai_range_table = &ai_ranges_64xx, - .ai_range_code = ai_range_code_64xx, - .ai_fifo = ai_fifo_64xx, - .has_8255 = 1, - }, + .name = "pci-das6402/16/jr", + .ai_se_chans = 64, + .ai_bits = 16, + .ai_speed = 5000, + .ao_nchan = 0, + .ao_scan_speed = 10000, + .layout = LAYOUT_64XX, + .ai_range_table = &ai_ranges_64xx, + .ai_range_code = ai_range_code_64xx, + .ai_fifo = ai_fifo_64xx, + .has_8255 = 1, + }, [BOARD_PCIDAS64_M1_16_JR] = { - .name = "pci-das64/m1/16/jr", - .ai_se_chans = 64, - .ai_bits = 16, - .ai_speed = 1000, - .ao_nchan = 0, - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, - .ai_range_table = &ai_ranges_64_mx, - .ai_range_code = ai_range_code_64_mx, - .ai_fifo = ai_fifo_64xx, - .has_8255 = 1, - }, + .name = "pci-das64/m1/16/jr", + .ai_se_chans = 64, + .ai_bits = 16, + .ai_speed = 1000, + .ao_nchan = 0, + .ao_scan_speed = 10000, + .layout = LAYOUT_64XX, + .ai_range_table = &ai_ranges_64_mx, + .ai_range_code = ai_range_code_64_mx, + .ai_fifo = ai_fifo_64xx, + .has_8255 = 1, + }, [BOARD_PCIDAS64_M2_16_JR] = { - .name = "pci-das64/m2/16/jr", - .ai_se_chans = 64, - .ai_bits = 16, - .ai_speed = 500, - .ao_nchan = 0, - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, - .ai_range_table = &ai_ranges_64_mx, - .ai_range_code = ai_range_code_64_mx, - .ai_fifo = ai_fifo_64xx, - .has_8255 = 1, - }, + .name = "pci-das64/m2/16/jr", + .ai_se_chans = 64, + .ai_bits = 16, + .ai_speed = 500, + .ao_nchan = 0, + .ao_scan_speed = 10000, + .layout = LAYOUT_64XX, + .ai_range_table = &ai_ranges_64_mx, + .ai_range_code = ai_range_code_64_mx, + .ai_fifo = ai_fifo_64xx, + .has_8255 = 1, + }, [BOARD_PCIDAS64_M3_16_JR] = { - .name = "pci-das64/m3/16/jr", - .ai_se_chans = 64, - .ai_bits = 16, - .ai_speed = 333, - .ao_nchan = 0, - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, - .ai_range_table = &ai_ranges_64_mx, - .ai_range_code = ai_range_code_64_mx, - .ai_fifo = ai_fifo_64xx, - .has_8255 = 1, - }, + .name = "pci-das64/m3/16/jr", + .ai_se_chans = 64, + .ai_bits = 16, + .ai_speed = 333, + .ao_nchan = 0, + .ao_scan_speed = 10000, + .layout = LAYOUT_64XX, + .ai_range_table = &ai_ranges_64_mx, + .ai_range_code = ai_range_code_64_mx, + .ai_fifo = ai_fifo_64xx, + .has_8255 = 1, + }, [BOARD_PCIDAS64_M1_14] = { - .name = "pci-das64/m1/14", - .ai_se_chans = 64, - .ai_bits = 14, - .ai_speed = 1000, - .ao_nchan = 2, - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, - .ai_range_table = &ai_ranges_64_mx, - .ai_range_code = ai_range_code_64_mx, - .ai_fifo = ai_fifo_64xx, - .has_8255 = 1, - }, + .name = "pci-das64/m1/14", + .ai_se_chans = 64, + .ai_bits = 14, + .ai_speed = 1000, + .ao_nchan = 2, + .ao_scan_speed = 10000, + .layout = LAYOUT_64XX, + .ai_range_table = &ai_ranges_64_mx, + .ai_range_code = ai_range_code_64_mx, + .ai_fifo = ai_fifo_64xx, + .has_8255 = 1, + }, [BOARD_PCIDAS64_M2_14] = { - .name = "pci-das64/m2/14", - .ai_se_chans = 64, - .ai_bits = 14, - .ai_speed = 500, - .ao_nchan = 2, - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, - .ai_range_table = &ai_ranges_64_mx, - .ai_range_code = ai_range_code_64_mx, - .ai_fifo = ai_fifo_64xx, - .has_8255 = 1, - }, + .name = "pci-das64/m2/14", + .ai_se_chans = 64, + .ai_bits = 14, + .ai_speed = 500, + .ao_nchan = 2, + .ao_scan_speed = 10000, + .layout = LAYOUT_64XX, + .ai_range_table = &ai_ranges_64_mx, + .ai_range_code = ai_range_code_64_mx, + .ai_fifo = ai_fifo_64xx, + .has_8255 = 1, + }, [BOARD_PCIDAS64_M3_14] = { - .name = "pci-das64/m3/14", - .ai_se_chans = 64, - .ai_bits = 14, - .ai_speed = 333, - .ao_nchan = 2, - .ao_scan_speed = 10000, - .layout = LAYOUT_64XX, - .ai_range_table = &ai_ranges_64_mx, - .ai_range_code = ai_range_code_64_mx, - .ai_fifo = ai_fifo_64xx, - .has_8255 = 1, - }, + .name = "pci-das64/m3/14", + .ai_se_chans = 64, + .ai_bits = 14, + .ai_speed = 333, + .ao_nchan = 2, + .ao_scan_speed = 10000, + .layout = LAYOUT_64XX, + .ai_range_table = &ai_ranges_64_mx, + .ai_range_code = ai_range_code_64_mx, + .ai_fifo = ai_fifo_64xx, + .has_8255 = 1, + }, #endif }; @@ -1190,7 +1190,7 @@ static unsigned int hw_revision(const struct comedi_device *dev, } static void set_dac_range_bits(struct comedi_device *dev, - u16 *bits, unsigned int channel, + u16 *bits, unsigned int channel, unsigned int range) { const struct pcidas64_board *board = dev->board_ptr; @@ -1239,9 +1239,9 @@ static void disable_ai_interrupts(struct comedi_device *dev) spin_lock_irqsave(&dev->spinlock, flags); devpriv->intr_enable_bits &= - ~EN_ADC_INTR_SRC_BIT & ~EN_ADC_DONE_INTR_BIT & - ~EN_ADC_ACTIVE_INTR_BIT & ~EN_ADC_STOP_INTR_BIT & - ~EN_ADC_OVERRUN_BIT & ~ADC_INTR_SRC_MASK; + ~EN_ADC_INTR_SRC_BIT & ~EN_ADC_DONE_INTR_BIT & + ~EN_ADC_ACTIVE_INTR_BIT & ~EN_ADC_STOP_INTR_BIT & + ~EN_ADC_OVERRUN_BIT & ~ADC_INTR_SRC_MASK; writew(devpriv->intr_enable_bits, devpriv->main_iobase + INTR_ENABLE_REG); spin_unlock_irqrestore(&dev->spinlock, flags); @@ -1256,7 +1256,7 @@ static void enable_ai_interrupts(struct comedi_device *dev, unsigned long flags; bits = EN_ADC_OVERRUN_BIT | EN_ADC_DONE_INTR_BIT | - EN_ADC_ACTIVE_INTR_BIT | EN_ADC_STOP_INTR_BIT; + EN_ADC_ACTIVE_INTR_BIT | EN_ADC_STOP_INTR_BIT; /* * Use pio transfer and interrupt on end of conversion * if CMDF_WAKE_EOS flag is set. @@ -1282,7 +1282,7 @@ static void init_plx9080(struct comedi_device *dev) void __iomem *plx_iobase = devpriv->plx9080_iobase; devpriv->plx_control_bits = - readl(devpriv->plx9080_iobase + PLX_REG_CNTRL); + readl(devpriv->plx9080_iobase + PLX_REG_CNTRL); #ifdef __BIG_ENDIAN bits = PLX_BIGEND_DMA0 | PLX_BIGEND_DMA1; @@ -1323,7 +1323,7 @@ static void init_plx9080(struct comedi_device *dev) /* 4020 uses 32 bit dma */ if (board->layout == LAYOUT_4020) bits |= PLX_DMAMODE_WIDTH_32; - else /* localspace0 bus is 16 bits wide */ + else /* localspace0 bus is 16 bits wide */ bits |= PLX_DMAMODE_WIDTH_16; writel(bits, plx_iobase + PLX_REG_DMAMODE1); if (ao_cmd_is_supported(board)) @@ -1377,8 +1377,7 @@ static int set_ai_fifo_segment_length(struct comedi_device *dev, bits = (~(num_increments - 1)) & fifo->fifo_size_reg_mask; devpriv->fifo_size_bits &= ~fifo->fifo_size_reg_mask; devpriv->fifo_size_bits |= bits; - writew(devpriv->fifo_size_bits, - devpriv->main_iobase + FIFO_SIZE_REG); + writew(devpriv->fifo_size_bits, devpriv->main_iobase + FIFO_SIZE_REG); devpriv->ai_fifo_segment_length = num_increments * increment_size; @@ -1413,8 +1412,7 @@ static unsigned int ai_fifo_size(struct comedi_device *dev) struct pcidas64_private *devpriv = dev->private; return devpriv->ai_fifo_segment_length * - board->ai_fifo->num_segments * - board->ai_fifo->sample_packing_ratio; + board->ai_fifo->num_segments * board->ai_fifo->sample_packing_ratio; } static void init_stc_registers(struct comedi_device *dev) @@ -1442,8 +1440,7 @@ static void init_stc_registers(struct comedi_device *dev) if (board->layout == LAYOUT_4020) bits |= INTERNAL_CLOCK_4020_BITS; devpriv->hw_config_bits |= bits; - writew(devpriv->hw_config_bits, - devpriv->main_iobase + HW_CONFIG_REG); + writew(devpriv->hw_config_bits, devpriv->main_iobase + HW_CONFIG_REG); writew(0, devpriv->main_iobase + DAQ_SYNC_REG); writew(0, devpriv->main_iobase + CALIBRATION_REG); @@ -1456,8 +1453,8 @@ static void init_stc_registers(struct comedi_device *dev) devpriv->dac_control1_bits = DAC_OUTPUT_ENABLE_BIT; devpriv->intr_enable_bits = - /* EN_DAC_INTR_SRC_BIT | DAC_INTR_QEMPTY_BITS | */ - EN_DAC_DONE_INTR_BIT | EN_DAC_UNDERRUN_BIT; + /* EN_DAC_INTR_SRC_BIT | DAC_INTR_QEMPTY_BITS | */ + EN_DAC_DONE_INTR_BIT | EN_DAC_UNDERRUN_BIT; writew(devpriv->intr_enable_bits, devpriv->main_iobase + INTR_ENABLE_REG); @@ -1474,9 +1471,9 @@ static int alloc_and_init_dma_members(struct comedi_device *dev) /* allocate pci dma buffers */ for (i = 0; i < ai_dma_ring_count(board); i++) { devpriv->ai_buffer[i] = - dma_alloc_coherent(&pcidev->dev, DMA_BUFFER_SIZE, - &devpriv->ai_buffer_bus_addr[i], - GFP_KERNEL); + dma_alloc_coherent(&pcidev->dev, DMA_BUFFER_SIZE, + &devpriv->ai_buffer_bus_addr[i], + GFP_KERNEL); if (!devpriv->ai_buffer[i]) return -ENOMEM; } @@ -1493,56 +1490,52 @@ static int alloc_and_init_dma_members(struct comedi_device *dev) } /* allocate dma descriptors */ devpriv->ai_dma_desc = - dma_alloc_coherent(&pcidev->dev, sizeof(struct plx_dma_desc) * - ai_dma_ring_count(board), - &devpriv->ai_dma_desc_bus_addr, GFP_KERNEL); + dma_alloc_coherent(&pcidev->dev, sizeof(struct plx_dma_desc) * + ai_dma_ring_count(board), + &devpriv->ai_dma_desc_bus_addr, GFP_KERNEL); if (!devpriv->ai_dma_desc) return -ENOMEM; if (ao_cmd_is_supported(board)) { devpriv->ao_dma_desc = - dma_alloc_coherent(&pcidev->dev, - sizeof(struct plx_dma_desc) * - AO_DMA_RING_COUNT, - &devpriv->ao_dma_desc_bus_addr, - GFP_KERNEL); + dma_alloc_coherent(&pcidev->dev, + sizeof(struct plx_dma_desc) * + AO_DMA_RING_COUNT, + &devpriv->ao_dma_desc_bus_addr, + GFP_KERNEL); if (!devpriv->ao_dma_desc) return -ENOMEM; } /* initialize dma descriptors */ for (i = 0; i < ai_dma_ring_count(board); i++) { devpriv->ai_dma_desc[i].pci_start_addr = - cpu_to_le32(devpriv->ai_buffer_bus_addr[i]); + cpu_to_le32(devpriv->ai_buffer_bus_addr[i]); if (board->layout == LAYOUT_4020) devpriv->ai_dma_desc[i].local_start_addr = - cpu_to_le32(devpriv->local1_iobase + - ADC_FIFO_REG); + cpu_to_le32(devpriv->local1_iobase + ADC_FIFO_REG); else devpriv->ai_dma_desc[i].local_start_addr = - cpu_to_le32(devpriv->local0_iobase + - ADC_FIFO_REG); + cpu_to_le32(devpriv->local0_iobase + ADC_FIFO_REG); devpriv->ai_dma_desc[i].transfer_size = cpu_to_le32(0); devpriv->ai_dma_desc[i].next = - cpu_to_le32((devpriv->ai_dma_desc_bus_addr + - ((i + 1) % ai_dma_ring_count(board)) * - sizeof(devpriv->ai_dma_desc[0])) | - PLX_DMADPR_DESCPCI | PLX_DMADPR_TCINTR | - PLX_DMADPR_XFERL2P); + cpu_to_le32((devpriv->ai_dma_desc_bus_addr + + ((i + 1) % ai_dma_ring_count(board)) * + sizeof(devpriv->ai_dma_desc[0])) | + PLX_DMADPR_DESCPCI | PLX_DMADPR_TCINTR | + PLX_DMADPR_XFERL2P); } if (ao_cmd_is_supported(board)) { for (i = 0; i < AO_DMA_RING_COUNT; i++) { devpriv->ao_dma_desc[i].pci_start_addr = - cpu_to_le32(devpriv->ao_buffer_bus_addr[i]); + cpu_to_le32(devpriv->ao_buffer_bus_addr[i]); devpriv->ao_dma_desc[i].local_start_addr = - cpu_to_le32(devpriv->local0_iobase + - DAC_FIFO_REG); + cpu_to_le32(devpriv->local0_iobase + DAC_FIFO_REG); devpriv->ao_dma_desc[i].transfer_size = cpu_to_le32(0); devpriv->ao_dma_desc[i].next = - cpu_to_le32((devpriv->ao_dma_desc_bus_addr + - ((i + 1) % (AO_DMA_RING_COUNT)) * - sizeof(devpriv->ao_dma_desc[0])) | - PLX_DMADPR_DESCPCI | - PLX_DMADPR_TCINTR); + cpu_to_le32((devpriv->ao_dma_desc_bus_addr + + ((i + 1) % (AO_DMA_RING_COUNT)) * + sizeof(devpriv->ao_dma_desc[0])) | + PLX_DMADPR_DESCPCI | PLX_DMADPR_TCINTR); } } return 0; @@ -1608,13 +1601,13 @@ static void i2c_set_sda(struct comedi_device *dev, int state) struct pcidas64_private *devpriv = dev->private; static const int data_bit = PLX_CNTRL_EEWB; void __iomem *plx_control_addr = devpriv->plx9080_iobase + - PLX_REG_CNTRL; + PLX_REG_CNTRL; - if (state) { /* set data line high */ + if (state) { /* set data line high */ devpriv->plx_control_bits &= ~data_bit; writel(devpriv->plx_control_bits, plx_control_addr); udelay(i2c_high_udelay); - } else { /* set data line low */ + } else { /* set data line low */ devpriv->plx_control_bits |= data_bit; writel(devpriv->plx_control_bits, plx_control_addr); udelay(i2c_low_udelay); @@ -1627,13 +1620,13 @@ static void i2c_set_scl(struct comedi_device *dev, int state) struct pcidas64_private *devpriv = dev->private; static const int clock_bit = PLX_CNTRL_USERO; void __iomem *plx_control_addr = devpriv->plx9080_iobase + - PLX_REG_CNTRL; + PLX_REG_CNTRL; - if (state) { /* set clock line high */ + if (state) { /* set clock line high */ devpriv->plx_control_bits &= ~clock_bit; writel(devpriv->plx_control_bits, plx_control_addr); udelay(i2c_high_udelay); - } else { /* set clock line low */ + } else { /* set clock line low */ devpriv->plx_control_bits |= clock_bit; writel(devpriv->plx_control_bits, plx_control_addr); udelay(i2c_low_udelay); @@ -1683,7 +1676,7 @@ static void i2c_stop(struct comedi_device *dev) } static void i2c_write(struct comedi_device *dev, unsigned int address, - const u8 *data, unsigned int length) + const u8 *data, unsigned int length) { struct pcidas64_private *devpriv = dev->private; unsigned int i; @@ -1725,8 +1718,7 @@ static void i2c_write(struct comedi_device *dev, unsigned int address, static int cb_pcidas64_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { const struct pcidas64_board *board = dev->board_ptr; struct pcidas64_private *devpriv = dev->private; @@ -1819,7 +1811,7 @@ static int ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, devpriv->i2c_cal_range_bits &= ~ADC_SRC_4020_MASK; if (insn->chanspec & CR_ALT_SOURCE) { devpriv->i2c_cal_range_bits |= - adc_src_4020_bits(devpriv->calibration_source); + adc_src_4020_bits(devpriv->calibration_source); } else { /* select BNC inputs */ devpriv->i2c_cal_range_bits |= adc_src_4020_bits(4); } @@ -1906,7 +1898,7 @@ static int ai_config_block_size(struct comedi_device *dev, unsigned int *data) if (requested_block_size) { fifo_size = requested_block_size * fifo->num_segments / - bytes_in_sample; + bytes_in_sample; retval = set_ai_fifo_size(dev, fifo_size); if (retval < 0) @@ -2016,7 +2008,7 @@ static void check_adc_timing(struct comedi_device *dev, struct comedi_cmd *cmd) unsigned int scan_divisor; static const int min_convert_divisor = 3; static const int max_convert_divisor = - max_counter_value + min_convert_divisor; + max_counter_value + min_convert_divisor; static const int min_scan_divisor_4020 = 2; unsigned long long max_scan_divisor, min_scan_divisor; @@ -2041,8 +2033,8 @@ static void check_adc_timing(struct comedi_device *dev, struct comedi_cmd *cmd) if (cmd->convert_src == TRIG_TIMER) { min_scan_divisor = convert_divisor * cmd->chanlist_len; max_scan_divisor = - (convert_divisor * cmd->chanlist_len - 1) + - max_counter_value; + (convert_divisor * cmd->chanlist_len - 1) + + max_counter_value; } else { min_scan_divisor = min_scan_divisor_4020; max_scan_divisor = max_counter_value + min_scan_divisor; @@ -2168,10 +2160,10 @@ static int ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, * allows */ if (cmd->scan_begin_src == TRIG_TIMER) { - err |= comedi_check_trigger_arg_min( - &cmd->scan_begin_arg, - cmd->convert_arg * - cmd->chanlist_len); + err |= + comedi_check_trigger_arg_min + (&cmd->scan_begin_arg, + cmd->convert_arg * cmd->chanlist_len); } } } @@ -2255,7 +2247,7 @@ static inline unsigned int dma_transfer_size(struct comedi_device *dev) unsigned int num_samples; num_samples = devpriv->ai_fifo_segment_length * - board->ai_fifo->sample_packing_ratio; + board->ai_fifo->sample_packing_ratio; if (num_samples > DMA_BUFFER_SIZE / sizeof(u16)) num_samples = DMA_BUFFER_SIZE / sizeof(u16); @@ -2279,7 +2271,7 @@ static u32 ai_scan_counter_6xxx(struct comedi_device *dev, case TRIG_TIMER: count = (cmd->scan_begin_arg - (cmd->convert_arg * (cmd->chanlist_len - 1))) / - TIMER_BASE; + TIMER_BASE; break; case TRIG_FOLLOW: count = cmd->convert_arg / TIMER_BASE; @@ -2330,8 +2322,7 @@ static void select_master_clock_4020(struct comedi_device *dev, } else { devpriv->hw_config_bits |= INTERNAL_CLOCK_4020_BITS; } - writew(devpriv->hw_config_bits, - devpriv->main_iobase + HW_CONFIG_REG); + writew(devpriv->hw_config_bits, devpriv->main_iobase + HW_CONFIG_REG); } static void select_master_clock(struct comedi_device *dev, @@ -2439,8 +2430,7 @@ static int setup_channel_queue(struct comedi_device *dev, (CR_CHAN(cmd->chanlist[cmd->chanlist_len - 1])), devpriv->main_iobase + ADC_QUEUE_HIGH_REG); /* set start channel, and rest of settings */ - writew(bits, - devpriv->main_iobase + ADC_QUEUE_LOAD_REG); + writew(bits, devpriv->main_iobase + ADC_QUEUE_LOAD_REG); } else { /* use external queue */ if (dev->write_subdev && dev->write_subdev->busy) { @@ -2451,8 +2441,7 @@ static int setup_channel_queue(struct comedi_device *dev, writew(devpriv->hw_config_bits, devpriv->main_iobase + HW_CONFIG_REG); /* clear DAC buffer to prevent weird interactions */ - writew(0, - devpriv->main_iobase + DAC_BUFFER_CLEAR_REG); + writew(0, devpriv->main_iobase + DAC_BUFFER_CLEAR_REG); /* clear queue pointer */ writew(0, devpriv->main_iobase + ADC_QUEUE_CLEAR_REG); /* load external queue */ @@ -2477,7 +2466,7 @@ static int setup_channel_queue(struct comedi_device *dev, /* mark end of queue */ if (i == cmd->chanlist_len - 1) bits |= QUEUE_EOSCAN_BIT | - QUEUE_EOSEQ_BIT; + QUEUE_EOSEQ_BIT; writew(bits, devpriv->main_iobase + ADC_QUEUE_FIFO_REG); @@ -2503,10 +2492,10 @@ static int setup_channel_queue(struct comedi_device *dev, if (range == 0) devpriv->i2c_cal_range_bits |= - attenuate_bit(channel); + attenuate_bit(channel); else devpriv->i2c_cal_range_bits &= - ~attenuate_bit(channel); + ~attenuate_bit(channel); } /* * update calibration/range i2c register only if necessary, @@ -2597,11 +2586,11 @@ static int ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) devpriv->adc_control1_bits |= TWO_CHANNEL_4020_BITS; devpriv->adc_control1_bits &= ~ADC_LO_CHANNEL_4020_MASK; devpriv->adc_control1_bits |= - adc_lo_chan_4020_bits(CR_CHAN(cmd->chanlist[0])); + adc_lo_chan_4020_bits(CR_CHAN(cmd->chanlist[0])); devpriv->adc_control1_bits &= ~ADC_HI_CHANNEL_4020_MASK; devpriv->adc_control1_bits |= - adc_hi_chan_4020_bits(CR_CHAN(cmd->chanlist - [cmd->chanlist_len - 1])); + adc_hi_chan_4020_bits(CR_CHAN(cmd->chanlist + [cmd->chanlist_len - 1])); } writew(devpriv->adc_control1_bits, devpriv->main_iobase + ADC_CONTROL1_REG); @@ -2610,15 +2599,13 @@ static int ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) /* clear adc buffer */ writew(0, devpriv->main_iobase + ADC_BUFFER_CLEAR_REG); - if ((cmd->flags & CMDF_WAKE_EOS) == 0 || - board->layout == LAYOUT_4020) { + if ((cmd->flags & CMDF_WAKE_EOS) == 0 || board->layout == LAYOUT_4020) { devpriv->ai_dma_index = 0; /* set dma transfer size */ for (i = 0; i < ai_dma_ring_count(board); i++) devpriv->ai_dma_desc[i].transfer_size = - cpu_to_le32(dma_transfer_size(dev) * - sizeof(u16)); + cpu_to_le32(dma_transfer_size(dev) * sizeof(u16)); /* give location of first dma descriptor */ load_first_dma_descriptor(dev, 1, @@ -2682,9 +2669,9 @@ static void pio_drain_ai_fifo_16(struct comedi_device *dev) do { /* get least significant 15 bits */ read_index = readw(devpriv->main_iobase + ADC_READ_PNTR_REG) & - 0x7fff; + 0x7fff; write_index = readw(devpriv->main_iobase + ADC_WRITE_PNTR_REG) & - 0x7fff; + 0x7fff; /* * Get most significant bits (grey code). * Different boards use different code so use a scheme @@ -2703,7 +2690,7 @@ static void pio_drain_ai_fifo_16(struct comedi_device *dev) if (read_segment != write_segment) num_samples = - devpriv->ai_fifo_segment_length - read_index; + devpriv->ai_fifo_segment_length - read_index; else num_samples = write_index - read_index; if (num_samples < 0) { @@ -2740,9 +2727,9 @@ static void pio_drain_ai_fifo_32(struct comedi_device *dev) unsigned int i; u32 fifo_data; int write_code = - readw(devpriv->main_iobase + ADC_WRITE_PNTR_REG) & 0x7fff; + readw(devpriv->main_iobase + ADC_WRITE_PNTR_REG) & 0x7fff; int read_code = - readw(devpriv->main_iobase + ADC_READ_PNTR_REG) & 0x7fff; + readw(devpriv->main_iobase + ADC_READ_PNTR_REG) & 0x7fff; nsamples = comedi_nsamples_left(s, 100000); for (i = 0; read_code != write_code && i < nsamples;) { @@ -2758,7 +2745,7 @@ static void pio_drain_ai_fifo_32(struct comedi_device *dev) i++; } read_code = readw(devpriv->main_iobase + ADC_READ_PNTR_REG) & - 0x7fff; + 0x7fff; } } @@ -2795,10 +2782,11 @@ static void drain_dma_buffers(struct comedi_device *dev, unsigned int channel) /* transfer data from dma buffer to comedi buffer */ num_samples = comedi_nsamples_left(s, dma_transfer_size(dev)); comedi_buf_write_samples(s, - devpriv->ai_buffer[devpriv->ai_dma_index], - num_samples); - devpriv->ai_dma_index = (devpriv->ai_dma_index + 1) % - ai_dma_ring_count(board); + devpriv->ai_buffer[devpriv-> + ai_dma_index], + num_samples); + devpriv->ai_dma_index = + (devpriv->ai_dma_index + 1) % ai_dma_ring_count(board); } /* * XXX check for dma ring buffer overrun @@ -2807,8 +2795,7 @@ static void drain_dma_buffers(struct comedi_device *dev, unsigned int channel) } static void handle_ai_interrupt(struct comedi_device *dev, - unsigned short status, - unsigned int plx_status) + unsigned short status, unsigned int plx_status) { const struct pcidas64_board *board = dev->board_ptr; struct pcidas64_private *devpriv = dev->private; @@ -2881,8 +2868,7 @@ static int last_ao_dma_load_completed(struct comedi_device *dev) if ((dma_status & PLX_DMACSR_DONE) == 0) return 0; - transfer_address = - readl(devpriv->plx9080_iobase + PLX_REG_DMAPADR0); + transfer_address = readl(devpriv->plx9080_iobase + PLX_REG_DMAPADR0); if (transfer_address != devpriv->ao_buffer_bus_addr[buffer_index]) return 0; @@ -2978,8 +2964,7 @@ static void load_ao_dma(struct comedi_device *dev, const struct comedi_cmd *cmd) if (next_transfer_addr >= devpriv->ao_buffer_bus_addr[buffer_index] && next_transfer_addr < - devpriv->ao_buffer_bus_addr[buffer_index] + - DMA_BUFFER_SIZE) + devpriv->ao_buffer_bus_addr[buffer_index] + DMA_BUFFER_SIZE) return; num_bytes = load_ao_dma_buffer(dev, cmd); } while (num_bytes >= DMA_BUFFER_SIZE); @@ -3130,7 +3115,7 @@ static void set_dac_control0_reg(struct comedi_device *dev, { struct pcidas64_private *devpriv = dev->private; unsigned int bits = DAC_ENABLE_BIT | WAVEFORM_GATE_LEVEL_BIT | - WAVEFORM_GATE_ENABLE_BIT | WAVEFORM_GATE_SELECT_BIT; + WAVEFORM_GATE_ENABLE_BIT | WAVEFORM_GATE_SELECT_BIT; if (cmd->start_src == TRIG_EXT) { bits |= WAVEFORM_TRIG_EXT_BITS; @@ -3376,7 +3361,7 @@ static int ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, if (get_ao_divisor(cmd->scan_begin_arg, cmd->flags) > max_counter_value) { cmd->scan_begin_arg = (max_counter_value + 2) * - TIMER_BASE; + TIMER_BASE; err |= -EINVAL; } } @@ -3447,8 +3432,7 @@ static int di_rbits(struct comedi_device *dev, struct comedi_subdevice *s, static int do_wbits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { if (comedi_dio_update_state(s, data)) writeb(s->state, dev->mmio + DO_REG); @@ -3460,8 +3444,7 @@ static int do_wbits(struct comedi_device *dev, static int dio_60xx_config_insn(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { int ret; @@ -3476,8 +3459,7 @@ static int dio_60xx_config_insn(struct comedi_device *dev, static int dio_60xx_wbits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { if (comedi_dio_update_state(s, data)) writeb(s->state, dev->mmio + DIO_DATA_60XX_REG); @@ -3560,35 +3542,35 @@ static int caldac_i2c_write(struct comedi_device *dev, }; switch (caldac_channel) { - case 0: /* chan 0 offset */ + case 0: /* chan 0 offset */ i2c_addr = CALDAC0_I2C_ADDR; serial_bytes[0] = OFFSET_0_2; break; - case 1: /* chan 1 offset */ + case 1: /* chan 1 offset */ i2c_addr = CALDAC0_I2C_ADDR; serial_bytes[0] = OFFSET_1_3; break; - case 2: /* chan 2 offset */ + case 2: /* chan 2 offset */ i2c_addr = CALDAC1_I2C_ADDR; serial_bytes[0] = OFFSET_0_2; break; - case 3: /* chan 3 offset */ + case 3: /* chan 3 offset */ i2c_addr = CALDAC1_I2C_ADDR; serial_bytes[0] = OFFSET_1_3; break; - case 4: /* chan 0 gain */ + case 4: /* chan 0 gain */ i2c_addr = CALDAC0_I2C_ADDR; serial_bytes[0] = GAIN_0_2; break; - case 5: /* chan 1 gain */ + case 5: /* chan 1 gain */ i2c_addr = CALDAC0_I2C_ADDR; serial_bytes[0] = GAIN_1_3; break; - case 6: /* chan 2 gain */ + case 6: /* chan 2 gain */ i2c_addr = CALDAC1_I2C_ADDR; serial_bytes[0] = GAIN_0_2; break; - case 7: /* chan 3 gain */ + case 7: /* chan 3 gain */ i2c_addr = CALDAC1_I2C_ADDR; serial_bytes[0] = GAIN_1_3; break; @@ -3703,8 +3685,8 @@ static u16 read_eeprom(struct comedi_device *dev, u8 address) static const int read_command = 0x6; unsigned int bitstream = (read_command << 8) | address; unsigned int bit; - void __iomem * const plx_control_addr = - devpriv->plx9080_iobase + PLX_REG_CNTRL; + void __iomem *const plx_control_addr = + devpriv->plx9080_iobase + PLX_REG_CNTRL; u16 value; static const int value_length = 16; static const int eeprom_udelay = 1; @@ -3827,7 +3809,7 @@ static int setup_subdevices(struct comedi_device *dev) if (board->ao_nchan) { s->type = COMEDI_SUBD_AO; s->subdev_flags = SDF_READABLE | SDF_WRITABLE | - SDF_GROUND | SDF_CMD_WRITE; + SDF_GROUND | SDF_CMD_WRITE; s->n_chan = board->ao_nchan; s->maxdata = (1 << board->ao_bits) - 1; s->range_table = board->ao_range_table; @@ -3965,8 +3947,7 @@ static int setup_subdevices(struct comedi_device *dev) return 0; } -static int auto_attach(struct comedi_device *dev, - unsigned long context) +static int auto_attach(struct comedi_device *dev, unsigned long context) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); const struct pcidas64_board *board = NULL; @@ -4006,16 +3987,16 @@ static int auto_attach(struct comedi_device *dev, /* figure out what local addresses are */ local_range = readl(devpriv->plx9080_iobase + PLX_REG_LAS0RR) & - PLX_LASRR_MEM_MASK; + PLX_LASRR_MEM_MASK; local_decode = readl(devpriv->plx9080_iobase + PLX_REG_LAS0BA) & - local_range & PLX_LASBA_MEM_MASK; - devpriv->local0_iobase = ((u32)devpriv->main_phys_iobase & + local_range & PLX_LASBA_MEM_MASK; + devpriv->local0_iobase = ((u32) devpriv->main_phys_iobase & ~local_range) | local_decode; local_range = readl(devpriv->plx9080_iobase + PLX_REG_LAS1RR) & - PLX_LASRR_MEM_MASK; + PLX_LASRR_MEM_MASK; local_decode = readl(devpriv->plx9080_iobase + PLX_REG_LAS1BA) & - local_range & PLX_LASBA_MEM_MASK; - devpriv->local1_iobase = ((u32)devpriv->dio_counter_phys_iobase & + local_range & PLX_LASBA_MEM_MASK; + devpriv->local1_iobase = ((u32) devpriv->dio_counter_phys_iobase & ~local_range) | local_decode; retval = alloc_and_init_dma_members(dev); @@ -4023,7 +4004,7 @@ static int auto_attach(struct comedi_device *dev, return retval; devpriv->hw_revision = - hw_revision(dev, readw(devpriv->main_iobase + HW_STATUS_REG)); + hw_revision(dev, readw(devpriv->main_iobase + HW_STATUS_REG)); dev_dbg(dev->class_dev, "stc hardware revision %i\n", devpriv->hw_revision); init_plx9080(dev); @@ -4067,10 +4048,10 @@ static void detach(struct comedi_device *dev) } static struct comedi_driver cb_pcidas64_driver = { - .driver_name = "cb_pcidas64", - .module = THIS_MODULE, - .auto_attach = auto_attach, - .detach = detach, + .driver_name = "cb_pcidas64", + .module = THIS_MODULE, + .auto_attach = auto_attach, + .detach = detach, }; static int cb_pcidas64_pci_probe(struct pci_dev *dev, @@ -4104,14 +4085,16 @@ static const struct pci_device_id cb_pcidas64_pci_table[] = { { PCI_VDEVICE(CB, 0x0079), BOARD_PCIDAS6014 }, { 0 } }; + MODULE_DEVICE_TABLE(pci, cb_pcidas64_pci_table); static struct pci_driver cb_pcidas64_pci_driver = { - .name = "cb_pcidas64", - .id_table = cb_pcidas64_pci_table, - .probe = cb_pcidas64_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "cb_pcidas64", + .id_table = cb_pcidas64_pci_table, + .probe = cb_pcidas64_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(cb_pcidas64_driver, cb_pcidas64_pci_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/cb_pcidda.c b/drivers/comedi/drivers/cb_pcidda.c index 78cf1603638c..36982f7451d7 100644 --- a/drivers/comedi/drivers/cb_pcidda.c +++ b/drivers/comedi/drivers/cb_pcidda.c @@ -41,14 +41,14 @@ #define CB_DDA_DIO1_8255_BASE 0x04 /* DAC registers */ -#define CB_DDA_DA_CTRL_REG 0x00 /* D/A Control Register */ -#define CB_DDA_DA_CTRL_SU BIT(0) /* Simultaneous update */ -#define CB_DDA_DA_CTRL_EN BIT(1) /* Enable specified DAC */ -#define CB_DDA_DA_CTRL_DAC(x) ((x) << 2) /* Specify DAC channel */ -#define CB_DDA_DA_CTRL_RANGE2V5 (0 << 6) /* 2.5V range */ -#define CB_DDA_DA_CTRL_RANGE5V (2 << 6) /* 5V range */ -#define CB_DDA_DA_CTRL_RANGE10V (3 << 6) /* 10V range */ -#define CB_DDA_DA_CTRL_UNIP BIT(8) /* Unipolar range */ +#define CB_DDA_DA_CTRL_REG 0x00 /* D/A Control Register */ +#define CB_DDA_DA_CTRL_SU BIT(0) /* Simultaneous update */ +#define CB_DDA_DA_CTRL_EN BIT(1) /* Enable specified DAC */ +#define CB_DDA_DA_CTRL_DAC(x) ((x) << 2) /* Specify DAC channel */ +#define CB_DDA_DA_CTRL_RANGE2V5 (0 << 6) /* 2.5V range */ +#define CB_DDA_DA_CTRL_RANGE5V (2 << 6) /* 5V range */ +#define CB_DDA_DA_CTRL_RANGE10V (3 << 6) /* 10V range */ +#define CB_DDA_DA_CTRL_UNIP BIT(8) /* Unipolar range */ #define DACALIBRATION1 4 /* D/A CALIBRATION REGISTER 1 */ /* write bits */ @@ -83,13 +83,13 @@ static const struct comedi_lrange cb_pcidda_ranges = { 6, { - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(2.5), - UNI_RANGE(10), - UNI_RANGE(5), - UNI_RANGE(2.5) - } + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(2.5), + UNI_RANGE(10), + UNI_RANGE(5), + UNI_RANGE(2.5) + } }; enum cb_pcidda_boardid { @@ -109,35 +109,35 @@ struct cb_pcidda_board { static const struct cb_pcidda_board cb_pcidda_boards[] = { [BOARD_DDA02_12] = { - .name = "pci-dda02/12", - .ao_chans = 2, - .ao_bits = 12, - }, + .name = "pci-dda02/12", + .ao_chans = 2, + .ao_bits = 12, + }, [BOARD_DDA04_12] = { - .name = "pci-dda04/12", - .ao_chans = 4, - .ao_bits = 12, - }, + .name = "pci-dda04/12", + .ao_chans = 4, + .ao_bits = 12, + }, [BOARD_DDA08_12] = { - .name = "pci-dda08/12", - .ao_chans = 8, - .ao_bits = 12, - }, + .name = "pci-dda08/12", + .ao_chans = 8, + .ao_bits = 12, + }, [BOARD_DDA02_16] = { - .name = "pci-dda02/16", - .ao_chans = 2, - .ao_bits = 16, - }, + .name = "pci-dda02/16", + .ao_chans = 2, + .ao_bits = 16, + }, [BOARD_DDA04_16] = { - .name = "pci-dda04/16", - .ao_chans = 4, - .ao_bits = 16, - }, + .name = "pci-dda04/16", + .ao_chans = 4, + .ao_bits = 16, + }, [BOARD_DDA08_16] = { - .name = "pci-dda08/16", - .ao_chans = 8, - .ao_bits = 16, - }, + .name = "pci-dda08/16", + .ao_chans = 8, + .ao_bits = 16, + }, }; struct cb_pcidda_private { @@ -284,8 +284,7 @@ static void cb_pcidda_calibrate(struct comedi_device *dev, unsigned int channel, static int cb_pcidda_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct cb_pcidda_private *devpriv = dev->private; unsigned int channel = CR_CHAN(insn->chanspec); @@ -384,17 +383,16 @@ static int cb_pcidda_auto_attach(struct comedi_device *dev, } static struct comedi_driver cb_pcidda_driver = { - .driver_name = "cb_pcidda", - .module = THIS_MODULE, - .auto_attach = cb_pcidda_auto_attach, - .detach = comedi_pci_detach, + .driver_name = "cb_pcidda", + .module = THIS_MODULE, + .auto_attach = cb_pcidda_auto_attach, + .detach = comedi_pci_detach, }; static int cb_pcidda_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) { - return comedi_pci_auto_config(dev, &cb_pcidda_driver, - id->driver_data); + return comedi_pci_auto_config(dev, &cb_pcidda_driver, id->driver_data); } static const struct pci_device_id cb_pcidda_pci_table[] = { @@ -406,14 +404,16 @@ static const struct pci_device_id cb_pcidda_pci_table[] = { { PCI_VDEVICE(CB, 0x0025), BOARD_DDA08_16 }, { 0 } }; + MODULE_DEVICE_TABLE(pci, cb_pcidda_pci_table); static struct pci_driver cb_pcidda_pci_driver = { - .name = "cb_pcidda", - .id_table = cb_pcidda_pci_table, - .probe = cb_pcidda_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "cb_pcidda", + .id_table = cb_pcidda_pci_table, + .probe = cb_pcidda_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(cb_pcidda_driver, cb_pcidda_pci_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/cb_pcimdas.c b/drivers/comedi/drivers/cb_pcimdas.c index 2292f69da4f4..0b51803db34c 100644 --- a/drivers/comedi/drivers/cb_pcimdas.c +++ b/drivers/comedi/drivers/cb_pcimdas.c @@ -111,20 +111,20 @@ static const struct comedi_lrange cb_pcimdas_ai_bip_range = { 4, { - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(2.5), - BIP_RANGE(1.25) - } + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(2.5), + BIP_RANGE(1.25) + } }; static const struct comedi_lrange cb_pcimdas_ai_uni_range = { 4, { - UNI_RANGE(10), - UNI_RANGE(5), - UNI_RANGE(2.5), - UNI_RANGE(1.25) - } + UNI_RANGE(10), + UNI_RANGE(5), + UNI_RANGE(2.5), + UNI_RANGE(1.25) + } }; /* @@ -133,13 +133,13 @@ static const struct comedi_lrange cb_pcimdas_ai_uni_range = { */ static const struct comedi_lrange cb_pcimdas_ao_range = { 6, { - BIP_RANGE(10), - BIP_RANGE(5), - UNI_RANGE(10), - UNI_RANGE(5), - RANGE_ext(-1, 1), - RANGE_ext(0, 1) - } + BIP_RANGE(10), + BIP_RANGE(5), + UNI_RANGE(10), + UNI_RANGE(5), + RANGE_ext(-1, 1), + RANGE_ext(0, 1) + } }; /* @@ -156,8 +156,7 @@ struct cb_pcimdas_private { static int cb_pcimdas_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { struct cb_pcimdas_private *devpriv = dev->private; unsigned int status; @@ -170,8 +169,7 @@ static int cb_pcimdas_ai_eoc(struct comedi_device *dev, static int cb_pcimdas_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct cb_pcimdas_private *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -238,8 +236,7 @@ static int cb_pcimdas_ao_insn_write(struct comedi_device *dev, static int cb_pcimdas_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct cb_pcimdas_private *devpriv = dev->private; unsigned int val; @@ -253,8 +250,7 @@ static int cb_pcimdas_di_insn_bits(struct comedi_device *dev, static int cb_pcimdas_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct cb_pcimdas_private *devpriv = dev->private; @@ -366,8 +362,7 @@ static int cb_pcimdas_auto_attach(struct comedi_device *dev, dev->iobase = pci_resource_start(pcidev, 4); dev->pacer = comedi_8254_init(devpriv->BADR3 + PCIMDAS_8254_BASE, - cb_pcimdas_pacer_clk(dev), - I8254_IO8, 0); + cb_pcimdas_pacer_clk(dev), I8254_IO8, 0); if (!dev->pacer) return -ENOMEM; @@ -377,28 +372,28 @@ static int cb_pcimdas_auto_attach(struct comedi_device *dev, /* Analog Input subdevice */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE; if (cb_pcimdas_is_ai_se(dev)) { - s->subdev_flags |= SDF_GROUND; - s->n_chan = 16; + s->subdev_flags |= SDF_GROUND; + s->n_chan = 16; } else { - s->subdev_flags |= SDF_DIFF; - s->n_chan = 8; + s->subdev_flags |= SDF_DIFF; + s->n_chan = 8; } - s->maxdata = 0xffff; - s->range_table = cb_pcimdas_is_ai_uni(dev) ? &cb_pcimdas_ai_uni_range - : &cb_pcimdas_ai_bip_range; - s->insn_read = cb_pcimdas_ai_insn_read; + s->maxdata = 0xffff; + s->range_table = cb_pcimdas_is_ai_uni(dev) ? &cb_pcimdas_ai_uni_range + : &cb_pcimdas_ai_bip_range; + s->insn_read = cb_pcimdas_ai_insn_read; /* Analog Output subdevice */ s = &dev->subdevices[1]; - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 2; - s->maxdata = 0xfff; - s->range_table = &cb_pcimdas_ao_range; - s->insn_write = cb_pcimdas_ao_insn_write; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 2; + s->maxdata = 0xfff; + s->range_table = &cb_pcimdas_ao_range; + s->insn_write = cb_pcimdas_ao_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) @@ -412,21 +407,21 @@ static int cb_pcimdas_auto_attach(struct comedi_device *dev, /* Digital Input subdevice (main connector) */ s = &dev->subdevices[3]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 4; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = cb_pcimdas_di_insn_bits; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 4; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = cb_pcimdas_di_insn_bits; /* Digital Output subdevice (main connector) */ s = &dev->subdevices[4]; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 4; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = cb_pcimdas_do_insn_bits; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 4; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = cb_pcimdas_do_insn_bits; /* Counter subdevice (8254) */ s = &dev->subdevices[5]; @@ -442,17 +437,16 @@ static int cb_pcimdas_auto_attach(struct comedi_device *dev, } static struct comedi_driver cb_pcimdas_driver = { - .driver_name = "cb_pcimdas", - .module = THIS_MODULE, - .auto_attach = cb_pcimdas_auto_attach, - .detach = comedi_pci_detach, + .driver_name = "cb_pcimdas", + .module = THIS_MODULE, + .auto_attach = cb_pcimdas_auto_attach, + .detach = comedi_pci_detach, }; static int cb_pcimdas_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) { - return comedi_pci_auto_config(dev, &cb_pcimdas_driver, - id->driver_data); + return comedi_pci_auto_config(dev, &cb_pcimdas_driver, id->driver_data); } static const struct pci_device_id cb_pcimdas_pci_table[] = { @@ -460,14 +454,16 @@ static const struct pci_device_id cb_pcimdas_pci_table[] = { { PCI_DEVICE(PCI_VENDOR_ID_CB, 0x0115) }, /* PCIe-DAS1602/16 */ { 0 } }; + MODULE_DEVICE_TABLE(pci, cb_pcimdas_pci_table); static struct pci_driver cb_pcimdas_pci_driver = { - .name = "cb_pcimdas", - .id_table = cb_pcimdas_pci_table, - .probe = cb_pcimdas_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "cb_pcimdas", + .id_table = cb_pcimdas_pci_table, + .probe = cb_pcimdas_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(cb_pcimdas_driver, cb_pcimdas_pci_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/cb_pcimdda.c b/drivers/comedi/drivers/cb_pcimdda.c index 21fc7b3c5f60..6d778d2afec5 100644 --- a/drivers/comedi/drivers/cb_pcimdda.c +++ b/drivers/comedi/drivers/cb_pcimdda.c @@ -113,8 +113,7 @@ static int cb_pcimdda_ao_insn_write(struct comedi_device *dev, static int cb_pcimdda_ao_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); @@ -142,13 +141,13 @@ static int cb_pcimdda_auto_attach(struct comedi_device *dev, s = &dev->subdevices[0]; /* analog output subdevice */ - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE | SDF_READABLE; - s->n_chan = 6; - s->maxdata = 0xffff; - s->range_table = &range_bipolar5; - s->insn_write = cb_pcimdda_ao_insn_write; - s->insn_read = cb_pcimdda_ao_insn_read; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE | SDF_READABLE; + s->n_chan = 6; + s->maxdata = 0xffff; + s->range_table = &range_bipolar5; + s->insn_write = cb_pcimdda_ao_insn_write; + s->insn_read = cb_pcimdda_ao_insn_read; ret = comedi_alloc_subdev_readback(s); if (ret) @@ -160,33 +159,35 @@ static int cb_pcimdda_auto_attach(struct comedi_device *dev, } static struct comedi_driver cb_pcimdda_driver = { - .driver_name = "cb_pcimdda", - .module = THIS_MODULE, - .auto_attach = cb_pcimdda_auto_attach, - .detach = comedi_pci_detach, + .driver_name = "cb_pcimdda", + .module = THIS_MODULE, + .auto_attach = cb_pcimdda_auto_attach, + .detach = comedi_pci_detach, }; static int cb_pcimdda_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) { - return comedi_pci_auto_config(dev, &cb_pcimdda_driver, - id->driver_data); + return comedi_pci_auto_config(dev, &cb_pcimdda_driver, id->driver_data); } static const struct pci_device_id cb_pcimdda_pci_table[] = { { PCI_DEVICE(PCI_VENDOR_ID_CB, PCI_ID_PCIM_DDA06_16) }, { 0 } }; + MODULE_DEVICE_TABLE(pci, cb_pcimdda_pci_table); static struct pci_driver cb_pcimdda_driver_pci_driver = { - .name = "cb_pcimdda", - .id_table = cb_pcimdda_pci_table, - .probe = cb_pcimdda_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "cb_pcimdda", + .id_table = cb_pcimdda_pci_table, + .probe = cb_pcimdda_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(cb_pcimdda_driver, cb_pcimdda_driver_pci_driver); MODULE_AUTHOR("Calin A. Culianu <calin@xxxxxxxxx>"); -MODULE_DESCRIPTION("Comedi low-level driver for the Computerboards PCIM-DDA series. Currently only supports PCIM-DDA06-16 (which also happens to be the only board in this series. :) ) "); +MODULE_DESCRIPTION + ("Comedi low-level driver for the Computerboards PCIM-DDA series. Currently only supports PCIM-DDA06-16 (which also happens to be the only board in this series. :) ) "); MODULE_LICENSE("GPL"); diff --git a/drivers/comedi/drivers/comedi_8254.c b/drivers/comedi/drivers/comedi_8254.c index 4bf5daa9e885..b987242c38fd 100644 --- a/drivers/comedi/drivers/comedi_8254.c +++ b/drivers/comedi/drivers/comedi_8254.c @@ -195,6 +195,7 @@ unsigned int comedi_8254_status(struct comedi_8254 *i8254, unsigned int counter) return __i8254_read(i8254, counter); } + EXPORT_SYMBOL_GPL(comedi_8254_status); /** @@ -219,6 +220,7 @@ unsigned int comedi_8254_read(struct comedi_8254 *i8254, unsigned int counter) return val; } + EXPORT_SYMBOL_GPL(comedi_8254_read); /** @@ -243,6 +245,7 @@ void comedi_8254_write(struct comedi_8254 *i8254, byte = (val >> 8) & 0xff; __i8254_write(i8254, byte, counter); } + EXPORT_SYMBOL_GPL(comedi_8254_write); /** @@ -262,12 +265,13 @@ int comedi_8254_set_mode(struct comedi_8254 *i8254, unsigned int counter, return -EINVAL; byte = I8254_CTRL_SEL_CTR(counter) | /* select counter */ - I8254_CTRL_LSB_MSB | /* load LSB then MSB */ - mode; /* mode and BCD|binary */ + I8254_CTRL_LSB_MSB | /* load LSB then MSB */ + mode; /* mode and BCD|binary */ __i8254_write(i8254, byte, I8254_CTRL_REG); return 0; } + EXPORT_SYMBOL_GPL(comedi_8254_set_mode); /** @@ -292,6 +296,7 @@ int comedi_8254_load(struct comedi_8254 *i8254, unsigned int counter, return 0; } + EXPORT_SYMBOL_GPL(comedi_8254_load); /** @@ -303,8 +308,7 @@ EXPORT_SYMBOL_GPL(comedi_8254_load); */ void comedi_8254_pacer_enable(struct comedi_8254 *i8254, unsigned int counter1, - unsigned int counter2, - bool enable) + unsigned int counter2, bool enable) { unsigned int mode; @@ -329,6 +333,7 @@ void comedi_8254_pacer_enable(struct comedi_8254 *i8254, comedi_8254_write(i8254, counter1, i8254->divisor1); } } + EXPORT_SYMBOL_GPL(comedi_8254_pacer_enable); /** @@ -342,6 +347,7 @@ void comedi_8254_update_divisors(struct comedi_8254 *i8254) i8254->divisor1 = i8254->next_div1 & 0xffff; i8254->divisor2 = i8254->next_div2 & 0xffff; } + EXPORT_SYMBOL_GPL(comedi_8254_update_divisors); /** @@ -351,8 +357,7 @@ EXPORT_SYMBOL_GPL(comedi_8254_update_divisors); * @flags: comedi_cmd flags */ void comedi_8254_cascade_ns_to_timer(struct comedi_8254 *i8254, - unsigned int *nanosec, - unsigned int flags) + unsigned int *nanosec, unsigned int flags) { unsigned int d1 = i8254->next_div1 ? i8254->next_div1 : I8254_MAX_COUNT; unsigned int d2 = i8254->next_div2 ? i8254->next_div2 : I8254_MAX_COUNT; @@ -427,6 +432,7 @@ void comedi_8254_cascade_ns_to_timer(struct comedi_8254 *i8254, i8254->next_div1 = d1; i8254->next_div2 = d2; } + EXPORT_SYMBOL_GPL(comedi_8254_cascade_ns_to_timer); /** @@ -460,6 +466,7 @@ void comedi_8254_ns_to_timer(struct comedi_8254 *i8254, *nanosec = divisor * i8254->osc_base; i8254->next_div = divisor; } + EXPORT_SYMBOL_GPL(comedi_8254_ns_to_timer); /** @@ -474,12 +481,12 @@ void comedi_8254_set_busy(struct comedi_8254 *i8254, if (counter < 3) i8254->busy[counter] = busy; } + EXPORT_SYMBOL_GPL(comedi_8254_set_busy); static int comedi_8254_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct comedi_8254 *i8254 = s->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -496,8 +503,7 @@ static int comedi_8254_insn_read(struct comedi_device *dev, static int comedi_8254_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct comedi_8254 *i8254 = s->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -513,8 +519,7 @@ static int comedi_8254_insn_write(struct comedi_device *dev, static int comedi_8254_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct comedi_8254 *i8254 = s->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -560,21 +565,22 @@ static int comedi_8254_insn_config(struct comedi_device *dev, void comedi_8254_subdevice_init(struct comedi_subdevice *s, struct comedi_8254 *i8254) { - s->type = COMEDI_SUBD_COUNTER; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 3; - s->maxdata = 0xffff; - s->range_table = &range_unknown; - s->insn_read = comedi_8254_insn_read; - s->insn_write = comedi_8254_insn_write; - s->insn_config = comedi_8254_insn_config; - - s->private = i8254; + s->type = COMEDI_SUBD_COUNTER; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 3; + s->maxdata = 0xffff; + s->range_table = &range_unknown; + s->insn_read = comedi_8254_insn_read; + s->insn_write = comedi_8254_insn_write; + s->insn_config = comedi_8254_insn_config; + + s->private = i8254; } + EXPORT_SYMBOL_GPL(comedi_8254_subdevice_init); static struct comedi_8254 *__i8254_init(unsigned long iobase, - void __iomem *mmio, + void __iomem *mmio, unsigned int osc_base, unsigned int iosize, unsigned int regshift) @@ -591,13 +597,13 @@ static struct comedi_8254 *__i8254_init(unsigned long iobase, if (!i8254) return NULL; - i8254->iobase = iobase; - i8254->mmio = mmio; - i8254->iosize = iosize; - i8254->regshift = regshift; + i8254->iobase = iobase; + i8254->mmio = mmio; + i8254->iosize = iosize; + i8254->regshift = regshift; /* default osc_base to the max speed of a generic 8254 timer */ - i8254->osc_base = osc_base ? osc_base : I8254_OSC_BASE_10MHZ; + i8254->osc_base = osc_base ? osc_base : I8254_OSC_BASE_10MHZ; /* reset all the counters by setting them to I8254_MODE0 */ for (i = 0; i < 3; i++) @@ -616,11 +622,11 @@ static struct comedi_8254 *__i8254_init(unsigned long iobase, */ struct comedi_8254 *comedi_8254_init(unsigned long iobase, unsigned int osc_base, - unsigned int iosize, - unsigned int regshift) + unsigned int iosize, unsigned int regshift) { return __i8254_init(iobase, NULL, osc_base, iosize, regshift); } + EXPORT_SYMBOL_GPL(comedi_8254_init); /** @@ -631,24 +637,27 @@ EXPORT_SYMBOL_GPL(comedi_8254_init); * @iosize: I/O register size * @regshift: register gap shift */ -struct comedi_8254 *comedi_8254_mm_init(void __iomem *mmio, +struct comedi_8254 *comedi_8254_mm_init(void __iomem *mmio, unsigned int osc_base, unsigned int iosize, unsigned int regshift) { return __i8254_init(0, mmio, osc_base, iosize, regshift); } + EXPORT_SYMBOL_GPL(comedi_8254_mm_init); static int __init comedi_8254_module_init(void) { return 0; } + module_init(comedi_8254_module_init); static void __exit comedi_8254_module_exit(void) { } + module_exit(comedi_8254_module_exit); MODULE_AUTHOR("H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>"); diff --git a/drivers/comedi/drivers/comedi_8254.h b/drivers/comedi/drivers/comedi_8254.h index d8264417e53c..88ca3e7474a9 100644 --- a/drivers/comedi/drivers/comedi_8254.h +++ b/drivers/comedi/drivers/comedi_8254.h @@ -91,9 +91,9 @@ struct comedi_8254 { unsigned int gate_src[3]; bool busy[3]; - int (*insn_config)(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data); + int (*insn_config)(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data); }; unsigned int comedi_8254_status(struct comedi_8254 *i8254, @@ -126,9 +126,9 @@ struct comedi_8254 *comedi_8254_init(unsigned long iobase, unsigned int osc_base, unsigned int iosize, unsigned int regshift); -struct comedi_8254 *comedi_8254_mm_init(void __iomem *mmio, +struct comedi_8254 *comedi_8254_mm_init(void __iomem *mmio, unsigned int osc_base, unsigned int iosize, unsigned int regshift); -#endif /* _COMEDI_8254_H */ +#endif /* _COMEDI_8254_H */ diff --git a/drivers/comedi/drivers/comedi_8255.c b/drivers/comedi/drivers/comedi_8255.c index b7ca465933ee..1a70b2627724 100644 --- a/drivers/comedi/drivers/comedi_8255.c +++ b/drivers/comedi/drivers/comedi_8255.c @@ -35,7 +35,7 @@ struct subdev_8255_private { unsigned long regbase; - int (*io)(struct comedi_device *dev, int dir, int port, int data, + int (*io)(struct comedi_device *dev, int dir, int port, int data, unsigned long regbase); }; @@ -61,8 +61,7 @@ static int subdev_8255_mmio(struct comedi_device *dev, static int subdev_8255_insn(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct subdev_8255_private *spriv = s->private; unsigned long regbase = spriv->regbase; @@ -114,8 +113,7 @@ static void subdev_8255_do_config(struct comedi_device *dev, static int subdev_8255_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int mask; @@ -141,11 +139,10 @@ static int subdev_8255_insn_config(struct comedi_device *dev, static int __subdev_8255_init(struct comedi_device *dev, struct comedi_subdevice *s, - int (*io)(struct comedi_device *dev, + int (*io)(struct comedi_device *dev, int dir, int port, int data, unsigned long regbase), - unsigned long regbase, - bool is_mmio) + unsigned long regbase, bool is_mmio) { struct subdev_8255_private *spriv; @@ -159,15 +156,15 @@ static int __subdev_8255_init(struct comedi_device *dev, spriv->io = subdev_8255_mmio; else spriv->io = subdev_8255_io; - spriv->regbase = regbase; + spriv->regbase = regbase; - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 24; - s->range_table = &range_digital; - s->maxdata = 1; - s->insn_bits = subdev_8255_insn; - s->insn_config = subdev_8255_insn_config; + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 24; + s->range_table = &range_digital; + s->maxdata = 1; + s->insn_bits = subdev_8255_insn; + s->insn_config = subdev_8255_insn_config; subdev_8255_do_config(dev, s); @@ -201,12 +198,13 @@ static int __subdev_8255_init(struct comedi_device *dev, * Return: -ENOMEM if failed to allocate memory, zero on success. */ int subdev_8255_init(struct comedi_device *dev, struct comedi_subdevice *s, - int (*io)(struct comedi_device *dev, int dir, int port, + int (*io)(struct comedi_device *dev, int dir, int port, int data, unsigned long regbase), unsigned long regbase) { return __subdev_8255_init(dev, s, io, regbase, false); } + EXPORT_SYMBOL_GPL(subdev_8255_init); /** @@ -236,12 +234,13 @@ EXPORT_SYMBOL_GPL(subdev_8255_init); * Return: -ENOMEM if failed to allocate memory, zero on success. */ int subdev_8255_mm_init(struct comedi_device *dev, struct comedi_subdevice *s, - int (*io)(struct comedi_device *dev, int dir, int port, + int (*io)(struct comedi_device *dev, int dir, int port, int data, unsigned long regbase), unsigned long regbase) { return __subdev_8255_init(dev, s, io, regbase, true); } + EXPORT_SYMBOL_GPL(subdev_8255_mm_init); /** @@ -258,17 +257,20 @@ unsigned long subdev_8255_regbase(struct comedi_subdevice *s) return spriv->regbase; } + EXPORT_SYMBOL_GPL(subdev_8255_regbase); static int __init comedi_8255_module_init(void) { return 0; } + module_init(comedi_8255_module_init); static void __exit comedi_8255_module_exit(void) { } + module_exit(comedi_8255_module_exit); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/comedi_bond.c b/drivers/comedi/drivers/comedi_bond.c index 4392b5927a99..44a4bf9e9316 100644 --- a/drivers/comedi/drivers/comedi_bond.c +++ b/drivers/comedi/drivers/comedi_bond.c @@ -93,7 +93,7 @@ static int bonding_dio_insn_bits(struct comedi_device *dev, if (b_chans > n_left) b_chans = n_left; b_mask = (b_chans < 32) ? ((1 << b_chans) - 1) - : 0xffffffff; + : 0xffffffff; b_write_mask = (write_mask >> n_done) & b_mask; b_data_bits = (data_bits >> n_done) & b_mask; /* Read/Write the new digital lines. */ @@ -335,13 +335,15 @@ static void bonding_detach(struct comedi_device *dev) } static struct comedi_driver bonding_driver = { - .driver_name = "comedi_bond", - .module = THIS_MODULE, - .attach = bonding_attach, - .detach = bonding_detach, + .driver_name = "comedi_bond", + .module = THIS_MODULE, + .attach = bonding_attach, + .detach = bonding_detach, }; + module_comedi_driver(bonding_driver); MODULE_AUTHOR("Calin A. Culianu"); -MODULE_DESCRIPTION("comedi_bond: A driver for COMEDI to bond multiple COMEDI devices together as one."); +MODULE_DESCRIPTION + ("comedi_bond: A driver for COMEDI to bond multiple COMEDI devices together as one."); MODULE_LICENSE("GPL"); diff --git a/drivers/comedi/drivers/comedi_isadma.c b/drivers/comedi/drivers/comedi_isadma.c index 479b58e209ba..7c6afd299b06 100644 --- a/drivers/comedi/drivers/comedi_isadma.c +++ b/drivers/comedi/drivers/comedi_isadma.c @@ -30,6 +30,7 @@ void comedi_isadma_program(struct comedi_isadma_desc *desc) enable_dma(desc->chan); release_dma_lock(flags); } + EXPORT_SYMBOL_GPL(comedi_isadma_program); /** @@ -50,6 +51,7 @@ unsigned int comedi_isadma_disable(unsigned int dma_chan) return residue; } + EXPORT_SYMBOL_GPL(comedi_isadma_disable); /** @@ -89,6 +91,7 @@ unsigned int comedi_isadma_disable_on_sample(unsigned int dma_chan, } return residue; } + EXPORT_SYMBOL_GPL(comedi_isadma_disable_on_sample); /** @@ -125,6 +128,7 @@ unsigned int comedi_isadma_poll(struct comedi_isadma *dma) return 0; return desc->size - result; } + EXPORT_SYMBOL_GPL(comedi_isadma_poll); /** @@ -135,8 +139,9 @@ EXPORT_SYMBOL_GPL(comedi_isadma_poll); void comedi_isadma_set_mode(struct comedi_isadma_desc *desc, char dma_dir) { desc->mode = (dma_dir == COMEDI_ISADMA_READ) ? DMA_MODE_READ - : DMA_MODE_WRITE; + : DMA_MODE_WRITE; } + EXPORT_SYMBOL_GPL(comedi_isadma_set_mode); /** @@ -219,6 +224,7 @@ struct comedi_isadma *comedi_isadma_alloc(struct comedi_device *dev, comedi_isadma_free(dma); return NULL; } + EXPORT_SYMBOL_GPL(comedi_isadma_alloc); /** @@ -249,17 +255,20 @@ void comedi_isadma_free(struct comedi_isadma *dma) free_dma(dma->chan); kfree(dma); } + EXPORT_SYMBOL_GPL(comedi_isadma_free); static int __init comedi_isadma_init(void) { return 0; } + module_init(comedi_isadma_init); static void __exit comedi_isadma_exit(void) { } + module_exit(comedi_isadma_exit); MODULE_AUTHOR("H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>"); diff --git a/drivers/comedi/drivers/comedi_isadma.h b/drivers/comedi/drivers/comedi_isadma.h index 9d2b12db7e6e..cbdc686b6d36 100644 --- a/drivers/comedi/drivers/comedi_isadma.h +++ b/drivers/comedi/drivers/comedi_isadma.h @@ -70,7 +70,7 @@ struct comedi_isadma *comedi_isadma_alloc(struct comedi_device *dev, unsigned int maxsize, char dma_dir); void comedi_isadma_free(struct comedi_isadma *dma); -#else /* !IS_ENABLED(CONFIG_ISA_DMA_API) */ +#else /* !IS_ENABLED(CONFIG_ISA_DMA_API) */ static inline void comedi_isadma_program(struct comedi_isadma_desc *desc) { @@ -97,10 +97,12 @@ static inline void comedi_isadma_set_mode(struct comedi_isadma_desc *desc, { } -static inline struct comedi_isadma * -comedi_isadma_alloc(struct comedi_device *dev, int n_desc, - unsigned int dma_chan1, unsigned int dma_chan2, - unsigned int maxsize, char dma_dir) +static inline struct comedi_isadma *comedi_isadma_alloc(struct comedi_device + *dev, int n_desc, + unsigned int dma_chan1, + unsigned int dma_chan2, + unsigned int maxsize, + char dma_dir) { return NULL; } @@ -109,6 +111,6 @@ static inline void comedi_isadma_free(struct comedi_isadma *dma) { } -#endif /* !IS_ENABLED(CONFIG_ISA_DMA_API) */ +#endif /* !IS_ENABLED(CONFIG_ISA_DMA_API) */ -#endif /* #ifndef _COMEDI_ISADMA_H */ +#endif /* #ifndef _COMEDI_ISADMA_H */ diff --git a/drivers/comedi/drivers/comedi_parport.c b/drivers/comedi/drivers/comedi_parport.c index 5338b5eea440..09b610a66564 100644 --- a/drivers/comedi/drivers/comedi_parport.c +++ b/drivers/comedi/drivers/comedi_parport.c @@ -135,8 +135,7 @@ static int parport_ctrl_reg_insn_bits(struct comedi_device *dev, static int parport_intr_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { data[1] = 0; return insn->n; @@ -245,46 +244,46 @@ static int parport_attach(struct comedi_device *dev, /* Digial I/O subdevice - Parallel port DATA register */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 8; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = parport_data_reg_insn_bits; - s->insn_config = parport_data_reg_insn_config; + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 8; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = parport_data_reg_insn_bits; + s->insn_config = parport_data_reg_insn_config; /* Digial Input subdevice - Parallel port STATUS register */ s = &dev->subdevices[1]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 5; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = parport_status_reg_insn_bits; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 5; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = parport_status_reg_insn_bits; /* Digial Output subdevice - Parallel port CONTROL register */ s = &dev->subdevices[2]; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 4; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = parport_ctrl_reg_insn_bits; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 4; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = parport_ctrl_reg_insn_bits; if (dev->irq) { /* Digial Input subdevice - Interrupt support */ s = &dev->subdevices[3]; dev->read_subdev = s; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE | SDF_CMD_READ; - s->n_chan = 1; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = parport_intr_insn_bits; - s->len_chanlist = 1; - s->do_cmdtest = parport_intr_cmdtest; - s->do_cmd = parport_intr_cmd; - s->cancel = parport_intr_cancel; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE | SDF_CMD_READ; + s->n_chan = 1; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = parport_intr_insn_bits; + s->len_chanlist = 1; + s->do_cmdtest = parport_intr_cmdtest; + s->do_cmd = parport_intr_cmd; + s->cancel = parport_intr_cancel; } outb(0, dev->iobase + PARPORT_DATA_REG); @@ -294,11 +293,12 @@ static int parport_attach(struct comedi_device *dev, } static struct comedi_driver parport_driver = { - .driver_name = "comedi_parport", - .module = THIS_MODULE, - .attach = parport_attach, - .detach = comedi_legacy_detach, + .driver_name = "comedi_parport", + .module = THIS_MODULE, + .attach = parport_attach, + .detach = comedi_legacy_detach, }; + module_comedi_driver(parport_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/comedi_test.c b/drivers/comedi/drivers/comedi_test.c index cbc225eb1991..83379ee98bc6 100644 --- a/drivers/comedi/drivers/comedi_test.c +++ b/drivers/comedi/drivers/comedi_test.c @@ -66,26 +66,29 @@ static struct class *ctcls; static struct device *ctdev; module_param_named(noauto, config_mode, bool, 0444); -MODULE_PARM_DESC(noauto, "Disable auto-configuration: (1=disable [defaults to enable])"); +MODULE_PARM_DESC(noauto, + "Disable auto-configuration: (1=disable [defaults to enable])"); module_param_named(amplitude, set_amplitude, uint, 0444); -MODULE_PARM_DESC(amplitude, "Set auto mode wave amplitude in microvolts: (defaults to 1 volt)"); +MODULE_PARM_DESC(amplitude, + "Set auto mode wave amplitude in microvolts: (defaults to 1 volt)"); module_param_named(period, set_period, uint, 0444); -MODULE_PARM_DESC(period, "Set auto mode wave period in microseconds: (defaults to 0.1 sec)"); +MODULE_PARM_DESC(period, + "Set auto mode wave period in microseconds: (defaults to 0.1 sec)"); /* Data unique to this driver */ struct waveform_private { struct timer_list ai_timer; /* timer for AI commands */ - u64 ai_convert_time; /* time of next AI conversion in usec */ + u64 ai_convert_time; /* time of next AI conversion in usec */ unsigned int wf_amplitude; /* waveform amplitude in microvolts */ - unsigned int wf_period; /* waveform period in microseconds */ + unsigned int wf_period; /* waveform period in microseconds */ unsigned int wf_current; /* current time in waveform period */ unsigned int ai_scan_period; /* AI scan period in usec */ unsigned int ai_convert_period; /* AI conversion period in usec */ struct timer_list ao_timer; /* timer for AO commands */ struct comedi_device *dev; /* parent comedi device */ - u64 ao_last_scan_time; /* time of previous AO scan in usec */ + u64 ao_last_scan_time; /* time of previous AO scan in usec */ unsigned int ao_scan_period; /* AO scan period in usec */ unsigned short ao_loopbacks[N_CHANS]; }; @@ -93,9 +96,9 @@ struct waveform_private { /* fake analog input ranges */ static const struct comedi_lrange waveform_ai_ranges = { 2, { - BIP_RANGE(10), - BIP_RANGE(5) - } + BIP_RANGE(10), + BIP_RANGE(5) + } }; static unsigned short fake_sawtooth(struct comedi_device *dev, @@ -120,7 +123,7 @@ static unsigned short fake_sawtooth(struct comedi_device *dev, value += offset; /* get rid of sawtooth's dc offset and clamp value */ if (value < binary_amplitude) { - value = 0; /* negative saturation */ + value = 0; /* negative saturation */ } else { value -= binary_amplitude; if (value > s->maxdata) @@ -148,7 +151,7 @@ static unsigned short fake_squarewave(struct comedi_device *dev, /* get one of two values for square-wave and clamp */ if (current_time < devpriv->wf_period / 2) { if (offset < value) - value = 0; /* negative saturation */ + value = 0; /* negative saturation */ else value = offset - value; } else { @@ -219,8 +222,7 @@ static void waveform_ai_timer(struct timer_list *t) if (async->scan_progress == 0) { /* done last conversion in scan, so add dead time */ time_increment += devpriv->ai_scan_period - - devpriv->ai_convert_period * - cmd->scan_end_arg; + devpriv->ai_convert_period * cmd->scan_end_arg; } devpriv->wf_current += time_increment; if (devpriv->wf_current >= devpriv->wf_period) @@ -272,7 +274,7 @@ static int waveform_ai_cmdtest(struct comedi_device *dev, /* Step 2b : and mutually compatible */ if (cmd->scan_begin_src == TRIG_FOLLOW && cmd->convert_src == TRIG_NOW) - err |= -EINVAL; /* scan period would be 0 */ + err |= -EINVAL; /* scan period would be 0 */ if (err) return 2; @@ -283,7 +285,7 @@ static int waveform_ai_cmdtest(struct comedi_device *dev, if (cmd->convert_src == TRIG_NOW) { err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); - } else { /* cmd->convert_src == TRIG_TIMER */ + } else { /* cmd->convert_src == TRIG_TIMER */ if (cmd->scan_begin_src == TRIG_FOLLOW) { err |= comedi_check_trigger_arg_min(&cmd->convert_arg, NSEC_PER_USEC); @@ -292,7 +294,7 @@ static int waveform_ai_cmdtest(struct comedi_device *dev, if (cmd->scan_begin_src == TRIG_FOLLOW) { err |= comedi_check_trigger_arg_is(&cmd->scan_begin_arg, 0); - } else { /* cmd->scan_begin_src == TRIG_TIMER */ + } else { /* cmd->scan_begin_src == TRIG_TIMER */ err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, NSEC_PER_USEC); } @@ -303,7 +305,7 @@ static int waveform_ai_cmdtest(struct comedi_device *dev, if (cmd->stop_src == TRIG_COUNT) err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); - else /* cmd->stop_src == TRIG_NONE */ + else /* cmd->stop_src == TRIG_NONE */ err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) @@ -361,13 +363,13 @@ static int waveform_ai_cmd(struct comedi_device *dev, if (cmd->convert_src == TRIG_NOW) devpriv->ai_convert_period = 0; - else /* cmd->convert_src == TRIG_TIMER */ + else /* cmd->convert_src == TRIG_TIMER */ devpriv->ai_convert_period = cmd->convert_arg / NSEC_PER_USEC; if (cmd->scan_begin_src == TRIG_FOLLOW) { devpriv->ai_scan_period = devpriv->ai_convert_period * - cmd->scan_end_arg; - } else { /* cmd->scan_begin_src == TRIG_TIMER */ + cmd->scan_end_arg; + } else { /* cmd->scan_begin_src == TRIG_TIMER */ devpriv->ai_scan_period = cmd->scan_begin_arg / NSEC_PER_USEC; } @@ -382,7 +384,7 @@ static int waveform_ai_cmd(struct comedi_device *dev, if (cmd->scan_begin_src == TRIG_TIMER) first_convert_time += devpriv->ai_scan_period; devpriv->ai_convert_time = ktime_to_us(ktime_get()) + - first_convert_time; + first_convert_time; /* Determine time within waveform period at time of conversion. */ wf_current = devpriv->ai_convert_time; @@ -394,7 +396,7 @@ static int waveform_ai_cmd(struct comedi_device *dev, * early! */ devpriv->ai_timer.expires = - jiffies + usecs_to_jiffies(devpriv->ai_convert_period) + 1; + jiffies + usecs_to_jiffies(devpriv->ai_convert_period) + 1; add_timer(&devpriv->ai_timer); return 0; } @@ -458,8 +460,9 @@ static void waveform_ao_timer(struct timer_list *t) unsigned int skip_bytes, nbytes; skip_bytes = - comedi_samples_to_bytes(s, cmd->scan_end_arg * - (scans_avail - 1)); + comedi_samples_to_bytes(s, + cmd->scan_end_arg * + (scans_avail - 1)); nbytes = comedi_buf_read_alloc(s, skip_bytes); comedi_buf_read_free(s, nbytes); comedi_inc_scan_progress(s, nbytes); @@ -484,7 +487,7 @@ static void waveform_ao_timer(struct timer_list *t) } /* advance time of last scan */ devpriv->ao_last_scan_time += - (u64)scans_avail * devpriv->ao_scan_period; + (u64) scans_avail * devpriv->ao_scan_period; } } if (cmd->stop_src == TRIG_COUNT && async->scans_done >= cmd->stop_arg) { @@ -493,7 +496,7 @@ static void waveform_ao_timer(struct timer_list *t) async->events |= COMEDI_CB_OVERFLOW; } else { unsigned int time_inc = devpriv->ao_last_scan_time + - devpriv->ao_scan_period - now; + devpriv->ao_scan_period - now; mod_timer(&devpriv->ao_timer, jiffies + usecs_to_jiffies(time_inc)); @@ -518,7 +521,7 @@ static int waveform_ao_inttrig_start(struct comedi_device *dev, devpriv->ao_last_scan_time = ktime_to_us(ktime_get()); devpriv->ao_timer.expires = - jiffies + usecs_to_jiffies(devpriv->ao_scan_period); + jiffies + usecs_to_jiffies(devpriv->ao_scan_period); add_timer(&devpriv->ao_timer); return 1; @@ -561,7 +564,7 @@ static int waveform_ao_cmdtest(struct comedi_device *dev, cmd->chanlist_len); if (cmd->stop_src == TRIG_COUNT) err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); - else /* cmd->stop_src == TRIG_NONE */ + else /* cmd->stop_src == TRIG_NONE */ err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) @@ -628,8 +631,7 @@ static int waveform_ao_insn_write(struct comedi_device *dev, static int waveform_ai_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { if (data[0] == INSN_CONFIG_GET_CMD_TIMING_CONSTRAINTS) { /* @@ -655,13 +657,12 @@ static int waveform_ai_insn_config(struct comedi_device *dev, static int waveform_ao_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { if (data[0] == INSN_CONFIG_GET_CMD_TIMING_CONSTRAINTS) { /* we don't care about actual channels */ - data[1] = NSEC_PER_USEC; /* scan_begin_min */ - data[2] = 0; /* convert_min */ + data[1] = NSEC_PER_USEC; /* scan_begin_min */ + data[2] = 0; /* convert_min */ return 0; } @@ -728,8 +729,7 @@ static int waveform_common_attach(struct comedi_device *dev, dev_info(dev->class_dev, "%s: %u microvolt, %u microsecond waveform attached\n", - dev->board_name, - devpriv->wf_amplitude, devpriv->wf_period); + dev->board_name, devpriv->wf_amplitude, devpriv->wf_period); return 0; } @@ -775,11 +775,11 @@ static void waveform_detach(struct comedi_device *dev) } static struct comedi_driver waveform_driver = { - .driver_name = "comedi_test", - .module = THIS_MODULE, - .attach = waveform_attach, - .auto_attach = waveform_auto_attach, - .detach = waveform_detach, + .driver_name = "comedi_test", + .module = THIS_MODULE, + .attach = waveform_attach, + .auto_attach = waveform_auto_attach, + .detach = waveform_detach, }; /* @@ -811,7 +811,8 @@ static int __init comedi_test_init(void) ret = comedi_auto_config(ctdev, &waveform_driver, 0); if (ret) { - pr_warn("comedi_test: unable to auto-configure device\n"); + pr_warn + ("comedi_test: unable to auto-configure device\n"); goto clean; } } @@ -828,6 +829,7 @@ static int __init comedi_test_init(void) return 0; } + module_init(comedi_test_init); static void __exit comedi_test_exit(void) @@ -842,6 +844,7 @@ static void __exit comedi_test_exit(void) comedi_driver_unregister(&waveform_driver); } + module_exit(comedi_test_exit); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/contec_pci_dio.c b/drivers/comedi/drivers/contec_pci_dio.c index b8fdd9c1f166..762c71c07c19 100644 --- a/drivers/comedi/drivers/contec_pci_dio.c +++ b/drivers/comedi/drivers/contec_pci_dio.c @@ -29,8 +29,7 @@ static int contec_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { if (comedi_dio_update_state(s, data)) outw(s->state, dev->iobase + PIO1616L_DO_REG); @@ -66,29 +65,29 @@ static int contec_auto_attach(struct comedi_device *dev, return ret; s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 16; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = contec_di_insn_bits; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 16; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = contec_di_insn_bits; s = &dev->subdevices[1]; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 16; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = contec_do_insn_bits; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 16; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = contec_do_insn_bits; return 0; } static struct comedi_driver contec_pci_dio_driver = { - .driver_name = "contec_pci_dio", - .module = THIS_MODULE, - .auto_attach = contec_auto_attach, - .detach = comedi_pci_detach, + .driver_name = "contec_pci_dio", + .module = THIS_MODULE, + .auto_attach = contec_auto_attach, + .detach = comedi_pci_detach, }; static int contec_pci_dio_pci_probe(struct pci_dev *dev, @@ -102,14 +101,16 @@ static const struct pci_device_id contec_pci_dio_pci_table[] = { { PCI_DEVICE(PCI_VENDOR_ID_CONTEC, 0x8172) }, { 0 } }; + MODULE_DEVICE_TABLE(pci, contec_pci_dio_pci_table); static struct pci_driver contec_pci_dio_pci_driver = { - .name = "contec_pci_dio", - .id_table = contec_pci_dio_pci_table, - .probe = contec_pci_dio_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "contec_pci_dio", + .id_table = contec_pci_dio_pci_table, + .probe = contec_pci_dio_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(contec_pci_dio_driver, contec_pci_dio_pci_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/dac02.c b/drivers/comedi/drivers/dac02.c index 5ef8114c2c85..c7086a47c219 100644 --- a/drivers/comedi/drivers/dac02.c +++ b/drivers/comedi/drivers/dac02.c @@ -50,13 +50,13 @@ */ static const struct comedi_lrange das02_ao_ranges = { 6, { - UNI_RANGE(5), - UNI_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(10), - RANGE_mA(4, 20), - RANGE_ext(0, 1) - } + UNI_RANGE(5), + UNI_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(10), + RANGE_mA(4, 20), + RANGE_ext(0, 1) + } }; /* @@ -67,8 +67,7 @@ static const struct comedi_lrange das02_ao_ranges = { static int dac02_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int range = CR_RANGE(insn->chanspec); @@ -114,22 +113,23 @@ static int dac02_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* Analog Output subdevice */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 2; - s->maxdata = 0x0fff; - s->range_table = &das02_ao_ranges; - s->insn_write = dac02_ao_insn_write; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 2; + s->maxdata = 0x0fff; + s->range_table = &das02_ao_ranges; + s->insn_write = dac02_ao_insn_write; return comedi_alloc_subdev_readback(s); } static struct comedi_driver dac02_driver = { - .driver_name = "dac02", - .module = THIS_MODULE, - .attach = dac02_attach, - .detach = comedi_legacy_detach, + .driver_name = "dac02", + .module = THIS_MODULE, + .attach = dac02_attach, + .detach = comedi_legacy_detach, }; + module_comedi_driver(dac02_driver); MODULE_AUTHOR("H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>"); diff --git a/drivers/comedi/drivers/daqboard2000.c b/drivers/comedi/drivers/daqboard2000.c index f64e747078bd..7d75b1234742 100644 --- a/drivers/comedi/drivers/daqboard2000.c +++ b/drivers/comedi/drivers/daqboard2000.c @@ -106,60 +106,60 @@ static const struct comedi_lrange db2k_ai_range = { 13, { - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(2.5), - BIP_RANGE(1.25), - BIP_RANGE(0.625), - BIP_RANGE(0.3125), - BIP_RANGE(0.156), - UNI_RANGE(10), - UNI_RANGE(5), - UNI_RANGE(2.5), - UNI_RANGE(1.25), - UNI_RANGE(0.625), - UNI_RANGE(0.3125) - } + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(2.5), + BIP_RANGE(1.25), + BIP_RANGE(0.625), + BIP_RANGE(0.3125), + BIP_RANGE(0.156), + UNI_RANGE(10), + UNI_RANGE(5), + UNI_RANGE(2.5), + UNI_RANGE(1.25), + UNI_RANGE(0.625), + UNI_RANGE(0.3125) + } }; /* * Register Memory Map */ -#define DB2K_REG_ACQ_CONTROL 0x00 /* u16 (w) */ -#define DB2K_REG_ACQ_STATUS 0x00 /* u16 (r) */ -#define DB2K_REG_ACQ_SCAN_LIST_FIFO 0x02 /* u16 */ -#define DB2K_REG_ACQ_PACER_CLOCK_DIV_LOW 0x04 /* u32 */ -#define DB2K_REG_ACQ_SCAN_COUNTER 0x08 /* u16 */ -#define DB2K_REG_ACQ_PACER_CLOCK_DIV_HIGH 0x0a /* u16 */ -#define DB2K_REG_ACQ_TRIGGER_COUNT 0x0c /* u16 */ -#define DB2K_REG_ACQ_RESULTS_FIFO 0x10 /* u16 */ -#define DB2K_REG_ACQ_RESULTS_SHADOW 0x14 /* u16 */ -#define DB2K_REG_ACQ_ADC_RESULT 0x18 /* u16 */ -#define DB2K_REG_DAC_SCAN_COUNTER 0x1c /* u16 */ -#define DB2K_REG_DAC_CONTROL 0x20 /* u16 (w) */ -#define DB2K_REG_DAC_STATUS 0x20 /* u16 (r) */ -#define DB2K_REG_DAC_FIFO 0x24 /* s16 */ -#define DB2K_REG_DAC_PACER_CLOCK_DIV 0x2a /* u16 */ -#define DB2K_REG_REF_DACS 0x2c /* u16 */ -#define DB2K_REG_DIO_CONTROL 0x30 /* u16 */ -#define DB2K_REG_P3_HSIO_DATA 0x32 /* s16 */ -#define DB2K_REG_P3_CONTROL 0x34 /* u16 */ -#define DB2K_REG_CAL_EEPROM_CONTROL 0x36 /* u16 */ -#define DB2K_REG_DAC_SETTING(x) (0x38 + (x) * 2) /* s16 */ -#define DB2K_REG_DIO_P2_EXP_IO_8_BIT 0x40 /* s16 */ -#define DB2K_REG_COUNTER_TIMER_CONTROL 0x80 /* u16 */ -#define DB2K_REG_COUNTER_INPUT(x) (0x88 + (x) * 2) /* s16 */ -#define DB2K_REG_TIMER_DIV(x) (0xa0 + (x) * 2) /* u16 */ -#define DB2K_REG_DMA_CONTROL 0xb0 /* u16 */ -#define DB2K_REG_TRIG_CONTROL 0xb2 /* u16 */ -#define DB2K_REG_CAL_EEPROM 0xb8 /* u16 */ -#define DB2K_REG_ACQ_DIGITAL_MARK 0xba /* u16 */ -#define DB2K_REG_TRIG_DACS 0xbc /* u16 */ -#define DB2K_REG_DIO_P2_EXP_IO_16_BIT(x) (0xc0 + (x) * 2) /* s16 */ +#define DB2K_REG_ACQ_CONTROL 0x00 /* u16 (w) */ +#define DB2K_REG_ACQ_STATUS 0x00 /* u16 (r) */ +#define DB2K_REG_ACQ_SCAN_LIST_FIFO 0x02 /* u16 */ +#define DB2K_REG_ACQ_PACER_CLOCK_DIV_LOW 0x04 /* u32 */ +#define DB2K_REG_ACQ_SCAN_COUNTER 0x08 /* u16 */ +#define DB2K_REG_ACQ_PACER_CLOCK_DIV_HIGH 0x0a /* u16 */ +#define DB2K_REG_ACQ_TRIGGER_COUNT 0x0c /* u16 */ +#define DB2K_REG_ACQ_RESULTS_FIFO 0x10 /* u16 */ +#define DB2K_REG_ACQ_RESULTS_SHADOW 0x14 /* u16 */ +#define DB2K_REG_ACQ_ADC_RESULT 0x18 /* u16 */ +#define DB2K_REG_DAC_SCAN_COUNTER 0x1c /* u16 */ +#define DB2K_REG_DAC_CONTROL 0x20 /* u16 (w) */ +#define DB2K_REG_DAC_STATUS 0x20 /* u16 (r) */ +#define DB2K_REG_DAC_FIFO 0x24 /* s16 */ +#define DB2K_REG_DAC_PACER_CLOCK_DIV 0x2a /* u16 */ +#define DB2K_REG_REF_DACS 0x2c /* u16 */ +#define DB2K_REG_DIO_CONTROL 0x30 /* u16 */ +#define DB2K_REG_P3_HSIO_DATA 0x32 /* s16 */ +#define DB2K_REG_P3_CONTROL 0x34 /* u16 */ +#define DB2K_REG_CAL_EEPROM_CONTROL 0x36 /* u16 */ +#define DB2K_REG_DAC_SETTING(x) (0x38 + (x) * 2) /* s16 */ +#define DB2K_REG_DIO_P2_EXP_IO_8_BIT 0x40 /* s16 */ +#define DB2K_REG_COUNTER_TIMER_CONTROL 0x80 /* u16 */ +#define DB2K_REG_COUNTER_INPUT(x) (0x88 + (x) * 2) /* s16 */ +#define DB2K_REG_TIMER_DIV(x) (0xa0 + (x) * 2) /* u16 */ +#define DB2K_REG_DMA_CONTROL 0xb0 /* u16 */ +#define DB2K_REG_TRIG_CONTROL 0xb2 /* u16 */ +#define DB2K_REG_CAL_EEPROM 0xb8 /* u16 */ +#define DB2K_REG_ACQ_DIGITAL_MARK 0xba /* u16 */ +#define DB2K_REG_TRIG_DACS 0xbc /* u16 */ +#define DB2K_REG_DIO_P2_EXP_IO_16_BIT(x) (0xc0 + (x) * 2) /* s16 */ /* CPLD registers */ -#define DB2K_REG_CPLD_STATUS 0x1000 /* u16 (r) */ -#define DB2K_REG_CPLD_WDATA 0x1000 /* u16 (w) */ +#define DB2K_REG_CPLD_STATUS 0x1000 /* u16 (r) */ +#define DB2K_REG_CPLD_WDATA 0x1000 /* u16 (w) */ /* Scan Sequencer programming */ #define DB2K_ACQ_CONTROL_SEQ_START_SCAN_LIST 0x0011 @@ -240,17 +240,17 @@ enum db2k_boardid { struct db2k_boardtype { const char *name; - unsigned int has_2_ao:1;/* false: 4 AO chans; true: 2 AO chans */ + unsigned int has_2_ao:1; /* false: 4 AO chans; true: 2 AO chans */ }; static const struct db2k_boardtype db2k_boardtypes[] = { [BOARD_DAQBOARD2000] = { - .name = "daqboard2000", - .has_2_ao = true, - }, + .name = "daqboard2000", + .has_2_ao = true, + }, [BOARD_DAQBOARD2001] = { - .name = "daqboard2001", - }, + .name = "daqboard2001", + }, }; struct db2k_private { @@ -260,8 +260,7 @@ struct db2k_private { static void db2k_write_acq_scan_list_entry(struct comedi_device *dev, u16 entry) { writew(entry & 0x00ff, dev->mmio + DB2K_REG_ACQ_SCAN_LIST_FIFO); - writew((entry >> 8) & 0x00ff, - dev->mmio + DB2K_REG_ACQ_SCAN_LIST_FIFO); + writew((entry >> 8) & 0x00ff, dev->mmio + DB2K_REG_ACQ_SCAN_LIST_FIFO); } static void db2k_setup_sampling(struct comedi_device *dev, int chan, int gain) @@ -365,8 +364,8 @@ static int db2k_ai_insn_read(struct comedi_device *dev, return ret; ret = - comedi_timeout(dev, s, insn, db2k_ai_status, - DB2K_ACQ_STATUS_RESULTS_FIFO_HAS_DATA); + comedi_timeout(dev, s, insn, db2k_ai_status, + DB2K_ACQ_STATUS_RESULTS_FIFO_HAS_DATA); if (ret) return ret; @@ -457,7 +456,7 @@ static void db2k_pulse_prog_pin(struct comedi_device *dev) mdelay(10); cntrl &= ~PLX_CNTRL_USERO; writel(cntrl, devpriv->plx + PLX_REG_CNTRL); - mdelay(10); /* Not in the original code, but I like symmetry... */ + mdelay(10); /* Not in the original code, but I like symmetry... */ } static int db2k_wait_cpld_init(struct comedi_device *dev) @@ -528,7 +527,7 @@ static int db2k_wait_fpga_programmed(struct comedi_device *dev) return -ETIMEDOUT; } -static int db2k_load_firmware(struct comedi_device *dev, const u8 *cpld_array, +static int db2k_load_firmware(struct comedi_device *dev, const u8 *cpld_array, size_t len, unsigned long context) { struct db2k_private *devpriv = dev->private; @@ -753,10 +752,10 @@ static void db2k_detach(struct comedi_device *dev) } static struct comedi_driver db2k_driver = { - .driver_name = "daqboard2000", - .module = THIS_MODULE, - .auto_attach = db2k_auto_attach, - .detach = db2k_detach, + .driver_name = "daqboard2000", + .module = THIS_MODULE, + .auto_attach = db2k_auto_attach, + .detach = db2k_detach, }; static int db2k_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) @@ -766,19 +765,21 @@ static int db2k_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) static const struct pci_device_id db2k_pci_table[] = { { PCI_DEVICE_SUB(PCI_VENDOR_ID_IOTECH, 0x0409, PCI_VENDOR_ID_IOTECH, - 0x0002), .driver_data = BOARD_DAQBOARD2000, }, + 0x0002), .driver_data = BOARD_DAQBOARD2000, }, { PCI_DEVICE_SUB(PCI_VENDOR_ID_IOTECH, 0x0409, PCI_VENDOR_ID_IOTECH, - 0x0004), .driver_data = BOARD_DAQBOARD2001, }, + 0x0004), .driver_data = BOARD_DAQBOARD2001, }, { 0 } }; + MODULE_DEVICE_TABLE(pci, db2k_pci_table); static struct pci_driver db2k_pci_driver = { - .name = "daqboard2000", - .id_table = db2k_pci_table, - .probe = db2k_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "daqboard2000", + .id_table = db2k_pci_table, + .probe = db2k_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(db2k_driver, db2k_pci_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/das08.c b/drivers/comedi/drivers/das08.c index b50743c5b822..c75f876a58e8 100644 --- a/drivers/comedi/drivers/das08.c +++ b/drivers/comedi/drivers/das08.c @@ -48,7 +48,7 @@ * the same mask. */ #define DAS08_CONTROL_MUX_MASK 0x7 /* multiplexor channel mask */ -#define DAS08_CONTROL_MUX(x) ((x) & DAS08_CONTROL_MUX_MASK) /* mux channel */ +#define DAS08_CONTROL_MUX(x) ((x) & DAS08_CONTROL_MUX_MASK) /* mux channel */ #define DAS08_CONTROL_INTE BIT(3) /* interrupt enable (not "JR" boards) */ #define DAS08_CONTROL_DO_MASK 0xf0 /* digital outputs mask (not "JR") */ /* digital outputs (not "JR" boards) */ @@ -87,55 +87,55 @@ static const struct comedi_lrange das08_pgl_ai_range = { 9, { - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(2.5), - BIP_RANGE(1.25), - BIP_RANGE(0.625), - UNI_RANGE(10), - UNI_RANGE(5), - UNI_RANGE(2.5), - UNI_RANGE(1.25) - } + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(2.5), + BIP_RANGE(1.25), + BIP_RANGE(0.625), + UNI_RANGE(10), + UNI_RANGE(5), + UNI_RANGE(2.5), + UNI_RANGE(1.25) + } }; static const struct comedi_lrange das08_pgh_ai_range = { 12, { - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(1), - BIP_RANGE(0.5), - BIP_RANGE(0.1), - BIP_RANGE(0.05), - BIP_RANGE(0.01), - BIP_RANGE(0.005), - UNI_RANGE(10), - UNI_RANGE(1), - UNI_RANGE(0.1), - UNI_RANGE(0.01) - } + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(1), + BIP_RANGE(0.5), + BIP_RANGE(0.1), + BIP_RANGE(0.05), + BIP_RANGE(0.01), + BIP_RANGE(0.005), + UNI_RANGE(10), + UNI_RANGE(1), + UNI_RANGE(0.1), + UNI_RANGE(0.01) + } }; static const struct comedi_lrange das08_pgm_ai_range = { 9, { - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(0.5), - BIP_RANGE(0.05), - BIP_RANGE(0.01), - UNI_RANGE(10), - UNI_RANGE(1), - UNI_RANGE(0.1), - UNI_RANGE(0.01) - } + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(0.5), + BIP_RANGE(0.05), + BIP_RANGE(0.01), + UNI_RANGE(10), + UNI_RANGE(1), + UNI_RANGE(0.1), + UNI_RANGE(0.01) + } }; static const struct comedi_lrange *const das08_ai_lranges[] = { - [das08_pg_none] = &range_unknown, - [das08_bipolar5] = &range_bipolar5, - [das08_pgh] = &das08_pgh_ai_range, - [das08_pgl] = &das08_pgl_ai_range, - [das08_pgm] = &das08_pgm_ai_range, + [das08_pg_none] = &range_unknown, + [das08_bipolar5] = &range_bipolar5, + [das08_pgh] = &das08_pgh_ai_range, + [das08_pgl] = &das08_pgl_ai_range, + [das08_pgm] = &das08_pgm_ai_range, }; static const int das08_pgh_ai_gainlist[] = { @@ -145,17 +145,16 @@ static const int das08_pgl_ai_gainlist[] = { 8, 0, 2, 4, 6, 1, 3, 5, 7 }; static const int das08_pgm_ai_gainlist[] = { 8, 0, 10, 12, 14, 9, 11, 13, 15 }; static const int *const das08_ai_gainlists[] = { - [das08_pg_none] = NULL, - [das08_bipolar5] = NULL, - [das08_pgh] = das08_pgh_ai_gainlist, - [das08_pgl] = das08_pgl_ai_gainlist, - [das08_pgm] = das08_pgm_ai_gainlist, + [das08_pg_none] = NULL, + [das08_bipolar5] = NULL, + [das08_pgh] = das08_pgh_ai_gainlist, + [das08_pgl] = das08_pgl_ai_gainlist, + [das08_pgm] = das08_pgm_ai_gainlist, }; static int das08_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned int status; @@ -195,8 +194,7 @@ static int das08_ai_insn_read(struct comedi_device *dev, if (devpriv->pg_gainlist) { /* set gain/range */ range = CR_RANGE(insn->chanspec); - outb(devpriv->pg_gainlist[range], - dev->iobase + DAS08_GAIN_REG); + outb(devpriv->pg_gainlist[range], dev->iobase + DAS08_GAIN_REG); } for (n = 0; n < insn->n; n++) { @@ -324,8 +322,7 @@ static void das08_ao_set_data(struct comedi_device *dev, static int das08_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int val = s->readback[chan]; @@ -408,7 +405,7 @@ int das08_common_attach(struct comedi_device *dev, unsigned long iobase) s->maxdata = 1; s->range_table = &range_digital; s->insn_bits = board->is_jr ? das08jr_di_insn_bits : - das08_di_insn_bits; + das08_di_insn_bits; } else { s->type = COMEDI_SUBD_UNUSED; } @@ -422,7 +419,7 @@ int das08_common_attach(struct comedi_device *dev, unsigned long iobase) s->maxdata = 1; s->range_table = &range_digital; s->insn_bits = board->is_jr ? das08jr_do_insn_bits : - das08_do_insn_bits; + das08_do_insn_bits; } else { s->type = COMEDI_SUBD_UNUSED; } @@ -452,17 +449,20 @@ int das08_common_attach(struct comedi_device *dev, unsigned long iobase) return 0; } + EXPORT_SYMBOL_GPL(das08_common_attach); static int __init das08_init(void) { return 0; } + module_init(das08_init); static void __exit das08_exit(void) { } + module_exit(das08_exit); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/das08_cs.c b/drivers/comedi/drivers/das08_cs.c index 223479f9ea3c..1c8edc3d60d1 100644 --- a/drivers/comedi/drivers/das08_cs.c +++ b/drivers/comedi/drivers/das08_cs.c @@ -37,14 +37,14 @@ static const struct das08_board_struct das08_cs_boards[] = { { - .name = "pcm-das08", - .ai_nbits = 12, - .ai_pg = das08_bipolar5, - .ai_encoding = das08_pcm_encode12, - .di_nchan = 3, - .do_nchan = 3, - .iosize = 16, - }, + .name = "pcm-das08", + .ai_nbits = 12, + .ai_pg = das08_bipolar5, + .ai_encoding = das08_pcm_encode12, + .di_nchan = 3, + .do_nchan = 3, + .iosize = 16, + }, }; static int das08_cs_auto_attach(struct comedi_device *dev, @@ -72,10 +72,10 @@ static int das08_cs_auto_attach(struct comedi_device *dev, } static struct comedi_driver driver_das08_cs = { - .driver_name = "das08_cs", - .module = THIS_MODULE, - .auto_attach = das08_cs_auto_attach, - .detach = comedi_pcmcia_disable, + .driver_name = "das08_cs", + .module = THIS_MODULE, + .auto_attach = das08_cs_auto_attach, + .detach = comedi_pcmcia_disable, }; static int das08_pcmcia_attach(struct pcmcia_device *link) @@ -87,15 +87,17 @@ static const struct pcmcia_device_id das08_cs_id_table[] = { PCMCIA_DEVICE_MANF_CARD(0x01c5, 0x4001), PCMCIA_DEVICE_NULL }; + MODULE_DEVICE_TABLE(pcmcia, das08_cs_id_table); static struct pcmcia_driver das08_cs_driver = { - .name = "pcm-das08", - .owner = THIS_MODULE, - .id_table = das08_cs_id_table, - .probe = das08_pcmcia_attach, - .remove = comedi_pcmcia_auto_unconfig, + .name = "pcm-das08", + .owner = THIS_MODULE, + .id_table = das08_cs_id_table, + .probe = das08_pcmcia_attach, + .remove = comedi_pcmcia_auto_unconfig, }; + module_comedi_pcmcia_driver(driver_das08_cs, das08_cs_driver); MODULE_AUTHOR("David A. Schleef <ds@xxxxxxxxxxx>"); diff --git a/drivers/comedi/drivers/das08_isa.c b/drivers/comedi/drivers/das08_isa.c index 8c4cfa821423..b702d7c9bfd1 100644 --- a/drivers/comedi/drivers/das08_isa.c +++ b/drivers/comedi/drivers/das08_isa.c @@ -35,125 +35,128 @@ static const struct das08_board_struct das08_isa_boards[] = { { - /* cio-das08.pdf */ - .name = "isa-das08", - .ai_nbits = 12, - .ai_pg = das08_pg_none, - .ai_encoding = das08_encode12, - .di_nchan = 3, - .do_nchan = 4, - .i8255_offset = 8, - .i8254_offset = 4, - .iosize = 16, /* unchecked */ - }, { - /* cio-das08pgx.pdf */ - .name = "das08-pgm", - .ai_nbits = 12, - .ai_pg = das08_pgm, - .ai_encoding = das08_encode12, - .di_nchan = 3, - .do_nchan = 4, - .i8255_offset = 0, - .i8254_offset = 0x04, - .iosize = 16, /* unchecked */ - }, { - /* cio-das08pgx.pdf */ - .name = "das08-pgh", - .ai_nbits = 12, - .ai_pg = das08_pgh, - .ai_encoding = das08_encode12, - .di_nchan = 3, - .do_nchan = 4, - .i8254_offset = 0x04, - .iosize = 16, /* unchecked */ - }, { - /* cio-das08pgx.pdf */ - .name = "das08-pgl", - .ai_nbits = 12, - .ai_pg = das08_pgl, - .ai_encoding = das08_encode12, - .di_nchan = 3, - .do_nchan = 4, - .i8254_offset = 0x04, - .iosize = 16, /* unchecked */ - }, { - /* cio-das08_aox.pdf */ - .name = "das08-aoh", - .ai_nbits = 12, - .ai_pg = das08_pgh, - .ai_encoding = das08_encode12, - .ao_nbits = 12, - .di_nchan = 3, - .do_nchan = 4, - .i8255_offset = 0x0c, - .i8254_offset = 0x04, - .iosize = 16, /* unchecked */ - }, { - /* cio-das08_aox.pdf */ - .name = "das08-aol", - .ai_nbits = 12, - .ai_pg = das08_pgl, - .ai_encoding = das08_encode12, - .ao_nbits = 12, - .di_nchan = 3, - .do_nchan = 4, - .i8255_offset = 0x0c, - .i8254_offset = 0x04, - .iosize = 16, /* unchecked */ - }, { - /* cio-das08_aox.pdf */ - .name = "das08-aom", - .ai_nbits = 12, - .ai_pg = das08_pgm, - .ai_encoding = das08_encode12, - .ao_nbits = 12, - .di_nchan = 3, - .do_nchan = 4, - .i8255_offset = 0x0c, - .i8254_offset = 0x04, - .iosize = 16, /* unchecked */ - }, { - /* cio-das08-jr-ao.pdf */ - .name = "das08/jr-ao", - .is_jr = true, - .ai_nbits = 12, - .ai_pg = das08_pg_none, - .ai_encoding = das08_encode12, - .ao_nbits = 12, - .di_nchan = 8, - .do_nchan = 8, - .iosize = 16, /* unchecked */ - }, { - /* cio-das08jr-16-ao.pdf */ - .name = "das08jr-16-ao", - .is_jr = true, - .ai_nbits = 16, - .ai_pg = das08_pg_none, - .ai_encoding = das08_encode16, - .ao_nbits = 16, - .di_nchan = 8, - .do_nchan = 8, - .i8254_offset = 0x04, - .iosize = 16, /* unchecked */ - }, { - .name = "pc104-das08", - .ai_nbits = 12, - .ai_pg = das08_pg_none, - .ai_encoding = das08_encode12, - .di_nchan = 3, - .do_nchan = 4, - .i8254_offset = 4, - .iosize = 16, /* unchecked */ - }, { - .name = "das08jr/16", - .is_jr = true, - .ai_nbits = 16, - .ai_pg = das08_pg_none, - .ai_encoding = das08_encode16, - .di_nchan = 8, - .do_nchan = 8, - .iosize = 16, /* unchecked */ - }, + /* cio-das08.pdf */ + .name = "isa-das08", + .ai_nbits = 12, + .ai_pg = das08_pg_none, + .ai_encoding = das08_encode12, + .di_nchan = 3, + .do_nchan = 4, + .i8255_offset = 8, + .i8254_offset = 4, + .iosize = 16, /* unchecked */ + }, { + /* cio-das08pgx.pdf */ + .name = "das08-pgm", + .ai_nbits = 12, + .ai_pg = das08_pgm, + .ai_encoding = das08_encode12, + .di_nchan = 3, + .do_nchan = 4, + .i8255_offset = 0, + .i8254_offset = 0x04, + .iosize = 16, /* unchecked */ + }, { + /* cio-das08pgx.pdf */ + .name = "das08-pgh", + .ai_nbits = 12, + .ai_pg = das08_pgh, + .ai_encoding = das08_encode12, + .di_nchan = 3, + .do_nchan = 4, + .i8254_offset = 0x04, + .iosize = 16, /* unchecked */ + }, { + /* cio-das08pgx.pdf */ + .name = "das08-pgl", + .ai_nbits = 12, + .ai_pg = das08_pgl, + .ai_encoding = das08_encode12, + .di_nchan = 3, + .do_nchan = 4, + .i8254_offset = 0x04, + .iosize = 16, /* unchecked */ + }, { + /* cio-das08_aox.pdf */ + .name = "das08-aoh", + .ai_nbits = 12, + .ai_pg = das08_pgh, + .ai_encoding = das08_encode12, + .ao_nbits = 12, + .di_nchan = 3, + .do_nchan = 4, + .i8255_offset = 0x0c, + .i8254_offset = 0x04, + .iosize = 16, /* unchecked */ + }, { + /* cio-das08_aox.pdf */ + .name = "das08-aol", + .ai_nbits = 12, + .ai_pg = das08_pgl, + .ai_encoding = das08_encode12, + .ao_nbits = 12, + .di_nchan = 3, + .do_nchan = 4, + .i8255_offset = 0x0c, + .i8254_offset = 0x04, + .iosize = 16, /* unchecked */ + }, { + /* cio-das08_aox.pdf */ + .name = "das08-aom", + .ai_nbits = 12, + .ai_pg = das08_pgm, + .ai_encoding = das08_encode12, + .ao_nbits = 12, + .di_nchan = 3, + .do_nchan = 4, + .i8255_offset = 0x0c, + .i8254_offset = 0x04, + .iosize = 16, /* unchecked */ + }, { + /* cio-das08-jr-ao.pdf */ + .name = "das08/jr-ao", + .is_jr = true, + .ai_nbits = 12, + .ai_pg = das08_pg_none, + .ai_encoding = das08_encode12, + .ao_nbits = 12, + .di_nchan = 8, + .do_nchan = 8, + .iosize = 16, /* unchecked */ + }, { + /* cio-das08jr-16-ao.pdf */ + .name = "das08jr-16-ao", + .is_jr = true, + .ai_nbits = 16, + .ai_pg = das08_pg_none, + .ai_encoding = das08_encode16, + .ao_nbits = 16, + .di_nchan = 8, + .do_nchan = 8, + .i8254_offset = 0x04, + .iosize = 16, /* unchecked */ + }, { + .name = "pc104-das08", + .ai_nbits = 12, + .ai_pg = das08_pg_none, + .ai_encoding = + das08_encode12, + .di_nchan = 3, + .do_nchan = 4, + .i8254_offset = 4, + .iosize = 16, /* unchecked */ + }, { + .name = "das08jr/16", + .is_jr = true, + .ai_nbits = 16, + .ai_pg = + das08_pg_none, + .ai_encoding = + das08_encode16, + .di_nchan = 8, + .do_nchan = 8, + .iosize = 16, /* unchecked */ + }, }; static int das08_isa_attach(struct comedi_device *dev, @@ -175,14 +178,15 @@ static int das08_isa_attach(struct comedi_device *dev, } static struct comedi_driver das08_isa_driver = { - .driver_name = "isa-das08", - .module = THIS_MODULE, - .attach = das08_isa_attach, - .detach = comedi_legacy_detach, - .board_name = &das08_isa_boards[0].name, - .num_names = ARRAY_SIZE(das08_isa_boards), - .offset = sizeof(das08_isa_boards[0]), + .driver_name = "isa-das08", + .module = THIS_MODULE, + .attach = das08_isa_attach, + .detach = comedi_legacy_detach, + .board_name = &das08_isa_boards[0].name, + .num_names = ARRAY_SIZE(das08_isa_boards), + .offset = sizeof(das08_isa_boards[0]), }; + module_comedi_driver(das08_isa_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/das08_pci.c b/drivers/comedi/drivers/das08_pci.c index 1cd903336a4c..c19cb6cfe0b6 100644 --- a/drivers/comedi/drivers/das08_pci.c +++ b/drivers/comedi/drivers/das08_pci.c @@ -30,15 +30,15 @@ static const struct das08_board_struct das08_pci_boards[] = { { - .name = "pci-das08", - .ai_nbits = 12, - .ai_pg = das08_bipolar5, - .ai_encoding = das08_encode12, - .di_nchan = 3, - .do_nchan = 4, - .i8254_offset = 4, - .iosize = 8, - }, + .name = "pci-das08", + .ai_nbits = 12, + .ai_pg = das08_bipolar5, + .ai_encoding = das08_encode12, + .di_nchan = 3, + .do_nchan = 4, + .i8254_offset = 4, + .iosize = 8, + }, }; static int das08_pci_auto_attach(struct comedi_device *dev, @@ -64,14 +64,13 @@ static int das08_pci_auto_attach(struct comedi_device *dev, } static struct comedi_driver das08_pci_comedi_driver = { - .driver_name = "pci-das08", - .module = THIS_MODULE, - .auto_attach = das08_pci_auto_attach, - .detach = comedi_pci_detach, + .driver_name = "pci-das08", + .module = THIS_MODULE, + .auto_attach = das08_pci_auto_attach, + .detach = comedi_pci_detach, }; -static int das08_pci_probe(struct pci_dev *dev, - const struct pci_device_id *id) +static int das08_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) { return comedi_pci_auto_config(dev, &das08_pci_comedi_driver, id->driver_data); @@ -81,14 +80,16 @@ static const struct pci_device_id das08_pci_table[] = { { PCI_DEVICE(PCI_VENDOR_ID_CB, 0x0029) }, { 0 } }; + MODULE_DEVICE_TABLE(pci, das08_pci_table); static struct pci_driver das08_pci_driver = { - .name = "pci-das08", - .id_table = das08_pci_table, - .probe = das08_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "pci-das08", + .id_table = das08_pci_table, + .probe = das08_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(das08_pci_comedi_driver, das08_pci_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/das16.c b/drivers/comedi/drivers/das16.c index 4ac2622b0fac..fb89bd59dc68 100644 --- a/drivers/comedi/drivers/das16.c +++ b/drivers/comedi/drivers/das16.c @@ -117,65 +117,65 @@ static const struct comedi_lrange range_das1x01_bip = { 4, { - BIP_RANGE(10), - BIP_RANGE(1), - BIP_RANGE(0.1), - BIP_RANGE(0.01) - } + BIP_RANGE(10), + BIP_RANGE(1), + BIP_RANGE(0.1), + BIP_RANGE(0.01) + } }; static const struct comedi_lrange range_das1x01_unip = { 4, { - UNI_RANGE(10), - UNI_RANGE(1), - UNI_RANGE(0.1), - UNI_RANGE(0.01) - } + UNI_RANGE(10), + UNI_RANGE(1), + UNI_RANGE(0.1), + UNI_RANGE(0.01) + } }; static const struct comedi_lrange range_das1x02_bip = { 4, { - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(2.5), - BIP_RANGE(1.25) - } + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(2.5), + BIP_RANGE(1.25) + } }; static const struct comedi_lrange range_das1x02_unip = { 4, { - UNI_RANGE(10), - UNI_RANGE(5), - UNI_RANGE(2.5), - UNI_RANGE(1.25) - } + UNI_RANGE(10), + UNI_RANGE(5), + UNI_RANGE(2.5), + UNI_RANGE(1.25) + } }; static const struct comedi_lrange range_das16jr = { 9, { - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(2.5), - BIP_RANGE(1.25), - BIP_RANGE(0.625), - UNI_RANGE(10), - UNI_RANGE(5), - UNI_RANGE(2.5), - UNI_RANGE(1.25) - } + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(2.5), + BIP_RANGE(1.25), + BIP_RANGE(0.625), + UNI_RANGE(10), + UNI_RANGE(5), + UNI_RANGE(2.5), + UNI_RANGE(1.25) + } }; static const struct comedi_lrange range_das16jr_16 = { 8, { - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(2.5), - BIP_RANGE(1.25), - UNI_RANGE(10), - UNI_RANGE(5), - UNI_RANGE(2.5), - UNI_RANGE(1.25) - } + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(2.5), + BIP_RANGE(1.25), + UNI_RANGE(10), + UNI_RANGE(5), + UNI_RANGE(2.5), + UNI_RANGE(1.25) + } }; static const int das16jr_gainlist[] = { 8, 0, 1, 2, 3, 4, 5, 6, 7 }; @@ -230,194 +230,406 @@ struct das16_board { static const struct das16_board das16_boards[] = { { - .name = "das-16", - .ai_maxdata = 0x0fff, - .ai_speed = 15000, - .ai_pg = das16_pg_none, - .has_ao = 1, - .has_8255 = 1, - .i8255_offset = 0x10, - .size = 0x14, - .id = 0x00, - }, { - .name = "das-16g", - .ai_maxdata = 0x0fff, - .ai_speed = 15000, - .ai_pg = das16_pg_none, - .has_ao = 1, - .has_8255 = 1, - .i8255_offset = 0x10, - .size = 0x14, - .id = 0x00, - }, { - .name = "das-16f", - .ai_maxdata = 0x0fff, - .ai_speed = 8500, - .ai_pg = das16_pg_none, - .has_ao = 1, - .has_8255 = 1, - .i8255_offset = 0x10, - .size = 0x14, - .id = 0x00, - }, { - .name = "cio-das16", - .ai_maxdata = 0x0fff, - .ai_speed = 20000, - .ai_pg = das16_pg_none, - .has_ao = 1, - .has_8255 = 1, - .i8255_offset = 0x10, - .size = 0x14, - .id = 0x80, - }, { - .name = "cio-das16/f", - .ai_maxdata = 0x0fff, - .ai_speed = 10000, - .ai_pg = das16_pg_none, - .has_ao = 1, - .has_8255 = 1, - .i8255_offset = 0x10, - .size = 0x14, - .id = 0x80, - }, { - .name = "cio-das16/jr", - .ai_maxdata = 0x0fff, - .ai_speed = 7692, - .ai_pg = das16_pg_16jr, - .size = 0x10, - .id = 0x00, - }, { - .name = "pc104-das16jr", - .ai_maxdata = 0x0fff, - .ai_speed = 3300, - .ai_pg = das16_pg_16jr, - .size = 0x10, - .id = 0x00, - }, { - .name = "cio-das16jr/16", - .ai_maxdata = 0xffff, - .ai_speed = 10000, - .ai_pg = das16_pg_16jr_16, - .size = 0x10, - .id = 0x00, - }, { - .name = "pc104-das16jr/16", - .ai_maxdata = 0xffff, - .ai_speed = 10000, - .ai_pg = das16_pg_16jr_16, - .size = 0x10, - .id = 0x00, - }, { - .name = "das-1201", - .ai_maxdata = 0x0fff, - .ai_speed = 20000, - .ai_pg = das16_pg_none, - .has_8255 = 1, - .i8255_offset = 0x400, - .size = 0x408, - .id = 0x20, - }, { - .name = "das-1202", - .ai_maxdata = 0x0fff, - .ai_speed = 10000, - .ai_pg = das16_pg_none, - .has_8255 = 1, - .i8255_offset = 0x400, - .size = 0x408, - .id = 0x20, - }, { - .name = "das-1401", - .ai_maxdata = 0x0fff, - .ai_speed = 10000, - .ai_pg = das16_pg_1601, - .size = 0x408, - .id = 0xc0, - }, { - .name = "das-1402", - .ai_maxdata = 0x0fff, - .ai_speed = 10000, - .ai_pg = das16_pg_1602, - .size = 0x408, - .id = 0xc0, - }, { - .name = "das-1601", - .ai_maxdata = 0x0fff, - .ai_speed = 10000, - .ai_pg = das16_pg_1601, - .has_ao = 1, - .has_8255 = 1, - .i8255_offset = 0x400, - .size = 0x408, - .id = 0xc0, - }, { - .name = "das-1602", - .ai_maxdata = 0x0fff, - .ai_speed = 10000, - .ai_pg = das16_pg_1602, - .has_ao = 1, - .has_8255 = 1, - .i8255_offset = 0x400, - .size = 0x408, - .id = 0xc0, - }, { - .name = "cio-das1401/12", - .ai_maxdata = 0x0fff, - .ai_speed = 6250, - .ai_pg = das16_pg_1601, - .size = 0x408, - .id = 0xc0, - }, { - .name = "cio-das1402/12", - .ai_maxdata = 0x0fff, - .ai_speed = 6250, - .ai_pg = das16_pg_1602, - .size = 0x408, - .id = 0xc0, - }, { - .name = "cio-das1402/16", - .ai_maxdata = 0xffff, - .ai_speed = 10000, - .ai_pg = das16_pg_1602, - .size = 0x408, - .id = 0xc0, - }, { - .name = "cio-das1601/12", - .ai_maxdata = 0x0fff, - .ai_speed = 6250, - .ai_pg = das16_pg_1601, - .has_ao = 1, - .has_8255 = 1, - .i8255_offset = 0x400, - .size = 0x408, - .id = 0xc0, - }, { - .name = "cio-das1602/12", - .ai_maxdata = 0x0fff, - .ai_speed = 10000, - .ai_pg = das16_pg_1602, - .has_ao = 1, - .has_8255 = 1, - .i8255_offset = 0x400, - .size = 0x408, - .id = 0xc0, - }, { - .name = "cio-das1602/16", - .ai_maxdata = 0xffff, - .ai_speed = 10000, - .ai_pg = das16_pg_1602, - .has_ao = 1, - .has_8255 = 1, - .i8255_offset = 0x400, - .size = 0x408, - .id = 0xc0, - }, { - .name = "cio-das16/330", - .ai_maxdata = 0x0fff, - .ai_speed = 3030, - .ai_pg = das16_pg_16jr, - .size = 0x14, - .id = 0xf0, - }, + .name = "das-16", + .ai_maxdata = 0x0fff, + .ai_speed = 15000, + .ai_pg = das16_pg_none, + .has_ao = 1, + .has_8255 = 1, + .i8255_offset = 0x10, + .size = 0x14, + .id = 0x00, + }, { + .name = "das-16g", + .ai_maxdata = 0x0fff, + .ai_speed = 15000, + .ai_pg = das16_pg_none, + .has_ao = 1, + .has_8255 = 1, + .i8255_offset = 0x10, + .size = 0x14, + .id = 0x00, + }, { + .name = "das-16f", + .ai_maxdata = 0x0fff, + .ai_speed = 8500, + .ai_pg = das16_pg_none, + .has_ao = 1, + .has_8255 = 1, + .i8255_offset = 0x10, + .size = 0x14, + .id = 0x00, + }, { + .name = "cio-das16", + .ai_maxdata = 0x0fff, + .ai_speed = 20000, + .ai_pg = das16_pg_none, + .has_ao = 1, + .has_8255 = 1, + .i8255_offset = 0x10, + .size = 0x14, + .id = 0x80, + }, { + .name = "cio-das16/f", + .ai_maxdata = 0x0fff, + .ai_speed = 10000, + .ai_pg = das16_pg_none, + .has_ao = 1, + .has_8255 = 1, + .i8255_offset = 0x10, + .size = 0x14, + .id = 0x80, + }, { + .name = "cio-das16/jr", + .ai_maxdata = 0x0fff, + .ai_speed = 7692, + .ai_pg = das16_pg_16jr, + .size = 0x10, + .id = 0x00, + }, { + .name = "pc104-das16jr", + .ai_maxdata = 0x0fff, + .ai_speed = 3300, + .ai_pg = das16_pg_16jr, + .size = 0x10, + .id = 0x00, + }, { + .name = "cio-das16jr/16", + .ai_maxdata = 0xffff, + .ai_speed = 10000, + .ai_pg = das16_pg_16jr_16, + .size = 0x10, + .id = 0x00, + }, { + .name = "pc104-das16jr/16", + .ai_maxdata = 0xffff, + .ai_speed = 10000, + .ai_pg = das16_pg_16jr_16, + .size = 0x10, + .id = 0x00, + }, { + .name = "das-1201", + .ai_maxdata = 0x0fff, + .ai_speed = 20000, + .ai_pg = das16_pg_none, + .has_8255 = 1, + .i8255_offset = 0x400, + .size = 0x408, + .id = 0x20, + }, { + .name = "das-1202", + .ai_maxdata = 0x0fff, + .ai_speed = 10000, + .ai_pg = + das16_pg_none, + .has_8255 = 1, + .i8255_offset = + 0x400, + .size = 0x408, + .id = 0x20, + }, { + .name = + "das-1401", + .ai_maxdata = + 0x0fff, + .ai_speed = + 10000, + .ai_pg = + das16_pg_1601, + .size = 0x408, + .id = 0xc0, + }, { + .name = + "das-1402", + .ai_maxdata + = 0x0fff, + .ai_speed = + 10000, + .ai_pg = + das16_pg_1602, + .size = + 0x408, + .id = 0xc0, + }, { + .name + = + "das-1601", + . + ai_maxdata + = + 0x0fff, + . + ai_speed + = + 10000, + . + ai_pg + = + das16_pg_1601, + . + has_ao + = 1, + . + has_8255 + = 1, + . + i8255_offset + = + 0x400, + . + size = + 0x408, + .id = + 0xc0, + }, { + . + name + = + "das-1602", + . + ai_maxdata + = + 0x0fff, + . + ai_speed + = + 10000, + . + ai_pg + = + das16_pg_1602, + . + has_ao + = + 1, + . + has_8255 + = + 1, + . + i8255_offset + = + 0x400, + . + size + = + 0x408, + . + id + = + 0xc0, + }, { + . + name + = + "cio-das1401/12", + . + ai_maxdata + = + 0x0fff, + . + ai_speed + = + 6250, + . + ai_pg + = + das16_pg_1601, + . + size + = + 0x408, + . + id + = + 0xc0, + }, { + . + name + = + "cio-das1402/12", + . + ai_maxdata + = + 0x0fff, + . + ai_speed + = + 6250, + . + ai_pg + = + das16_pg_1602, + . + size + = + 0x408, + . + id + = + 0xc0, + }, { + . + name + = + "cio-das1402/16", + . + ai_maxdata + = + 0xffff, + . + ai_speed + = + 10000, + . + ai_pg + = + das16_pg_1602, + . + size + = + 0x408, + . + id + = + 0xc0, + }, { + . + name + = + "cio-das1601/12", + . + ai_maxdata + = + 0x0fff, + . + ai_speed + = + 6250, + . + ai_pg + = + das16_pg_1601, + . + has_ao + = + 1, + . + has_8255 + = + 1, + . + i8255_offset + = + 0x400, + . + size + = + 0x408, + . + id + = + 0xc0, + }, { + . + name + = + "cio-das1602/12", + . + ai_maxdata + = + 0x0fff, + . + ai_speed + = + 10000, + . + ai_pg + = + das16_pg_1602, + . + has_ao + = + 1, + . + has_8255 + = + 1, + . + i8255_offset + = + 0x400, + . + size + = + 0x408, + . + id + = + 0xc0, + }, { + . + name + = + "cio-das1602/16", + . + ai_maxdata + = + 0xffff, + . + ai_speed + = + 10000, + . + ai_pg + = + das16_pg_1602, + . + has_ao + = + 1, + . + has_8255 + = + 1, + . + i8255_offset + = + 0x400, + . + size + = + 0x408, + . + id + = + 0xc0, + }, { + . + name + = + "cio-das16/330", + . + ai_maxdata + = + 0x0fff, + . + ai_speed + = + 3030, + . + ai_pg + = + das16_pg_16jr, + . + size + = + 0x14, + . + id + = + 0xf0, + }, }; /* @@ -430,16 +642,16 @@ static inline int timer_period(void) } struct das16_private_struct { - struct comedi_isadma *dma; - struct comedi_device *dev; - unsigned int clockbase; - unsigned int ctrl_reg; - unsigned int divisor1; - unsigned int divisor2; - struct timer_list timer; - unsigned long extra_iobase; - unsigned int can_burst:1; - unsigned int timer_running:1; + struct comedi_isadma *dma; + struct comedi_device *dev; + unsigned int clockbase; + unsigned int ctrl_reg; + unsigned int divisor1; + unsigned int divisor2; + struct timer_list timer; + unsigned long extra_iobase; + unsigned int can_burst:1; + unsigned int timer_running:1; }; static void das16_ai_setup_dma(struct comedi_device *dev, @@ -533,8 +745,7 @@ static void das16_timer_interrupt(struct timer_list *t) static void das16_ai_set_mux_range(struct comedi_device *dev, unsigned int first_chan, - unsigned int last_chan, - unsigned int range) + unsigned int last_chan, unsigned int range) { const struct das16_board *board = dev->board_ptr; @@ -652,7 +863,7 @@ static int das16_cmd_test(struct comedi_device *dev, struct comedi_subdevice *s, if (cmd->stop_src == TRIG_COUNT) err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); - else /* TRIG_NONE */ + else /* TRIG_NONE */ err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) @@ -808,8 +1019,7 @@ static void das16_ai_munge(struct comedi_device *dev, static int das16_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned int status; @@ -821,8 +1031,7 @@ static int das16_ai_eoc(struct comedi_device *dev, static int das16_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int range = CR_RANGE(insn->chanspec); @@ -855,8 +1064,7 @@ static int das16_ai_insn_read(struct comedi_device *dev, static int das16_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); int i; @@ -877,8 +1085,7 @@ static int das16_ao_insn_write(struct comedi_device *dev, static int das16_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { data[1] = inb(dev->iobase + DAS16_DIO_REG) & 0xf; @@ -887,8 +1094,7 @@ static int das16_di_insn_bits(struct comedi_device *dev, static int das16_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { if (comedi_dio_update_state(s, data)) outb(s->state, dev->iobase + DAS16_DIO_REG); @@ -1084,62 +1290,62 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* Analog Input subdevice */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE; if (status & DAS16_STATUS_MUXBIT) { - s->subdev_flags |= SDF_GROUND; - s->n_chan = 16; + s->subdev_flags |= SDF_GROUND; + s->n_chan = 16; } else { - s->subdev_flags |= SDF_DIFF; - s->n_chan = 8; + s->subdev_flags |= SDF_DIFF; + s->n_chan = 8; } - s->len_chanlist = s->n_chan; - s->maxdata = board->ai_maxdata; - s->range_table = das16_ai_range(dev, s, it, board->ai_pg, status); - s->insn_read = das16_ai_insn_read; + s->len_chanlist = s->n_chan; + s->maxdata = board->ai_maxdata; + s->range_table = das16_ai_range(dev, s, it, board->ai_pg, status); + s->insn_read = das16_ai_insn_read; if (devpriv->dma) { dev->read_subdev = s; - s->subdev_flags |= SDF_CMD_READ; - s->do_cmdtest = das16_cmd_test; - s->do_cmd = das16_cmd_exec; - s->cancel = das16_cancel; - s->munge = das16_ai_munge; + s->subdev_flags |= SDF_CMD_READ; + s->do_cmdtest = das16_cmd_test; + s->do_cmd = das16_cmd_exec; + s->cancel = das16_cancel; + s->munge = das16_ai_munge; } /* Analog Output subdevice */ s = &dev->subdevices[1]; if (board->has_ao) { - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 2; - s->maxdata = 0x0fff; - s->range_table = das16_ao_range(dev, s, it); - s->insn_write = das16_ao_insn_write; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 2; + s->maxdata = 0x0fff; + s->range_table = das16_ao_range(dev, s, it); + s->insn_write = das16_ao_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) return ret; } else { - s->type = COMEDI_SUBD_UNUSED; + s->type = COMEDI_SUBD_UNUSED; } /* Digital Input subdevice */ s = &dev->subdevices[2]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 4; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = das16_di_insn_bits; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 4; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = das16_di_insn_bits; /* Digital Output subdevice */ s = &dev->subdevices[3]; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 4; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = das16_do_insn_bits; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 4; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = das16_do_insn_bits; /* initialize digital output lines */ outb(s->state, dev->iobase + DAS16_DIO_REG); @@ -1185,14 +1391,15 @@ static void das16_detach(struct comedi_device *dev) } static struct comedi_driver das16_driver = { - .driver_name = "das16", - .module = THIS_MODULE, - .attach = das16_attach, - .detach = das16_detach, - .board_name = &das16_boards[0].name, - .num_names = ARRAY_SIZE(das16_boards), - .offset = sizeof(das16_boards[0]), + .driver_name = "das16", + .module = THIS_MODULE, + .attach = das16_attach, + .detach = das16_detach, + .board_name = &das16_boards[0].name, + .num_names = ARRAY_SIZE(das16_boards), + .offset = sizeof(das16_boards[0]), }; + module_comedi_driver(das16_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/das16m1.c b/drivers/comedi/drivers/das16m1.c index 75f3dbbe97ac..191e741a4450 100644 --- a/drivers/comedi/drivers/das16m1.c +++ b/drivers/comedi/drivers/das16m1.c @@ -82,16 +82,16 @@ static const struct comedi_lrange range_das16m1 = { 9, { - BIP_RANGE(5), - BIP_RANGE(2.5), - BIP_RANGE(1.25), - BIP_RANGE(0.625), - UNI_RANGE(10), - UNI_RANGE(5), - UNI_RANGE(2.5), - UNI_RANGE(1.25), - BIP_RANGE(10) - } + BIP_RANGE(5), + BIP_RANGE(2.5), + BIP_RANGE(1.25), + BIP_RANGE(0.625), + UNI_RANGE(10), + UNI_RANGE(5), + UNI_RANGE(2.5), + UNI_RANGE(1.25), + BIP_RANGE(10) + } }; struct das16m1_private { @@ -208,7 +208,7 @@ static int das16m1_ai_cmdtest(struct comedi_device *dev, if (cmd->stop_src == TRIG_COUNT) err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); - else /* TRIG_NONE */ + else /* TRIG_NONE */ err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) @@ -236,8 +236,7 @@ static int das16m1_ai_cmdtest(struct comedi_device *dev, return 0; } -static int das16m1_ai_cmd(struct comedi_device *dev, - struct comedi_subdevice *s) +static int das16m1_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) { struct das16m1_private *devpriv = dev->private; struct comedi_async *async = s->async; @@ -269,7 +268,7 @@ static int das16m1_ai_cmd(struct comedi_device *dev, comedi_8254_update_divisors(dev->pacer); comedi_8254_pacer_enable(dev->pacer, 1, 2, true); devpriv->intr_ctrl |= DAS16M1_INTR_CTRL_PACER_INT; - } else { /* TRIG_EXT */ + } else { /* TRIG_EXT */ devpriv->intr_ctrl |= DAS16M1_INTR_CTRL_PACER_EXT; } @@ -308,8 +307,7 @@ static int das16m1_ai_cancel(struct comedi_device *dev, static int das16m1_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned int status; @@ -321,8 +319,7 @@ static int das16m1_ai_eoc(struct comedi_device *dev, static int das16m1_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { int ret; int i; @@ -350,8 +347,7 @@ static int das16m1_ai_insn_read(struct comedi_device *dev, static int das16m1_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { data[1] = inb(dev->iobase + DAS16M1_DI_REG) & 0xf; @@ -360,8 +356,7 @@ static int das16m1_di_insn_bits(struct comedi_device *dev, static int das16m1_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { if (comedi_dio_update_state(s, data)) outb(s->state, dev->iobase + DAS16M1_DO_REG); @@ -386,8 +381,7 @@ static void das16m1_handler(struct comedi_device *dev, unsigned int status) * Make sure hardware counter reading is not bogus due to initial * value not having been loaded yet. */ - if (devpriv->adc_count == 0 && - hw_counter == devpriv->initial_hw_count) { + if (devpriv->adc_count == 0 && hw_counter == devpriv->initial_hw_count) { num_samples = 0; } else { /* @@ -546,40 +540,40 @@ static int das16m1_attach(struct comedi_device *dev, /* Analog Input subdevice */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_DIFF; - s->n_chan = 8; - s->maxdata = 0x0fff; - s->range_table = &range_das16m1; - s->insn_read = das16m1_ai_insn_read; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_DIFF; + s->n_chan = 8; + s->maxdata = 0x0fff; + s->range_table = &range_das16m1; + s->insn_read = das16m1_ai_insn_read; if (dev->irq) { dev->read_subdev = s; - s->subdev_flags |= SDF_CMD_READ; - s->len_chanlist = 256; - s->do_cmdtest = das16m1_ai_cmdtest; - s->do_cmd = das16m1_ai_cmd; - s->cancel = das16m1_ai_cancel; - s->poll = das16m1_ai_poll; - s->munge = das16m1_ai_munge; + s->subdev_flags |= SDF_CMD_READ; + s->len_chanlist = 256; + s->do_cmdtest = das16m1_ai_cmdtest; + s->do_cmd = das16m1_ai_cmd; + s->cancel = das16m1_ai_cancel; + s->poll = das16m1_ai_poll; + s->munge = das16m1_ai_munge; } /* Digital Input subdevice */ s = &dev->subdevices[1]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 4; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = das16m1_di_insn_bits; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 4; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = das16m1_di_insn_bits; /* Digital Output subdevice */ s = &dev->subdevices[2]; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 4; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = das16m1_do_insn_bits; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 4; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = das16m1_do_insn_bits; /* Digital I/O subdevice (8255) */ s = &dev->subdevices[3]; @@ -610,11 +604,12 @@ static void das16m1_detach(struct comedi_device *dev) } static struct comedi_driver das16m1_driver = { - .driver_name = "das16m1", - .module = THIS_MODULE, - .attach = das16m1_attach, - .detach = das16m1_detach, + .driver_name = "das16m1", + .module = THIS_MODULE, + .attach = das16m1_attach, + .detach = das16m1_detach, }; + module_comedi_driver(das16m1_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/das1800.c b/drivers/comedi/drivers/das1800.c index f50891a6ee7d..474de674e037 100644 --- a/drivers/comedi/drivers/das1800.c +++ b/drivers/comedi/drivers/das1800.c @@ -144,28 +144,28 @@ static const struct comedi_lrange das1801_ai_range = { 8, { - BIP_RANGE(5), /* bipolar gain = 1 */ - BIP_RANGE(1), /* bipolar gain = 10 */ - BIP_RANGE(0.1), /* bipolar gain = 50 */ - BIP_RANGE(0.02), /* bipolar gain = 250 */ - UNI_RANGE(5), /* unipolar gain = 1 */ - UNI_RANGE(1), /* unipolar gain = 10 */ - UNI_RANGE(0.1), /* unipolar gain = 50 */ - UNI_RANGE(0.02) /* unipolar gain = 250 */ - } + BIP_RANGE(5), /* bipolar gain = 1 */ + BIP_RANGE(1), /* bipolar gain = 10 */ + BIP_RANGE(0.1), /* bipolar gain = 50 */ + BIP_RANGE(0.02), /* bipolar gain = 250 */ + UNI_RANGE(5), /* unipolar gain = 1 */ + UNI_RANGE(1), /* unipolar gain = 10 */ + UNI_RANGE(0.1), /* unipolar gain = 50 */ + UNI_RANGE(0.02) /* unipolar gain = 250 */ + } }; static const struct comedi_lrange das1802_ai_range = { 8, { - BIP_RANGE(10), /* bipolar gain = 1 */ - BIP_RANGE(5), /* bipolar gain = 2 */ - BIP_RANGE(2.5), /* bipolar gain = 4 */ - BIP_RANGE(1.25), /* bipolar gain = 8 */ - UNI_RANGE(10), /* unipolar gain = 1 */ - UNI_RANGE(5), /* unipolar gain = 2 */ - UNI_RANGE(2.5), /* unipolar gain = 4 */ - UNI_RANGE(1.25) /* unipolar gain = 8 */ - } + BIP_RANGE(10), /* bipolar gain = 1 */ + BIP_RANGE(5), /* bipolar gain = 2 */ + BIP_RANGE(2.5), /* bipolar gain = 4 */ + BIP_RANGE(1.25), /* bipolar gain = 8 */ + UNI_RANGE(10), /* unipolar gain = 1 */ + UNI_RANGE(5), /* unipolar gain = 2 */ + UNI_RANGE(2.5), /* unipolar gain = 4 */ + UNI_RANGE(1.25) /* unipolar gain = 8 */ + } }; /* @@ -212,102 +212,102 @@ struct das1800_board { static const struct das1800_board das1800_boards[] = { [BOARD_DAS1701ST] = { - .name = "das-1701st", - .id = DAS1800_ID_ST, - .ai_speed = 6250, - .is_01_series = 1, - }, + .name = "das-1701st", + .id = DAS1800_ID_ST, + .ai_speed = 6250, + .is_01_series = 1, + }, [BOARD_DAS1701ST_DA] = { - .name = "das-1701st-da", - .id = DAS1800_ID_ST_DA, - .ai_speed = 6250, - .is_01_series = 1, - }, + .name = "das-1701st-da", + .id = DAS1800_ID_ST_DA, + .ai_speed = 6250, + .is_01_series = 1, + }, [BOARD_DAS1702ST] = { - .name = "das-1702st", - .id = DAS1800_ID_ST, - .ai_speed = 6250, - }, + .name = "das-1702st", + .id = DAS1800_ID_ST, + .ai_speed = 6250, + }, [BOARD_DAS1702ST_DA] = { - .name = "das-1702st-da", - .id = DAS1800_ID_ST_DA, - .ai_speed = 6250, - }, + .name = "das-1702st-da", + .id = DAS1800_ID_ST_DA, + .ai_speed = 6250, + }, [BOARD_DAS1702HR] = { - .name = "das-1702hr", - .id = DAS1800_ID_HR, - .ai_speed = 20000, - }, + .name = "das-1702hr", + .id = DAS1800_ID_HR, + .ai_speed = 20000, + }, [BOARD_DAS1702HR_DA] = { - .name = "das-1702hr-da", - .id = DAS1800_ID_HR_DA, - .ai_speed = 20000, - }, + .name = "das-1702hr-da", + .id = DAS1800_ID_HR_DA, + .ai_speed = 20000, + }, [BOARD_DAS1701AO] = { - .name = "das-1701ao", - .id = DAS1800_ID_AO, - .ai_speed = 6250, - .is_01_series = 1, - }, + .name = "das-1701ao", + .id = DAS1800_ID_AO, + .ai_speed = 6250, + .is_01_series = 1, + }, [BOARD_DAS1702AO] = { - .name = "das-1702ao", - .id = DAS1800_ID_AO, - .ai_speed = 6250, - }, + .name = "das-1702ao", + .id = DAS1800_ID_AO, + .ai_speed = 6250, + }, [BOARD_DAS1801ST] = { - .name = "das-1801st", - .id = DAS1800_ID_ST, - .ai_speed = 3000, - .is_01_series = 1, - }, + .name = "das-1801st", + .id = DAS1800_ID_ST, + .ai_speed = 3000, + .is_01_series = 1, + }, [BOARD_DAS1801ST_DA] = { - .name = "das-1801st-da", - .id = DAS1800_ID_ST_DA, - .ai_speed = 3000, - .is_01_series = 1, - }, + .name = "das-1801st-da", + .id = DAS1800_ID_ST_DA, + .ai_speed = 3000, + .is_01_series = 1, + }, [BOARD_DAS1802ST] = { - .name = "das-1802st", - .id = DAS1800_ID_ST, - .ai_speed = 3000, - }, + .name = "das-1802st", + .id = DAS1800_ID_ST, + .ai_speed = 3000, + }, [BOARD_DAS1802ST_DA] = { - .name = "das-1802st-da", - .id = DAS1800_ID_ST_DA, - .ai_speed = 3000, - }, + .name = "das-1802st-da", + .id = DAS1800_ID_ST_DA, + .ai_speed = 3000, + }, [BOARD_DAS1802HR] = { - .name = "das-1802hr", - .id = DAS1800_ID_HR, - .ai_speed = 10000, - }, + .name = "das-1802hr", + .id = DAS1800_ID_HR, + .ai_speed = 10000, + }, [BOARD_DAS1802HR_DA] = { - .name = "das-1802hr-da", - .id = DAS1800_ID_HR_DA, - .ai_speed = 10000, - }, + .name = "das-1802hr-da", + .id = DAS1800_ID_HR_DA, + .ai_speed = 10000, + }, [BOARD_DAS1801HC] = { - .name = "das-1801hc", - .id = DAS1800_ID_HC, - .ai_speed = 3000, - .is_01_series = 1, - }, + .name = "das-1801hc", + .id = DAS1800_ID_HC, + .ai_speed = 3000, + .is_01_series = 1, + }, [BOARD_DAS1802HC] = { - .name = "das-1802hc", - .id = DAS1800_ID_HC, - .ai_speed = 3000, - }, + .name = "das-1802hc", + .id = DAS1800_ID_HC, + .ai_speed = 3000, + }, [BOARD_DAS1801AO] = { - .name = "das-1801ao", - .id = DAS1800_ID_AO, - .ai_speed = 3000, - .is_01_series = 1, - }, + .name = "das-1801ao", + .id = DAS1800_ID_AO, + .ai_speed = 3000, + .is_01_series = 1, + }, [BOARD_DAS1802AO] = { - .name = "das-1802ao", - .id = DAS1800_ID_AO, - .ai_speed = 3000, - }, + .name = "das-1802ao", + .id = DAS1800_ID_AO, + .ai_speed = 3000, + }, }; struct das1800_private { @@ -548,8 +548,8 @@ static int das1800_ai_fixup_paced_timing(struct comedi_device *dev, /* * Paced mode: - * scan_begin_src is TRIG_FOLLOW - * convert_src is TRIG_TIMER + * scan_begin_src is TRIG_FOLLOW + * convert_src is TRIG_TIMER * * The convert_arg sets the pacer sample acquisition time. * The max acquisition speed is limited to the boards @@ -568,8 +568,8 @@ static int das1800_ai_fixup_burst_timing(struct comedi_device *dev, /* * Burst mode: - * scan_begin_src is TRIG_TIMER or TRIG_EXT - * convert_src is TRIG_TIMER + * scan_begin_src is TRIG_TIMER or TRIG_EXT + * convert_src is TRIG_TIMER * * The convert_arg sets burst sample acquisition time. * The max acquisition speed is limited to the boards @@ -707,7 +707,7 @@ static int das1800_ai_cmdtest(struct comedi_device *dev, if (cmd->convert_src == TRIG_TIMER) { if (cmd->scan_begin_src == TRIG_FOLLOW) err |= das1800_ai_fixup_paced_timing(dev, cmd); - else /* TRIG_TIMER or TRIG_EXT */ + else /* TRIG_TIMER or TRIG_EXT */ err |= das1800_ai_fixup_burst_timing(dev, cmd); } @@ -832,8 +832,7 @@ static void das1800_ai_set_chanlist(struct comedi_device *dev, spin_unlock_irqrestore(&dev->spinlock, flags); } -static int das1800_ai_cmd(struct comedi_device *dev, - struct comedi_subdevice *s) +static int das1800_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) { struct das1800_private *devpriv = dev->private; int control_a, control_c; @@ -867,7 +866,7 @@ static int das1800_ai_cmd(struct comedi_device *dev, control_a |= ATEN; if (cmd->start_src == TRIG_EXT) control_a |= TGEN | CGSL; - else /* TRIG_NOW */ + else /* TRIG_NOW */ control_a |= CGEN; if (control_a & (ATEN | TGEN)) { if ((cmd->start_arg & CR_INVERT) || (cmd->stop_arg & CR_INVERT)) @@ -881,14 +880,14 @@ static int das1800_ai_cmd(struct comedi_device *dev, if (cmd->convert_src == TRIG_TIMER) { /* trig on cascaded counters */ control_c |= IPCLK; - } else { /* TRIG_EXT */ + } else { /* TRIG_EXT */ /* trig on falling edge of external trigger */ control_c |= XPCLK; } } else if (cmd->scan_begin_src == TRIG_TIMER) { /* burst mode with internal pacer clock */ control_c |= BMDE | IPCLK; - } else { /* TRIG_EXT */ + } else { /* TRIG_EXT */ /* burst mode with external trigger */ control_c |= BMDE | XPCLK; } @@ -926,8 +925,7 @@ static int das1800_ai_cmd(struct comedi_device *dev, static int das1800_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned char status; @@ -939,8 +937,7 @@ static int das1800_ai_eoc(struct comedi_device *dev, static int das1800_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int range = CR_RANGE(insn->chanspec); bool is_unipolar = comedi_range_is_unipolar(s, range); @@ -949,8 +946,7 @@ static int das1800_ai_insn_read(struct comedi_device *dev, unsigned short dpnt; unsigned long flags; - outb(das1800_ai_chanspec_bits(s, insn->chanspec), - dev->iobase + DAS1800_CONTROL_C); /* software pacer */ + outb(das1800_ai_chanspec_bits(s, insn->chanspec), dev->iobase + DAS1800_CONTROL_C); /* software pacer */ outb(CVEN, dev->iobase + DAS1800_STATUS); /* enable conversions */ outb(0x0, dev->iobase + DAS1800_CONTROL_A); /* reset fifo */ outb(FFEN, dev->iobase + DAS1800_CONTROL_A); @@ -983,8 +979,7 @@ static int das1800_ai_insn_read(struct comedi_device *dev, static int das1800_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int update_chan = s->n_chan - 1; @@ -1020,8 +1015,7 @@ static int das1800_ao_insn_write(struct comedi_device *dev, static int das1800_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { data[1] = inb(dev->iobase + DAS1800_DIGITAL) & 0xf; data[0] = 0; @@ -1031,8 +1025,7 @@ static int das1800_di_insn_bits(struct comedi_device *dev, static int das1800_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { if (comedi_dio_update_state(s, data)) outb(s->state, dev->iobase + DAS1800_DIGITAL); @@ -1057,22 +1050,22 @@ static void das1800_init_dma(struct comedi_device *dev, dma_chan = &it->options[2]; switch ((dma_chan[0] & 0x7) | (dma_chan[1] << 4)) { - case 0x5: /* dma0 == 5 */ + case 0x5: /* dma0 == 5 */ devpriv->dma_bits = DMA_CH5; break; - case 0x6: /* dma0 == 6 */ + case 0x6: /* dma0 == 6 */ devpriv->dma_bits = DMA_CH6; break; - case 0x7: /* dma0 == 7 */ + case 0x7: /* dma0 == 7 */ devpriv->dma_bits = DMA_CH7; break; - case 0x65: /* dma0 == 5, dma1 == 6 */ + case 0x65: /* dma0 == 5, dma1 == 6 */ devpriv->dma_bits = DMA_CH5_CH6; break; - case 0x76: /* dma0 == 6, dma1 == 7 */ + case 0x76: /* dma0 == 6, dma1 == 7 */ devpriv->dma_bits = DMA_CH6_CH7; break; - case 0x57: /* dma0 == 7, dma1 == 5 */ + case 0x57: /* dma0 == 7, dma1 == 5 */ devpriv->dma_bits = DMA_CH7_CH5; break; default: @@ -1117,11 +1110,11 @@ static int das1800_probe(struct comedi_device *dev) return -ENODEV; } - /* - * If the dev->board_ptr is not set, the user is trying to attach - * an unspecified board to this driver. In this case the id is used - * to 'probe' for the dev->board_ptr. - */ + /* + * If the dev->board_ptr is not set, the user is trying to attach + * an unspecified board to this driver. In this case the id is used + * to 'probe' for the dev->board_ptr. + */ switch (id) { case DAS1800_ID_ST_DA: /* das-1701st-da, das-1702st-da, das-1801st-da, das-1802st-da */ @@ -1259,35 +1252,35 @@ static int das1800_attach(struct comedi_device *dev, * actual physical channel mapping is when EXP-1800 boards are used. */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_DIFF | SDF_GROUND; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_DIFF | SDF_GROUND; if (board->id != DAS1800_ID_HC) - s->subdev_flags |= SDF_COMMON; - s->n_chan = (board->id == DAS1800_ID_HC) ? 64 : 256; - s->maxdata = is_16bit ? 0xffff : 0x0fff; - s->range_table = board->is_01_series ? &das1801_ai_range - : &das1802_ai_range; - s->insn_read = das1800_ai_insn_read; + s->subdev_flags |= SDF_COMMON; + s->n_chan = (board->id == DAS1800_ID_HC) ? 64 : 256; + s->maxdata = is_16bit ? 0xffff : 0x0fff; + s->range_table = board->is_01_series ? &das1801_ai_range + : &das1802_ai_range; + s->insn_read = das1800_ai_insn_read; if (dev->irq) { dev->read_subdev = s; - s->subdev_flags |= SDF_CMD_READ; - s->len_chanlist = s->n_chan; - s->do_cmd = das1800_ai_cmd; - s->do_cmdtest = das1800_ai_cmdtest; - s->poll = das1800_ai_poll; - s->cancel = das1800_ai_cancel; - s->munge = das1800_ai_munge; + s->subdev_flags |= SDF_CMD_READ; + s->len_chanlist = s->n_chan; + s->do_cmd = das1800_ai_cmd; + s->do_cmdtest = das1800_ai_cmdtest; + s->poll = das1800_ai_poll; + s->cancel = das1800_ai_cancel; + s->munge = das1800_ai_munge; } /* Analog Output subdevice */ s = &dev->subdevices[1]; if (board->id == DAS1800_ID_ST_DA || board->id == DAS1800_ID_HR_DA) { - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = (board->id == DAS1800_ID_ST_DA) ? 4 : 2; - s->maxdata = is_16bit ? 0xffff : 0x0fff; - s->range_table = &range_bipolar10; - s->insn_write = das1800_ao_insn_write; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = (board->id == DAS1800_ID_ST_DA) ? 4 : 2; + s->maxdata = is_16bit ? 0xffff : 0x0fff; + s->range_table = &range_bipolar10; + s->insn_write = das1800_ao_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) @@ -1304,28 +1297,28 @@ static int das1800_attach(struct comedi_device *dev, * 'ao' boards have waveform analog outputs that are not * currently supported. */ - s->type = COMEDI_SUBD_UNUSED; + s->type = COMEDI_SUBD_UNUSED; } else { - s->type = COMEDI_SUBD_UNUSED; + s->type = COMEDI_SUBD_UNUSED; } /* Digital Input subdevice */ s = &dev->subdevices[2]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 4; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = das1800_di_insn_bits; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 4; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = das1800_di_insn_bits; /* Digital Output subdevice */ s = &dev->subdevices[3]; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = (board->id == DAS1800_ID_HC) ? 8 : 4; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = das1800_do_insn_bits; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = (board->id == DAS1800_ID_HC) ? 8 : 4; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = das1800_do_insn_bits; das1800_ai_cancel(dev, dev->read_subdev); @@ -1349,14 +1342,15 @@ static void das1800_detach(struct comedi_device *dev) } static struct comedi_driver das1800_driver = { - .driver_name = "das1800", - .module = THIS_MODULE, - .attach = das1800_attach, - .detach = das1800_detach, - .num_names = ARRAY_SIZE(das1800_boards), - .board_name = &das1800_boards[0].name, - .offset = sizeof(struct das1800_board), + .driver_name = "das1800", + .module = THIS_MODULE, + .attach = das1800_attach, + .detach = das1800_detach, + .num_names = ARRAY_SIZE(das1800_boards), + .board_name = &das1800_boards[0].name, + .offset = sizeof(struct das1800_board), }; + module_comedi_driver(das1800_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/das6402.c b/drivers/comedi/drivers/das6402.c index 96f4107b8054..fca3c1a16fdf 100644 --- a/drivers/comedi/drivers/das6402.c +++ b/drivers/comedi/drivers/das6402.c @@ -89,15 +89,15 @@ static const struct comedi_lrange das6402_ai_ranges = { 8, { - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(2.5), - BIP_RANGE(1.25), - UNI_RANGE(10), - UNI_RANGE(5), - UNI_RANGE(2.5), - UNI_RANGE(1.25) - } + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(2.5), + BIP_RANGE(1.25), + UNI_RANGE(10), + UNI_RANGE(5), + UNI_RANGE(2.5), + UNI_RANGE(1.25) + } }; /* @@ -107,11 +107,11 @@ static const struct comedi_lrange das6402_ai_ranges = { */ static const struct comedi_lrange das6402_ao_ranges = { 4, { - BIP_RANGE(5), - BIP_RANGE(10), - UNI_RANGE(5), - UNI_RANGE(10) - } + BIP_RANGE(5), + BIP_RANGE(10), + UNI_RANGE(5), + UNI_RANGE(10) + } }; struct das6402_boardinfo { @@ -121,12 +121,12 @@ struct das6402_boardinfo { static struct das6402_boardinfo das6402_boards[] = { { - .name = "das6402-12", - .maxdata = 0x0fff, - }, { - .name = "das6402-16", - .maxdata = 0xffff, - }, + .name = "das6402-12", + .maxdata = 0x0fff, + }, { + .name = "das6402-16", + .maxdata = 0xffff, + }, }; struct das6402_private { @@ -134,14 +134,12 @@ struct das6402_private { unsigned int ao_range; }; -static void das6402_set_mode(struct comedi_device *dev, - unsigned int mode) +static void das6402_set_mode(struct comedi_device *dev, unsigned int mode) { outb(DAS6402_MODE_ENHANCED | mode, dev->iobase + DAS6402_MODE_REG); } -static void das6402_set_extended(struct comedi_device *dev, - unsigned int val) +static void das6402_set_extended(struct comedi_device *dev, unsigned int val) { outb(DAS6402_STATUS_W_EXTEND, dev->iobase + DAS6402_STATUS_REG); outb(DAS6402_STATUS_W_EXTEND | val, dev->iobase + DAS6402_STATUS_REG); @@ -205,8 +203,7 @@ static irqreturn_t das6402_interrupt(int irq, void *d) static void das6402_ai_set_mode(struct comedi_device *dev, struct comedi_subdevice *s, - unsigned int chanspec, - unsigned int mode) + unsigned int chanspec, unsigned int mode) { unsigned int range = CR_RANGE(chanspec); unsigned int aref = CR_AREF(chanspec); @@ -220,8 +217,7 @@ static void das6402_ai_set_mode(struct comedi_device *dev, das6402_set_mode(dev, mode); } -static int das6402_ai_cmd(struct comedi_device *dev, - struct comedi_subdevice *s) +static int das6402_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) { struct das6402_private *devpriv = dev->private; struct comedi_cmd *cmd = &s->async->cmd; @@ -324,7 +320,7 @@ static int das6402_ai_cmdtest(struct comedi_device *dev, if (cmd->stop_src == TRIG_COUNT) err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); - else /* TRIG_NONE */ + else /* TRIG_NONE */ err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) @@ -364,8 +360,7 @@ static void das6402_ai_soft_trig(struct comedi_device *dev) static int das6402_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned int status; @@ -377,8 +372,7 @@ static int das6402_ai_eoc(struct comedi_device *dev, static int das6402_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int aref = CR_AREF(insn->chanspec); @@ -415,8 +409,7 @@ static int das6402_ai_insn_read(struct comedi_device *dev, static int das6402_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct das6402_private *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -475,8 +468,7 @@ static int das6402_ao_insn_write(struct comedi_device *dev, static int das6402_ao_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); @@ -491,8 +483,7 @@ static int das6402_ao_insn_read(struct comedi_device *dev, static int das6402_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { data[1] = inb(dev->iobase + DAS6402_DI_DO_REG); @@ -501,8 +492,7 @@ static int das6402_di_insn_bits(struct comedi_device *dev, static int das6402_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { if (comedi_dio_update_state(s, data)) outb(s->state, dev->iobase + DAS6402_DI_DO_REG); @@ -527,9 +517,8 @@ static void das6402_reset(struct comedi_device *dev) /* default ADC to single-ended unipolar 10V inputs */ das6402_set_mode(dev, DAS6402_MODE_RANGE(0) | - DAS6402_MODE_POLLED | - DAS6402_MODE_SE | - DAS6402_MODE_UNI); + DAS6402_MODE_POLLED | + DAS6402_MODE_SE | DAS6402_MODE_UNI); /* default mux for single channel conversion (channel 0) */ outw(DAS6402_AI_MUX_HI(0) | DAS6402_AI_MUX_LO(0), @@ -603,30 +592,30 @@ static int das6402_attach(struct comedi_device *dev, /* Analog Input subdevice */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF; - s->n_chan = 64; - s->maxdata = board->maxdata; - s->range_table = &das6402_ai_ranges; - s->insn_read = das6402_ai_insn_read; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF; + s->n_chan = 64; + s->maxdata = board->maxdata; + s->range_table = &das6402_ai_ranges; + s->insn_read = das6402_ai_insn_read; if (dev->irq) { dev->read_subdev = s; - s->subdev_flags |= SDF_CMD_READ; - s->len_chanlist = s->n_chan; - s->do_cmdtest = das6402_ai_cmdtest; - s->do_cmd = das6402_ai_cmd; - s->cancel = das6402_ai_cancel; + s->subdev_flags |= SDF_CMD_READ; + s->len_chanlist = s->n_chan; + s->do_cmdtest = das6402_ai_cmdtest; + s->do_cmd = das6402_ai_cmd; + s->cancel = das6402_ai_cancel; } /* Analog Output subdevice */ s = &dev->subdevices[1]; - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 2; - s->maxdata = board->maxdata; - s->range_table = &das6402_ao_ranges; - s->insn_write = das6402_ao_insn_write; - s->insn_read = das6402_ao_insn_read; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 2; + s->maxdata = board->maxdata; + s->range_table = &das6402_ao_ranges; + s->insn_write = das6402_ao_insn_write; + s->insn_read = das6402_ao_insn_read; ret = comedi_alloc_subdev_readback(s); if (ret) @@ -634,36 +623,36 @@ static int das6402_attach(struct comedi_device *dev, /* Digital Input subdevice */ s = &dev->subdevices[2]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 8; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = das6402_di_insn_bits; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 8; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = das6402_di_insn_bits; /* Digital Input subdevice */ s = &dev->subdevices[3]; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 8; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = das6402_do_insn_bits; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 8; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = das6402_do_insn_bits; return 0; } static struct comedi_driver das6402_driver = { - .driver_name = "das6402", - .module = THIS_MODULE, - .attach = das6402_attach, - .detach = comedi_legacy_detach, - .board_name = &das6402_boards[0].name, - .num_names = ARRAY_SIZE(das6402_boards), - .offset = sizeof(struct das6402_boardinfo), + .driver_name = "das6402", + .module = THIS_MODULE, + .attach = das6402_attach, + .detach = comedi_legacy_detach, + .board_name = &das6402_boards[0].name, + .num_names = ARRAY_SIZE(das6402_boards), + .offset = sizeof(struct das6402_boardinfo), }; -module_comedi_driver(das6402_driver) -MODULE_AUTHOR("H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>"); +module_comedi_driver(das6402_driver) + MODULE_AUTHOR("H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>"); MODULE_DESCRIPTION("Comedi driver for DAS6402 compatible boards"); MODULE_LICENSE("GPL"); diff --git a/drivers/comedi/drivers/das800.c b/drivers/comedi/drivers/das800.c index bc08324f422f..cbf7a9cad5d6 100644 --- a/drivers/comedi/drivers/das800.c +++ b/drivers/comedi/drivers/das800.c @@ -73,8 +73,8 @@ #define IRQ 0x8 #define BUSY 0x80 #define DAS800_GAIN 3 -#define CIO_FFOV 0x8 /* cio-das802/16 fifo overflow */ -#define CIO_ENHF 0x90 /* cio-das802/16 fifo half full int ena */ +#define CIO_FFOV 0x8 /* cio-das802/16 fifo overflow */ +#define CIO_ENHF 0x90 /* cio-das802/16 fifo half full int ena */ #define CONTROL1 0x80 #define CONV_CONTROL 0xa0 #define SCAN_LIMITS 0xc0 @@ -96,57 +96,57 @@ struct das800_board { static const struct comedi_lrange range_das801_ai = { 9, { - BIP_RANGE(5), - BIP_RANGE(10), - UNI_RANGE(10), - BIP_RANGE(0.5), - UNI_RANGE(1), - BIP_RANGE(0.05), - UNI_RANGE(0.1), - BIP_RANGE(0.01), - UNI_RANGE(0.02) - } + BIP_RANGE(5), + BIP_RANGE(10), + UNI_RANGE(10), + BIP_RANGE(0.5), + UNI_RANGE(1), + BIP_RANGE(0.05), + UNI_RANGE(0.1), + BIP_RANGE(0.01), + UNI_RANGE(0.02) + } }; static const struct comedi_lrange range_cio_das801_ai = { 9, { - BIP_RANGE(5), - BIP_RANGE(10), - UNI_RANGE(10), - BIP_RANGE(0.5), - UNI_RANGE(1), - BIP_RANGE(0.05), - UNI_RANGE(0.1), - BIP_RANGE(0.005), - UNI_RANGE(0.01) - } + BIP_RANGE(5), + BIP_RANGE(10), + UNI_RANGE(10), + BIP_RANGE(0.5), + UNI_RANGE(1), + BIP_RANGE(0.05), + UNI_RANGE(0.1), + BIP_RANGE(0.005), + UNI_RANGE(0.01) + } }; static const struct comedi_lrange range_das802_ai = { 9, { - BIP_RANGE(5), - BIP_RANGE(10), - UNI_RANGE(10), - BIP_RANGE(2.5), - UNI_RANGE(5), - BIP_RANGE(1.25), - UNI_RANGE(2.5), - BIP_RANGE(0.625), - UNI_RANGE(1.25) - } + BIP_RANGE(5), + BIP_RANGE(10), + UNI_RANGE(10), + BIP_RANGE(2.5), + UNI_RANGE(5), + BIP_RANGE(1.25), + UNI_RANGE(2.5), + BIP_RANGE(0.625), + UNI_RANGE(1.25) + } }; static const struct comedi_lrange range_das80216_ai = { 8, { - BIP_RANGE(10), - UNI_RANGE(10), - BIP_RANGE(5), - UNI_RANGE(5), - BIP_RANGE(2.5), - UNI_RANGE(2.5), - BIP_RANGE(1.25), - UNI_RANGE(1.25) - } + BIP_RANGE(10), + UNI_RANGE(10), + BIP_RANGE(5), + UNI_RANGE(5), + BIP_RANGE(2.5), + UNI_RANGE(2.5), + BIP_RANGE(1.25), + UNI_RANGE(1.25) + } }; enum das800_boardinfo { @@ -161,47 +161,47 @@ enum das800_boardinfo { static const struct das800_board das800_boards[] = { [BOARD_DAS800] = { - .name = "das-800", - .ai_speed = 25000, - .ai_range = &range_bipolar5, - .resolution = 12, - }, + .name = "das-800", + .ai_speed = 25000, + .ai_range = &range_bipolar5, + .resolution = 12, + }, [BOARD_CIODAS800] = { - .name = "cio-das800", - .ai_speed = 20000, - .ai_range = &range_bipolar5, - .resolution = 12, - }, + .name = "cio-das800", + .ai_speed = 20000, + .ai_range = &range_bipolar5, + .resolution = 12, + }, [BOARD_DAS801] = { - .name = "das-801", - .ai_speed = 25000, - .ai_range = &range_das801_ai, - .resolution = 12, - }, + .name = "das-801", + .ai_speed = 25000, + .ai_range = &range_das801_ai, + .resolution = 12, + }, [BOARD_CIODAS801] = { - .name = "cio-das801", - .ai_speed = 20000, - .ai_range = &range_cio_das801_ai, - .resolution = 12, - }, + .name = "cio-das801", + .ai_speed = 20000, + .ai_range = &range_cio_das801_ai, + .resolution = 12, + }, [BOARD_DAS802] = { - .name = "das-802", - .ai_speed = 25000, - .ai_range = &range_das802_ai, - .resolution = 12, - }, + .name = "das-802", + .ai_speed = 25000, + .ai_range = &range_das802_ai, + .resolution = 12, + }, [BOARD_CIODAS802] = { - .name = "cio-das802", - .ai_speed = 20000, - .ai_range = &range_das802_ai, - .resolution = 12, - }, + .name = "cio-das802", + .ai_speed = 20000, + .ai_range = &range_das802_ai, + .resolution = 12, + }, [BOARD_CIODAS80216] = { - .name = "cio-das802/16", - .ai_speed = 10000, - .ai_range = &range_das80216_ai, - .resolution = 16, - }, + .name = "cio-das802/16", + .ai_speed = 10000, + .ai_range = &range_das80216_ai, + .resolution = 16, + }, }; struct das800_private { @@ -335,7 +335,7 @@ static int das800_ai_do_cmdtest(struct comedi_device *dev, if (cmd->stop_src == TRIG_COUNT) err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); - else /* TRIG_NONE */ + else /* TRIG_NONE */ err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) @@ -463,7 +463,7 @@ static irqreturn_t das800_interrupt(int irq, void *d) /* cio-das802/16 has no fifo empty status bit */ fifo_empty = false; fifo_overflow = !!(inb(dev->iobase + DAS800_GAIN) & - CIO_FFOV); + CIO_FFOV); } if (fifo_empty || fifo_overflow) break; @@ -507,8 +507,7 @@ static irqreturn_t das800_interrupt(int irq, void *d) static int das800_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned int status; @@ -520,8 +519,7 @@ static int das800_ai_eoc(struct comedi_device *dev, static int das800_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct das800_private *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -565,8 +563,7 @@ static int das800_ai_insn_read(struct comedi_device *dev, static int das800_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { data[1] = (inb(dev->iobase + DAS800_STATUS) >> 4) & 0x7; @@ -575,8 +572,7 @@ static int das800_di_insn_bits(struct comedi_device *dev, static int das800_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct das800_private *devpriv = dev->private; unsigned long irq_flags; @@ -668,8 +664,7 @@ static int das800_attach(struct comedi_device *dev, struct comedi_devconfig *it) dev->board_name = board->name; if (irq > 1 && irq <= 7) { - ret = request_irq(irq, das800_interrupt, 0, "das800", - dev); + ret = request_irq(irq, das800_interrupt, 0, "das800", dev); if (ret == 0) dev->irq = irq; } @@ -686,37 +681,37 @@ static int das800_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* Analog Input subdevice */ s = &dev->subdevices[0]; dev->read_subdev = s; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_GROUND; - s->n_chan = 8; - s->maxdata = (1 << board->resolution) - 1; - s->range_table = board->ai_range; - s->insn_read = das800_ai_insn_read; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_GROUND; + s->n_chan = 8; + s->maxdata = (1 << board->resolution) - 1; + s->range_table = board->ai_range; + s->insn_read = das800_ai_insn_read; if (dev->irq) { - s->subdev_flags |= SDF_CMD_READ; - s->len_chanlist = 8; - s->do_cmdtest = das800_ai_do_cmdtest; - s->do_cmd = das800_ai_do_cmd; - s->cancel = das800_cancel; + s->subdev_flags |= SDF_CMD_READ; + s->len_chanlist = 8; + s->do_cmdtest = das800_ai_do_cmdtest; + s->do_cmd = das800_ai_do_cmd; + s->cancel = das800_cancel; } /* Digital Input subdevice */ s = &dev->subdevices[1]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 3; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = das800_di_insn_bits; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 3; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = das800_di_insn_bits; /* Digital Output subdevice */ s = &dev->subdevices[2]; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 4; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = das800_do_insn_bits; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 4; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = das800_do_insn_bits; das800_disable(dev); @@ -729,14 +724,15 @@ static int das800_attach(struct comedi_device *dev, struct comedi_devconfig *it) }; static struct comedi_driver driver_das800 = { - .driver_name = "das800", - .module = THIS_MODULE, - .attach = das800_attach, - .detach = comedi_legacy_detach, - .num_names = ARRAY_SIZE(das800_boards), - .board_name = &das800_boards[0].name, - .offset = sizeof(struct das800_board), + .driver_name = "das800", + .module = THIS_MODULE, + .attach = das800_attach, + .detach = comedi_legacy_detach, + .num_names = ARRAY_SIZE(das800_boards), + .board_name = &das800_boards[0].name, + .offset = sizeof(struct das800_board), }; + module_comedi_driver(driver_das800); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/dmm32at.c b/drivers/comedi/drivers/dmm32at.c index 56682f01242f..a6535b2ba7c0 100644 --- a/drivers/comedi/drivers/dmm32at.c +++ b/drivers/comedi/drivers/dmm32at.c @@ -37,19 +37,19 @@ #define DMM32AT_AI_START_CONV_REG 0x00 #define DMM32AT_AI_LSB_REG 0x00 #define DMM32AT_AUX_DOUT_REG 0x01 -#define DMM32AT_AUX_DOUT2 BIT(2) /* J3.42 - OUT2 (OUT2EN) */ -#define DMM32AT_AUX_DOUT1 BIT(1) /* J3.43 */ -#define DMM32AT_AUX_DOUT0 BIT(0) /* J3.44 - OUT0 (OUT0EN) */ +#define DMM32AT_AUX_DOUT2 BIT(2) /* J3.42 - OUT2 (OUT2EN) */ +#define DMM32AT_AUX_DOUT1 BIT(1) /* J3.43 */ +#define DMM32AT_AUX_DOUT0 BIT(0) /* J3.44 - OUT0 (OUT0EN) */ #define DMM32AT_AI_MSB_REG 0x01 #define DMM32AT_AI_LO_CHAN_REG 0x02 #define DMM32AT_AI_HI_CHAN_REG 0x03 #define DMM32AT_AUX_DI_REG 0x04 #define DMM32AT_AUX_DI_DACBUSY BIT(7) #define DMM32AT_AUX_DI_CALBUSY BIT(6) -#define DMM32AT_AUX_DI3 BIT(3) /* J3.45 - ADCLK (CLKSEL) */ -#define DMM32AT_AUX_DI2 BIT(2) /* J3.46 - GATE12 (GT12EN) */ -#define DMM32AT_AUX_DI1 BIT(1) /* J3.47 - GATE0 (GT0EN) */ -#define DMM32AT_AUX_DI0 BIT(0) /* J3.48 - CLK0 (SRC0) */ +#define DMM32AT_AUX_DI3 BIT(3) /* J3.45 - ADCLK (CLKSEL) */ +#define DMM32AT_AUX_DI2 BIT(2) /* J3.46 - GATE12 (GT12EN) */ +#define DMM32AT_AUX_DI1 BIT(1) /* J3.47 - GATE0 (GT0EN) */ +#define DMM32AT_AUX_DI0 BIT(0) /* J3.48 - CLK0 (SRC0) */ #define DMM32AT_AO_LSB_REG 0x04 #define DMM32AT_AO_MSB_REG 0x05 #define DMM32AT_AO_MSB_DACH(x) ((x) << 6) @@ -83,27 +83,27 @@ #define DMM32AT_INTCLK_ADINT BIT(7) #define DMM32AT_INTCLK_DINT BIT(6) #define DMM32AT_INTCLK_TINT BIT(5) -#define DMM32AT_INTCLK_CLKEN BIT(1) /* 1=see below 0=software */ -#define DMM32AT_INTCLK_CLKSEL BIT(0) /* 1=OUT2 0=EXTCLK */ +#define DMM32AT_INTCLK_CLKEN BIT(1) /* 1=see below 0=software */ +#define DMM32AT_INTCLK_CLKSEL BIT(0) /* 1=OUT2 0=EXTCLK */ #define DMM32AT_CTRDIO_CFG_REG 0x0a -#define DMM32AT_CTRDIO_CFG_FREQ12 BIT(7) /* CLK12 1=100KHz 0=10MHz */ -#define DMM32AT_CTRDIO_CFG_FREQ0 BIT(6) /* CLK0 1=10KHz 0=10MHz */ -#define DMM32AT_CTRDIO_CFG_OUT2EN BIT(5) /* J3.42 1=OUT2 is DOUT2 */ -#define DMM32AT_CTRDIO_CFG_OUT0EN BIT(4) /* J3,44 1=OUT0 is DOUT0 */ -#define DMM32AT_CTRDIO_CFG_GT0EN BIT(2) /* J3.47 1=DIN1 is GATE0 */ -#define DMM32AT_CTRDIO_CFG_SRC0 BIT(1) /* CLK0 is 0=FREQ0 1=J3.48 */ -#define DMM32AT_CTRDIO_CFG_GT12EN BIT(0) /* J3.46 1=DIN2 is GATE12 */ +#define DMM32AT_CTRDIO_CFG_FREQ12 BIT(7) /* CLK12 1=100KHz 0=10MHz */ +#define DMM32AT_CTRDIO_CFG_FREQ0 BIT(6) /* CLK0 1=10KHz 0=10MHz */ +#define DMM32AT_CTRDIO_CFG_OUT2EN BIT(5) /* J3.42 1=OUT2 is DOUT2 */ +#define DMM32AT_CTRDIO_CFG_OUT0EN BIT(4) /* J3,44 1=OUT0 is DOUT0 */ +#define DMM32AT_CTRDIO_CFG_GT0EN BIT(2) /* J3.47 1=DIN1 is GATE0 */ +#define DMM32AT_CTRDIO_CFG_SRC0 BIT(1) /* CLK0 is 0=FREQ0 1=J3.48 */ +#define DMM32AT_CTRDIO_CFG_GT12EN BIT(0) /* J3.46 1=DIN2 is GATE12 */ #define DMM32AT_AI_CFG_REG 0x0b #define DMM32AT_AI_CFG_SCINT(x) ((x) << 4) #define DMM32AT_AI_CFG_SCINT_20US DMM32AT_AI_CFG_SCINT(0) #define DMM32AT_AI_CFG_SCINT_15US DMM32AT_AI_CFG_SCINT(1) #define DMM32AT_AI_CFG_SCINT_10US DMM32AT_AI_CFG_SCINT(2) #define DMM32AT_AI_CFG_SCINT_5US DMM32AT_AI_CFG_SCINT(3) -#define DMM32AT_AI_CFG_RANGE BIT(3) /* 0=5V 1=10V */ -#define DMM32AT_AI_CFG_ADBU BIT(2) /* 0=bipolar 1=unipolar */ +#define DMM32AT_AI_CFG_RANGE BIT(3) /* 0=5V 1=10V */ +#define DMM32AT_AI_CFG_ADBU BIT(2) /* 0=bipolar 1=unipolar */ #define DMM32AT_AI_CFG_GAIN(x) ((x) << 0) #define DMM32AT_AI_READBACK_REG 0x0b -#define DMM32AT_AI_READBACK_WAIT BIT(7) /* DMM32AT_AI_STATUS_STS */ +#define DMM32AT_AI_READBACK_WAIT BIT(7) /* DMM32AT_AI_STATUS_STS */ #define DMM32AT_AI_READBACK_RANGE BIT(3) #define DMM32AT_AI_READBACK_ADBU BIT(2) #define DMM32AT_AI_READBACK_GAIN_MASK (3 << 0) @@ -112,7 +112,7 @@ #define DMM32AT_CLK2 0x0e #define DMM32AT_CLKCT 0x0f -#define DMM32AT_8255_IOBASE 0x0c /* Page 1 registers */ +#define DMM32AT_8255_IOBASE 0x0c /* Page 1 registers */ /* Board register values. */ @@ -129,11 +129,11 @@ /* board AI ranges in comedi structure */ static const struct comedi_lrange dmm32at_airanges = { 4, { - UNI_RANGE(10), - UNI_RANGE(5), - BIP_RANGE(10), - BIP_RANGE(5) - } + UNI_RANGE(10), + UNI_RANGE(5), + BIP_RANGE(10), + BIP_RANGE(5) + } }; /* register values for above ranges */ @@ -149,11 +149,11 @@ static const unsigned char dmm32at_rangebits[] = { */ static const struct comedi_lrange dmm32at_aoranges = { 4, { - UNI_RANGE(10), - UNI_RANGE(5), - BIP_RANGE(10), - BIP_RANGE(5) - } + UNI_RANGE(10), + UNI_RANGE(5), + BIP_RANGE(10), + BIP_RANGE(5) + } }; static void dmm32at_ai_set_chanspec(struct comedi_device *dev, @@ -189,8 +189,7 @@ static unsigned int dmm32at_ai_get_sample(struct comedi_device *dev, static int dmm32at_ai_status(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned char status; @@ -202,8 +201,7 @@ static int dmm32at_ai_status(struct comedi_device *dev, static int dmm32at_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { int ret; int i; @@ -305,7 +303,7 @@ static int dmm32at_ai_cmdtest(struct comedi_device *dev, if (cmd->stop_src == TRIG_COUNT) err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); - else /* TRIG_NONE */ + else /* TRIG_NONE */ err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) @@ -437,8 +435,7 @@ static irqreturn_t dmm32at_isr(int irq, void *d) static int dmm32at_ao_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned char status; @@ -450,8 +447,7 @@ static int dmm32at_ao_eoc(struct comedi_device *dev, static int dmm32at_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); int i; @@ -570,29 +566,29 @@ static int dmm32at_attach(struct comedi_device *dev, /* Analog Input subdevice */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF; - s->n_chan = 32; - s->maxdata = 0xffff; - s->range_table = &dmm32at_airanges; - s->insn_read = dmm32at_ai_insn_read; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF; + s->n_chan = 32; + s->maxdata = 0xffff; + s->range_table = &dmm32at_airanges; + s->insn_read = dmm32at_ai_insn_read; if (dev->irq) { dev->read_subdev = s; - s->subdev_flags |= SDF_CMD_READ; - s->len_chanlist = s->n_chan; - s->do_cmd = dmm32at_ai_cmd; - s->do_cmdtest = dmm32at_ai_cmdtest; - s->cancel = dmm32at_ai_cancel; + s->subdev_flags |= SDF_CMD_READ; + s->len_chanlist = s->n_chan; + s->do_cmd = dmm32at_ai_cmd; + s->do_cmdtest = dmm32at_ai_cmdtest; + s->cancel = dmm32at_ai_cancel; } /* Analog Output subdevice */ s = &dev->subdevices[1]; - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 4; - s->maxdata = 0x0fff; - s->range_table = &dmm32at_aoranges; - s->insn_write = dmm32at_ao_insn_write; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 4; + s->maxdata = 0x0fff; + s->range_table = &dmm32at_aoranges; + s->insn_write = dmm32at_ao_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) @@ -604,11 +600,12 @@ static int dmm32at_attach(struct comedi_device *dev, } static struct comedi_driver dmm32at_driver = { - .driver_name = "dmm32at", - .module = THIS_MODULE, - .attach = dmm32at_attach, - .detach = comedi_legacy_detach, + .driver_name = "dmm32at", + .module = THIS_MODULE, + .attach = dmm32at_attach, + .detach = comedi_legacy_detach, }; + module_comedi_driver(dmm32at_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/dt2801.c b/drivers/comedi/drivers/dt2801.c index 0d571d817b4e..8e91b125c962 100644 --- a/drivers/comedi/drivers/dt2801.c +++ b/drivers/comedi/drivers/dt2801.c @@ -91,40 +91,40 @@ /* ignore 'defined but not used' warning */ static const struct comedi_lrange range_dt2801_ai_pgh_bipolar = { 4, { - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(2.5), - BIP_RANGE(1.25) - } + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(2.5), + BIP_RANGE(1.25) + } }; #endif static const struct comedi_lrange range_dt2801_ai_pgl_bipolar = { 4, { - BIP_RANGE(10), - BIP_RANGE(1), - BIP_RANGE(0.1), - BIP_RANGE(0.02) - } + BIP_RANGE(10), + BIP_RANGE(1), + BIP_RANGE(0.1), + BIP_RANGE(0.02) + } }; #if 0 /* ignore 'defined but not used' warning */ static const struct comedi_lrange range_dt2801_ai_pgh_unipolar = { 4, { - UNI_RANGE(10), - UNI_RANGE(5), - UNI_RANGE(2.5), - UNI_RANGE(1.25) - } + UNI_RANGE(10), + UNI_RANGE(5), + UNI_RANGE(2.5), + UNI_RANGE(1.25) + } }; #endif static const struct comedi_lrange range_dt2801_ai_pgl_unipolar = { 4, { - UNI_RANGE(10), - UNI_RANGE(1), - UNI_RANGE(0.1), - UNI_RANGE(0.02) - } + UNI_RANGE(10), + UNI_RANGE(1), + UNI_RANGE(0.1), + UNI_RANGE(0.02) + } }; struct dt2801_board { @@ -149,7 +149,7 @@ static const struct dt2801_board boardtypes[] = { .ad_chan = 16, .adbits = 12, .adrangetype = 0, - .dabits = 12}, + .dabits = 12 }, { .name = "dt2801-a", .boardcode = 0x52, @@ -157,7 +157,7 @@ static const struct dt2801_board boardtypes[] = { .ad_chan = 16, .adbits = 12, .adrangetype = 0, - .dabits = 12}, + .dabits = 12 }, { .name = "dt2801/5716a", .boardcode = 0x82, @@ -165,7 +165,7 @@ static const struct dt2801_board boardtypes[] = { .ad_chan = 16, .adbits = 16, .adrangetype = 1, - .dabits = 12}, + .dabits = 12 }, { .name = "dt2805", .boardcode = 0x12, @@ -173,7 +173,7 @@ static const struct dt2801_board boardtypes[] = { .ad_chan = 16, .adbits = 12, .adrangetype = 0, - .dabits = 12}, + .dabits = 12 }, { .name = "dt2805/5716a", .boardcode = 0x92, @@ -181,7 +181,7 @@ static const struct dt2801_board boardtypes[] = { .ad_chan = 16, .adbits = 16, .adrangetype = 1, - .dabits = 12}, + .dabits = 12 }, { .name = "dt2808", .boardcode = 0x20, @@ -189,7 +189,7 @@ static const struct dt2801_board boardtypes[] = { .ad_chan = 16, .adbits = 12, .adrangetype = 2, - .dabits = 8}, + .dabits = 8 }, { .name = "dt2818", .boardcode = 0xa2, @@ -197,7 +197,7 @@ static const struct dt2801_board boardtypes[] = { .ad_chan = 4, .adbits = 12, .adrangetype = 0, - .dabits = 12}, + .dabits = 12 }, { .name = "dt2809", .boardcode = 0xb0, @@ -205,7 +205,7 @@ static const struct dt2801_board boardtypes[] = { .ad_chan = 8, .adbits = 12, .adrangetype = 1, - .dabits = 12}, + .dabits = 12 }, }; struct dt2801_private { @@ -468,8 +468,7 @@ static int dt2801_ai_insn_read(struct comedi_device *dev, static int dt2801_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); @@ -484,8 +483,7 @@ static int dt2801_ao_insn_write(struct comedi_device *dev, static int dt2801_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { int which = (s == &dev->subdevices[3]) ? 1 : 0; unsigned int val = 0; @@ -507,8 +505,7 @@ static int dt2801_dio_insn_bits(struct comedi_device *dev, static int dt2801_dio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { int ret; @@ -633,11 +630,12 @@ static int dt2801_attach(struct comedi_device *dev, struct comedi_devconfig *it) } static struct comedi_driver dt2801_driver = { - .driver_name = "dt2801", - .module = THIS_MODULE, - .attach = dt2801_attach, - .detach = comedi_legacy_detach, + .driver_name = "dt2801", + .module = THIS_MODULE, + .attach = dt2801_attach, + .detach = comedi_legacy_detach, }; + module_comedi_driver(dt2801_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/dt2811.c b/drivers/comedi/drivers/dt2811.c index 0eb5e6ba6916..f088b976d603 100644 --- a/drivers/comedi/drivers/dt2811.c +++ b/drivers/comedi/drivers/dt2811.c @@ -62,8 +62,8 @@ #define DT2811_ADDATA_LO_REG 0x02 /* r A/D Data low byte */ #define DT2811_ADDATA_HI_REG 0x03 /* r A/D Data high byte */ -#define DT2811_DADATA_LO_REG(x) (0x02 + ((x) * 2)) /* w D/A Data low */ -#define DT2811_DADATA_HI_REG(x) (0x03 + ((x) * 2)) /* w D/A Data high */ +#define DT2811_DADATA_LO_REG(x) (0x02 + ((x) * 2)) /* w D/A Data low */ +#define DT2811_DADATA_HI_REG(x) (0x03 + ((x) * 2)) /* w D/A Data high */ #define DT2811_DI_REG 0x06 /* r Digital Input Port 0 */ #define DT2811_DO_REG 0x06 /* w Digital Output Port 1 */ @@ -108,40 +108,40 @@ static const unsigned int dt2811_clk_multipliers[] = { */ static const struct comedi_lrange dt2811_pgh_ai_ranges = { 12, { - BIP_RANGE(5), /* range 0: gain=1 */ - BIP_RANGE(2.5), /* range 1: gain=2 */ - BIP_RANGE(1.25), /* range 2: gain=4 */ - BIP_RANGE(0.625), /* range 3: gain=8 */ - - BIP_RANGE(2.5), /* range 0+4: gain=1 */ - BIP_RANGE(1.25), /* range 1+4: gain=2 */ - BIP_RANGE(0.625), /* range 2+4: gain=4 */ - BIP_RANGE(0.3125), /* range 3+4: gain=8 */ - - UNI_RANGE(5), /* range 0+8: gain=1 */ - UNI_RANGE(2.5), /* range 1+8: gain=2 */ - UNI_RANGE(1.25), /* range 2+8: gain=4 */ - UNI_RANGE(0.625) /* range 3+8: gain=8 */ - } + BIP_RANGE(5), /* range 0: gain=1 */ + BIP_RANGE(2.5), /* range 1: gain=2 */ + BIP_RANGE(1.25), /* range 2: gain=4 */ + BIP_RANGE(0.625), /* range 3: gain=8 */ + + BIP_RANGE(2.5), /* range 0+4: gain=1 */ + BIP_RANGE(1.25), /* range 1+4: gain=2 */ + BIP_RANGE(0.625), /* range 2+4: gain=4 */ + BIP_RANGE(0.3125), /* range 3+4: gain=8 */ + + UNI_RANGE(5), /* range 0+8: gain=1 */ + UNI_RANGE(2.5), /* range 1+8: gain=2 */ + UNI_RANGE(1.25), /* range 2+8: gain=4 */ + UNI_RANGE(0.625) /* range 3+8: gain=8 */ + } }; static const struct comedi_lrange dt2811_pgl_ai_ranges = { 12, { - BIP_RANGE(5), /* range 0: gain=1 */ - BIP_RANGE(0.5), /* range 1: gain=10 */ - BIP_RANGE(0.05), /* range 2: gain=100 */ - BIP_RANGE(0.01), /* range 3: gain=500 */ - - BIP_RANGE(2.5), /* range 0+4: gain=1 */ - BIP_RANGE(0.25), /* range 1+4: gain=10 */ - BIP_RANGE(0.025), /* range 2+4: gain=100 */ - BIP_RANGE(0.005), /* range 3+4: gain=500 */ - - UNI_RANGE(5), /* range 0+8: gain=1 */ - UNI_RANGE(0.5), /* range 1+8: gain=10 */ - UNI_RANGE(0.05), /* range 2+8: gain=100 */ - UNI_RANGE(0.01) /* range 3+8: gain=500 */ - } + BIP_RANGE(5), /* range 0: gain=1 */ + BIP_RANGE(0.5), /* range 1: gain=10 */ + BIP_RANGE(0.05), /* range 2: gain=100 */ + BIP_RANGE(0.01), /* range 3: gain=500 */ + + BIP_RANGE(2.5), /* range 0+4: gain=1 */ + BIP_RANGE(0.25), /* range 1+4: gain=10 */ + BIP_RANGE(0.025), /* range 2+4: gain=100 */ + BIP_RANGE(0.005), /* range 3+4: gain=500 */ + + UNI_RANGE(5), /* range 0+8: gain=1 */ + UNI_RANGE(0.5), /* range 1+8: gain=10 */ + UNI_RANGE(0.05), /* range 2+8: gain=100 */ + UNI_RANGE(0.01) /* range 3+8: gain=500 */ + } }; /* @@ -155,10 +155,10 @@ static const struct comedi_lrange dt2811_pgl_ai_ranges = { */ static const struct comedi_lrange dt2811_ao_ranges = { 3, { - BIP_RANGE(5), /* default setting from factory */ - BIP_RANGE(2.5), - UNI_RANGE(5) - } + BIP_RANGE(5), /* default setting from factory */ + BIP_RANGE(2.5), + UNI_RANGE(5) + } }; struct dt2811_board { @@ -168,11 +168,11 @@ struct dt2811_board { static const struct dt2811_board dt2811_boards[] = { { - .name = "dt2811-pgh", - .is_pgh = 1, - }, { - .name = "dt2811-pgl", - }, + .name = "dt2811-pgh", + .is_pgh = 1, + }, { + .name = "dt2811-pgl", + }, }; struct dt2811_private { @@ -185,7 +185,7 @@ static unsigned int dt2811_ai_read_sample(struct comedi_device *dev, unsigned int val; val = inb(dev->iobase + DT2811_ADDATA_LO_REG) | - (inb(dev->iobase + DT2811_ADDATA_HI_REG) << 8); + (inb(dev->iobase + DT2811_ADDATA_HI_REG) << 8); return val & s->maxdata; } @@ -249,8 +249,7 @@ static void dt2811_ai_set_chanspec(struct comedi_device *dev, dev->iobase + DT2811_ADGCR_REG); } -static int dt2811_ai_cmd(struct comedi_device *dev, - struct comedi_subdevice *s) +static int dt2811_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) { struct dt2811_private *devpriv = dev->private; struct comedi_cmd *cmd = &s->async->cmd; @@ -270,7 +269,7 @@ static int dt2811_ai_cmd(struct comedi_device *dev, * at the rate set by the internal clock/divider. */ mode = DT2811_ADCSR_ADMODE(1); - } else { /* TRIG_EXT */ + } else { /* TRIG_EXT */ if (cmd->convert_src == TRIG_TIMER) { /* * Mode 2 @@ -281,7 +280,7 @@ static int dt2811_ai_cmd(struct comedi_device *dev, * on the external trigger input. */ mode = DT2811_ADCSR_ADMODE(2); - } else { /* TRIG_EXT */ + } else { /* TRIG_EXT */ /* * Mode 3 * Continuous conversion, external trigger, clock @@ -325,7 +324,7 @@ static unsigned int dt2811_ns_to_timer(unsigned int *nanosec, unsigned int mult = dt2811_clk_multipliers[_mult]; unsigned long long divider = div * mult; unsigned int divisor = DT2811_TMRCTR_MANTISSA(_div) | - DT2811_TMRCTR_EXPONENT(_mult); + DT2811_TMRCTR_EXPONENT(_mult); /* * The timer can be configured to run at a slowest @@ -388,8 +387,7 @@ static unsigned int dt2811_ns_to_timer(unsigned int *nanosec, } static int dt2811_ai_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_cmd *cmd) + struct comedi_subdevice *s, struct comedi_cmd *cmd) { struct dt2811_private *devpriv = dev->private; unsigned int arg; @@ -431,7 +429,7 @@ static int dt2811_ai_cmdtest(struct comedi_device *dev, cmd->chanlist_len); if (cmd->stop_src == TRIG_COUNT) err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); - else /* TRIG_NONE */ + else /* TRIG_NONE */ err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) @@ -443,7 +441,7 @@ static int dt2811_ai_cmdtest(struct comedi_device *dev, arg = cmd->convert_arg; devpriv->ai_divisor = dt2811_ns_to_timer(&arg, cmd->flags); err |= comedi_check_trigger_arg_is(&cmd->convert_arg, arg); - } else { /* TRIG_EXT */ + } else { /* TRIG_EXT */ /* The convert_arg is used to set the divisor. */ devpriv->ai_divisor = cmd->convert_arg; } @@ -458,8 +456,7 @@ static int dt2811_ai_cmdtest(struct comedi_device *dev, static int dt2811_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned int status; @@ -471,8 +468,7 @@ static int dt2811_ai_eoc(struct comedi_device *dev, static int dt2811_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { int ret; int i; @@ -494,8 +490,7 @@ static int dt2811_ai_insn_read(struct comedi_device *dev, static int dt2811_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int val = s->readback[chan]; @@ -514,8 +509,7 @@ static int dt2811_ao_insn_write(struct comedi_device *dev, static int dt2811_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { data[1] = inb(dev->iobase + DT2811_DI_REG); @@ -524,8 +518,7 @@ static int dt2811_di_insn_bits(struct comedi_device *dev, static int dt2811_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { if (comedi_dio_update_state(s, data)) outb(s->state, dev->iobase + DT2811_DO_REG); @@ -564,7 +557,7 @@ static int dt2811_attach(struct comedi_device *dev, struct comedi_devconfig *it) dt2811_reset(dev); /* IRQ's 2,3,5,7 are valid for async command support */ - if (it->options[1] <= 7 && (BIT(it->options[1]) & 0xac)) { + if (it->options[1] <= 7 && (BIT(it->options[1]) & 0xac)) { ret = request_irq(it->options[1], dt2811_interrupt, 0, dev->board_name, dev); if (ret == 0) @@ -577,32 +570,32 @@ static int dt2811_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* Analog Input subdevice */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | - ((it->options[2] == 1) ? SDF_DIFF : - (it->options[2] == 2) ? SDF_COMMON : SDF_GROUND); - s->n_chan = (it->options[2] == 1) ? 8 : 16; - s->maxdata = 0x0fff; - s->range_table = board->is_pgh ? &dt2811_pgh_ai_ranges - : &dt2811_pgl_ai_ranges; - s->insn_read = dt2811_ai_insn_read; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | + ((it->options[2] == 1) ? SDF_DIFF : + (it->options[2] == 2) ? SDF_COMMON : SDF_GROUND); + s->n_chan = (it->options[2] == 1) ? 8 : 16; + s->maxdata = 0x0fff; + s->range_table = board->is_pgh ? &dt2811_pgh_ai_ranges + : &dt2811_pgl_ai_ranges; + s->insn_read = dt2811_ai_insn_read; if (dev->irq) { dev->read_subdev = s; - s->subdev_flags |= SDF_CMD_READ; - s->len_chanlist = 1; - s->do_cmdtest = dt2811_ai_cmdtest; - s->do_cmd = dt2811_ai_cmd; - s->cancel = dt2811_ai_cancel; + s->subdev_flags |= SDF_CMD_READ; + s->len_chanlist = 1; + s->do_cmdtest = dt2811_ai_cmdtest; + s->do_cmd = dt2811_ai_cmd; + s->cancel = dt2811_ai_cancel; } /* Analog Output subdevice */ s = &dev->subdevices[1]; - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 2; - s->maxdata = 0x0fff; - s->range_table = &dt2811_ao_ranges; - s->insn_write = dt2811_ao_insn_write; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 2; + s->maxdata = 0x0fff; + s->range_table = &dt2811_ao_ranges; + s->insn_write = dt2811_ao_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) @@ -610,34 +603,35 @@ static int dt2811_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* Digital Input subdevice */ s = &dev->subdevices[2]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 8; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = dt2811_di_insn_bits; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 8; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = dt2811_di_insn_bits; /* Digital Output subdevice */ s = &dev->subdevices[3]; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 8; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = dt2811_do_insn_bits; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 8; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = dt2811_do_insn_bits; return 0; } static struct comedi_driver dt2811_driver = { - .driver_name = "dt2811", - .module = THIS_MODULE, - .attach = dt2811_attach, - .detach = comedi_legacy_detach, - .board_name = &dt2811_boards[0].name, - .num_names = ARRAY_SIZE(dt2811_boards), - .offset = sizeof(struct dt2811_board), + .driver_name = "dt2811", + .module = THIS_MODULE, + .attach = dt2811_attach, + .detach = comedi_legacy_detach, + .board_name = &dt2811_boards[0].name, + .num_names = ARRAY_SIZE(dt2811_boards), + .offset = sizeof(struct dt2811_board), }; + module_comedi_driver(dt2811_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/dt2814.c b/drivers/comedi/drivers/dt2814.c index ed44ce0d151b..742e24379738 100644 --- a/drivers/comedi/drivers/dt2814.c +++ b/drivers/comedi/drivers/dt2814.c @@ -49,8 +49,7 @@ static int dt2814_ai_notbusy(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned int status; @@ -86,8 +85,7 @@ static int dt2814_ai_clear(struct comedi_device *dev) static int dt2814_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned int status; @@ -182,7 +180,7 @@ static int dt2814_ai_cmdtest(struct comedi_device *dev, if (cmd->stop_src == TRIG_COUNT) err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 2); - else /* TRIG_NONE */ + else /* TRIG_NONE */ err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) @@ -280,7 +278,7 @@ static irqreturn_t dt2814_interrupt(int irq, void *d) } else { comedi_buf_write_samples(s, &data, 1); if (async->cmd.stop_src == TRIG_COUNT && - async->scans_done >= async->cmd.stop_arg) { + async->scans_done >= async->cmd.stop_arg) { async->events |= COMEDI_CB_EOA; } } @@ -360,11 +358,12 @@ static void dt2814_detach(struct comedi_device *dev) } static struct comedi_driver dt2814_driver = { - .driver_name = "dt2814", - .module = THIS_MODULE, - .attach = dt2814_attach, - .detach = dt2814_detach, + .driver_name = "dt2814", + .module = THIS_MODULE, + .attach = dt2814_attach, + .detach = dt2814_detach, }; + module_comedi_driver(dt2814_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/dt2815.c b/drivers/comedi/drivers/dt2815.c index 5906f32aa01f..2dba8b64ef11 100644 --- a/drivers/comedi/drivers/dt2815.c +++ b/drivers/comedi/drivers/dt2815.c @@ -57,8 +57,7 @@ struct dt2815_private { static int dt2815_ao_status(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned int status; @@ -194,8 +193,7 @@ static int dt2815_attach(struct comedi_device *dev, struct comedi_devconfig *it) break; } else if (status != 0x00) { dev_dbg(dev->class_dev, - "unexpected status 0x%x (@t=%d)\n", - status, i); + "unexpected status 0x%x (@t=%d)\n", status, i); if (status & 0x60) outb(0x00, dev->iobase + DT2815_STATUS); } @@ -205,11 +203,12 @@ static int dt2815_attach(struct comedi_device *dev, struct comedi_devconfig *it) } static struct comedi_driver dt2815_driver = { - .driver_name = "dt2815", - .module = THIS_MODULE, - .attach = dt2815_attach, - .detach = comedi_legacy_detach, + .driver_name = "dt2815", + .module = THIS_MODULE, + .attach = dt2815_attach, + .detach = comedi_legacy_detach, }; + module_comedi_driver(dt2815_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/dt2817.c b/drivers/comedi/drivers/dt2817.c index 7c1463e835d3..cb2f91e1fd43 100644 --- a/drivers/comedi/drivers/dt2817.c +++ b/drivers/comedi/drivers/dt2817.c @@ -32,8 +32,7 @@ static int dt2817_dio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int oe = 0; @@ -69,8 +68,7 @@ static int dt2817_dio_insn_config(struct comedi_device *dev, static int dt2817_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned long iobase = dev->iobase + DT2817_DATA; unsigned int mask; @@ -128,11 +126,12 @@ static int dt2817_attach(struct comedi_device *dev, struct comedi_devconfig *it) } static struct comedi_driver dt2817_driver = { - .driver_name = "dt2817", - .module = THIS_MODULE, - .attach = dt2817_attach, - .detach = comedi_legacy_detach, + .driver_name = "dt2817", + .module = THIS_MODULE, + .attach = dt2817_attach, + .detach = comedi_legacy_detach, }; + module_comedi_driver(dt2817_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/dt282x.c b/drivers/comedi/drivers/dt282x.c index 2656b4b0e3d0..1d4c6de3b445 100644 --- a/drivers/comedi/drivers/dt282x.c +++ b/drivers/comedi/drivers/dt282x.c @@ -118,56 +118,56 @@ static const struct comedi_lrange range_dt282x_ai_lo_bipolar = { 4, { - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(2.5), - BIP_RANGE(1.25) - } + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(2.5), + BIP_RANGE(1.25) + } }; static const struct comedi_lrange range_dt282x_ai_lo_unipolar = { 4, { - UNI_RANGE(10), - UNI_RANGE(5), - UNI_RANGE(2.5), - UNI_RANGE(1.25) - } + UNI_RANGE(10), + UNI_RANGE(5), + UNI_RANGE(2.5), + UNI_RANGE(1.25) + } }; static const struct comedi_lrange range_dt282x_ai_5_bipolar = { 4, { - BIP_RANGE(5), - BIP_RANGE(2.5), - BIP_RANGE(1.25), - BIP_RANGE(0.625) - } + BIP_RANGE(5), + BIP_RANGE(2.5), + BIP_RANGE(1.25), + BIP_RANGE(0.625) + } }; static const struct comedi_lrange range_dt282x_ai_5_unipolar = { 4, { - UNI_RANGE(5), - UNI_RANGE(2.5), - UNI_RANGE(1.25), - UNI_RANGE(0.625) - } + UNI_RANGE(5), + UNI_RANGE(2.5), + UNI_RANGE(1.25), + UNI_RANGE(0.625) + } }; static const struct comedi_lrange range_dt282x_ai_hi_bipolar = { 4, { - BIP_RANGE(10), - BIP_RANGE(1), - BIP_RANGE(0.1), - BIP_RANGE(0.02) - } + BIP_RANGE(10), + BIP_RANGE(1), + BIP_RANGE(0.1), + BIP_RANGE(0.02) + } }; static const struct comedi_lrange range_dt282x_ai_hi_unipolar = { 4, { - UNI_RANGE(10), - UNI_RANGE(1), - UNI_RANGE(0.1), - UNI_RANGE(0.02) - } + UNI_RANGE(10), + UNI_RANGE(1), + UNI_RANGE(0.1), + UNI_RANGE(0.02) + } }; /* @@ -177,12 +177,12 @@ static const struct comedi_lrange range_dt282x_ai_hi_unipolar = { */ static const struct comedi_lrange dt282x_ao_range = { 5, { - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(2.5), - UNI_RANGE(10), - UNI_RANGE(5), - } + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(2.5), + UNI_RANGE(10), + UNI_RANGE(5), + } }; struct dt282x_board { @@ -198,114 +198,136 @@ struct dt282x_board { static const struct dt282x_board boardtypes[] = { { - .name = "dt2821", - .ai_maxdata = 0x0fff, - .adchan_se = 16, - .adchan_di = 8, - .ai_speed = 20000, - .dachan = 2, - .ao_maxdata = 0x0fff, - }, { - .name = "dt2821-f", - .ai_maxdata = 0x0fff, - .adchan_se = 16, - .adchan_di = 8, - .ai_speed = 6500, - .dachan = 2, - .ao_maxdata = 0x0fff, - }, { - .name = "dt2821-g", - .ai_maxdata = 0x0fff, - .adchan_se = 16, - .adchan_di = 8, - .ai_speed = 4000, - .dachan = 2, - .ao_maxdata = 0x0fff, - }, { - .name = "dt2823", - .ai_maxdata = 0xffff, - .adchan_di = 4, - .ai_speed = 10000, - .dachan = 2, - .ao_maxdata = 0xffff, - }, { - .name = "dt2824-pgh", - .ai_maxdata = 0x0fff, - .adchan_se = 16, - .adchan_di = 8, - .ai_speed = 20000, - }, { - .name = "dt2824-pgl", - .ai_maxdata = 0x0fff, - .adchan_se = 16, - .adchan_di = 8, - .ai_speed = 20000, - .ispgl = 1, - }, { - .name = "dt2825", - .ai_maxdata = 0x0fff, - .adchan_se = 16, - .adchan_di = 8, - .ai_speed = 20000, - .ispgl = 1, - .dachan = 2, - .ao_maxdata = 0x0fff, - }, { - .name = "dt2827", - .ai_maxdata = 0xffff, - .adchan_di = 4, - .ai_speed = 10000, - .dachan = 2, - .ao_maxdata = 0x0fff, - }, { - .name = "dt2828", - .ai_maxdata = 0x0fff, - .adchan_se = 4, - .ai_speed = 10000, - .dachan = 2, - .ao_maxdata = 0x0fff, - }, { - .name = "dt2829", - .ai_maxdata = 0xffff, - .adchan_se = 8, - .ai_speed = 33250, - .dachan = 2, - .ao_maxdata = 0xffff, - }, { - .name = "dt21-ez", - .ai_maxdata = 0x0fff, - .adchan_se = 16, - .adchan_di = 8, - .ai_speed = 10000, - .dachan = 2, - .ao_maxdata = 0x0fff, - }, { - .name = "dt23-ez", - .ai_maxdata = 0xffff, - .adchan_se = 16, - .adchan_di = 8, - .ai_speed = 10000, - }, { - .name = "dt24-ez", - .ai_maxdata = 0x0fff, - .adchan_se = 16, - .adchan_di = 8, - .ai_speed = 10000, - }, { - .name = "dt24-ez-pgl", - .ai_maxdata = 0x0fff, - .adchan_se = 16, - .adchan_di = 8, - .ai_speed = 10000, - .ispgl = 1, - }, + .name = "dt2821", + .ai_maxdata = 0x0fff, + .adchan_se = 16, + .adchan_di = 8, + .ai_speed = 20000, + .dachan = 2, + .ao_maxdata = 0x0fff, + }, { + .name = "dt2821-f", + .ai_maxdata = 0x0fff, + .adchan_se = 16, + .adchan_di = 8, + .ai_speed = 6500, + .dachan = 2, + .ao_maxdata = 0x0fff, + }, { + .name = "dt2821-g", + .ai_maxdata = 0x0fff, + .adchan_se = 16, + .adchan_di = 8, + .ai_speed = 4000, + .dachan = 2, + .ao_maxdata = 0x0fff, + }, { + .name = "dt2823", + .ai_maxdata = 0xffff, + .adchan_di = 4, + .ai_speed = 10000, + .dachan = 2, + .ao_maxdata = 0xffff, + }, { + .name = "dt2824-pgh", + .ai_maxdata = 0x0fff, + .adchan_se = 16, + .adchan_di = 8, + .ai_speed = 20000, + }, { + .name = "dt2824-pgl", + .ai_maxdata = 0x0fff, + .adchan_se = 16, + .adchan_di = 8, + .ai_speed = 20000, + .ispgl = 1, + }, { + .name = "dt2825", + .ai_maxdata = 0x0fff, + .adchan_se = 16, + .adchan_di = 8, + .ai_speed = 20000, + .ispgl = 1, + .dachan = 2, + .ao_maxdata = 0x0fff, + }, { + .name = "dt2827", + .ai_maxdata = 0xffff, + .adchan_di = 4, + .ai_speed = 10000, + .dachan = 2, + .ao_maxdata = 0x0fff, + }, { + .name = "dt2828", + .ai_maxdata = 0x0fff, + .adchan_se = 4, + .ai_speed = 10000, + .dachan = 2, + .ao_maxdata = 0x0fff, + }, { + .name = "dt2829", + .ai_maxdata = 0xffff, + .adchan_se = 8, + .ai_speed = 33250, + .dachan = 2, + .ao_maxdata = 0xffff, + }, { + .name = "dt21-ez", + .ai_maxdata = 0x0fff, + .adchan_se = 16, + .adchan_di = 8, + .ai_speed = 10000, + .dachan = 2, + .ao_maxdata = 0x0fff, + }, { + .name = + "dt23-ez", + .ai_maxdata = + 0xffff, + .adchan_se = 16, + .adchan_di = 8, + .ai_speed = + 10000, + }, { + .name = + "dt24-ez", + .ai_maxdata + = 0x0fff, + .adchan_se + = 16, + .adchan_di + = 8, + .ai_speed = + 10000, + }, { + .name + = + "dt24-ez-pgl", + . + ai_maxdata + = + 0x0fff, + . + adchan_se + = 16, + . + adchan_di + = 8, + . + ai_speed + = + 10000, + . + ispgl + = 1, + }, }; struct dt282x_private { struct comedi_isadma *dma; unsigned int ad_2scomp:1; unsigned int divisor; - int dacsr; /* software copies of registers */ + int dacsr; /* software copies of registers */ int adcsr; int supcsr; int ntrig; @@ -393,13 +415,12 @@ static unsigned int dt282x_ns_to_timer(unsigned int *ns, unsigned int flags) } *ns = divider * base; return DT2821_TMRCTR_PRESCALE(prescale) | - DT2821_TMRCTR_DIVIDER(divider); + DT2821_TMRCTR_DIVIDER(divider); } static void dt282x_munge(struct comedi_device *dev, struct comedi_subdevice *s, - unsigned short *buf, - unsigned int nbytes) + unsigned short *buf, unsigned int nbytes) { struct dt282x_private *devpriv = dev->private; unsigned int val; @@ -420,8 +441,7 @@ static void dt282x_munge(struct comedi_device *dev, } static unsigned int dt282x_ao_setup_dma(struct comedi_device *dev, - struct comedi_subdevice *s, - int cur_dma) + struct comedi_subdevice *s, int cur_dma) { struct dt282x_private *devpriv = dev->private; struct comedi_isadma *dma = devpriv->dma; @@ -549,16 +569,14 @@ static void dt282x_load_changain(struct comedi_device *dev, int n, outw(devpriv->adcsr | DT2821_ADCSR_GS(range) | - DT2821_ADCSR_CHAN(chan), - dev->iobase + DT2821_ADCSR_REG); + DT2821_ADCSR_CHAN(chan), dev->iobase + DT2821_ADCSR_REG); } outw(DT2821_CHANCSR_NUMB(n), dev->iobase + DT2821_CHANCSR_REG); } static int dt282x_ai_timeout(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned int status; @@ -586,8 +604,7 @@ static int dt282x_ai_timeout(struct comedi_device *dev, */ static int dt282x_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct dt282x_private *devpriv = dev->private; unsigned int val; @@ -628,8 +645,7 @@ static int dt282x_ai_insn_read(struct comedi_device *dev, } static int dt282x_ai_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_cmd *cmd) + struct comedi_subdevice *s, struct comedi_cmd *cmd) { const struct dt282x_board *board = dev->board_ptr; struct dt282x_private *devpriv = dev->private; @@ -669,7 +685,7 @@ static int dt282x_ai_cmdtest(struct comedi_device *dev, if (cmd->stop_src == TRIG_COUNT) err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); - else /* TRIG_EXT | TRIG_NONE */ + else /* TRIG_EXT | TRIG_NONE */ err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) @@ -706,8 +722,7 @@ static int dt282x_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) outw(devpriv->supcsr | DT2821_SUPCSR_CLRDMADNE | DT2821_SUPCSR_BUFFB | - DT2821_SUPCSR_ADCINIT, - dev->iobase + DT2821_SUPCSR_REG); + DT2821_SUPCSR_ADCINIT, dev->iobase + DT2821_SUPCSR_REG); devpriv->ntrig = cmd->stop_arg * cmd->scan_end_arg; devpriv->nread = devpriv->ntrig; @@ -765,8 +780,7 @@ static int dt282x_ai_cancel(struct comedi_device *dev, static int dt282x_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct dt282x_private *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -795,8 +809,7 @@ static int dt282x_ao_insn_write(struct comedi_device *dev, } static int dt282x_ao_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_cmd *cmd) + struct comedi_subdevice *s, struct comedi_cmd *cmd) { struct dt282x_private *devpriv = dev->private; int err = 0; @@ -832,7 +845,7 @@ static int dt282x_ao_cmdtest(struct comedi_device *dev, if (cmd->stop_src == TRIG_COUNT) err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); - else /* TRIG_EXT | TRIG_NONE */ + else /* TRIG_EXT | TRIG_NONE */ err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) @@ -851,8 +864,7 @@ static int dt282x_ao_cmdtest(struct comedi_device *dev, } static int dt282x_ao_inttrig(struct comedi_device *dev, - struct comedi_subdevice *s, - unsigned int trig_num) + struct comedi_subdevice *s, unsigned int trig_num) { struct dt282x_private *devpriv = dev->private; struct comedi_cmd *cmd = &s->async->cmd; @@ -882,13 +894,11 @@ static int dt282x_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s) dt282x_disable_dma(dev); devpriv->supcsr = DT2821_SUPCSR_ERRINTEN | - DT2821_SUPCSR_DS_DA_CLK | - DT2821_SUPCSR_DDMA; + DT2821_SUPCSR_DS_DA_CLK | DT2821_SUPCSR_DDMA; outw(devpriv->supcsr | DT2821_SUPCSR_CLRDMADNE | DT2821_SUPCSR_BUFFB | - DT2821_SUPCSR_DACINIT, - dev->iobase + DT2821_SUPCSR_REG); + DT2821_SUPCSR_DACINIT, dev->iobase + DT2821_SUPCSR_REG); devpriv->ntrig = cmd->stop_arg * cmd->chanlist_len; devpriv->nread = devpriv->ntrig; @@ -902,8 +912,7 @@ static int dt282x_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s) devpriv->dacsr &= (DT2821_DACSR_LBOE | DT2821_DACSR_HBOE); devpriv->dacsr |= (DT2821_DACSR_SSEL | - DT2821_DACSR_DACLK | - DT2821_DACSR_IDARDY); + DT2821_DACSR_DACLK | DT2821_DACSR_IDARDY); outw(devpriv->dacsr, dev->iobase + DT2821_DACSR_REG); s->async->inttrig = dt282x_ao_inttrig; @@ -932,8 +941,7 @@ static int dt282x_ao_cancel(struct comedi_device *dev, static int dt282x_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { if (comedi_dio_update_state(s, data)) outw(s->state, dev->iobase + DT2821_DIODAT_REG); @@ -945,8 +953,7 @@ static int dt282x_dio_insn_bits(struct comedi_device *dev, static int dt282x_dio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct dt282x_private *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -1087,65 +1094,65 @@ static int dt282x_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* Analog Input subdevice */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE; if ((it->options[4] && board->adchan_di) || board->adchan_se == 0) { - s->subdev_flags |= SDF_DIFF; - s->n_chan = board->adchan_di; + s->subdev_flags |= SDF_DIFF; + s->n_chan = board->adchan_di; } else { - s->subdev_flags |= SDF_COMMON; - s->n_chan = board->adchan_se; + s->subdev_flags |= SDF_COMMON; + s->n_chan = board->adchan_se; } - s->maxdata = board->ai_maxdata; + s->maxdata = board->ai_maxdata; s->range_table = opt_ai_range_lkup(board->ispgl, it->options[8]); devpriv->ad_2scomp = it->options[5] ? 1 : 0; - s->insn_read = dt282x_ai_insn_read; + s->insn_read = dt282x_ai_insn_read; if (dev->irq) { dev->read_subdev = s; - s->subdev_flags |= SDF_CMD_READ; - s->len_chanlist = s->n_chan; - s->do_cmdtest = dt282x_ai_cmdtest; - s->do_cmd = dt282x_ai_cmd; - s->cancel = dt282x_ai_cancel; + s->subdev_flags |= SDF_CMD_READ; + s->len_chanlist = s->n_chan; + s->do_cmdtest = dt282x_ai_cmdtest; + s->do_cmd = dt282x_ai_cmd; + s->cancel = dt282x_ai_cancel; } /* Analog Output subdevice */ s = &dev->subdevices[1]; if (board->dachan) { - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = board->dachan; - s->maxdata = board->ao_maxdata; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = board->dachan; + s->maxdata = board->ao_maxdata; /* ranges are per-channel, set by jumpers on the board */ - s->range_table = &dt282x_ao_range; - s->insn_write = dt282x_ao_insn_write; + s->range_table = &dt282x_ao_range; + s->insn_write = dt282x_ao_insn_write; if (dev->irq) { dev->write_subdev = s; - s->subdev_flags |= SDF_CMD_WRITE; - s->len_chanlist = s->n_chan; - s->do_cmdtest = dt282x_ao_cmdtest; - s->do_cmd = dt282x_ao_cmd; - s->cancel = dt282x_ao_cancel; + s->subdev_flags |= SDF_CMD_WRITE; + s->len_chanlist = s->n_chan; + s->do_cmdtest = dt282x_ao_cmdtest; + s->do_cmd = dt282x_ao_cmd; + s->cancel = dt282x_ao_cancel; } ret = comedi_alloc_subdev_readback(s); if (ret) return ret; } else { - s->type = COMEDI_SUBD_UNUSED; + s->type = COMEDI_SUBD_UNUSED; } /* Digital I/O subdevice */ s = &dev->subdevices[2]; - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 16; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = dt282x_dio_insn_bits; - s->insn_config = dt282x_dio_insn_config; + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 16; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = dt282x_dio_insn_bits; + s->insn_config = dt282x_dio_insn_config; return 0; } @@ -1157,14 +1164,15 @@ static void dt282x_detach(struct comedi_device *dev) } static struct comedi_driver dt282x_driver = { - .driver_name = "dt282x", - .module = THIS_MODULE, - .attach = dt282x_attach, - .detach = dt282x_detach, - .board_name = &boardtypes[0].name, - .num_names = ARRAY_SIZE(boardtypes), - .offset = sizeof(struct dt282x_board), + .driver_name = "dt282x", + .module = THIS_MODULE, + .attach = dt282x_attach, + .detach = dt282x_detach, + .board_name = &boardtypes[0].name, + .num_names = ARRAY_SIZE(boardtypes), + .offset = sizeof(struct dt282x_board), }; + module_comedi_driver(dt282x_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/dt3000.c b/drivers/comedi/drivers/dt3000.c index ec27aa4730d4..67a562b9b169 100644 --- a/drivers/comedi/drivers/dt3000.c +++ b/drivers/comedi/drivers/dt3000.c @@ -130,20 +130,20 @@ static const struct comedi_lrange range_dt3000_ai = { 4, { - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(2.5), - BIP_RANGE(1.25) - } + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(2.5), + BIP_RANGE(1.25) + } }; static const struct comedi_lrange range_dt3000_ai_pgl = { 4, { - BIP_RANGE(10), - BIP_RANGE(1), - BIP_RANGE(0.1), - BIP_RANGE(0.02) - } + BIP_RANGE(10), + BIP_RANGE(1), + BIP_RANGE(0.1), + BIP_RANGE(0.02) + } }; enum dt3k_boardid { @@ -167,55 +167,55 @@ struct dt3k_boardtype { static const struct dt3k_boardtype dt3k_boardtypes[] = { [BOARD_DT3001] = { - .name = "dt3001", - .adchan = 16, - .adrange = &range_dt3000_ai, - .ai_speed = 3000, - .has_ao = 1, - }, + .name = "dt3001", + .adchan = 16, + .adrange = &range_dt3000_ai, + .ai_speed = 3000, + .has_ao = 1, + }, [BOARD_DT3001_PGL] = { - .name = "dt3001-pgl", - .adchan = 16, - .adrange = &range_dt3000_ai_pgl, - .ai_speed = 3000, - .has_ao = 1, - }, + .name = "dt3001-pgl", + .adchan = 16, + .adrange = &range_dt3000_ai_pgl, + .ai_speed = 3000, + .has_ao = 1, + }, [BOARD_DT3002] = { - .name = "dt3002", - .adchan = 32, - .adrange = &range_dt3000_ai, - .ai_speed = 3000, - }, + .name = "dt3002", + .adchan = 32, + .adrange = &range_dt3000_ai, + .ai_speed = 3000, + }, [BOARD_DT3003] = { - .name = "dt3003", - .adchan = 64, - .adrange = &range_dt3000_ai, - .ai_speed = 3000, - .has_ao = 1, - }, + .name = "dt3003", + .adchan = 64, + .adrange = &range_dt3000_ai, + .ai_speed = 3000, + .has_ao = 1, + }, [BOARD_DT3003_PGL] = { - .name = "dt3003-pgl", - .adchan = 64, - .adrange = &range_dt3000_ai_pgl, - .ai_speed = 3000, - .has_ao = 1, - }, + .name = "dt3003-pgl", + .adchan = 64, + .adrange = &range_dt3000_ai_pgl, + .ai_speed = 3000, + .has_ao = 1, + }, [BOARD_DT3004] = { - .name = "dt3004", - .adchan = 16, - .adrange = &range_dt3000_ai, - .ai_speed = 10000, - .ai_is_16bit = 1, - .has_ao = 1, - }, + .name = "dt3004", + .adchan = 16, + .adrange = &range_dt3000_ai, + .ai_speed = 10000, + .ai_is_16bit = 1, + .has_ao = 1, + }, [BOARD_DT3005] = { - .name = "dt3005", /* a.k.a. 3004-200 */ - .adchan = 16, - .adrange = &range_dt3000_ai, - .ai_speed = 5000, - .ai_is_16bit = 1, - .has_ao = 1, - }, + .name = "dt3005", /* a.k.a. 3004-200 */ + .adchan = 16, + .adrange = &range_dt3000_ai, + .ai_speed = 5000, + .ai_is_16bit = 1, + .has_ao = 1, + }, }; struct dt3k_private { @@ -299,8 +299,7 @@ static void dt3k_ai_empty_fifo(struct comedi_device *dev, writew(rear, dev->mmio + DPR_AD_BUF_REAR); } -static int dt3k_ai_cancel(struct comedi_device *dev, - struct comedi_subdevice *s) +static int dt3k_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) { writew(DPR_SUBSYS_AI, dev->mmio + DPR_SUBSYS); dt3k_send_cmd(dev, DPR_CMD_STOP); @@ -418,7 +417,7 @@ static int dt3k_ai_cmdtest(struct comedi_device *dev, if (cmd->stop_src == TRIG_COUNT) err |= comedi_check_trigger_arg_max(&cmd->stop_arg, 0x00ffffff); - else /* TRIG_NONE */ + else /* TRIG_NONE */ err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) @@ -439,8 +438,9 @@ static int dt3k_ai_cmdtest(struct comedi_device *dev, if (cmd->scan_begin_src == TRIG_TIMER) { arg = cmd->convert_arg * cmd->scan_end_arg; - err |= comedi_check_trigger_arg_min( - &cmd->scan_begin_arg, arg); + err |= + comedi_check_trigger_arg_min(&cmd->scan_begin_arg, + arg); } } @@ -503,8 +503,7 @@ static int dt3k_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) static int dt3k_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { int i; unsigned int chan, gain; @@ -521,8 +520,7 @@ static int dt3k_ai_insn_read(struct comedi_device *dev, static int dt3k_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int val = s->readback[chan]; @@ -551,8 +549,7 @@ static void dt3k_dio_config(struct comedi_device *dev, int bits) static int dt3k_dio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int mask; @@ -574,8 +571,7 @@ static int dt3k_dio_insn_config(struct comedi_device *dev, static int dt3k_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { if (comedi_dio_update_state(s, data)) dt3k_writesingle(dev, DPR_SUBSYS_DOUT, 0, s->state); @@ -587,8 +583,7 @@ static int dt3k_dio_insn_bits(struct comedi_device *dev, static int dt3k_mem_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int addr = CR_CHAN(insn->chanspec); int i; @@ -606,8 +601,7 @@ static int dt3k_mem_insn_read(struct comedi_device *dev, return i; } -static int dt3000_auto_attach(struct comedi_device *dev, - unsigned long context) +static int dt3000_auto_attach(struct comedi_device *dev, unsigned long context) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); const struct dt3k_boardtype *board = NULL; @@ -647,70 +641,69 @@ static int dt3000_auto_attach(struct comedi_device *dev, /* Analog Input subdevice */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF; - s->n_chan = board->adchan; - s->maxdata = board->ai_is_16bit ? 0xffff : 0x0fff; - s->range_table = &range_dt3000_ai; /* XXX */ - s->insn_read = dt3k_ai_insn_read; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF; + s->n_chan = board->adchan; + s->maxdata = board->ai_is_16bit ? 0xffff : 0x0fff; + s->range_table = &range_dt3000_ai; /* XXX */ + s->insn_read = dt3k_ai_insn_read; if (dev->irq) { dev->read_subdev = s; - s->subdev_flags |= SDF_CMD_READ; - s->len_chanlist = 512; - s->do_cmd = dt3k_ai_cmd; - s->do_cmdtest = dt3k_ai_cmdtest; - s->cancel = dt3k_ai_cancel; + s->subdev_flags |= SDF_CMD_READ; + s->len_chanlist = 512; + s->do_cmd = dt3k_ai_cmd; + s->do_cmdtest = dt3k_ai_cmdtest; + s->cancel = dt3k_ai_cancel; } /* Analog Output subdevice */ s = &dev->subdevices[1]; if (board->has_ao) { - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 2; - s->maxdata = 0x0fff; - s->range_table = &range_bipolar10; - s->insn_write = dt3k_ao_insn_write; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 2; + s->maxdata = 0x0fff; + s->range_table = &range_bipolar10; + s->insn_write = dt3k_ao_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) return ret; } else { - s->type = COMEDI_SUBD_UNUSED; + s->type = COMEDI_SUBD_UNUSED; } /* Digital I/O subdevice */ s = &dev->subdevices[2]; - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 8; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_config = dt3k_dio_insn_config; - s->insn_bits = dt3k_dio_insn_bits; + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 8; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_config = dt3k_dio_insn_config; + s->insn_bits = dt3k_dio_insn_bits; /* Memory subdevice */ s = &dev->subdevices[3]; - s->type = COMEDI_SUBD_MEMORY; - s->subdev_flags = SDF_READABLE; - s->n_chan = 0x1000; - s->maxdata = 0xff; - s->range_table = &range_unknown; - s->insn_read = dt3k_mem_insn_read; + s->type = COMEDI_SUBD_MEMORY; + s->subdev_flags = SDF_READABLE; + s->n_chan = 0x1000; + s->maxdata = 0xff; + s->range_table = &range_unknown; + s->insn_read = dt3k_mem_insn_read; return 0; } static struct comedi_driver dt3000_driver = { - .driver_name = "dt3000", - .module = THIS_MODULE, - .auto_attach = dt3000_auto_attach, - .detach = comedi_pci_detach, + .driver_name = "dt3000", + .module = THIS_MODULE, + .auto_attach = dt3000_auto_attach, + .detach = comedi_pci_detach, }; -static int dt3000_pci_probe(struct pci_dev *dev, - const struct pci_device_id *id) +static int dt3000_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) { return comedi_pci_auto_config(dev, &dt3000_driver, id->driver_data); } @@ -725,14 +718,16 @@ static const struct pci_device_id dt3000_pci_table[] = { { PCI_VDEVICE(DT, 0x0028), BOARD_DT3003_PGL }, { 0 } }; + MODULE_DEVICE_TABLE(pci, dt3000_pci_table); static struct pci_driver dt3000_pci_driver = { - .name = "dt3000", - .id_table = dt3000_pci_table, - .probe = dt3000_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "dt3000", + .id_table = dt3000_pci_table, + .probe = dt3000_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(dt3000_driver, dt3000_pci_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/dt9812.c b/drivers/comedi/drivers/dt9812.c index 634f57730c1e..f356337af6c3 100644 --- a/drivers/comedi/drivers/dt9812.c +++ b/drivers/comedi/drivers/dt9812.c @@ -74,8 +74,8 @@ #define F020_MASK_DACXCN_DACXEN 0x80 enum { - /* A/D D/A DI DO CT */ - DT9812_DEVID_DT9812_10, /* 8 2 8 8 1 +/- 10V */ + /* A/D D/A DI DO CT */ + DT9812_DEVID_DT9812_10, /* 8 2 8 8 1 +/- 10V */ DT9812_DEVID_DT9812_2PT5, /* 8 2 8 8 1 0-2.44V */ }; @@ -256,8 +256,8 @@ static int dt9812_read_info(struct comedi_device *dev, } static int dt9812_read_multiple_registers(struct comedi_device *dev, - int reg_count, u8 *address, - u8 *value) + int reg_count, u8 *address, + u8 *value) { struct usb_device *usb = comedi_to_usb_dev(dev); struct dt9812_private *devpriv = dev->private; @@ -280,8 +280,8 @@ static int dt9812_read_multiple_registers(struct comedi_device *dev, } static int dt9812_write_multiple_registers(struct comedi_device *dev, - int reg_count, u8 *address, - u8 *value) + int reg_count, u8 *address, + u8 *value) { struct usb_device *usb = comedi_to_usb_dev(dev); struct dt9812_private *devpriv = dev->private; @@ -319,7 +319,7 @@ static int dt9812_rmw_multiple_registers(struct comedi_device *dev, &cmd, 32, &count, DT9812_USB_TIMEOUT); } -static int dt9812_digital_in(struct comedi_device *dev, u8 *bits) +static int dt9812_digital_in(struct comedi_device *dev, u8 *bits) { struct dt9812_private *devpriv = dev->private; u8 reg[2] = { F020_SFR_P3, F020_SFR_P1 }; @@ -385,8 +385,7 @@ static void dt9812_configure_gain(struct comedi_device *dev, rmw->address = F020_SFR_ADC0CF; rmw->and_mask = F020_MASK_ADC0CF_AMP0GN2 | - F020_MASK_ADC0CF_AMP0GN1 | - F020_MASK_ADC0CF_AMP0GN0; + F020_MASK_ADC0CF_AMP0GN1 | F020_MASK_ADC0CF_AMP0GN0; switch (gain) { /* @@ -399,7 +398,7 @@ static void dt9812_configure_gain(struct comedi_device *dev, */ case DT9812_GAIN_0PT5: rmw->or_value = F020_MASK_ADC0CF_AMP0GN2 | - F020_MASK_ADC0CF_AMP0GN1; + F020_MASK_ADC0CF_AMP0GN1; break; default: /* this should never happen, just use a gain of 1 */ @@ -414,7 +413,7 @@ static void dt9812_configure_gain(struct comedi_device *dev, break; case DT9812_GAIN_8: rmw->or_value = F020_MASK_ADC0CF_AMP0GN1 | - F020_MASK_ADC0CF_AMP0GN0; + F020_MASK_ADC0CF_AMP0GN0; break; case DT9812_GAIN_16: rmw->or_value = F020_MASK_ADC0CF_AMP0GN2; @@ -423,7 +422,7 @@ static void dt9812_configure_gain(struct comedi_device *dev, } static int dt9812_analog_in(struct comedi_device *dev, - int channel, u16 *value, enum dt9812_gain gain) + int channel, u16 *value, enum dt9812_gain gain) { struct dt9812_private *devpriv = dev->private; struct dt9812_rmw_byte rmw[3]; @@ -541,8 +540,7 @@ static int dt9812_analog_out(struct comedi_device *dev, int channel, u16 value) static int dt9812_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { u8 bits = 0; int ret; @@ -558,8 +556,7 @@ static int dt9812_di_insn_bits(struct comedi_device *dev, static int dt9812_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { if (comedi_dio_update_state(s, data)) dt9812_digital_out(dev, s->state); @@ -571,8 +568,7 @@ static int dt9812_do_insn_bits(struct comedi_device *dev, static int dt9812_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); u16 val = 0; @@ -591,8 +587,7 @@ static int dt9812_ai_insn_read(struct comedi_device *dev, static int dt9812_ao_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct dt9812_private *devpriv = dev->private; int ret; @@ -606,8 +601,7 @@ static int dt9812_ao_insn_read(struct comedi_device *dev, static int dt9812_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); int i; @@ -749,8 +743,7 @@ static int dt9812_reset_device(struct comedi_device *dev) return 0; } -static int dt9812_auto_attach(struct comedi_device *dev, - unsigned long context) +static int dt9812_auto_attach(struct comedi_device *dev, unsigned long context) { struct usb_interface *intf = comedi_to_usb_interface(dev); struct dt9812_private *devpriv; @@ -782,40 +775,40 @@ static int dt9812_auto_attach(struct comedi_device *dev, /* Digital Input subdevice */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 8; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = dt9812_di_insn_bits; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 8; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = dt9812_di_insn_bits; /* Digital Output subdevice */ s = &dev->subdevices[1]; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 8; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = dt9812_do_insn_bits; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 8; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = dt9812_do_insn_bits; /* Analog Input subdevice */ s = &dev->subdevices[2]; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_GROUND; - s->n_chan = 8; - s->maxdata = 0x0fff; - s->range_table = is_unipolar ? &range_unipolar2_5 : &range_bipolar10; - s->insn_read = dt9812_ai_insn_read; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_GROUND; + s->n_chan = 8; + s->maxdata = 0x0fff; + s->range_table = is_unipolar ? &range_unipolar2_5 : &range_bipolar10; + s->insn_read = dt9812_ai_insn_read; /* Analog Output subdevice */ s = &dev->subdevices[3]; - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 2; - s->maxdata = 0x0fff; - s->range_table = is_unipolar ? &range_unipolar2_5 : &range_bipolar10; - s->insn_write = dt9812_ao_insn_write; - s->insn_read = dt9812_ao_insn_read; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 2; + s->maxdata = 0x0fff; + s->range_table = is_unipolar ? &range_unipolar2_5 : &range_bipolar10; + s->insn_write = dt9812_ao_insn_write; + s->insn_read = dt9812_ao_insn_read; ret = comedi_alloc_subdev_readback(s); if (ret) @@ -840,10 +833,10 @@ static void dt9812_detach(struct comedi_device *dev) } static struct comedi_driver dt9812_driver = { - .driver_name = "dt9812", - .module = THIS_MODULE, - .auto_attach = dt9812_auto_attach, - .detach = dt9812_detach, + .driver_name = "dt9812", + .module = THIS_MODULE, + .auto_attach = dt9812_auto_attach, + .detach = dt9812_detach, }; static int dt9812_usb_probe(struct usb_interface *intf, @@ -856,14 +849,16 @@ static const struct usb_device_id dt9812_usb_table[] = { { USB_DEVICE(0x0867, 0x9812) }, { } }; + MODULE_DEVICE_TABLE(usb, dt9812_usb_table); static struct usb_driver dt9812_usb_driver = { - .name = "dt9812", - .id_table = dt9812_usb_table, - .probe = dt9812_usb_probe, - .disconnect = comedi_usb_auto_unconfig, + .name = "dt9812", + .id_table = dt9812_usb_table, + .probe = dt9812_usb_probe, + .disconnect = comedi_usb_auto_unconfig, }; + module_comedi_usb_driver(dt9812_driver, dt9812_usb_driver); MODULE_AUTHOR("Anders Blomdell <anders.blomdell@xxxxxxxxxxxxxx>"); diff --git a/drivers/comedi/drivers/dyna_pci10xx.c b/drivers/comedi/drivers/dyna_pci10xx.c index c224422bb126..22ac738ee12a 100644 --- a/drivers/comedi/drivers/dyna_pci10xx.c +++ b/drivers/comedi/drivers/dyna_pci10xx.c @@ -33,10 +33,10 @@ static const struct comedi_lrange range_pci1050_ai = { 3, { - BIP_RANGE(10), - BIP_RANGE(5), - UNI_RANGE(10) - } + BIP_RANGE(10), + BIP_RANGE(5), + UNI_RANGE(10) + } }; static const char range_codes_pci1050_ai[] = { 0x00, 0x10, 0x30 }; @@ -48,8 +48,7 @@ struct dyna_pci10xx_private { static int dyna_pci10xx_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned int status; @@ -233,10 +232,10 @@ static void dyna_pci10xx_detach(struct comedi_device *dev) } static struct comedi_driver dyna_pci10xx_driver = { - .driver_name = "dyna_pci10xx", - .module = THIS_MODULE, - .auto_attach = dyna_pci10xx_auto_attach, - .detach = dyna_pci10xx_detach, + .driver_name = "dyna_pci10xx", + .module = THIS_MODULE, + .auto_attach = dyna_pci10xx_auto_attach, + .detach = dyna_pci10xx_detach, }; static int dyna_pci10xx_pci_probe(struct pci_dev *dev, @@ -250,14 +249,16 @@ static const struct pci_device_id dyna_pci10xx_pci_table[] = { { PCI_DEVICE(PCI_VENDOR_ID_PLX, 0x1050) }, { 0 } }; + MODULE_DEVICE_TABLE(pci, dyna_pci10xx_pci_table); static struct pci_driver dyna_pci10xx_pci_driver = { - .name = "dyna_pci10xx", - .id_table = dyna_pci10xx_pci_table, - .probe = dyna_pci10xx_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "dyna_pci10xx", + .id_table = dyna_pci10xx_pci_table, + .probe = dyna_pci10xx_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(dyna_pci10xx_driver, dyna_pci10xx_pci_driver); MODULE_LICENSE("GPL"); diff --git a/drivers/comedi/drivers/fl512.c b/drivers/comedi/drivers/fl512.c index b715f30659fa..e6943f3a5124 100644 --- a/drivers/comedi/drivers/fl512.c +++ b/drivers/comedi/drivers/fl512.c @@ -37,20 +37,19 @@ static const struct comedi_lrange range_fl512 = { 4, { - BIP_RANGE(0.5), - BIP_RANGE(1), - BIP_RANGE(5), - BIP_RANGE(10), - UNI_RANGE(1), - UNI_RANGE(5), - UNI_RANGE(10) - } + BIP_RANGE(0.5), + BIP_RANGE(1), + BIP_RANGE(5), + BIP_RANGE(10), + UNI_RANGE(1), + UNI_RANGE(5), + UNI_RANGE(10) + } }; static int fl512_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int val; @@ -76,8 +75,7 @@ static int fl512_ai_insn_read(struct comedi_device *dev, static int fl512_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int val = s->readback[chan]; @@ -111,31 +109,32 @@ static int fl512_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* Analog Input subdevice */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_GROUND; - s->n_chan = 16; - s->maxdata = 0x0fff; - s->range_table = &range_fl512; - s->insn_read = fl512_ai_insn_read; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_GROUND; + s->n_chan = 16; + s->maxdata = 0x0fff; + s->range_table = &range_fl512; + s->insn_read = fl512_ai_insn_read; /* Analog Output subdevice */ s = &dev->subdevices[1]; - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 2; - s->maxdata = 0x0fff; - s->range_table = &range_fl512; - s->insn_write = fl512_ao_insn_write; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 2; + s->maxdata = 0x0fff; + s->range_table = &range_fl512; + s->insn_write = fl512_ao_insn_write; return comedi_alloc_subdev_readback(s); } static struct comedi_driver fl512_driver = { - .driver_name = "fl512", - .module = THIS_MODULE, - .attach = fl512_attach, - .detach = comedi_legacy_detach, + .driver_name = "fl512", + .module = THIS_MODULE, + .attach = fl512_attach, + .detach = comedi_legacy_detach, }; + module_comedi_driver(fl512_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/gsc_hpdi.c b/drivers/comedi/drivers/gsc_hpdi.c index e35e4a743714..4aa12595315b 100644 --- a/drivers/comedi/drivers/gsc_hpdi.c +++ b/drivers/comedi/drivers/gsc_hpdi.c @@ -50,7 +50,7 @@ #define RX_FIFO_RESET_BIT BIT(2) #define TX_ENABLE_BIT BIT(4) #define RX_ENABLE_BIT BIT(5) -#define DEMAND_DMA_DIRECTION_TX_BIT BIT(6) /* ch 0 only */ +#define DEMAND_DMA_DIRECTION_TX_BIT BIT(6) /* ch 0 only */ #define LINE_VALID_ON_STATUS_VALID_BIT BIT(7) #define START_TX_BIT BIT(8) #define CABLE_THROTTLE_ENABLE_BIT BIT(9) @@ -217,7 +217,7 @@ static irqreturn_t gsc_hpdi_interrupt(int irq, void *d) spin_lock_irqsave(&dev->spinlock, flags); dma1_status = readb(devpriv->plx9080_mmio + PLX_REG_DMACSR1); if (plx_status & PLX_INTCSR_DMA1IA) { - /* XXX */ /* dma chan 1 interrupt */ + /* XXX *//* dma chan 1 interrupt */ writeb((dma1_status & PLX_DMACSR_ENABLE) | PLX_DMACSR_CLEARINTR, devpriv->plx9080_mmio + PLX_REG_DMACSR1); } @@ -272,8 +272,7 @@ static int gsc_hpdi_cancel(struct comedi_device *dev, return 0; } -static int gsc_hpdi_cmd(struct comedi_device *dev, - struct comedi_subdevice *s) +static int gsc_hpdi_cmd(struct comedi_device *dev, struct comedi_subdevice *s) { struct hpdi_private *devpriv = dev->private; struct comedi_async *async = s->async; @@ -302,7 +301,7 @@ static int gsc_hpdi_cmd(struct comedi_device *dev, /* give location of first dma descriptor */ bits = devpriv->dma_desc_phys_addr | PLX_DMADPR_DESCPCI | - PLX_DMADPR_TCINTR | PLX_DMADPR_XFERL2P; + PLX_DMADPR_TCINTR | PLX_DMADPR_XFERL2P; writel(bits, devpriv->plx9080_mmio + PLX_REG_DMADPR0); /* enable dma transfer */ @@ -347,8 +346,7 @@ static int gsc_hpdi_check_chanlist(struct comedi_device *dev, } static int gsc_hpdi_cmd_test(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_cmd *cmd) + struct comedi_subdevice *s, struct comedi_cmd *cmd) { int err = 0; @@ -388,7 +386,7 @@ static int gsc_hpdi_cmd_test(struct comedi_device *dev, if (cmd->stop_src == TRIG_COUNT) err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); - else /* TRIG_NONE */ + else /* TRIG_NONE */ err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) @@ -414,7 +412,7 @@ static int gsc_hpdi_setup_dma_descriptors(struct comedi_device *dev, struct hpdi_private *devpriv = dev->private; dma_addr_t phys_addr = devpriv->dma_desc_phys_addr; u32 next_bits = PLX_DMADPR_DESCPCI | PLX_DMADPR_TCINTR | - PLX_DMADPR_XFERL2P; + PLX_DMADPR_XFERL2P; unsigned int offset = 0; unsigned int idx = 0; unsigned int i; @@ -431,10 +429,14 @@ static int gsc_hpdi_setup_dma_descriptors(struct comedi_device *dev, devpriv->dma_desc[i].local_start_addr = cpu_to_le32(FIFO_REG); devpriv->dma_desc[i].transfer_size = cpu_to_le32(len); devpriv->dma_desc[i].next = cpu_to_le32((phys_addr + - (i + 1) * sizeof(devpriv->dma_desc[0])) | next_bits); + (i + + 1) * + sizeof + (devpriv->dma_desc[0])) + | next_bits); devpriv->desc_dio_buffer[i] = devpriv->dio_buffer[idx] + - (offset / sizeof(u32)); + (offset / sizeof(u32)); offset += len; if (len + offset > DMA_BUFFER_SIZE) { @@ -517,9 +519,9 @@ static int gsc_hpdi_init(struct comedi_device *dev) dev->mmio + TX_PROG_ALMOST_REG); devpriv->tx_fifo_size = readl(dev->mmio + TX_FIFO_SIZE_REG) & - FIFO_SIZE_MASK; + FIFO_SIZE_MASK; devpriv->rx_fifo_size = readl(dev->mmio + RX_FIFO_SIZE_REG) & - FIFO_SIZE_MASK; + FIFO_SIZE_MASK; writel(0, dev->mmio + INTERRUPT_CONTROL_REG); @@ -657,17 +659,17 @@ static int gsc_hpdi_auto_attach(struct comedi_device *dev, /* Digital I/O subdevice */ s = &dev->subdevices[0]; dev->read_subdev = s; - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_LSAMPL | - SDF_CMD_READ; - s->n_chan = 32; - s->len_chanlist = 32; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_config = gsc_hpdi_dio_insn_config; - s->do_cmd = gsc_hpdi_cmd; - s->do_cmdtest = gsc_hpdi_cmd_test; - s->cancel = gsc_hpdi_cancel; + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_LSAMPL | + SDF_CMD_READ; + s->n_chan = 32; + s->len_chanlist = 32; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_config = gsc_hpdi_dio_insn_config; + s->do_cmd = gsc_hpdi_cmd; + s->do_cmdtest = gsc_hpdi_cmd_test; + s->cancel = gsc_hpdi_cancel; return gsc_hpdi_init(dev); } @@ -691,10 +693,10 @@ static void gsc_hpdi_detach(struct comedi_device *dev) } static struct comedi_driver gsc_hpdi_driver = { - .driver_name = "gsc_hpdi", - .module = THIS_MODULE, - .auto_attach = gsc_hpdi_auto_attach, - .detach = gsc_hpdi_detach, + .driver_name = "gsc_hpdi", + .module = THIS_MODULE, + .auto_attach = gsc_hpdi_auto_attach, + .detach = gsc_hpdi_detach, }; static int gsc_hpdi_pci_probe(struct pci_dev *dev, @@ -708,14 +710,16 @@ static const struct pci_device_id gsc_hpdi_pci_table[] = { PCI_VENDOR_ID_PLX, 0x2400) }, { 0 } }; + MODULE_DEVICE_TABLE(pci, gsc_hpdi_pci_table); static struct pci_driver gsc_hpdi_pci_driver = { - .name = "gsc_hpdi", - .id_table = gsc_hpdi_pci_table, - .probe = gsc_hpdi_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "gsc_hpdi", + .id_table = gsc_hpdi_pci_table, + .probe = gsc_hpdi_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(gsc_hpdi_driver, gsc_hpdi_pci_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/icp_multi.c b/drivers/comedi/drivers/icp_multi.c index 16d2b78de83c..111ba101dc84 100644 --- a/drivers/comedi/drivers/icp_multi.c +++ b/drivers/comedi/drivers/icp_multi.c @@ -76,19 +76,18 @@ /* analog input and output have the same range options */ static const struct comedi_lrange icp_multi_ranges = { 4, { - UNI_RANGE(5), - UNI_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(10) - } + UNI_RANGE(5), + UNI_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(10) + } }; static const char range_codes_analog[] = { 0x00, 0x20, 0x10, 0x30 }; static int icp_multi_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned int status; @@ -100,8 +99,7 @@ static int icp_multi_ai_eoc(struct comedi_device *dev, static int icp_multi_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int range = CR_RANGE(insn->chanspec); @@ -113,7 +111,7 @@ static int icp_multi_ai_insn_read(struct comedi_device *dev, /* Set mode and range data for specified channel */ if (aref == AREF_DIFF) { adc_csr = ICP_MULTI_ADC_CSR_DI_CHAN(chan) | - ICP_MULTI_ADC_CSR_DI; + ICP_MULTI_ADC_CSR_DI; } else { adc_csr = ICP_MULTI_ADC_CSR_SE_CHAN(chan); } @@ -140,8 +138,7 @@ static int icp_multi_ai_insn_read(struct comedi_device *dev, static int icp_multi_ao_ready(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned int status; @@ -153,8 +150,7 @@ static int icp_multi_ao_ready(struct comedi_device *dev, static int icp_multi_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int range = CR_RANGE(insn->chanspec); @@ -189,8 +185,7 @@ static int icp_multi_ao_insn_write(struct comedi_device *dev, static int icp_multi_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { data[1] = readw(dev->mmio + ICP_MULTI_DI); @@ -199,8 +194,7 @@ static int icp_multi_di_insn_bits(struct comedi_device *dev, static int icp_multi_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { if (comedi_dio_update_state(s, data)) writew(s->state, dev->mmio + ICP_MULTI_DO); @@ -263,21 +257,21 @@ static int icp_multi_auto_attach(struct comedi_device *dev, /* Analog Input subdevice */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_COMMON | SDF_GROUND | SDF_DIFF; - s->n_chan = 16; - s->maxdata = 0x0fff; - s->range_table = &icp_multi_ranges; - s->insn_read = icp_multi_ai_insn_read; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_COMMON | SDF_GROUND | SDF_DIFF; + s->n_chan = 16; + s->maxdata = 0x0fff; + s->range_table = &icp_multi_ranges; + s->insn_read = icp_multi_ai_insn_read; /* Analog Output subdevice */ s = &dev->subdevices[1]; - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_COMMON; - s->n_chan = 4; - s->maxdata = 0x0fff; - s->range_table = &icp_multi_ranges; - s->insn_write = icp_multi_ao_insn_write; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_COMMON; + s->n_chan = 4; + s->maxdata = 0x0fff; + s->range_table = &icp_multi_ranges; + s->insn_write = icp_multi_ao_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) @@ -285,30 +279,30 @@ static int icp_multi_auto_attach(struct comedi_device *dev, /* Digital Input subdevice */ s = &dev->subdevices[2]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 16; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = icp_multi_di_insn_bits; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 16; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = icp_multi_di_insn_bits; /* Digital Output subdevice */ s = &dev->subdevices[3]; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 8; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = icp_multi_do_insn_bits; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 8; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = icp_multi_do_insn_bits; return 0; } static struct comedi_driver icp_multi_driver = { - .driver_name = "icp_multi", - .module = THIS_MODULE, - .auto_attach = icp_multi_auto_attach, - .detach = comedi_pci_detach, + .driver_name = "icp_multi", + .module = THIS_MODULE, + .auto_attach = icp_multi_auto_attach, + .detach = comedi_pci_detach, }; static int icp_multi_pci_probe(struct pci_dev *dev, @@ -321,14 +315,16 @@ static const struct pci_device_id icp_multi_pci_table[] = { { PCI_DEVICE(PCI_VENDOR_ID_ICP, 0x8000) }, { 0 } }; + MODULE_DEVICE_TABLE(pci, icp_multi_pci_table); static struct pci_driver icp_multi_pci_driver = { - .name = "icp_multi", - .id_table = icp_multi_pci_table, - .probe = icp_multi_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "icp_multi", + .id_table = icp_multi_pci_table, + .probe = icp_multi_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(icp_multi_driver, icp_multi_pci_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/ii_pci20kc.c b/drivers/comedi/drivers/ii_pci20kc.c index 399255dbe388..33a892fb7cb6 100644 --- a/drivers/comedi/drivers/ii_pci20kc.c +++ b/drivers/comedi/drivers/ii_pci20kc.c @@ -119,19 +119,19 @@ /* the AO range is set by jumpers on the 20006M module */ static const struct comedi_lrange ii20k_ao_ranges = { 3, { - BIP_RANGE(5), /* Chan 0 - W1/W3 in Chan 1 - W2/W4 in */ - UNI_RANGE(10), /* Chan 0 - W1/W3 out Chan 1 - W2/W4 in */ - BIP_RANGE(10) /* Chan 0 - W1/W3 in Chan 1 - W2/W4 out */ - } + BIP_RANGE(5), /* Chan 0 - W1/W3 in Chan 1 - W2/W4 in */ + UNI_RANGE(10), /* Chan 0 - W1/W3 out Chan 1 - W2/W4 in */ + BIP_RANGE(10) /* Chan 0 - W1/W3 in Chan 1 - W2/W4 out */ + } }; static const struct comedi_lrange ii20k_ai_ranges = { 4, { - BIP_RANGE(5), /* gain 1 */ - BIP_RANGE(0.5), /* gain 10 */ - BIP_RANGE(0.05), /* gain 100 */ - BIP_RANGE(0.025) /* gain 200 */ - }, + BIP_RANGE(5), /* gain 1 */ + BIP_RANGE(0.5), /* gain 10 */ + BIP_RANGE(0.05), /* gain 100 */ + BIP_RANGE(0.025) /* gain 200 */ + }, }; static void __iomem *ii20k_module_iobase(struct comedi_device *dev, @@ -142,8 +142,7 @@ static void __iomem *ii20k_module_iobase(struct comedi_device *dev, static int ii20k_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { void __iomem *iobase = ii20k_module_iobase(dev, s); unsigned int chan = CR_CHAN(insn->chanspec); @@ -167,8 +166,7 @@ static int ii20k_ao_insn_write(struct comedi_device *dev, static int ii20k_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { void __iomem *iobase = ii20k_module_iobase(dev, s); unsigned char status; @@ -180,8 +178,7 @@ static int ii20k_ai_eoc(struct comedi_device *dev, } static void ii20k_ai_setup(struct comedi_device *dev, - struct comedi_subdevice *s, - unsigned int chanspec) + struct comedi_subdevice *s, unsigned int chanspec) { void __iomem *iobase = ii20k_module_iobase(dev, s); unsigned int chan = CR_CHAN(chanspec); @@ -207,9 +204,8 @@ static void ii20k_ai_setup(struct comedi_device *dev, /* set the channel list byte */ val = II20K_AI_CHANLIST_ONBOARD_ONLY | - II20K_AI_CHANLIST_MUX_ENA | - II20K_AI_CHANLIST_GAIN(range) | - II20K_AI_CHANLIST_CHAN(chan); + II20K_AI_CHANLIST_MUX_ENA | + II20K_AI_CHANLIST_GAIN(range) | II20K_AI_CHANLIST_CHAN(chan); writeb(val, iobase + II20K_AI_CHANLIST_REG); /* reset settling time counter and trigger delay counter */ @@ -221,8 +217,7 @@ static void ii20k_ai_setup(struct comedi_device *dev, static int ii20k_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { void __iomem *iobase = ii20k_module_iobase(dev, s); int ret; @@ -316,8 +311,7 @@ static void ii20k_dio_config(struct comedi_device *dev, static int ii20k_dio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int mask; @@ -343,8 +337,7 @@ static int ii20k_dio_insn_config(struct comedi_device *dev, static int ii20k_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int mask; @@ -384,12 +377,12 @@ static int ii20k_init_module(struct comedi_device *dev, case II20K_ID_PCI20006M_1: case II20K_ID_PCI20006M_2: /* Analog Output subdevice */ - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = (id == II20K_ID_PCI20006M_2) ? 2 : 1; - s->maxdata = 0xffff; - s->range_table = &ii20k_ao_ranges; - s->insn_write = ii20k_ao_insn_write; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = (id == II20K_ID_PCI20006M_2) ? 2 : 1; + s->maxdata = 0xffff; + s->range_table = &ii20k_ao_ranges; + s->insn_write = ii20k_ao_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) @@ -397,12 +390,12 @@ static int ii20k_init_module(struct comedi_device *dev, break; case II20K_ID_PCI20341M_1: /* Analog Input subdevice */ - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_DIFF; - s->n_chan = 4; - s->maxdata = 0xffff; - s->range_table = &ii20k_ai_ranges; - s->insn_read = ii20k_ai_insn_read; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_DIFF; + s->n_chan = 4; + s->maxdata = 0xffff; + s->range_table = &ii20k_ai_ranges; + s->insn_read = ii20k_ai_insn_read; break; default: s->type = COMEDI_SUBD_UNUSED; @@ -412,8 +405,7 @@ static int ii20k_init_module(struct comedi_device *dev, return 0; } -static int ii20k_attach(struct comedi_device *dev, - struct comedi_devconfig *it) +static int ii20k_attach(struct comedi_device *dev, struct comedi_devconfig *it) { struct comedi_subdevice *s; unsigned int membase; @@ -486,13 +478,13 @@ static int ii20k_attach(struct comedi_device *dev, /* Digital I/O subdevice */ s = &dev->subdevices[3]; if (has_dio) { - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 32; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = ii20k_dio_insn_bits; - s->insn_config = ii20k_dio_insn_config; + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 32; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = ii20k_dio_insn_bits; + s->insn_config = ii20k_dio_insn_config; /* default all channels to input */ ii20k_dio_config(dev, s); @@ -512,11 +504,12 @@ static void ii20k_detach(struct comedi_device *dev) } static struct comedi_driver ii20k_driver = { - .driver_name = "ii_pci20kc", - .module = THIS_MODULE, - .attach = ii20k_attach, - .detach = ii20k_detach, + .driver_name = "ii_pci20kc", + .module = THIS_MODULE, + .attach = ii20k_attach, + .detach = ii20k_detach, }; + module_comedi_driver(ii20k_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/jr3_pci.c b/drivers/comedi/drivers/jr3_pci.c index f963080dd61f..71489cb97b4b 100644 --- a/drivers/comedi/drivers/jr3_pci.c +++ b/drivers/comedi/drivers/jr3_pci.c @@ -56,21 +56,21 @@ struct jr3_pci_board { static const struct jr3_pci_board jr3_pci_boards[] = { [BOARD_JR3_1] = { - .name = "jr3_pci_1", - .n_subdevs = 1, - }, + .name = "jr3_pci_1", + .n_subdevs = 1, + }, [BOARD_JR3_2] = { - .name = "jr3_pci_2", - .n_subdevs = 2, - }, + .name = "jr3_pci_2", + .n_subdevs = 2, + }, [BOARD_JR3_3] = { - .name = "jr3_pci_3", - .n_subdevs = 3, - }, + .name = "jr3_pci_3", + .n_subdevs = 3, + }, [BOARD_JR3_4] = { - .name = "jr3_pci_4", - .n_subdevs = 4, - }, + .name = "jr3_pci_4", + .n_subdevs = 4, + }, }; struct jr3_pci_transform { @@ -126,12 +126,12 @@ static struct jr3_pci_poll_delay poll_delay_min_max(int min, int max) return result; } -static int is_complete(struct jr3_sensor __iomem *sensor) +static int is_complete(struct jr3_sensor __iomem *sensor) { return get_s16(&sensor->command_word0) == 0; } -static void set_transforms(struct jr3_sensor __iomem *sensor, +static void set_transforms(struct jr3_sensor __iomem *sensor, const struct jr3_pci_transform *transf, short num) { int i; @@ -149,18 +149,17 @@ static void set_transforms(struct jr3_sensor __iomem *sensor, } } -static void use_transform(struct jr3_sensor __iomem *sensor, - short transf_num) +static void use_transform(struct jr3_sensor __iomem *sensor, short transf_num) { set_s16(&sensor->command_word0, 0x0500 + (transf_num & 0x000f)); } -static void use_offset(struct jr3_sensor __iomem *sensor, short offset_num) +static void use_offset(struct jr3_sensor __iomem *sensor, short offset_num) { set_s16(&sensor->command_word0, 0x0600 + (offset_num & 0x000f)); } -static void set_offset(struct jr3_sensor __iomem *sensor) +static void set_offset(struct jr3_sensor __iomem *sensor) { set_s16(&sensor->command_word0, 0x0700); } @@ -174,7 +173,7 @@ struct six_axis_t { s16 mz; }; -static void set_full_scales(struct jr3_sensor __iomem *sensor, +static void set_full_scales(struct jr3_sensor __iomem *sensor, struct six_axis_t full_scale) { set_s16(&sensor->full_scale.fx, full_scale.fx); @@ -186,7 +185,7 @@ static void set_full_scales(struct jr3_sensor __iomem *sensor, set_s16(&sensor->command_word0, 0x0a00); } -static struct six_axis_t get_max_full_scales(struct jr3_sensor __iomem *sensor) +static struct six_axis_t get_max_full_scales(struct jr3_sensor __iomem *sensor) { struct six_axis_t result; @@ -251,8 +250,7 @@ static unsigned int jr3_pci_ai_read_chan(struct comedi_device *dev, static int jr3_pci_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct jr3_pci_subdev_private *spriv = s->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -291,7 +289,7 @@ static int jr3_pci_open(struct comedi_device *dev) return 0; } -static int read_idm_word(const u8 *data, size_t size, int *pos, +static int read_idm_word(const u8 *data, size_t size, int *pos, unsigned int *val) { int result = 0; @@ -299,8 +297,7 @@ static int read_idm_word(const u8 *data, size_t size, int *pos, if (pos && val) { /* Skip over non hex */ - for (; *pos < size && !isxdigit(data[*pos]); (*pos)++) - ; + for (; *pos < size && !isxdigit(data[*pos]); (*pos)++); /* Collect value */ *val = 0; for (; *pos < size; (*pos)++) { @@ -317,7 +314,7 @@ static int read_idm_word(const u8 *data, size_t size, int *pos, } static int jr3_check_firmware(struct comedi_device *dev, - const u8 *data, size_t size) + const u8 *data, size_t size) { int more = 1; int pos = 0; @@ -348,7 +345,7 @@ static int jr3_check_firmware(struct comedi_device *dev, } static void jr3_write_firmware(struct comedi_device *dev, - int subdev, const u8 *data, size_t size) + int subdev, const u8 *data, size_t size) { struct jr3_block __iomem *block = dev->mmio; u32 __iomem *lo; @@ -375,7 +372,7 @@ static void jr3_write_firmware(struct comedi_device *dev, unsigned int data1 = 0; more = more && - read_idm_word(data, size, &pos, &data1); + read_idm_word(data, size, &pos, &data1); count--; /* jr3[addr + 0x20000 * pnum] = data1; */ } else { @@ -387,9 +384,9 @@ static void jr3_write_firmware(struct comedi_device *dev, hi = &block[subdev].program_hi[addr]; more = more && - read_idm_word(data, size, &pos, &data1); + read_idm_word(data, size, &pos, &data1); more = more && - read_idm_word(data, size, &pos, &data2); + read_idm_word(data, size, &pos, &data2); count -= 2; if (more) { set_u16(lo, data1); @@ -404,7 +401,7 @@ static void jr3_write_firmware(struct comedi_device *dev, } static int jr3_download_firmware(struct comedi_device *dev, - const u8 *data, size_t size, + const u8 *data, size_t size, unsigned long context) { int subdev; @@ -587,7 +584,7 @@ static void jr3_pci_poll_dev(struct timer_list *t) sub_delay = jr3_pci_poll_subdevice(s); spriv->next_time_min = jiffies + - msecs_to_jiffies(sub_delay.min); + msecs_to_jiffies(sub_delay.min); if (sub_delay.max && sub_delay.max < delay) /* @@ -603,8 +600,9 @@ static void jr3_pci_poll_dev(struct timer_list *t) add_timer(&devpriv->timer); } -static struct jr3_pci_subdev_private * -jr3_pci_alloc_spriv(struct comedi_device *dev, struct comedi_subdevice *s) +static struct jr3_pci_subdev_private *jr3_pci_alloc_spriv(struct comedi_device + *dev, struct + comedi_subdevice * s) { struct jr3_block __iomem *block = dev->mmio; struct jr3_pci_subdev_private *spriv; @@ -652,8 +650,7 @@ static void jr3_pci_show_copyright(struct comedi_device *dev) dev_dbg(dev->class_dev, "Firmware copyright: %s\n", copy); } -static int jr3_pci_auto_attach(struct comedi_device *dev, - unsigned long context) +static int jr3_pci_auto_attach(struct comedi_device *dev, unsigned long context) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); static const struct jr3_pci_board *board; @@ -697,18 +694,18 @@ static int jr3_pci_auto_attach(struct comedi_device *dev, dev->open = jr3_pci_open; for (i = 0; i < dev->n_subdevices; i++) { s = &dev->subdevices[i]; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_GROUND; - s->n_chan = 8 * 7 + 2; - s->insn_read = jr3_pci_ai_insn_read; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_GROUND; + s->n_chan = 8 * 7 + 2; + s->insn_read = jr3_pci_ai_insn_read; spriv = jr3_pci_alloc_spriv(dev, s); if (!spriv) return -ENOMEM; /* Channel specific range and maxdata */ - s->range_table_list = spriv->range_table_list; - s->maxdata_list = spriv->maxdata_list; + s->range_table_list = spriv->range_table_list; + s->maxdata_list = spriv->maxdata_list; } /* Reset DSP card */ @@ -765,10 +762,10 @@ static void jr3_pci_detach(struct comedi_device *dev) } static struct comedi_driver jr3_pci_driver = { - .driver_name = "jr3_pci", - .module = THIS_MODULE, - .auto_attach = jr3_pci_auto_attach, - .detach = jr3_pci_detach, + .driver_name = "jr3_pci", + .module = THIS_MODULE, + .auto_attach = jr3_pci_auto_attach, + .detach = jr3_pci_detach, }; static int jr3_pci_pci_probe(struct pci_dev *dev, @@ -785,14 +782,16 @@ static const struct pci_device_id jr3_pci_pci_table[] = { { PCI_VDEVICE(JR3, 0x3114), BOARD_JR3_4 }, { 0 } }; + MODULE_DEVICE_TABLE(pci, jr3_pci_pci_table); static struct pci_driver jr3_pci_pci_driver = { - .name = "jr3_pci", - .id_table = jr3_pci_pci_table, - .probe = jr3_pci_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "jr3_pci", + .id_table = jr3_pci_pci_table, + .probe = jr3_pci_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(jr3_pci_driver, jr3_pci_pci_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/jr3_pci.h b/drivers/comedi/drivers/jr3_pci.h index acd4e5456ceb..548633b36c91 100644 --- a/drivers/comedi/drivers/jr3_pci.h +++ b/drivers/comedi/drivers/jr3_pci.h @@ -4,22 +4,22 @@ * is 16 bits, but aligned on a 32 bit PCI boundary */ -static inline u16 get_u16(const u32 __iomem *p) +static inline u16 get_u16(const u32 __iomem *p) { - return (u16)readl(p); + return (u16) readl(p); } -static inline void set_u16(u32 __iomem *p, u16 val) +static inline void set_u16(u32 __iomem *p, u16 val) { writel(val, p); } -static inline s16 get_s16(const s32 __iomem *p) +static inline s16 get_s16(const s32 __iomem *p) { - return (s16)readl(p); + return (s16) readl(p); } -static inline void set_s16(s32 __iomem *p, s16 val) +static inline void set_s16(s32 __iomem *p, s16 val) { writel(val, p); } @@ -319,8 +319,8 @@ struct jr3_sensor { * command (10) set new full scales (pg. 38). */ - struct six_axis_array shunts; /* offset 0x0060 */ - s32 reserved2[2]; /* offset 0x0066 */ + struct six_axis_array shunts; /* offset 0x0060 */ + s32 reserved2[2]; /* offset 0x0066 */ /* * Default_FS contains the full scale that is used if the user does @@ -328,7 +328,7 @@ struct jr3_sensor { */ struct six_axis_array default_FS; /* offset 0x0068 */ - s32 reserved3; /* offset 0x006e */ + s32 reserved3; /* offset 0x006e */ /* * Load_envelope_num is the load envelope number that is currently @@ -336,7 +336,7 @@ struct jr3_sensor { * envelopes has been initialized. */ - s32 load_envelope_num; /* offset 0x006f */ + s32 load_envelope_num; /* offset 0x006f */ /* Min_full_scale is the recommend minimum full scale. */ @@ -367,7 +367,7 @@ struct jr3_sensor { */ struct six_axis_array min_full_scale; /* offset 0x0070 */ - s32 reserved4; /* offset 0x0076 */ + s32 reserved4; /* offset 0x0076 */ /* * Transform_num is the transform number that is currently in use. @@ -375,7 +375,7 @@ struct jr3_sensor { * (5) use transform # (pg. 33). */ - s32 transform_num; /* offset 0x0077 */ + s32 transform_num; /* offset 0x0077 */ /* * Max_full_scale is the recommended maximum full scale. @@ -383,7 +383,7 @@ struct jr3_sensor { */ struct six_axis_array max_full_scale; /* offset 0x0078 */ - s32 reserved5; /* offset 0x007e */ + s32 reserved5; /* offset 0x007e */ /* * Peak_address is the address of the data which will be monitored @@ -392,7 +392,7 @@ struct jr3_sensor { * (ex. to watch filter3 data for peaks, set this value to 0x00a8). */ - s32 peak_address; /* offset 0x007f */ + s32 peak_address; /* offset 0x007f */ /* * Full_scale is the sensor full scales which are currently in use. @@ -407,7 +407,7 @@ struct jr3_sensor { * axes used for each vector respectively. */ - struct force_array full_scale; /* offset 0x0080 */ + struct force_array full_scale; /* offset 0x0080 */ /* * Offsets contains the sensor offsets. These values are subtracted from @@ -423,7 +423,7 @@ struct jr3_sensor { * about Z by 90 degrees, FY would be 5 and all others would be zero. */ - struct six_axis_array offsets; /* offset 0x0088 */ + struct six_axis_array offsets; /* offset 0x0088 */ /* * Offset_num is the number of the offset currently in use. This @@ -431,7 +431,7 @@ struct jr3_sensor { * offset # command (pg. 34). It can vary between 0 and 15. */ - s32 offset_num; /* offset 0x008e */ + s32 offset_num; /* offset 0x008e */ /* * Vect_axes is a bit map showing which of the axes are being used @@ -439,7 +439,7 @@ struct jr3_sensor { * after the user has executed the set vector axes command (pg. 37). */ - u32 vect_axes; /* offset 0x008f */ + u32 vect_axes; /* offset 0x008f */ /* * Filter0 is the decoupled, unfiltered data from the JR3 sensor. @@ -454,15 +454,15 @@ struct jr3_sensor { * cutoff at 125 Hz, 31.25 Hz, 7.813 Hz, 1.953 Hz and 0.4883 Hz. */ - struct force_array filter[7]; /* - * offset 0x0090, - * offset 0x0098, - * offset 0x00a0, - * offset 0x00a8, - * offset 0x00b0, - * offset 0x00b8, - * offset 0x00c0 - */ + struct force_array filter[7]; /* + * offset 0x0090, + * offset 0x0098, + * offset 0x00a0, + * offset 0x00a8, + * offset 0x00b0, + * offset 0x00b8, + * offset 0x00c0 + */ /* * Rate_data is the calculated rate data. It is a first derivative @@ -471,7 +471,7 @@ struct jr3_sensor { * calculated is specified by the variable rate_address (pg. 12). */ - struct force_array rate_data; /* offset 0x00c8 */ + struct force_array rate_data; /* offset 0x00c8 */ /* * Minimum_data & maximum_data are the minimum and maximum (peak) @@ -504,8 +504,8 @@ struct jr3_sensor { * sat_value = 32768 - 2^(16 - ADC bits) */ - s32 near_sat_value; /* offset 0x00e0 */ - s32 sat_value; /* offset 0x00e1 */ + s32 near_sat_value; /* offset 0x00e0 */ + s32 sat_value; /* offset 0x00e1 */ /* * Rate_address, rate_divisor & rate_count contain the data used to @@ -525,9 +525,9 @@ struct jr3_sensor { * will minimize the time necessary to start the rate calculations. */ - s32 rate_address; /* offset 0x00e2 */ - u32 rate_divisor; /* offset 0x00e3 */ - u32 rate_count; /* offset 0x00e4 */ + s32 rate_address; /* offset 0x00e2 */ + u32 rate_divisor; /* offset 0x00e3 */ + u32 rate_count; /* offset 0x00e4 */ /* * Command_word2 through command_word0 are the locations used to @@ -543,9 +543,9 @@ struct jr3_sensor { * command_word1). */ - s32 command_word2; /* offset 0x00e5 */ - s32 command_word1; /* offset 0x00e6 */ - s32 command_word0; /* offset 0x00e7 */ + s32 command_word2; /* offset 0x00e5 */ + s32 command_word1; /* offset 0x00e6 */ + s32 command_word0; /* offset 0x00e7 */ /* * Count1 through count6 are unsigned counters which are incremented @@ -560,12 +560,12 @@ struct jr3_sensor { * once. */ - u32 count1; /* offset 0x00e8 */ - u32 count2; /* offset 0x00e9 */ - u32 count3; /* offset 0x00ea */ - u32 count4; /* offset 0x00eb */ - u32 count5; /* offset 0x00ec */ - u32 count6; /* offset 0x00ed */ + u32 count1; /* offset 0x00e8 */ + u32 count2; /* offset 0x00e9 */ + u32 count3; /* offset 0x00ea */ + u32 count4; /* offset 0x00eb */ + u32 count5; /* offset 0x00ec */ + u32 count6; /* offset 0x00ed */ /* * Error_count is a running count of data reception errors. If this @@ -578,7 +578,7 @@ struct jr3_sensor { * where this counter counts a bad sample, that sample is ignored. */ - u32 error_count; /* offset 0x00ee */ + u32 error_count; /* offset 0x00ee */ /* * Count_x is a counter which is incremented every time the JR3 DSP @@ -588,7 +588,7 @@ struct jr3_sensor { * Issues section on pg. 49 for more details. */ - u32 count_x; /* offset 0x00ef */ + u32 count_x; /* offset 0x00ef */ /* * Warnings & errors contain the warning and error bits @@ -596,8 +596,8 @@ struct jr3_sensor { * 21 under the headings warnings_bits and error_bits. */ - u32 warnings; /* offset 0x00f0 */ - u32 errors; /* offset 0x00f1 */ + u32 warnings; /* offset 0x00f0 */ + u32 errors; /* offset 0x00f1 */ /* * Threshold_bits is a word containing the bits that are set by the @@ -605,7 +605,7 @@ struct jr3_sensor { * (pg. 23) for more details. */ - s32 threshold_bits; /* offset 0x00f2 */ + s32 threshold_bits; /* offset 0x00f2 */ /* * Last_crc is the value that shows the actual calculated CRC. CRC @@ -613,7 +613,7 @@ struct jr3_sensor { * description for cal_crc_bad (pg. 21) for more information. */ - s32 last_CRC; /* offset 0x00f3 */ + s32 last_CRC; /* offset 0x00f3 */ /* * EEProm_ver_no contains the version number of the sensor EEProm. @@ -622,8 +622,8 @@ struct jr3_sensor { * 3.02 would be stored as 302. */ - s32 eeprom_ver_no; /* offset 0x00f4 */ - s32 software_ver_no; /* offset 0x00f5 */ + s32 eeprom_ver_no; /* offset 0x00f4 */ + s32 software_ver_no; /* offset 0x00f5 */ /* * Software_day & software_year are the release date of the software @@ -632,8 +632,8 @@ struct jr3_sensor { * years. */ - s32 software_day; /* offset 0x00f6 */ - s32 software_year; /* offset 0x00f7 */ + s32 software_day; /* offset 0x00f6 */ + s32 software_year; /* offset 0x00f7 */ /* * Serial_no & model_no are the two values which uniquely identify a @@ -642,8 +642,8 @@ struct jr3_sensor { * different sensor configurations. */ - u32 serial_no; /* offset 0x00f8 */ - u32 model_no; /* offset 0x00f9 */ + u32 serial_no; /* offset 0x00f8 */ + u32 model_no; /* offset 0x00f9 */ /* * Cal_day & cal_year are the sensor calibration date. Day is the @@ -651,8 +651,8 @@ struct jr3_sensor { * 366 for leap years. */ - s32 cal_day; /* offset 0x00fa */ - s32 cal_year; /* offset 0x00fb */ + s32 cal_day; /* offset 0x00fa */ + s32 cal_year; /* offset 0x00fb */ /* * Units is an enumerated read only value defining the engineering @@ -678,9 +678,9 @@ struct jr3_sensor { * received. */ - u32 units; /* offset 0x00fc */ - s32 bits; /* offset 0x00fd */ - s32 channels; /* offset 0x00fe */ + u32 units; /* offset 0x00fc */ + s32 bits; /* offset 0x00fd */ + s32 channels; /* offset 0x00fe */ /* * Thickness specifies the overall thickness of the sensor from @@ -690,7 +690,7 @@ struct jr3_sensor { * transformation from the center of the sensor to either flange. */ - s32 thickness; /* offset 0x00ff */ + s32 thickness; /* offset 0x00ff */ /* * Load_envelopes is a table containing the load envelope @@ -726,10 +726,10 @@ struct jr3_sensor { }; struct jr3_block { - u32 program_lo[0x4000]; /* 0x00000 - 0x10000 */ + u32 program_lo[0x4000]; /* 0x00000 - 0x10000 */ struct jr3_sensor sensor; /* 0x10000 - 0x10c00 */ char pad2[0x30000 - 0x00c00]; /* 0x10c00 - 0x40000 */ - u32 program_hi[0x8000]; /* 0x40000 - 0x60000 */ - u32 reset; /* 0x60000 - 0x60004 */ + u32 program_hi[0x8000]; /* 0x40000 - 0x60000 */ + u32 reset; /* 0x60000 - 0x60004 */ char pad3[0x20000 - 0x00004]; /* 0x60004 - 0x80000 */ }; diff --git a/drivers/comedi/drivers/ke_counter.c b/drivers/comedi/drivers/ke_counter.c index bef1b20c1c8d..f2e04c2b337d 100644 --- a/drivers/comedi/drivers/ke_counter.c +++ b/drivers/comedi/drivers/ke_counter.c @@ -40,8 +40,7 @@ static int ke_counter_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int val; @@ -62,8 +61,7 @@ static int ke_counter_insn_write(struct comedi_device *dev, static int ke_counter_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int val; @@ -94,8 +92,7 @@ static void ke_counter_reset(struct comedi_device *dev) static int ke_counter_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned char src; @@ -147,8 +144,7 @@ static int ke_counter_insn_config(struct comedi_device *dev, static int ke_counter_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { if (comedi_dio_update_state(s, data)) outb(s->state, dev->iobase + KE_DO_REG); @@ -175,22 +171,22 @@ static int ke_counter_auto_attach(struct comedi_device *dev, return ret; s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_COUNTER; - s->subdev_flags = SDF_READABLE; - s->n_chan = 3; - s->maxdata = 0x01ffffff; - s->range_table = &range_unknown; - s->insn_read = ke_counter_insn_read; - s->insn_write = ke_counter_insn_write; - s->insn_config = ke_counter_insn_config; + s->type = COMEDI_SUBD_COUNTER; + s->subdev_flags = SDF_READABLE; + s->n_chan = 3; + s->maxdata = 0x01ffffff; + s->range_table = &range_unknown; + s->insn_read = ke_counter_insn_read; + s->insn_write = ke_counter_insn_write; + s->insn_config = ke_counter_insn_config; s = &dev->subdevices[1]; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 3; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = ke_counter_do_insn_bits; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 3; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = ke_counter_do_insn_bits; outb(KE_OSC_SEL_20MHZ, dev->iobase + KE_OSC_SEL_REG); @@ -200,31 +196,32 @@ static int ke_counter_auto_attach(struct comedi_device *dev, } static struct comedi_driver ke_counter_driver = { - .driver_name = "ke_counter", - .module = THIS_MODULE, - .auto_attach = ke_counter_auto_attach, - .detach = comedi_pci_detach, + .driver_name = "ke_counter", + .module = THIS_MODULE, + .auto_attach = ke_counter_auto_attach, + .detach = comedi_pci_detach, }; static int ke_counter_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) { - return comedi_pci_auto_config(dev, &ke_counter_driver, - id->driver_data); + return comedi_pci_auto_config(dev, &ke_counter_driver, id->driver_data); } static const struct pci_device_id ke_counter_pci_table[] = { { PCI_DEVICE(PCI_VENDOR_ID_KOLTER, 0x0014) }, { 0 } }; + MODULE_DEVICE_TABLE(pci, ke_counter_pci_table); static struct pci_driver ke_counter_pci_driver = { - .name = "ke_counter", - .id_table = ke_counter_pci_table, - .probe = ke_counter_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "ke_counter", + .id_table = ke_counter_pci_table, + .probe = ke_counter_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(ke_counter_driver, ke_counter_pci_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/me4000.c b/drivers/comedi/drivers/me4000.c index 0d3d4cafce2e..f93d216c7287 100644 --- a/drivers/comedi/drivers/me4000.c +++ b/drivers/comedi/drivers/me4000.c @@ -187,107 +187,107 @@ struct me4000_board { static const struct me4000_board me4000_boards[] = { [BOARD_ME4650] = { - .name = "ME-4650", - .ai_nchan = 16, - }, + .name = "ME-4650", + .ai_nchan = 16, + }, [BOARD_ME4660] = { - .name = "ME-4660", - .ai_nchan = 32, - .can_do_diff_ai = 1, - .has_counter = 1, - }, + .name = "ME-4660", + .ai_nchan = 32, + .can_do_diff_ai = 1, + .has_counter = 1, + }, [BOARD_ME4660I] = { - .name = "ME-4660i", - .ai_nchan = 32, - .can_do_diff_ai = 1, - .has_counter = 1, - }, + .name = "ME-4660i", + .ai_nchan = 32, + .can_do_diff_ai = 1, + .has_counter = 1, + }, [BOARD_ME4660S] = { - .name = "ME-4660s", - .ai_nchan = 32, - .can_do_diff_ai = 1, - .can_do_sh_ai = 1, - .has_counter = 1, - }, + .name = "ME-4660s", + .ai_nchan = 32, + .can_do_diff_ai = 1, + .can_do_sh_ai = 1, + .has_counter = 1, + }, [BOARD_ME4660IS] = { - .name = "ME-4660is", - .ai_nchan = 32, - .can_do_diff_ai = 1, - .can_do_sh_ai = 1, - .has_counter = 1, - }, + .name = "ME-4660is", + .ai_nchan = 32, + .can_do_diff_ai = 1, + .can_do_sh_ai = 1, + .has_counter = 1, + }, [BOARD_ME4670] = { - .name = "ME-4670", - .ai_nchan = 32, - .can_do_diff_ai = 1, - .ex_trig_analog = 1, - .has_ao = 1, - .has_counter = 1, - }, + .name = "ME-4670", + .ai_nchan = 32, + .can_do_diff_ai = 1, + .ex_trig_analog = 1, + .has_ao = 1, + .has_counter = 1, + }, [BOARD_ME4670I] = { - .name = "ME-4670i", - .ai_nchan = 32, - .can_do_diff_ai = 1, - .ex_trig_analog = 1, - .has_ao = 1, - .has_counter = 1, - }, + .name = "ME-4670i", + .ai_nchan = 32, + .can_do_diff_ai = 1, + .ex_trig_analog = 1, + .has_ao = 1, + .has_counter = 1, + }, [BOARD_ME4670S] = { - .name = "ME-4670s", - .ai_nchan = 32, - .can_do_diff_ai = 1, - .can_do_sh_ai = 1, - .ex_trig_analog = 1, - .has_ao = 1, - .has_counter = 1, - }, + .name = "ME-4670s", + .ai_nchan = 32, + .can_do_diff_ai = 1, + .can_do_sh_ai = 1, + .ex_trig_analog = 1, + .has_ao = 1, + .has_counter = 1, + }, [BOARD_ME4670IS] = { - .name = "ME-4670is", - .ai_nchan = 32, - .can_do_diff_ai = 1, - .can_do_sh_ai = 1, - .ex_trig_analog = 1, - .has_ao = 1, - .has_counter = 1, - }, + .name = "ME-4670is", + .ai_nchan = 32, + .can_do_diff_ai = 1, + .can_do_sh_ai = 1, + .ex_trig_analog = 1, + .has_ao = 1, + .has_counter = 1, + }, [BOARD_ME4680] = { - .name = "ME-4680", - .ai_nchan = 32, - .can_do_diff_ai = 1, - .ex_trig_analog = 1, - .has_ao = 1, - .has_ao_fifo = 1, - .has_counter = 1, - }, + .name = "ME-4680", + .ai_nchan = 32, + .can_do_diff_ai = 1, + .ex_trig_analog = 1, + .has_ao = 1, + .has_ao_fifo = 1, + .has_counter = 1, + }, [BOARD_ME4680I] = { - .name = "ME-4680i", - .ai_nchan = 32, - .can_do_diff_ai = 1, - .ex_trig_analog = 1, - .has_ao = 1, - .has_ao_fifo = 1, - .has_counter = 1, - }, + .name = "ME-4680i", + .ai_nchan = 32, + .can_do_diff_ai = 1, + .ex_trig_analog = 1, + .has_ao = 1, + .has_ao_fifo = 1, + .has_counter = 1, + }, [BOARD_ME4680S] = { - .name = "ME-4680s", - .ai_nchan = 32, - .can_do_diff_ai = 1, - .can_do_sh_ai = 1, - .ex_trig_analog = 1, - .has_ao = 1, - .has_ao_fifo = 1, - .has_counter = 1, - }, + .name = "ME-4680s", + .ai_nchan = 32, + .can_do_diff_ai = 1, + .can_do_sh_ai = 1, + .ex_trig_analog = 1, + .has_ao = 1, + .has_ao_fifo = 1, + .has_counter = 1, + }, [BOARD_ME4680IS] = { - .name = "ME-4680is", - .ai_nchan = 32, - .can_do_diff_ai = 1, - .can_do_sh_ai = 1, - .ex_trig_analog = 1, - .has_ao = 1, - .has_ao_fifo = 1, - .has_counter = 1, - }, + .name = "ME-4680is", + .ai_nchan = 32, + .can_do_diff_ai = 1, + .can_do_sh_ai = 1, + .ex_trig_analog = 1, + .has_ao = 1, + .has_ao_fifo = 1, + .has_counter = 1, + }, }; /* @@ -298,15 +298,15 @@ static const struct me4000_board me4000_boards[] = { */ static const struct comedi_lrange me4000_ai_range = { 4, { - UNI_RANGE(2.5), - UNI_RANGE(10), - BIP_RANGE(2.5), - BIP_RANGE(10) - } + UNI_RANGE(2.5), + UNI_RANGE(10), + BIP_RANGE(2.5), + BIP_RANGE(10) + } }; static int me4000_xilinx_download(struct comedi_device *dev, - const u8 *data, size_t size, + const u8 *data, size_t size, unsigned long context) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); @@ -348,9 +348,9 @@ static int me4000_xilinx_download(struct comedi_device *dev, /* Download Xilinx firmware */ file_length = (((unsigned int)data[0] & 0xff) << 24) + - (((unsigned int)data[1] & 0xff) << 16) + - (((unsigned int)data[2] & 0xff) << 8) + - ((unsigned int)data[3] & 0xff); + (((unsigned int)data[1] & 0xff) << 16) + + (((unsigned int)data[2] & 0xff) << 8) + + ((unsigned int)data[3] & 0xff); usleep_range(10, 1000); for (i = 0; i < file_length; i++) { @@ -446,8 +446,7 @@ static unsigned int me4000_ai_get_sample(struct comedi_device *dev, static int me4000_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned int status; @@ -459,8 +458,7 @@ static int me4000_ai_eoc(struct comedi_device *dev, static int me4000_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int range = CR_RANGE(insn->chanspec); @@ -673,8 +671,7 @@ static int me4000_ai_do_cmd(struct comedi_device *dev, /* Start sources */ ctrl = devpriv->ai_ctrl_mode | - ME4000_AI_CTRL_CHANNEL_FIFO | - ME4000_AI_CTRL_DATA_FIFO; + ME4000_AI_CTRL_CHANNEL_FIFO | ME4000_AI_CTRL_DATA_FIFO; /* Stop triggers */ if (cmd->stop_src == TRIG_COUNT) { @@ -756,7 +753,7 @@ static int me4000_ai_do_cmd_test(struct comedi_device *dev, cmd->scan_begin_src == TRIG_EXT && cmd->convert_src == TRIG_EXT) { devpriv->ai_ctrl_mode = ME4000_AI_CTRL_MODE_0 | - ME4000_AI_CTRL_MODE_1; + ME4000_AI_CTRL_MODE_1; } else { err |= -EINVAL; } @@ -791,7 +788,7 @@ static int me4000_ai_do_cmd_test(struct comedi_device *dev, if (cmd->stop_src == TRIG_COUNT) err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); - else /* TRIG_NONE */ + else /* TRIG_NONE */ err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) @@ -929,8 +926,7 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) if (!dev->attached) return IRQ_NONE; - if (inl(dev->iobase + ME4000_IRQ_STATUS_REG) & - ME4000_IRQ_STATUS_AI_HF) { + if (inl(dev->iobase + ME4000_IRQ_STATUS_REG) & ME4000_IRQ_STATUS_AI_HF) { /* Read status register to find out what happened */ tmp = inl(dev->iobase + ME4000_AI_STATUS_REG); @@ -963,8 +959,7 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) outl(tmp, dev->iobase + ME4000_AI_CTRL_REG); } - if (inl(dev->iobase + ME4000_IRQ_STATUS_REG) & - ME4000_IRQ_STATUS_SC) { + if (inl(dev->iobase + ME4000_IRQ_STATUS_REG) & ME4000_IRQ_STATUS_SC) { /* Acquisition is complete */ s->async->events |= COMEDI_CB_EOA; @@ -991,8 +986,7 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id) static int me4000_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int tmp; @@ -1016,8 +1010,7 @@ static int me4000_ao_insn_write(struct comedi_device *dev, static int me4000_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { if (comedi_dio_update_state(s, data)) { outl((s->state >> 0) & 0xFF, @@ -1031,17 +1024,16 @@ static int me4000_dio_insn_bits(struct comedi_device *dev, } data[1] = ((inl(dev->iobase + ME4000_DIO_PORT_0_REG) & 0xFF) << 0) | - ((inl(dev->iobase + ME4000_DIO_PORT_1_REG) & 0xFF) << 8) | - ((inl(dev->iobase + ME4000_DIO_PORT_2_REG) & 0xFF) << 16) | - ((inl(dev->iobase + ME4000_DIO_PORT_3_REG) & 0xFF) << 24); + ((inl(dev->iobase + ME4000_DIO_PORT_1_REG) & 0xFF) << 8) | + ((inl(dev->iobase + ME4000_DIO_PORT_2_REG) & 0xFF) << 16) | + ((inl(dev->iobase + ME4000_DIO_PORT_3_REG) & 0xFF) << 24); return insn->n; } static int me4000_dio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int mask; @@ -1092,8 +1084,7 @@ static int me4000_dio_insn_config(struct comedi_device *dev, return insn->n; } -static int me4000_auto_attach(struct comedi_device *dev, - unsigned long context) +static int me4000_auto_attach(struct comedi_device *dev, unsigned long context) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); const struct me4000_board *board = NULL; @@ -1147,50 +1138,50 @@ static int me4000_auto_attach(struct comedi_device *dev, /* Analog Input subdevice */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_COMMON | SDF_GROUND; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_COMMON | SDF_GROUND; if (board->can_do_diff_ai) - s->subdev_flags |= SDF_DIFF; - s->n_chan = board->ai_nchan; - s->maxdata = 0xffff; - s->len_chanlist = ME4000_AI_CHANNEL_LIST_COUNT; - s->range_table = &me4000_ai_range; - s->insn_read = me4000_ai_insn_read; + s->subdev_flags |= SDF_DIFF; + s->n_chan = board->ai_nchan; + s->maxdata = 0xffff; + s->len_chanlist = ME4000_AI_CHANNEL_LIST_COUNT; + s->range_table = &me4000_ai_range; + s->insn_read = me4000_ai_insn_read; if (dev->irq) { dev->read_subdev = s; - s->subdev_flags |= SDF_CMD_READ; - s->cancel = me4000_ai_cancel; - s->do_cmdtest = me4000_ai_do_cmd_test; - s->do_cmd = me4000_ai_do_cmd; + s->subdev_flags |= SDF_CMD_READ; + s->cancel = me4000_ai_cancel; + s->do_cmdtest = me4000_ai_do_cmd_test; + s->do_cmd = me4000_ai_do_cmd; } /* Analog Output subdevice */ s = &dev->subdevices[1]; if (board->has_ao) { - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE | SDF_COMMON | SDF_GROUND; - s->n_chan = 4; - s->maxdata = 0xffff; - s->range_table = &range_bipolar10; - s->insn_write = me4000_ao_insn_write; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE | SDF_COMMON | SDF_GROUND; + s->n_chan = 4; + s->maxdata = 0xffff; + s->range_table = &range_bipolar10; + s->insn_write = me4000_ao_insn_write; result = comedi_alloc_subdev_readback(s); if (result) return result; } else { - s->type = COMEDI_SUBD_UNUSED; + s->type = COMEDI_SUBD_UNUSED; } /* Digital I/O subdevice */ s = &dev->subdevices[2]; - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 32; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = me4000_dio_insn_bits; - s->insn_config = me4000_dio_insn_config; + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 32; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = me4000_dio_insn_bits; + s->insn_config = me4000_dio_insn_config; /* * Check for optoisolated ME-4000 version. If one the first @@ -1198,8 +1189,7 @@ static int me4000_auto_attach(struct comedi_device *dev, */ if (!inl(dev->iobase + ME4000_DIO_DIR_REG)) { s->io_bits |= 0xFF; - outl(ME4000_DIO_CTRL_MODE_0, - dev->iobase + ME4000_DIO_DIR_REG); + outl(ME4000_DIO_CTRL_MODE_0, dev->iobase + ME4000_DIO_DIR_REG); } /* Counter subdevice (8254) */ @@ -1234,14 +1224,13 @@ static void me4000_detach(struct comedi_device *dev) } static struct comedi_driver me4000_driver = { - .driver_name = "me4000", - .module = THIS_MODULE, - .auto_attach = me4000_auto_attach, - .detach = me4000_detach, + .driver_name = "me4000", + .module = THIS_MODULE, + .auto_attach = me4000_auto_attach, + .detach = me4000_detach, }; -static int me4000_pci_probe(struct pci_dev *dev, - const struct pci_device_id *id) +static int me4000_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) { return comedi_pci_auto_config(dev, &me4000_driver, id->driver_data); } @@ -1262,14 +1251,16 @@ static const struct pci_device_id me4000_pci_table[] = { { PCI_VDEVICE(MEILHAUS, 0x4683), BOARD_ME4680IS }, { 0 } }; + MODULE_DEVICE_TABLE(pci, me4000_pci_table); static struct pci_driver me4000_pci_driver = { - .name = "me4000", - .id_table = me4000_pci_table, - .probe = me4000_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "me4000", + .id_table = me4000_pci_table, + .probe = me4000_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(me4000_driver, me4000_pci_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/me_daq.c b/drivers/comedi/drivers/me_daq.c index ef18e387471b..8daab6d16532 100644 --- a/drivers/comedi/drivers/me_daq.c +++ b/drivers/comedi/drivers/me_daq.c @@ -92,23 +92,23 @@ static const struct comedi_lrange me_ai_range = { 8, { - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(2.5), - BIP_RANGE(1.25), - UNI_RANGE(10), - UNI_RANGE(5), - UNI_RANGE(2.5), - UNI_RANGE(1.25) - } + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(2.5), + BIP_RANGE(1.25), + UNI_RANGE(10), + UNI_RANGE(5), + UNI_RANGE(2.5), + UNI_RANGE(1.25) + } }; static const struct comedi_lrange me_ao_range = { 3, { - BIP_RANGE(10), - BIP_RANGE(5), - UNI_RANGE(10) - } + BIP_RANGE(10), + BIP_RANGE(5), + UNI_RANGE(10) + } }; enum me_boardid { @@ -124,20 +124,20 @@ struct me_board { static const struct me_board me_boards[] = { [BOARD_ME2600] = { - .name = "me-2600i", - .needs_firmware = 1, - .has_ao = 1, - }, + .name = "me-2600i", + .needs_firmware = 1, + .has_ao = 1, + }, [BOARD_ME2000] = { - .name = "me-2000i", - }, + .name = "me-2000i", + }, }; struct me_private_data { void __iomem *plx_regbase; /* PLX configuration base address */ - unsigned short ctrl1; /* Mirror of CONTROL_1 register */ - unsigned short ctrl2; /* Mirror of CONTROL_2 register */ + unsigned short ctrl1; /* Mirror of CONTROL_1 register */ + unsigned short ctrl2; /* Mirror of CONTROL_2 register */ unsigned short dac_ctrl; /* Mirror of the DAC_CONTROL register */ }; @@ -148,8 +148,7 @@ static inline void sleep(unsigned int sec) static int me_dio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct me_private_data *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -181,8 +180,7 @@ static int me_dio_insn_config(struct comedi_device *dev, static int me_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { void __iomem *mmio_porta = dev->mmio + ME_DIO_PORT_A_REG; void __iomem *mmio_portb = dev->mmio + ME_DIO_PORT_B_REG; @@ -214,8 +212,7 @@ static int me_dio_insn_bits(struct comedi_device *dev, static int me_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned int status; @@ -227,8 +224,7 @@ static int me_ai_eoc(struct comedi_device *dev, static int me_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct me_private_data *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -294,8 +290,7 @@ static int me_ai_insn_read(struct comedi_device *dev, static int me_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct me_private_data *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -337,7 +332,7 @@ static int me_ao_insn_write(struct comedi_device *dev, } static int me2600_xilinx_download(struct comedi_device *dev, - const u8 *data, size_t size, + const u8 *data, size_t size, unsigned long context) { struct me_private_data *devpriv = dev->private; @@ -400,8 +395,7 @@ static int me2600_xilinx_download(struct comedi_device *dev, /* Enable PLX-Interrupts */ writel(PLX9052_INTCSR_LI1ENAB | PLX9052_INTCSR_LI1POL | - PLX9052_INTCSR_PCIENAB, - devpriv->plx_regbase + PLX9052_INTCSR); + PLX9052_INTCSR_PCIENAB, devpriv->plx_regbase + PLX9052_INTCSR); return 0; } @@ -424,8 +418,7 @@ static int me_reset(struct comedi_device *dev) return 0; } -static int me_auto_attach(struct comedi_device *dev, - unsigned long context) +static int me_auto_attach(struct comedi_device *dev, unsigned long context) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); const struct me_board *board = NULL; @@ -471,23 +464,23 @@ static int me_auto_attach(struct comedi_device *dev, return ret; s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_COMMON | SDF_DIFF; - s->n_chan = 16; - s->maxdata = 0x0fff; - s->len_chanlist = 16; - s->range_table = &me_ai_range; - s->insn_read = me_ai_insn_read; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_COMMON | SDF_DIFF; + s->n_chan = 16; + s->maxdata = 0x0fff; + s->len_chanlist = 16; + s->range_table = &me_ai_range; + s->insn_read = me_ai_insn_read; s = &dev->subdevices[1]; if (board->has_ao) { - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE | SDF_COMMON; - s->n_chan = 4; - s->maxdata = 0x0fff; - s->len_chanlist = 4; - s->range_table = &me_ao_range; - s->insn_write = me_ao_insn_write; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE | SDF_COMMON; + s->n_chan = 4; + s->maxdata = 0x0fff; + s->len_chanlist = 4; + s->range_table = &me_ao_range; + s->insn_write = me_ao_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) @@ -497,14 +490,14 @@ static int me_auto_attach(struct comedi_device *dev, } s = &dev->subdevices[2]; - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 32; - s->maxdata = 1; - s->len_chanlist = 32; - s->range_table = &range_digital; - s->insn_bits = me_dio_insn_bits; - s->insn_config = me_dio_insn_config; + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 32; + s->maxdata = 1; + s->len_chanlist = 32; + s->range_table = &range_digital; + s->insn_bits = me_dio_insn_bits; + s->insn_config = me_dio_insn_config; return 0; } @@ -523,14 +516,13 @@ static void me_detach(struct comedi_device *dev) } static struct comedi_driver me_daq_driver = { - .driver_name = "me_daq", - .module = THIS_MODULE, - .auto_attach = me_auto_attach, - .detach = me_detach, + .driver_name = "me_daq", + .module = THIS_MODULE, + .auto_attach = me_auto_attach, + .detach = me_detach, }; -static int me_daq_pci_probe(struct pci_dev *dev, - const struct pci_device_id *id) +static int me_daq_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) { return comedi_pci_auto_config(dev, &me_daq_driver, id->driver_data); } @@ -540,14 +532,16 @@ static const struct pci_device_id me_daq_pci_table[] = { { PCI_VDEVICE(MEILHAUS, 0x2000), BOARD_ME2000 }, { 0 } }; + MODULE_DEVICE_TABLE(pci, me_daq_pci_table); static struct pci_driver me_daq_pci_driver = { - .name = "me_daq", - .id_table = me_daq_pci_table, - .probe = me_daq_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "me_daq", + .id_table = me_daq_pci_table, + .probe = me_daq_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(me_daq_driver, me_daq_pci_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/mf6x4.c b/drivers/comedi/drivers/mf6x4.c index 9da8dd748078..3451a1c9ed5c 100644 --- a/drivers/comedi/drivers/mf6x4.c +++ b/drivers/comedi/drivers/mf6x4.c @@ -54,13 +54,13 @@ struct mf6x4_board { static const struct mf6x4_board mf6x4_boards[] = { [BOARD_MF634] = { - .name = "mf634", - .bar_nums = {0, 2, 3}, - }, + .name = "mf634", + .bar_nums = { 0, 2, 3}, + }, [BOARD_MF624] = { - .name = "mf624", - .bar_nums = {0, 2, 4}, - }, + .name = "mf624", + .bar_nums = { 0, 2, 4}, + }, }; struct mf6x4_private { @@ -83,8 +83,7 @@ struct mf6x4_private { static int mf6x4_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { data[1] = ioread16(dev->mmio + MF6X4_DIN_REG) & MF6X4_DIN_MASK; @@ -93,8 +92,7 @@ static int mf6x4_di_insn_bits(struct comedi_device *dev, static int mf6x4_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { if (comedi_dio_update_state(s, data)) iowrite16(s->state, dev->mmio + MF6X4_DOUT_REG); @@ -106,8 +104,7 @@ static int mf6x4_do_insn_bits(struct comedi_device *dev, static int mf6x4_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { struct mf6x4_private *devpriv = dev->private; unsigned int status; @@ -121,8 +118,7 @@ static int mf6x4_ai_eoc(struct comedi_device *dev, static int mf6x4_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int d; @@ -154,8 +150,7 @@ static int mf6x4_ai_insn_read(struct comedi_device *dev, static int mf6x4_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct mf6x4_private *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -224,21 +219,21 @@ static int mf6x4_auto_attach(struct comedi_device *dev, unsigned long context) /* Analog Input subdevice */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_GROUND; - s->n_chan = 8; - s->maxdata = 0x3fff; - s->range_table = &range_bipolar10; - s->insn_read = mf6x4_ai_insn_read; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_GROUND; + s->n_chan = 8; + s->maxdata = 0x3fff; + s->range_table = &range_bipolar10; + s->insn_read = mf6x4_ai_insn_read; /* Analog Output subdevice */ s = &dev->subdevices[1]; - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 8; - s->maxdata = 0x3fff; - s->range_table = &range_bipolar10; - s->insn_write = mf6x4_ao_insn_write; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 8; + s->maxdata = 0x3fff; + s->range_table = &range_bipolar10; + s->insn_write = mf6x4_ao_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) @@ -246,21 +241,21 @@ static int mf6x4_auto_attach(struct comedi_device *dev, unsigned long context) /* Digital Input subdevice */ s = &dev->subdevices[2]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 8; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = mf6x4_di_insn_bits; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 8; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = mf6x4_di_insn_bits; /* Digital Output subdevice */ s = &dev->subdevices[3]; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 8; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = mf6x4_do_insn_bits; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 8; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = mf6x4_do_insn_bits; return 0; } @@ -279,10 +274,10 @@ static void mf6x4_detach(struct comedi_device *dev) } static struct comedi_driver mf6x4_driver = { - .driver_name = "mf6x4", - .module = THIS_MODULE, - .auto_attach = mf6x4_auto_attach, - .detach = mf6x4_detach, + .driver_name = "mf6x4", + .module = THIS_MODULE, + .auto_attach = mf6x4_auto_attach, + .detach = mf6x4_detach, }; static int mf6x4_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) @@ -295,13 +290,14 @@ static const struct pci_device_id mf6x4_pci_table[] = { { PCI_VDEVICE(HUMUSOFT, 0x0624), BOARD_MF624 }, { 0 } }; + MODULE_DEVICE_TABLE(pci, mf6x4_pci_table); static struct pci_driver mf6x4_pci_driver = { - .name = "mf6x4", - .id_table = mf6x4_pci_table, - .probe = mf6x4_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "mf6x4", + .id_table = mf6x4_pci_table, + .probe = mf6x4_pci_probe, + .remove = comedi_pci_auto_unconfig, }; module_comedi_pci_driver(mf6x4_driver, mf6x4_pci_driver); diff --git a/drivers/comedi/drivers/mite.c b/drivers/comedi/drivers/mite.c index 70960e3ba878..50e1c76075dc 100644 --- a/drivers/comedi/drivers/mite.c +++ b/drivers/comedi/drivers/mite.c @@ -50,7 +50,7 @@ #define UNKNOWN_DMA_BURST_ENABLE_BITS 0x600 #define MITE_PCI_CONFIG_OFFSET 0x300 -#define MITE_CSIGR 0x460 /* chip signature */ +#define MITE_CSIGR 0x460 /* chip signature */ #define CSIGR_TO_IOWINS(x) (((x) >> 29) & 0x7) #define CSIGR_TO_WINS(x) (((x) >> 24) & 0x1f) #define CSIGR_TO_WPDEP(x) (((x) >> 20) & 0x7) @@ -230,6 +230,7 @@ u32 mite_bytes_in_transit(struct mite_channel *mite_chan) return readl(mite->mmio + MITE_FCR(mite_chan->channel)) & 0xff; } + EXPORT_SYMBOL_GPL(mite_bytes_in_transit); /* returns lower bound for number of bytes transferred from device to memory */ @@ -356,6 +357,7 @@ void mite_sync_dma(struct mite_channel *mite_chan, struct comedi_subdevice *s) else mite_sync_output_dma(mite_chan, s); } + EXPORT_SYMBOL_GPL(mite_sync_dma); static unsigned int mite_get_status(struct mite_channel *mite_chan) @@ -384,8 +386,7 @@ static unsigned int mite_get_status(struct mite_channel *mite_chan) * This will also ack the DONE interrupt if active. */ void mite_ack_linkc(struct mite_channel *mite_chan, - struct comedi_subdevice *s, - bool sync) + struct comedi_subdevice *s, bool sync) { struct mite *mite = mite_chan->mite; unsigned int status; @@ -404,6 +405,7 @@ void mite_ack_linkc(struct mite_channel *mite_chan, s->async->events |= COMEDI_CB_ERROR; } } + EXPORT_SYMBOL_GPL(mite_ack_linkc); /** @@ -424,6 +426,7 @@ int mite_done(struct mite_channel *mite_chan) spin_unlock_irqrestore(&mite->lock, flags); return done; } + EXPORT_SYMBOL_GPL(mite_done); static void mite_dma_reset(struct mite_channel *mite_chan) @@ -452,6 +455,7 @@ void mite_dma_arm(struct mite_channel *mite_chan) writel(CHOR_START, mite->mmio + MITE_CHOR(mite_chan->channel)); spin_unlock_irqrestore(&mite->lock, flags); } + EXPORT_SYMBOL_GPL(mite_dma_arm); /** @@ -465,6 +469,7 @@ void mite_dma_disarm(struct mite_channel *mite_chan) /* disarm */ writel(CHOR_ABORT, mite->mmio + MITE_CHOR(mite_chan->channel)); } + EXPORT_SYMBOL_GPL(mite_dma_disarm); /** @@ -556,6 +561,7 @@ void mite_prep_dma(struct mite_channel *mite_chan, writel(mite_chan->ring->dma_addr, mite->mmio + MITE_LKAR(mite_chan->channel)); } + EXPORT_SYMBOL_GPL(mite_prep_dma); /** @@ -590,6 +596,7 @@ struct mite_channel *mite_request_channel_in_range(struct mite *mite, spin_unlock_irqrestore(&mite->lock, flags); return mite_chan; } + EXPORT_SYMBOL_GPL(mite_request_channel_in_range); /** @@ -603,6 +610,7 @@ struct mite_channel *mite_request_channel(struct mite *mite, return mite_request_channel_in_range(mite, ring, 0, mite->num_channels - 1); } + EXPORT_SYMBOL_GPL(mite_request_channel); /** @@ -632,6 +640,7 @@ void mite_release_channel(struct mite_channel *mite_chan) } spin_unlock_irqrestore(&mite->lock, flags); } + EXPORT_SYMBOL_GPL(mite_release_channel); /** @@ -648,8 +657,7 @@ EXPORT_SYMBOL_GPL(mite_release_channel); * transferred. */ int mite_init_ring_descriptors(struct mite_ring *ring, - struct comedi_subdevice *s, - unsigned int nbytes) + struct comedi_subdevice *s, unsigned int nbytes) { struct comedi_async *async = s->async; struct mite_dma_desc *desc = NULL; @@ -693,6 +701,7 @@ int mite_init_ring_descriptors(struct mite_ring *ring, smp_wmb(); return 0; } + EXPORT_SYMBOL_GPL(mite_init_ring_descriptors); static void mite_free_dma_descs(struct mite_ring *ring) @@ -740,6 +749,7 @@ int mite_buf_change(struct mite_ring *ring, struct comedi_subdevice *s) return mite_init_ring_descriptors(ring, s, n_links << PAGE_SHIFT); } + EXPORT_SYMBOL_GPL(mite_buf_change); /** @@ -763,6 +773,7 @@ struct mite_ring *mite_alloc_ring(struct mite *mite) ring->dma_addr = 0; return ring; } + EXPORT_SYMBOL_GPL(mite_alloc_ring); /** @@ -777,6 +788,7 @@ void mite_free_ring(struct mite_ring *ring) kfree(ring); } } + EXPORT_SYMBOL_GPL(mite_free_ring); static int mite_setup(struct comedi_device *dev, struct mite *mite, @@ -902,6 +914,7 @@ struct mite *mite_attach(struct comedi_device *dev, bool use_win1) return mite; } + EXPORT_SYMBOL_GPL(mite_attach); /** @@ -920,17 +933,20 @@ void mite_detach(struct mite *mite) kfree(mite); } + EXPORT_SYMBOL_GPL(mite_detach); static int __init mite_module_init(void) { return 0; } + module_init(mite_module_init); static void __exit mite_module_exit(void) { } + module_exit(mite_module_exit); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/mpc624.c b/drivers/comedi/drivers/mpc624.c index 646f4c086204..ea6a0257926e 100644 --- a/drivers/comedi/drivers/mpc624.c +++ b/drivers/comedi/drivers/mpc624.c @@ -49,13 +49,13 @@ #include <linux/delay.h> /* 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 BIT(5) @@ -94,7 +94,7 @@ static const struct comedi_lrange range_mpc624_bipolar1 = { /* BIP_RANGE(1.01) this is correct, */ /* but my MPC-624 actually seems to have a range of 2.02 */ BIP_RANGE(2.02) - } + } }; static const struct comedi_lrange range_mpc624_bipolar10 = { @@ -103,7 +103,7 @@ static const struct comedi_lrange range_mpc624_bipolar10 = { /* BIP_RANGE(10.1) this is correct, */ /* but my MPC-624 actually seems to have a range of 20.2 */ BIP_RANGE(20.2) - } + } }; static unsigned int mpc624_ai_get_sample(struct comedi_device *dev, @@ -141,19 +141,19 @@ static unsigned int mpc624_ai_get_sample(struct comedi_device *dev, /* * 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 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. + * 31: EOC - (End Of Transmission) bit - should be 0 + * 30: DMY - (Dummy) bit - should be 0 + * 29: SIG - (Sign) bit - 1 if 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) dev_dbg(dev->class_dev, "EOC bit is set!"); @@ -187,8 +187,7 @@ static unsigned int mpc624_ai_get_sample(struct comedi_device *dev, static int mpc624_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned char status; @@ -200,8 +199,7 @@ static int mpc624_ai_eoc(struct comedi_device *dev, static int mpc624_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { int ret; int i; @@ -287,23 +285,24 @@ static int mpc624_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* Analog Input subdevice */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_DIFF; - s->n_chan = 4; - s->maxdata = 0x3fffffff; - s->range_table = (it->options[1] == 0) ? &range_mpc624_bipolar1 - : &range_mpc624_bipolar10; - s->insn_read = mpc624_ai_insn_read; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_DIFF; + s->n_chan = 4; + s->maxdata = 0x3fffffff; + s->range_table = (it->options[1] == 0) ? &range_mpc624_bipolar1 + : &range_mpc624_bipolar10; + s->insn_read = mpc624_ai_insn_read; return 0; } static struct comedi_driver mpc624_driver = { - .driver_name = "mpc624", - .module = THIS_MODULE, - .attach = mpc624_attach, - .detach = comedi_legacy_detach, + .driver_name = "mpc624", + .module = THIS_MODULE, + .attach = mpc624_attach, + .detach = comedi_legacy_detach, }; + module_comedi_driver(mpc624_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/multiq3.c b/drivers/comedi/drivers/multiq3.c index c1897aee9a9a..926f3f7a1d3a 100644 --- a/drivers/comedi/drivers/multiq3.c +++ b/drivers/comedi/drivers/multiq3.c @@ -80,8 +80,7 @@ static void multiq3_set_ctrl(struct comedi_device *dev, unsigned int bits) static int multiq3_ai_status(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned int status; @@ -93,8 +92,7 @@ static int multiq3_ai_status(struct comedi_device *dev, static int multiq3_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int val; @@ -130,8 +128,7 @@ static int multiq3_ai_insn_read(struct comedi_device *dev, static int multiq3_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int val = s->readback[chan]; @@ -140,7 +137,7 @@ static int multiq3_ao_insn_write(struct comedi_device *dev, for (i = 0; i < insn->n; i++) { val = data[i]; multiq3_set_ctrl(dev, MULTIQ3_CTRL_LD | - MULTIQ3_CTRL_AO_CHAN(chan)); + MULTIQ3_CTRL_AO_CHAN(chan)); outw(val, dev->iobase + MULTIQ3_AO_REG); multiq3_set_ctrl(dev, 0); } @@ -160,8 +157,7 @@ static int multiq3_di_insn_bits(struct comedi_device *dev, static int multiq3_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { if (comedi_dio_update_state(s, data)) outw(s->state, dev->iobase + MULTIQ3_DO_REG); @@ -183,7 +179,7 @@ static int multiq3_encoder_insn_read(struct comedi_device *dev, for (i = 0; i < insn->n; i++) { /* select encoder channel */ multiq3_set_ctrl(dev, MULTIQ3_CTRL_EN | - MULTIQ3_CTRL_E_CHAN(chan)); + MULTIQ3_CTRL_E_CHAN(chan)); /* reset the byte pointer */ outb(MULTIQ3_BP_RESET, dev->iobase + MULTIQ3_ENC_CTRL_REG); @@ -200,10 +196,10 @@ static int multiq3_encoder_insn_read(struct comedi_device *dev, * Munge the data so that the reset value is in the middle * of the maxdata range, i.e.: * - * real value comedi value - * 0xffffff 0x7fffff 1 negative count - * 0x000000 0x800000 reset value - * 0x000001 0x800001 1 positive count + * real value comedi value + * 0xffffff 0x7fffff 1 negative count + * 0x000000 0x800000 reset value + * 0x000001 0x800001 1 positive count * * It's possible for the 24-bit counter to overflow but it * would normally take _quite_ a few turns. A 2000 line @@ -217,8 +213,7 @@ static int multiq3_encoder_insn_read(struct comedi_device *dev, return insn->n; } -static void multiq3_encoder_reset(struct comedi_device *dev, - unsigned int chan) +static void multiq3_encoder_reset(struct comedi_device *dev, unsigned int chan) { multiq3_set_ctrl(dev, MULTIQ3_CTRL_EN | MULTIQ3_CTRL_E_CHAN(chan)); outb(MULTIQ3_EFLAG_RESET, dev->iobase + MULTIQ3_ENC_CTRL_REG); @@ -265,21 +260,21 @@ static int multiq3_attach(struct comedi_device *dev, /* Analog Input subdevice */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_GROUND; - s->n_chan = 8; - s->maxdata = 0x1fff; - s->range_table = &range_bipolar5; - s->insn_read = multiq3_ai_insn_read; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_GROUND; + s->n_chan = 8; + s->maxdata = 0x1fff; + s->range_table = &range_bipolar5; + s->insn_read = multiq3_ai_insn_read; /* Analog Output subdevice */ s = &dev->subdevices[1]; - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 8; - s->maxdata = 0x0fff; - s->range_table = &range_bipolar5; - s->insn_write = multiq3_ao_insn_write; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 8; + s->maxdata = 0x0fff; + s->range_table = &range_bipolar5; + s->insn_write = multiq3_ao_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) @@ -287,31 +282,31 @@ static int multiq3_attach(struct comedi_device *dev, /* Digital Input subdevice */ s = &dev->subdevices[2]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 16; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = multiq3_di_insn_bits; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 16; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = multiq3_di_insn_bits; /* Digital Output subdevice */ s = &dev->subdevices[3]; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 16; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = multiq3_do_insn_bits; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 16; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = multiq3_do_insn_bits; /* Encoder (Counter) subdevice */ s = &dev->subdevices[4]; - s->type = COMEDI_SUBD_COUNTER; - s->subdev_flags = SDF_READABLE | SDF_LSAMPL; - s->n_chan = it->options[2] * 2; - s->maxdata = 0x00ffffff; - s->range_table = &range_unknown; - s->insn_read = multiq3_encoder_insn_read; - s->insn_config = multiq3_encoder_insn_config; + s->type = COMEDI_SUBD_COUNTER; + s->subdev_flags = SDF_READABLE | SDF_LSAMPL; + s->n_chan = it->options[2] * 2; + s->maxdata = 0x00ffffff; + s->range_table = &range_unknown; + s->insn_read = multiq3_encoder_insn_read; + s->insn_config = multiq3_encoder_insn_config; for (i = 0; i < s->n_chan; i++) multiq3_encoder_reset(dev, i); @@ -320,11 +315,12 @@ static int multiq3_attach(struct comedi_device *dev, } static struct comedi_driver multiq3_driver = { - .driver_name = "multiq3", - .module = THIS_MODULE, - .attach = multiq3_attach, - .detach = comedi_legacy_detach, + .driver_name = "multiq3", + .module = THIS_MODULE, + .attach = multiq3_attach, + .detach = comedi_legacy_detach, }; + module_comedi_driver(multiq3_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/ni_6527.c b/drivers/comedi/drivers/ni_6527.c index f1a45cf7342a..9e4a3d9424cf 100644 --- a/drivers/comedi/drivers/ni_6527.c +++ b/drivers/comedi/drivers/ni_6527.c @@ -69,11 +69,11 @@ struct ni6527_board { static const struct ni6527_board ni6527_boards[] = { [BOARD_PCI6527] = { - .name = "pci-6527", - }, + .name = "pci-6527", + }, [BOARD_PXI6527] = { - .name = "pxi-6527", - }, + .name = "pxi-6527", + }, }; struct ni6527_private { @@ -109,8 +109,7 @@ static void ni6527_set_filter_enable(struct comedi_device *dev, static int ni6527_di_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct ni6527_private *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -143,8 +142,7 @@ static int ni6527_di_insn_config(struct comedi_device *dev, static int ni6527_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int val; @@ -159,8 +157,7 @@ static int ni6527_di_insn_bits(struct comedi_device *dev, static int ni6527_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int mask; @@ -172,8 +169,7 @@ static int ni6527_do_insn_bits(struct comedi_device *dev, if (mask & 0x0000ff) writeb(val & 0xff, dev->mmio + NI6527_DO_REG(0)); if (mask & 0x00ff00) - writeb((val >> 8) & 0xff, - dev->mmio + NI6527_DO_REG(1)); + writeb((val >> 8) & 0xff, dev->mmio + NI6527_DO_REG(1)); if (mask & 0xff0000) writeb((val >> 16) & 0xff, dev->mmio + NI6527_DO_REG(2)); @@ -272,8 +268,7 @@ static int ni6527_intr_insn_bits(struct comedi_device *dev, static void ni6527_set_edge_detection(struct comedi_device *dev, unsigned int mask, - unsigned int rising, - unsigned int falling) + unsigned int rising, unsigned int falling) { unsigned int i; @@ -285,11 +280,11 @@ static void ni6527_set_edge_detection(struct comedi_device *dev, /* preserve rising-edge detection channels */ rising |= readb(dev->mmio + NI6527_RISING_EDGE_REG(i)) & - (~mask & 0xff); + (~mask & 0xff); /* preserve falling-edge detection channels */ falling |= readb(dev->mmio + NI6527_FALLING_EDGE_REG(i)) & - (~mask & 0xff); + (~mask & 0xff); } /* update rising-edge detection channels */ writeb(rising & 0xff, @@ -306,8 +301,7 @@ static void ni6527_set_edge_detection(struct comedi_device *dev, static int ni6527_intr_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int mask = 0xffffffff; unsigned int rising, falling, shift; @@ -369,8 +363,7 @@ static void ni6527_reset(struct comedi_device *dev) writeb(NI6527_CTRL_DISABLE_IRQS, dev->mmio + NI6527_CTRL_REG); } -static int ni6527_auto_attach(struct comedi_device *dev, - unsigned long context) +static int ni6527_auto_attach(struct comedi_device *dev, unsigned long context) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); const struct ni6527_board *board = NULL; @@ -414,38 +407,38 @@ static int ni6527_auto_attach(struct comedi_device *dev, /* Digital Input subdevice */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 24; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_config = ni6527_di_insn_config; - s->insn_bits = ni6527_di_insn_bits; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 24; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_config = ni6527_di_insn_config; + s->insn_bits = ni6527_di_insn_bits; /* Digital Output subdevice */ s = &dev->subdevices[1]; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 24; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = ni6527_do_insn_bits; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 24; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = ni6527_do_insn_bits; /* Edge detection interrupt subdevice */ s = &dev->subdevices[2]; if (dev->irq) { dev->read_subdev = s; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE | SDF_CMD_READ; - s->n_chan = 1; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_config = ni6527_intr_insn_config; - s->insn_bits = ni6527_intr_insn_bits; - s->len_chanlist = 1; - s->do_cmdtest = ni6527_intr_cmdtest; - s->do_cmd = ni6527_intr_cmd; - s->cancel = ni6527_intr_cancel; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE | SDF_CMD_READ; + s->n_chan = 1; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_config = ni6527_intr_insn_config; + s->insn_bits = ni6527_intr_insn_bits; + s->len_chanlist = 1; + s->do_cmdtest = ni6527_intr_cmdtest; + s->do_cmd = ni6527_intr_cmd; + s->cancel = ni6527_intr_cancel; } else { s->type = COMEDI_SUBD_UNUSED; } @@ -461,14 +454,13 @@ static void ni6527_detach(struct comedi_device *dev) } static struct comedi_driver ni6527_driver = { - .driver_name = "ni_6527", - .module = THIS_MODULE, - .auto_attach = ni6527_auto_attach, - .detach = ni6527_detach, + .driver_name = "ni_6527", + .module = THIS_MODULE, + .auto_attach = ni6527_auto_attach, + .detach = ni6527_detach, }; -static int ni6527_pci_probe(struct pci_dev *dev, - const struct pci_device_id *id) +static int ni6527_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) { return comedi_pci_auto_config(dev, &ni6527_driver, id->driver_data); } @@ -478,14 +470,16 @@ static const struct pci_device_id ni6527_pci_table[] = { { PCI_VDEVICE(NI, 0x2b20), BOARD_PCI6527 }, { 0 } }; + MODULE_DEVICE_TABLE(pci, ni6527_pci_table); static struct pci_driver ni6527_pci_driver = { - .name = "ni_6527", - .id_table = ni6527_pci_table, - .probe = ni6527_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "ni_6527", + .id_table = ni6527_pci_table, + .probe = ni6527_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(ni6527_driver, ni6527_pci_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/ni_65xx.c b/drivers/comedi/drivers/ni_65xx.c index 7cd8497420f2..78f1c07d4f57 100644 --- a/drivers/comedi/drivers/ni_65xx.c +++ b/drivers/comedi/drivers/ni_65xx.c @@ -78,13 +78,13 @@ #define NI_65XX_CTRL_INT_ENA BIT(2) #define NI_65XX_CTRL_OVERFLOW_ENA BIT(1) #define NI_65XX_CTRL_EDGE_ENA BIT(0) -#define NI_65XX_REV_REG 0x04 /* 32-bit */ -#define NI_65XX_FILTER_REG 0x08 /* 32-bit */ -#define NI_65XX_RTSI_ROUTE_REG 0x0c /* 16-bit */ -#define NI_65XX_RTSI_EDGE_REG 0x0e /* 16-bit */ -#define NI_65XX_RTSI_WDOG_REG 0x10 /* 16-bit */ -#define NI_65XX_RTSI_TRIG_REG 0x12 /* 16-bit */ -#define NI_65XX_AUTO_CLK_SEL_REG 0x14 /* PXI-6528 only */ +#define NI_65XX_REV_REG 0x04 /* 32-bit */ +#define NI_65XX_FILTER_REG 0x08 /* 32-bit */ +#define NI_65XX_RTSI_ROUTE_REG 0x0c /* 16-bit */ +#define NI_65XX_RTSI_EDGE_REG 0x0e /* 16-bit */ +#define NI_65XX_RTSI_WDOG_REG 0x10 /* 16-bit */ +#define NI_65XX_RTSI_TRIG_REG 0x12 /* 16-bit */ +#define NI_65XX_AUTO_CLK_SEL_REG 0x14 /* PXI-6528 only */ #define NI_65XX_AUTO_CLK_SEL_STATUS BIT(1) #define NI_65XX_AUTO_CLK_SEL_DISABLE BIT(0) #define NI_65XX_WDOG_CTRL_REG 0x15 @@ -95,7 +95,7 @@ #define NI_65XX_RTSI_CFG_SYNC_DETECT BIT(0) #define NI_65XX_WDOG_STATUS_REG 0x17 #define NI_65XX_WDOG_STATUS_EXP BIT(0) -#define NI_65XX_WDOG_INTERVAL_REG 0x18 /* 32-bit */ +#define NI_65XX_WDOG_INTERVAL_REG 0x18 /* 32-bit */ /* Recurring port registers (8-bit) */ #define NI_65XX_PORT(x) ((x) * 0x10) @@ -150,114 +150,114 @@ struct ni_65xx_board { static const struct ni_65xx_board ni_65xx_boards[] = { [BOARD_PCI6509] = { - .name = "pci-6509", - .num_dio_ports = 12, - }, + .name = "pci-6509", + .num_dio_ports = 12, + }, [BOARD_PXI6509] = { - .name = "pxi-6509", - .num_dio_ports = 12, - }, + .name = "pxi-6509", + .num_dio_ports = 12, + }, [BOARD_PCI6510] = { - .name = "pci-6510", - .num_di_ports = 4, - }, + .name = "pci-6510", + .num_di_ports = 4, + }, [BOARD_PCI6511] = { - .name = "pci-6511", - .num_di_ports = 8, - }, + .name = "pci-6511", + .num_di_ports = 8, + }, [BOARD_PXI6511] = { - .name = "pxi-6511", - .num_di_ports = 8, - }, + .name = "pxi-6511", + .num_di_ports = 8, + }, [BOARD_PCI6512] = { - .name = "pci-6512", - .num_do_ports = 8, - }, + .name = "pci-6512", + .num_do_ports = 8, + }, [BOARD_PXI6512] = { - .name = "pxi-6512", - .num_do_ports = 8, - }, + .name = "pxi-6512", + .num_do_ports = 8, + }, [BOARD_PCI6513] = { - .name = "pci-6513", - .num_do_ports = 8, - .legacy_invert = 1, - }, + .name = "pci-6513", + .num_do_ports = 8, + .legacy_invert = 1, + }, [BOARD_PXI6513] = { - .name = "pxi-6513", - .num_do_ports = 8, - .legacy_invert = 1, - }, + .name = "pxi-6513", + .num_do_ports = 8, + .legacy_invert = 1, + }, [BOARD_PCI6514] = { - .name = "pci-6514", - .num_di_ports = 4, - .num_do_ports = 4, - .legacy_invert = 1, - }, + .name = "pci-6514", + .num_di_ports = 4, + .num_do_ports = 4, + .legacy_invert = 1, + }, [BOARD_PXI6514] = { - .name = "pxi-6514", - .num_di_ports = 4, - .num_do_ports = 4, - .legacy_invert = 1, - }, + .name = "pxi-6514", + .num_di_ports = 4, + .num_do_ports = 4, + .legacy_invert = 1, + }, [BOARD_PCI6515] = { - .name = "pci-6515", - .num_di_ports = 4, - .num_do_ports = 4, - .legacy_invert = 1, - }, + .name = "pci-6515", + .num_di_ports = 4, + .num_do_ports = 4, + .legacy_invert = 1, + }, [BOARD_PXI6515] = { - .name = "pxi-6515", - .num_di_ports = 4, - .num_do_ports = 4, - .legacy_invert = 1, - }, + .name = "pxi-6515", + .num_di_ports = 4, + .num_do_ports = 4, + .legacy_invert = 1, + }, [BOARD_PCI6516] = { - .name = "pci-6516", - .num_do_ports = 4, - .legacy_invert = 1, - }, + .name = "pci-6516", + .num_do_ports = 4, + .legacy_invert = 1, + }, [BOARD_PCI6517] = { - .name = "pci-6517", - .num_do_ports = 4, - .legacy_invert = 1, - }, + .name = "pci-6517", + .num_do_ports = 4, + .legacy_invert = 1, + }, [BOARD_PCI6518] = { - .name = "pci-6518", - .num_di_ports = 2, - .num_do_ports = 2, - .legacy_invert = 1, - }, + .name = "pci-6518", + .num_di_ports = 2, + .num_do_ports = 2, + .legacy_invert = 1, + }, [BOARD_PCI6519] = { - .name = "pci-6519", - .num_di_ports = 2, - .num_do_ports = 2, - .legacy_invert = 1, - }, + .name = "pci-6519", + .num_di_ports = 2, + .num_do_ports = 2, + .legacy_invert = 1, + }, [BOARD_PCI6520] = { - .name = "pci-6520", - .num_di_ports = 1, - .num_do_ports = 1, - }, + .name = "pci-6520", + .num_di_ports = 1, + .num_do_ports = 1, + }, [BOARD_PCI6521] = { - .name = "pci-6521", - .num_di_ports = 1, - .num_do_ports = 1, - }, + .name = "pci-6521", + .num_di_ports = 1, + .num_do_ports = 1, + }, [BOARD_PXI6521] = { - .name = "pxi-6521", - .num_di_ports = 1, - .num_do_ports = 1, - }, + .name = "pxi-6521", + .num_di_ports = 1, + .num_do_ports = 1, + }, [BOARD_PCI6528] = { - .name = "pci-6528", - .num_di_ports = 3, - .num_do_ports = 3, - }, + .name = "pci-6528", + .num_di_ports = 3, + .num_do_ports = 3, + }, [BOARD_PXI6528] = { - .name = "pxi-6528", - .num_di_ports = 3, - .num_do_ports = 3, - }, + .name = "pxi-6528", + .num_di_ports = 3, + .num_do_ports = 3, + }, }; static bool ni_65xx_legacy_invert_outputs; @@ -345,8 +345,7 @@ static void ni_65xx_disable_edge_detection(struct comedi_device *dev) static int ni_65xx_dio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned long base_port = (unsigned long)s->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -401,7 +400,7 @@ static int ni_65xx_dio_insn_config(struct comedi_device *dev, return -EINVAL; val = readb(dev->mmio + NI_65XX_IO_SEL_REG(port)); data[1] = (val == NI_65XX_IO_SEL_INPUT) ? COMEDI_INPUT - : COMEDI_OUTPUT; + : COMEDI_OUTPUT; break; default: @@ -413,8 +412,7 @@ static int ni_65xx_dio_insn_config(struct comedi_device *dev, static int ni_65xx_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned long base_port = (unsigned long)s->private; unsigned int base_chan = CR_CHAN(insn->chanspec); @@ -550,8 +548,7 @@ static int ni_65xx_intr_cancel(struct comedi_device *dev, static int ni_65xx_intr_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { data[1] = 0; return insn->n; @@ -604,8 +601,8 @@ static int ni_65xx_intr_insn_config(struct comedi_device *dev, } /* ripped from mite.h and mite_setup2() to avoid mite dependency */ -#define MITE_IODWBSR 0xc0 /* IO Device Window Base Size Register */ -#define WENAB BIT(7) /* window enable */ +#define MITE_IODWBSR 0xc0 /* IO Device Window Base Size Register */ +#define WENAB BIT(7) /* window enable */ static int ni_65xx_mite_init(struct pci_dev *pcidev) { @@ -626,8 +623,7 @@ static int ni_65xx_mite_init(struct pci_dev *pcidev) return 0; } -static int ni_65xx_auto_attach(struct comedi_device *dev, - unsigned long context) +static int ni_65xx_auto_attach(struct comedi_device *dev, unsigned long context) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); const struct ni_65xx_board *board = NULL; @@ -674,28 +670,28 @@ static int ni_65xx_auto_attach(struct comedi_device *dev, s = &dev->subdevices[0]; if (board->num_di_ports) { - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = NI_65XX_PORT_TO_CHAN(board->num_di_ports); - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = ni_65xx_dio_insn_bits; - s->insn_config = ni_65xx_dio_insn_config; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = NI_65XX_PORT_TO_CHAN(board->num_di_ports); + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = ni_65xx_dio_insn_bits; + s->insn_config = ni_65xx_dio_insn_config; /* the input ports always start at port 0 */ s->private = (void *)0; } else { - s->type = COMEDI_SUBD_UNUSED; + s->type = COMEDI_SUBD_UNUSED; } s = &dev->subdevices[1]; if (board->num_do_ports) { - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = NI_65XX_PORT_TO_CHAN(board->num_do_ports); - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = ni_65xx_dio_insn_bits; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = NI_65XX_PORT_TO_CHAN(board->num_do_ports); + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = ni_65xx_dio_insn_bits; /* the output ports always start after the input ports */ s->private = (void *)(unsigned long)board->num_di_ports; @@ -715,18 +711,18 @@ static int ni_65xx_auto_attach(struct comedi_device *dev, NI_65XX_IO_DATA_REG(board->num_di_ports + i)); } } else { - s->type = COMEDI_SUBD_UNUSED; + s->type = COMEDI_SUBD_UNUSED; } s = &dev->subdevices[2]; if (board->num_dio_ports) { - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = NI_65XX_PORT_TO_CHAN(board->num_dio_ports); - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = ni_65xx_dio_insn_bits; - s->insn_config = ni_65xx_dio_insn_config; + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = NI_65XX_PORT_TO_CHAN(board->num_dio_ports); + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = ni_65xx_dio_insn_bits; + s->insn_config = ni_65xx_dio_insn_config; /* the input/output ports always start at port 0 */ s->private = (void *)0; @@ -737,24 +733,24 @@ static int ni_65xx_auto_attach(struct comedi_device *dev, dev->mmio + NI_65XX_IO_SEL_REG(i)); } } else { - s->type = COMEDI_SUBD_UNUSED; + s->type = COMEDI_SUBD_UNUSED; } s = &dev->subdevices[3]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 1; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = ni_65xx_intr_insn_bits; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 1; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = ni_65xx_intr_insn_bits; if (dev->irq) { dev->read_subdev = s; - s->subdev_flags |= SDF_CMD_READ; - s->len_chanlist = 1; - s->insn_config = ni_65xx_intr_insn_config; - s->do_cmdtest = ni_65xx_intr_cmdtest; - s->do_cmd = ni_65xx_intr_cmd; - s->cancel = ni_65xx_intr_cancel; + s->subdev_flags |= SDF_CMD_READ; + s->len_chanlist = 1; + s->insn_config = ni_65xx_intr_insn_config; + s->do_cmdtest = ni_65xx_intr_cmdtest; + s->do_cmd = ni_65xx_intr_cmd; + s->cancel = ni_65xx_intr_cancel; } ni_65xx_disable_input_filters(dev); @@ -771,10 +767,10 @@ static void ni_65xx_detach(struct comedi_device *dev) } static struct comedi_driver ni_65xx_driver = { - .driver_name = "ni_65xx", - .module = THIS_MODULE, - .auto_attach = ni_65xx_auto_attach, - .detach = ni_65xx_detach, + .driver_name = "ni_65xx", + .module = THIS_MODULE, + .auto_attach = ni_65xx_auto_attach, + .detach = ni_65xx_detach, }; static int ni_65xx_pci_probe(struct pci_dev *dev, @@ -808,14 +804,16 @@ static const struct pci_device_id ni_65xx_pci_table[] = { { PCI_VDEVICE(NI, 0x71c5), BOARD_PCI6520 }, { 0 } }; + MODULE_DEVICE_TABLE(pci, ni_65xx_pci_table); static struct pci_driver ni_65xx_pci_driver = { - .name = "ni_65xx", - .id_table = ni_65xx_pci_table, - .probe = ni_65xx_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "ni_65xx", + .id_table = ni_65xx_pci_table, + .probe = ni_65xx_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(ni_65xx_driver, ni_65xx_pci_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/ni_660x.c b/drivers/comedi/drivers/ni_660x.c index e60d0125bcb2..93031f3afc2c 100644 --- a/drivers/comedi/drivers/ni_660x.c +++ b/drivers/comedi/drivers/ni_660x.c @@ -96,104 +96,104 @@ struct ni_660x_register_data { }; static const struct ni_660x_register_data ni_660x_reg_data[NI660X_NUM_REGS] = { - [NITIO_G0_INT_ACK] = { 0x004, 2 }, /* write */ - [NITIO_G0_STATUS] = { 0x004, 2 }, /* read */ - [NITIO_G1_INT_ACK] = { 0x006, 2 }, /* write */ - [NITIO_G1_STATUS] = { 0x006, 2 }, /* read */ - [NITIO_G01_STATUS] = { 0x008, 2 }, /* read */ - [NITIO_G0_CMD] = { 0x00c, 2 }, /* write */ - [NI660X_STC_DIO_PARALLEL_INPUT] = { 0x00e, 2 }, /* read */ - [NITIO_G1_CMD] = { 0x00e, 2 }, /* write */ - [NITIO_G0_HW_SAVE] = { 0x010, 4 }, /* read */ - [NITIO_G1_HW_SAVE] = { 0x014, 4 }, /* read */ - [NI660X_STC_DIO_OUTPUT] = { 0x014, 2 }, /* write */ - [NI660X_STC_DIO_CONTROL] = { 0x016, 2 }, /* write */ - [NITIO_G0_SW_SAVE] = { 0x018, 4 }, /* read */ - [NITIO_G1_SW_SAVE] = { 0x01c, 4 }, /* read */ - [NITIO_G0_MODE] = { 0x034, 2 }, /* write */ - [NITIO_G01_STATUS1] = { 0x036, 2 }, /* read */ - [NITIO_G1_MODE] = { 0x036, 2 }, /* write */ - [NI660X_STC_DIO_SERIAL_INPUT] = { 0x038, 2 }, /* read */ - [NITIO_G0_LOADA] = { 0x038, 4 }, /* write */ - [NITIO_G01_STATUS2] = { 0x03a, 2 }, /* read */ - [NITIO_G0_LOADB] = { 0x03c, 4 }, /* write */ - [NITIO_G1_LOADA] = { 0x040, 4 }, /* write */ - [NITIO_G1_LOADB] = { 0x044, 4 }, /* write */ - [NITIO_G0_INPUT_SEL] = { 0x048, 2 }, /* write */ - [NITIO_G1_INPUT_SEL] = { 0x04a, 2 }, /* write */ - [NITIO_G0_AUTO_INC] = { 0x088, 2 }, /* write */ - [NITIO_G1_AUTO_INC] = { 0x08a, 2 }, /* write */ - [NITIO_G01_RESET] = { 0x090, 2 }, /* write */ - [NITIO_G0_INT_ENA] = { 0x092, 2 }, /* write */ - [NITIO_G1_INT_ENA] = { 0x096, 2 }, /* write */ - [NITIO_G0_CNT_MODE] = { 0x0b0, 2 }, /* write */ - [NITIO_G1_CNT_MODE] = { 0x0b2, 2 }, /* write */ - [NITIO_G0_GATE2] = { 0x0b4, 2 }, /* write */ - [NITIO_G1_GATE2] = { 0x0b6, 2 }, /* write */ - [NITIO_G0_DMA_CFG] = { 0x0b8, 2 }, /* write */ - [NITIO_G0_DMA_STATUS] = { 0x0b8, 2 }, /* read */ - [NITIO_G1_DMA_CFG] = { 0x0ba, 2 }, /* write */ - [NITIO_G1_DMA_STATUS] = { 0x0ba, 2 }, /* read */ - [NITIO_G2_INT_ACK] = { 0x104, 2 }, /* write */ - [NITIO_G2_STATUS] = { 0x104, 2 }, /* read */ - [NITIO_G3_INT_ACK] = { 0x106, 2 }, /* write */ - [NITIO_G3_STATUS] = { 0x106, 2 }, /* read */ - [NITIO_G23_STATUS] = { 0x108, 2 }, /* read */ - [NITIO_G2_CMD] = { 0x10c, 2 }, /* write */ - [NITIO_G3_CMD] = { 0x10e, 2 }, /* write */ - [NITIO_G2_HW_SAVE] = { 0x110, 4 }, /* read */ - [NITIO_G3_HW_SAVE] = { 0x114, 4 }, /* read */ - [NITIO_G2_SW_SAVE] = { 0x118, 4 }, /* read */ - [NITIO_G3_SW_SAVE] = { 0x11c, 4 }, /* read */ - [NITIO_G2_MODE] = { 0x134, 2 }, /* write */ - [NITIO_G23_STATUS1] = { 0x136, 2 }, /* read */ - [NITIO_G3_MODE] = { 0x136, 2 }, /* write */ - [NITIO_G2_LOADA] = { 0x138, 4 }, /* write */ - [NITIO_G23_STATUS2] = { 0x13a, 2 }, /* read */ - [NITIO_G2_LOADB] = { 0x13c, 4 }, /* write */ - [NITIO_G3_LOADA] = { 0x140, 4 }, /* write */ - [NITIO_G3_LOADB] = { 0x144, 4 }, /* write */ - [NITIO_G2_INPUT_SEL] = { 0x148, 2 }, /* write */ - [NITIO_G3_INPUT_SEL] = { 0x14a, 2 }, /* write */ - [NITIO_G2_AUTO_INC] = { 0x188, 2 }, /* write */ - [NITIO_G3_AUTO_INC] = { 0x18a, 2 }, /* write */ - [NITIO_G23_RESET] = { 0x190, 2 }, /* write */ - [NITIO_G2_INT_ENA] = { 0x192, 2 }, /* write */ - [NITIO_G3_INT_ENA] = { 0x196, 2 }, /* write */ - [NITIO_G2_CNT_MODE] = { 0x1b0, 2 }, /* write */ - [NITIO_G3_CNT_MODE] = { 0x1b2, 2 }, /* write */ - [NITIO_G2_GATE2] = { 0x1b4, 2 }, /* write */ - [NITIO_G3_GATE2] = { 0x1b6, 2 }, /* write */ - [NITIO_G2_DMA_CFG] = { 0x1b8, 2 }, /* write */ - [NITIO_G2_DMA_STATUS] = { 0x1b8, 2 }, /* read */ - [NITIO_G3_DMA_CFG] = { 0x1ba, 2 }, /* write */ - [NITIO_G3_DMA_STATUS] = { 0x1ba, 2 }, /* read */ - [NI660X_DIO32_INPUT] = { 0x414, 4 }, /* read */ - [NI660X_DIO32_OUTPUT] = { 0x510, 4 }, /* write */ - [NI660X_CLK_CFG] = { 0x73c, 4 }, /* write */ - [NI660X_GLOBAL_INT_STATUS] = { 0x754, 4 }, /* read */ - [NI660X_DMA_CFG] = { 0x76c, 4 }, /* write */ - [NI660X_GLOBAL_INT_CFG] = { 0x770, 4 }, /* write */ - [NI660X_IO_CFG_0_1] = { 0x77c, 2 }, /* read/write */ - [NI660X_IO_CFG_2_3] = { 0x77e, 2 }, /* read/write */ - [NI660X_IO_CFG_4_5] = { 0x780, 2 }, /* read/write */ - [NI660X_IO_CFG_6_7] = { 0x782, 2 }, /* read/write */ - [NI660X_IO_CFG_8_9] = { 0x784, 2 }, /* read/write */ - [NI660X_IO_CFG_10_11] = { 0x786, 2 }, /* read/write */ - [NI660X_IO_CFG_12_13] = { 0x788, 2 }, /* read/write */ - [NI660X_IO_CFG_14_15] = { 0x78a, 2 }, /* read/write */ - [NI660X_IO_CFG_16_17] = { 0x78c, 2 }, /* read/write */ - [NI660X_IO_CFG_18_19] = { 0x78e, 2 }, /* read/write */ - [NI660X_IO_CFG_20_21] = { 0x790, 2 }, /* read/write */ - [NI660X_IO_CFG_22_23] = { 0x792, 2 }, /* read/write */ - [NI660X_IO_CFG_24_25] = { 0x794, 2 }, /* read/write */ - [NI660X_IO_CFG_26_27] = { 0x796, 2 }, /* read/write */ - [NI660X_IO_CFG_28_29] = { 0x798, 2 }, /* read/write */ - [NI660X_IO_CFG_30_31] = { 0x79a, 2 }, /* read/write */ - [NI660X_IO_CFG_32_33] = { 0x79c, 2 }, /* read/write */ - [NI660X_IO_CFG_34_35] = { 0x79e, 2 }, /* read/write */ - [NI660X_IO_CFG_36_37] = { 0x7a0, 2 }, /* read/write */ - [NI660X_IO_CFG_38_39] = { 0x7a2, 2 } /* read/write */ + [NITIO_G0_INT_ACK] = { 0x004, 2 }, /* write */ + [NITIO_G0_STATUS] = { 0x004, 2 }, /* read */ + [NITIO_G1_INT_ACK] = { 0x006, 2 }, /* write */ + [NITIO_G1_STATUS] = { 0x006, 2 }, /* read */ + [NITIO_G01_STATUS] = { 0x008, 2 }, /* read */ + [NITIO_G0_CMD] = { 0x00c, 2 }, /* write */ + [NI660X_STC_DIO_PARALLEL_INPUT] = { 0x00e, 2 }, /* read */ + [NITIO_G1_CMD] = { 0x00e, 2 }, /* write */ + [NITIO_G0_HW_SAVE] = { 0x010, 4 }, /* read */ + [NITIO_G1_HW_SAVE] = { 0x014, 4 }, /* read */ + [NI660X_STC_DIO_OUTPUT] = { 0x014, 2 }, /* write */ + [NI660X_STC_DIO_CONTROL] = { 0x016, 2 }, /* write */ + [NITIO_G0_SW_SAVE] = { 0x018, 4 }, /* read */ + [NITIO_G1_SW_SAVE] = { 0x01c, 4 }, /* read */ + [NITIO_G0_MODE] = { 0x034, 2 }, /* write */ + [NITIO_G01_STATUS1] = { 0x036, 2 }, /* read */ + [NITIO_G1_MODE] = { 0x036, 2 }, /* write */ + [NI660X_STC_DIO_SERIAL_INPUT] = { 0x038, 2 }, /* read */ + [NITIO_G0_LOADA] = { 0x038, 4 }, /* write */ + [NITIO_G01_STATUS2] = { 0x03a, 2 }, /* read */ + [NITIO_G0_LOADB] = { 0x03c, 4 }, /* write */ + [NITIO_G1_LOADA] = { 0x040, 4 }, /* write */ + [NITIO_G1_LOADB] = { 0x044, 4 }, /* write */ + [NITIO_G0_INPUT_SEL] = { 0x048, 2 }, /* write */ + [NITIO_G1_INPUT_SEL] = { 0x04a, 2 }, /* write */ + [NITIO_G0_AUTO_INC] = { 0x088, 2 }, /* write */ + [NITIO_G1_AUTO_INC] = { 0x08a, 2 }, /* write */ + [NITIO_G01_RESET] = { 0x090, 2 }, /* write */ + [NITIO_G0_INT_ENA] = { 0x092, 2 }, /* write */ + [NITIO_G1_INT_ENA] = { 0x096, 2 }, /* write */ + [NITIO_G0_CNT_MODE] = { 0x0b0, 2 }, /* write */ + [NITIO_G1_CNT_MODE] = { 0x0b2, 2 }, /* write */ + [NITIO_G0_GATE2] = { 0x0b4, 2 }, /* write */ + [NITIO_G1_GATE2] = { 0x0b6, 2 }, /* write */ + [NITIO_G0_DMA_CFG] = { 0x0b8, 2 }, /* write */ + [NITIO_G0_DMA_STATUS] = { 0x0b8, 2 }, /* read */ + [NITIO_G1_DMA_CFG] = { 0x0ba, 2 }, /* write */ + [NITIO_G1_DMA_STATUS] = { 0x0ba, 2 }, /* read */ + [NITIO_G2_INT_ACK] = { 0x104, 2 }, /* write */ + [NITIO_G2_STATUS] = { 0x104, 2 }, /* read */ + [NITIO_G3_INT_ACK] = { 0x106, 2 }, /* write */ + [NITIO_G3_STATUS] = { 0x106, 2 }, /* read */ + [NITIO_G23_STATUS] = { 0x108, 2 }, /* read */ + [NITIO_G2_CMD] = { 0x10c, 2 }, /* write */ + [NITIO_G3_CMD] = { 0x10e, 2 }, /* write */ + [NITIO_G2_HW_SAVE] = { 0x110, 4 }, /* read */ + [NITIO_G3_HW_SAVE] = { 0x114, 4 }, /* read */ + [NITIO_G2_SW_SAVE] = { 0x118, 4 }, /* read */ + [NITIO_G3_SW_SAVE] = { 0x11c, 4 }, /* read */ + [NITIO_G2_MODE] = { 0x134, 2 }, /* write */ + [NITIO_G23_STATUS1] = { 0x136, 2 }, /* read */ + [NITIO_G3_MODE] = { 0x136, 2 }, /* write */ + [NITIO_G2_LOADA] = { 0x138, 4 }, /* write */ + [NITIO_G23_STATUS2] = { 0x13a, 2 }, /* read */ + [NITIO_G2_LOADB] = { 0x13c, 4 }, /* write */ + [NITIO_G3_LOADA] = { 0x140, 4 }, /* write */ + [NITIO_G3_LOADB] = { 0x144, 4 }, /* write */ + [NITIO_G2_INPUT_SEL] = { 0x148, 2 }, /* write */ + [NITIO_G3_INPUT_SEL] = { 0x14a, 2 }, /* write */ + [NITIO_G2_AUTO_INC] = { 0x188, 2 }, /* write */ + [NITIO_G3_AUTO_INC] = { 0x18a, 2 }, /* write */ + [NITIO_G23_RESET] = { 0x190, 2 }, /* write */ + [NITIO_G2_INT_ENA] = { 0x192, 2 }, /* write */ + [NITIO_G3_INT_ENA] = { 0x196, 2 }, /* write */ + [NITIO_G2_CNT_MODE] = { 0x1b0, 2 }, /* write */ + [NITIO_G3_CNT_MODE] = { 0x1b2, 2 }, /* write */ + [NITIO_G2_GATE2] = { 0x1b4, 2 }, /* write */ + [NITIO_G3_GATE2] = { 0x1b6, 2 }, /* write */ + [NITIO_G2_DMA_CFG] = { 0x1b8, 2 }, /* write */ + [NITIO_G2_DMA_STATUS] = { 0x1b8, 2 }, /* read */ + [NITIO_G3_DMA_CFG] = { 0x1ba, 2 }, /* write */ + [NITIO_G3_DMA_STATUS] = { 0x1ba, 2 }, /* read */ + [NI660X_DIO32_INPUT] = { 0x414, 4 }, /* read */ + [NI660X_DIO32_OUTPUT] = { 0x510, 4 }, /* write */ + [NI660X_CLK_CFG] = { 0x73c, 4 }, /* write */ + [NI660X_GLOBAL_INT_STATUS] = { 0x754, 4 }, /* read */ + [NI660X_DMA_CFG] = { 0x76c, 4 }, /* write */ + [NI660X_GLOBAL_INT_CFG] = { 0x770, 4 }, /* write */ + [NI660X_IO_CFG_0_1] = { 0x77c, 2 }, /* read/write */ + [NI660X_IO_CFG_2_3] = { 0x77e, 2 }, /* read/write */ + [NI660X_IO_CFG_4_5] = { 0x780, 2 }, /* read/write */ + [NI660X_IO_CFG_6_7] = { 0x782, 2 }, /* read/write */ + [NI660X_IO_CFG_8_9] = { 0x784, 2 }, /* read/write */ + [NI660X_IO_CFG_10_11] = { 0x786, 2 }, /* read/write */ + [NI660X_IO_CFG_12_13] = { 0x788, 2 }, /* read/write */ + [NI660X_IO_CFG_14_15] = { 0x78a, 2 }, /* read/write */ + [NI660X_IO_CFG_16_17] = { 0x78c, 2 }, /* read/write */ + [NI660X_IO_CFG_18_19] = { 0x78e, 2 }, /* read/write */ + [NI660X_IO_CFG_20_21] = { 0x790, 2 }, /* read/write */ + [NI660X_IO_CFG_22_23] = { 0x792, 2 }, /* read/write */ + [NI660X_IO_CFG_24_25] = { 0x794, 2 }, /* read/write */ + [NI660X_IO_CFG_26_27] = { 0x796, 2 }, /* read/write */ + [NI660X_IO_CFG_28_29] = { 0x798, 2 }, /* read/write */ + [NI660X_IO_CFG_30_31] = { 0x79a, 2 }, /* read/write */ + [NI660X_IO_CFG_32_33] = { 0x79c, 2 }, /* read/write */ + [NI660X_IO_CFG_34_35] = { 0x79e, 2 }, /* read/write */ + [NI660X_IO_CFG_36_37] = { 0x7a0, 2 }, /* read/write */ + [NI660X_IO_CFG_38_39] = { 0x7a2, 2 } /* read/write */ }; #define NI660X_CHIP_OFFSET 0x800 @@ -215,33 +215,33 @@ struct ni_660x_board { static const struct ni_660x_board ni_660x_boards[] = { [BOARD_PCI6601] = { - .name = "PCI-6601", - .n_chips = 1, - }, + .name = "PCI-6601", + .n_chips = 1, + }, [BOARD_PCI6602] = { - .name = "PCI-6602", - .n_chips = 2, - }, + .name = "PCI-6602", + .n_chips = 2, + }, [BOARD_PXI6602] = { - .name = "PXI-6602", - .n_chips = 2, - }, + .name = "PXI-6602", + .n_chips = 2, + }, [BOARD_PCI6608] = { - .name = "PCI-6608", - .n_chips = 2, - }, + .name = "PCI-6608", + .n_chips = 2, + }, [BOARD_PXI6608] = { - .name = "PXI-6608", - .n_chips = 2, - }, + .name = "PXI-6608", + .n_chips = 2, + }, [BOARD_PCI6624] = { - .name = "PCI-6624", - .n_chips = 2, - }, + .name = "PCI-6624", + .n_chips = 2, + }, [BOARD_PXI6624] = { - .name = "PXI-6624", - .n_chips = 2, - }, + .name = "PXI-6624", + .n_chips = 2, + }, }; #define NI660X_NUM_PFI_CHANNELS 40 @@ -272,7 +272,7 @@ static void ni_660x_write(struct comedi_device *dev, unsigned int chip, unsigned int bits, unsigned int reg) { unsigned int addr = (chip * NI660X_CHIP_OFFSET) + - ni_660x_reg_data[reg].offset; + ni_660x_reg_data[reg].offset; if (ni_660x_reg_data[reg].size == 2) writew(bits, dev->mmio + addr); @@ -284,7 +284,7 @@ static unsigned int ni_660x_read(struct comedi_device *dev, unsigned int chip, unsigned int reg) { unsigned int addr = (chip * NI660X_CHIP_OFFSET) + - ni_660x_reg_data[reg].offset; + ni_660x_reg_data[reg].offset; if (ni_660x_reg_data[reg].size == 2) return readw(dev->mmio + addr); @@ -318,8 +318,7 @@ static inline void ni_660x_set_dma_channel(struct comedi_device *dev, devpriv->dma_cfg[chip] |= NI660X_DMA_CFG_SEL(mite_channel, counter->counter_index); ni_660x_write(dev, chip, devpriv->dma_cfg[chip] | - NI660X_DMA_CFG_RESET(mite_channel), - NI660X_DMA_CFG); + NI660X_DMA_CFG_RESET(mite_channel), NI660X_DMA_CFG); } static inline void ni_660x_unset_dma_channel(struct comedi_device *dev, @@ -530,8 +529,7 @@ static void ni_660x_free_mite_rings(struct comedi_device *dev) static int ni_660x_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int shift = CR_CHAN(insn->chanspec); unsigned int mask = data[0] << shift; @@ -587,7 +585,7 @@ static void ni_660x_select_pfi_output(struct comedi_device *dev, /* set the pfi channel to high-z on the inactive chip */ bits = ni_660x_read(dev, idle_chip, NI660X_IO_CFG(chan)); bits &= ~NI660X_IO_CFG_OUT_SEL_MASK(chan); - bits |= NI660X_IO_CFG_OUT_SEL(chan, 0); /* high-z */ + bits |= NI660X_IO_CFG_OUT_SEL(chan, 0); /* high-z */ ni_660x_write(dev, idle_chip, bits, NI660X_IO_CFG(chan)); } @@ -599,8 +597,7 @@ static void ni_660x_select_pfi_output(struct comedi_device *dev, } static void ni_660x_set_pfi_direction(struct comedi_device *dev, - unsigned int chan, - unsigned int direction) + unsigned int chan, unsigned int direction) { struct ni_660x_private *devpriv = dev->private; u64 bit; @@ -693,8 +690,7 @@ static void ni_660x_set_pfi_filter(struct comedi_device *dev, static int ni_660x_dio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); int ret; @@ -767,18 +763,18 @@ static inline int get_output_select_source(int dest, struct comedi_device *dev) * The following can be enabled when RTSI routing info is * determined (not currently documented): * if (ni_get_rtsi_direction(dev, dest) == COMEDI_OUTPUT) { - * reg = ni_get_rtsi_routing(dev, dest); - - * if (reg == NI_RTSI_OUTPUT_RGOUT0) { - * dest = NI_RGOUT0; ** prepare for lookup below ** - * reg = get_rgout0_reg(dev); - * } else if (reg >= NI_RTSI_OUTPUT_RTSI_BRD(0) && - * reg <= NI_RTSI_OUTPUT_RTSI_BRD(3)) { - * const int i = reg - NI_RTSI_OUTPUT_RTSI_BRD(0); - - * dest = NI_RTSI_BRD(i); ** prepare for lookup ** - * reg = get_ith_rtsi_brd_reg(i, dev); - * } + * reg = ni_get_rtsi_routing(dev, dest); + + * if (reg == NI_RTSI_OUTPUT_RGOUT0) { + * dest = NI_RGOUT0; ** prepare for lookup below ** + * reg = get_rgout0_reg(dev); + * } else if (reg >= NI_RTSI_OUTPUT_RTSI_BRD(0) && + * reg <= NI_RTSI_OUTPUT_RTSI_BRD(3)) { + * const int i = reg - NI_RTSI_OUTPUT_RTSI_BRD(0); + + * dest = NI_RTSI_BRD(i); ** prepare for lookup ** + * reg = get_ith_rtsi_brd_reg(i, dev); + * } * } */ } else if (channel_is_ctr(dest)) { @@ -852,20 +848,20 @@ static inline int connect_route(unsigned int src, unsigned int dest, * The following can be enabled when RTSI routing info is * determined (not currently documented): * if (reg == NI_RTSI_OUTPUT_RGOUT0) { - * int ret = incr_rgout0_src_use(src, dev); + * int ret = incr_rgout0_src_use(src, dev); - * if (ret < 0) - * return ret; + * if (ret < 0) + * return ret; * } else if (ni_rtsi_route_requires_mux(reg)) { - * ** Attempt to allocate and route (src->brd) ** - * int brd = incr_rtsi_brd_src_use(src, dev); + * ** Attempt to allocate and route (src->brd) ** + * int brd = incr_rtsi_brd_src_use(src, dev); - * if (brd < 0) - * return brd; + * if (brd < 0) + * return brd; - * ** Now lookup the register value for (brd->dest) ** - * reg = ni_lookup_route_register(brd, CR_CHAN(dest), - * &devpriv->routing_tables); + * ** Now lookup the register value for (brd->dest) ** + * reg = ni_lookup_route_register(brd, CR_CHAN(dest), + * &devpriv->routing_tables); * } * ni_set_rtsi_direction(dev, dest, COMEDI_OUTPUT); @@ -901,8 +897,7 @@ static inline int disconnect_route(unsigned int src, unsigned int dest, /* The route is valid and is connected. Now disconnect... */ if (channel_is_pfi(CR_CHAN(dest))) { unsigned int source = ((CR_CHAN(dest) - NI_PFI(0)) < 8) - ? NI_660X_PFI_OUTPUT_DIO - : NI_660X_PFI_OUTPUT_COUNTER; + ? NI_660X_PFI_OUTPUT_DIO : NI_660X_PFI_OUTPUT_COUNTER; /* set the pfi to high impedance, and disconnect */ ni_660x_set_pfi_direction(dev, dest, COMEDI_INPUT); @@ -915,21 +910,21 @@ static inline int disconnect_route(unsigned int src, unsigned int dest, * The following can be enabled when RTSI routing info is * determined (not currently documented): * if (reg == NI_RTSI_OUTPUT_RGOUT0) { - * int ret = decr_rgout0_src_use(src, dev); + * int ret = decr_rgout0_src_use(src, dev); - * if (ret < 0) - * return ret; + * if (ret < 0) + * return ret; * } else if (ni_rtsi_route_requires_mux(reg)) { - * ** find which RTSI_BRD line is source for rtsi pin ** - * int brd = ni_find_route_source( - * ni_get_rtsi_routing(dev, dest), CR_CHAN(dest), - * &devpriv->routing_tables); + * ** find which RTSI_BRD line is source for rtsi pin ** + * int brd = ni_find_route_source( + * ni_get_rtsi_routing(dev, dest), CR_CHAN(dest), + * &devpriv->routing_tables); - * if (brd < 0) - * return brd; + * if (brd < 0) + * return brd; - * ** decrement/disconnect RTSI_BRD line from source ** - * decr_rtsi_brd_src_use(src, brd, dev); + * ** decrement/disconnect RTSI_BRD line from source ** + * decr_rtsi_brd_src_use(src, brd, dev); * } * ** set rtsi output selector to default state ** @@ -946,8 +941,7 @@ static inline int disconnect_route(unsigned int src, unsigned int dest, } static int ni_global_insn_config(struct comedi_device *dev, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { switch (data[0]) { case INSN_DEVICE_CONFIG_TEST_ROUTE: @@ -957,10 +951,10 @@ static int ni_global_insn_config(struct comedi_device *dev, return connect_route(data[1], data[2], dev); case INSN_DEVICE_CONFIG_DISCONNECT_ROUTE: return disconnect_route(data[1], data[2], dev); - /* - * This case is already handled one level up. - * case INSN_DEVICE_CONFIG_GET_ROUTES: - */ + /* + * This case is already handled one level up. + * case INSN_DEVICE_CONFIG_GET_ROUTES: + */ default: return -EINVAL; } @@ -994,8 +988,7 @@ static void ni_660x_init_tio_chips(struct comedi_device *dev, } } -static int ni_660x_auto_attach(struct comedi_device *dev, - unsigned long context) +static int ni_660x_auto_attach(struct comedi_device *dev, unsigned long context) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); const struct ni_660x_board *board = NULL; @@ -1024,7 +1017,7 @@ static int ni_660x_auto_attach(struct comedi_device *dev, return ret; devpriv = dev->private; - devpriv->mite = mite_attach(dev, true); /* use win1 */ + devpriv->mite = mite_attach(dev, true); /* use win1 */ if (!devpriv->mite) return -ENOMEM; @@ -1037,9 +1030,11 @@ static int ni_660x_auto_attach(struct comedi_device *dev, /* prepare the device for globally-named routes. */ if (ni_assign_device_routes("ni_660x", board->name, NULL, &devpriv->routing_tables) < 0) { - dev_warn(dev->class_dev, "%s: %s device has no signal routing table.\n", + dev_warn(dev->class_dev, + "%s: %s device has no signal routing table.\n", __func__, board->name); - dev_warn(dev->class_dev, "%s: High level NI signal names will not be available for this %s board.\n", + dev_warn(dev->class_dev, + "%s: High level NI signal names will not be available for this %s board.\n", __func__, board->name); } else { /* @@ -1081,70 +1076,70 @@ static int ni_660x_auto_attach(struct comedi_device *dev, * Counter 0-3 signals are from the first TIO chip. * Counter 4-7 signals are from the second TIO chip. * - * Comedi External - * PFI Chan DIO Chan Counter Signal - * ------- -------- -------------- - * 0 0 - * 1 1 - * 2 2 - * 3 3 - * 4 4 - * 5 5 - * 6 6 - * 7 7 - * 8 8 CTR 7 OUT - * 9 9 CTR 7 AUX - * 10 10 CTR 7 GATE - * 11 11 CTR 7 SOURCE - * 12 12 CTR 6 OUT - * 13 13 CTR 6 AUX - * 14 14 CTR 6 GATE - * 15 15 CTR 6 SOURCE - * 16 16 CTR 5 OUT - * 17 17 CTR 5 AUX - * 18 18 CTR 5 GATE - * 19 19 CTR 5 SOURCE - * 20 20 CTR 4 OUT - * 21 21 CTR 4 AUX - * 22 22 CTR 4 GATE - * 23 23 CTR 4 SOURCE - * 24 24 CTR 3 OUT - * 25 25 CTR 3 AUX - * 26 26 CTR 3 GATE - * 27 27 CTR 3 SOURCE - * 28 28 CTR 2 OUT - * 29 29 CTR 2 AUX - * 30 30 CTR 2 GATE - * 31 31 CTR 2 SOURCE - * 32 CTR 1 OUT - * 33 CTR 1 AUX - * 34 CTR 1 GATE - * 35 CTR 1 SOURCE - * 36 CTR 0 OUT - * 37 CTR 0 AUX - * 38 CTR 0 GATE - * 39 CTR 0 SOURCE + * Comedi External + * PFI Chan DIO Chan Counter Signal + * ------- -------- -------------- + * 0 0 + * 1 1 + * 2 2 + * 3 3 + * 4 4 + * 5 5 + * 6 6 + * 7 7 + * 8 8 CTR 7 OUT + * 9 9 CTR 7 AUX + * 10 10 CTR 7 GATE + * 11 11 CTR 7 SOURCE + * 12 12 CTR 6 OUT + * 13 13 CTR 6 AUX + * 14 14 CTR 6 GATE + * 15 15 CTR 6 SOURCE + * 16 16 CTR 5 OUT + * 17 17 CTR 5 AUX + * 18 18 CTR 5 GATE + * 19 19 CTR 5 SOURCE + * 20 20 CTR 4 OUT + * 21 21 CTR 4 AUX + * 22 22 CTR 4 GATE + * 23 23 CTR 4 SOURCE + * 24 24 CTR 3 OUT + * 25 25 CTR 3 AUX + * 26 26 CTR 3 GATE + * 27 27 CTR 3 SOURCE + * 28 28 CTR 2 OUT + * 29 29 CTR 2 AUX + * 30 30 CTR 2 GATE + * 31 31 CTR 2 SOURCE + * 32 CTR 1 OUT + * 33 CTR 1 AUX + * 34 CTR 1 GATE + * 35 CTR 1 SOURCE + * 36 CTR 0 OUT + * 37 CTR 0 AUX + * 38 CTR 0 GATE + * 39 CTR 0 SOURCE */ s = &dev->subdevices[subdev++]; - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = NI660X_NUM_PFI_CHANNELS; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = ni_660x_dio_insn_bits; - s->insn_config = ni_660x_dio_insn_config; - - /* - * Default the DIO channels as: - * chan 0-7: DIO inputs - * chan 8-39: counter signal inputs - */ + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = NI660X_NUM_PFI_CHANNELS; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = ni_660x_dio_insn_bits; + s->insn_config = ni_660x_dio_insn_config; + + /* + * Default the DIO channels as: + * chan 0-7: DIO inputs + * chan 8-39: counter signal inputs + */ for (i = 0; i < s->n_chan; ++i) { unsigned int source = (i < 8) ? NI_660X_PFI_OUTPUT_DIO - : NI_660X_PFI_OUTPUT_COUNTER; + : NI_660X_PFI_OUTPUT_COUNTER; ni_660x_set_pfi_routing(dev, i, source); - ni_660x_set_pfi_direction(dev, i, COMEDI_INPUT);/* high-z */ + ni_660x_set_pfi_direction(dev, i, COMEDI_INPUT); /* high-z */ } /* Counter subdevices (4 NI TIO General Purpose Counters per chip) */ @@ -1153,26 +1148,26 @@ static int ni_660x_auto_attach(struct comedi_device *dev, if (i < n_counters) { struct ni_gpct *counter = &gpct_dev->counters[i]; - s->type = COMEDI_SUBD_COUNTER; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE | - SDF_LSAMPL | SDF_CMD_READ; - s->n_chan = 3; - s->maxdata = 0xffffffff; - s->insn_read = ni_tio_insn_read; - s->insn_write = ni_tio_insn_write; - s->insn_config = ni_tio_insn_config; - s->len_chanlist = 1; - s->do_cmd = ni_660x_cmd; - s->do_cmdtest = ni_tio_cmdtest; - s->cancel = ni_660x_cancel; - s->poll = ni_660x_input_poll; - s->buf_change = ni_660x_buf_change; + s->type = COMEDI_SUBD_COUNTER; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE | + SDF_LSAMPL | SDF_CMD_READ; + s->n_chan = 3; + s->maxdata = 0xffffffff; + s->insn_read = ni_tio_insn_read; + s->insn_write = ni_tio_insn_write; + s->insn_config = ni_tio_insn_config; + s->len_chanlist = 1; + s->do_cmd = ni_660x_cmd; + s->do_cmdtest = ni_tio_cmdtest; + s->cancel = ni_660x_cancel; + s->poll = ni_660x_input_poll; + s->buf_change = ni_660x_buf_change; s->async_dma_dir = DMA_BIDIRECTIONAL; - s->private = counter; + s->private = counter; ni_tio_init_counter(counter); } else { - s->type = COMEDI_SUBD_UNUSED; + s->type = COMEDI_SUBD_UNUSED; } } @@ -1218,10 +1213,10 @@ static void ni_660x_detach(struct comedi_device *dev) } static struct comedi_driver ni_660x_driver = { - .driver_name = "ni_660x", - .module = THIS_MODULE, - .auto_attach = ni_660x_auto_attach, - .detach = ni_660x_detach, + .driver_name = "ni_660x", + .module = THIS_MODULE, + .auto_attach = ni_660x_auto_attach, + .detach = ni_660x_detach, }; static int ni_660x_pci_probe(struct pci_dev *dev, @@ -1240,14 +1235,16 @@ static const struct pci_device_id ni_660x_pci_table[] = { { PCI_VDEVICE(NI, 0x1e40), BOARD_PXI6624 }, { 0 } }; + MODULE_DEVICE_TABLE(pci, ni_660x_pci_table); static struct pci_driver ni_660x_pci_driver = { - .name = "ni_660x", - .id_table = ni_660x_pci_table, - .probe = ni_660x_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "ni_660x", + .id_table = ni_660x_pci_table, + .probe = ni_660x_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(ni_660x_driver, ni_660x_pci_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/ni_670x.c b/drivers/comedi/drivers/ni_670x.c index c197e47486be..29a891919ffc 100644 --- a/drivers/comedi/drivers/ni_670x.c +++ b/drivers/comedi/drivers/ni_670x.c @@ -51,17 +51,17 @@ struct ni_670x_board { static const struct ni_670x_board ni_670x_boards[] = { [BOARD_PCI6703] = { - .name = "PCI-6703", - .ao_chans = 16, - }, + .name = "PCI-6703", + .ao_chans = 16, + }, [BOARD_PXI6704] = { - .name = "PXI-6704", - .ao_chans = 32, - }, + .name = "PXI-6704", + .ao_chans = 32, + }, [BOARD_PCI6704] = { - .name = "PCI-6704", - .ao_chans = 32, - }, + .name = "PCI-6704", + .ao_chans = 32, + }, }; struct ni_670x_private { @@ -71,8 +71,7 @@ struct ni_670x_private { static int ni_670x_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int val = s->readback[chan]; @@ -103,8 +102,7 @@ static int ni_670x_ao_insn_write(struct comedi_device *dev, static int ni_670x_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { if (comedi_dio_update_state(s, data)) writel(s->state, dev->mmio + DIO_PORT0_DATA_OFFSET); @@ -116,8 +114,7 @@ static int ni_670x_dio_insn_bits(struct comedi_device *dev, static int ni_670x_dio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { int ret; @@ -131,8 +128,8 @@ static int ni_670x_dio_insn_config(struct comedi_device *dev, } /* ripped from mite.h and mite_setup2() to avoid mite dependency */ -#define MITE_IODWBSR 0xc0 /* IO Device Window Base Size Register */ -#define WENAB BIT(7) /* window enable */ +#define MITE_IODWBSR 0xc0 /* IO Device Window Base Size Register */ +#define WENAB BIT(7) /* window enable */ static int ni_670x_mite_init(struct pci_dev *pcidev) { @@ -153,8 +150,7 @@ static int ni_670x_mite_init(struct pci_dev *pcidev) return 0; } -static int ni_670x_auto_attach(struct comedi_device *dev, - unsigned long context) +static int ni_670x_auto_attach(struct comedi_device *dev, unsigned long context) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); const struct ni_670x_board *board = NULL; @@ -249,10 +245,10 @@ static void ni_670x_detach(struct comedi_device *dev) } static struct comedi_driver ni_670x_driver = { - .driver_name = "ni_670x", - .module = THIS_MODULE, - .auto_attach = ni_670x_auto_attach, - .detach = ni_670x_detach, + .driver_name = "ni_670x", + .module = THIS_MODULE, + .auto_attach = ni_670x_auto_attach, + .detach = ni_670x_detach, }; static int ni_670x_pci_probe(struct pci_dev *dev, @@ -267,14 +263,16 @@ static const struct pci_device_id ni_670x_pci_table[] = { { PCI_VDEVICE(NI, 0x2c90), BOARD_PCI6703 }, { 0 } }; + MODULE_DEVICE_TABLE(pci, ni_670x_pci_table); static struct pci_driver ni_670x_pci_driver = { - .name = "ni_670x", - .id_table = ni_670x_pci_table, - .probe = ni_670x_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "ni_670x", + .id_table = ni_670x_pci_table, + .probe = ni_670x_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(ni_670x_driver, ni_670x_pci_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/ni_at_a2150.c b/drivers/comedi/drivers/ni_at_a2150.c index 10ad7b88713e..4bb8e608f76b 100644 --- a/drivers/comedi/drivers/ni_at_a2150.c +++ b/drivers/comedi/drivers/ni_at_a2150.c @@ -79,9 +79,9 @@ /* dma terminal count interrupt has occurred */ #define DMA_TC_BIT 0x80 #define ID_BITS(x) (((x) >> 8) & 0x3) -#define IRQ_DMA_CNTRL_REG 0x12 /* write only */ -#define DMA_CHAN_BITS(x) ((x) & 0x7) /* sets dma channel */ -#define DMA_EN_BIT 0x8 /* enables dma */ +#define IRQ_DMA_CNTRL_REG 0x12 /* write only */ +#define DMA_CHAN_BITS(x) ((x) & 0x7) /* sets dma channel */ +#define DMA_EN_BIT 0x8 /* enables dma */ #define IRQ_LVL_BITS(x) (((x) & 0xf) << 4) /* sets irq level */ #define FIFO_INTR_EN_BIT 0x100 /* enable fifo interrupts */ #define FIFO_INTR_FHF_BIT 0x200 /* interrupt fifo half full */ @@ -100,8 +100,8 @@ struct a2150_board { /* analog input range */ static const struct comedi_lrange range_a2150 = { 1, { - BIP_RANGE(2.828) - } + BIP_RANGE(2.828) + } }; /* enum must match board indices */ @@ -109,16 +109,16 @@ enum { a2150_c, a2150_s }; static const struct a2150_board a2150_boards[] = { { .name = "at-a2150c", - .clock = {31250, 22676, 20833, 19531}, + .clock = { 31250, 22676, 20833, 19531}, .num_clocks = 4, .ai_speed = 19531, - }, + }, { .name = "at-a2150s", - .clock = {62500, 50000, 41667, 0}, + .clock = { 62500, 50000, 41667, 0}, .num_clocks = 3, .ai_speed = 41667, - }, + }, }; struct a2150_private { @@ -434,7 +434,7 @@ static int a2150_ai_cmdtest(struct comedi_device *dev, if (cmd->stop_src == TRIG_COUNT) err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); - else /* TRIG_NONE */ + else /* TRIG_NONE */ err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) @@ -508,7 +508,7 @@ static int a2150_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) /* set size of transfer to fill in 1/3 second */ #define ONE_THIRD_SECOND 333333333 desc->size = comedi_bytes_per_sample(s) * cmd->chanlist_len * - ONE_THIRD_SECOND / cmd->scan_begin_arg; + ONE_THIRD_SECOND / cmd->scan_begin_arg; if (desc->size > desc->maxsize) desc->size = desc->maxsize; if (desc->size < comedi_bytes_per_sample(s)) @@ -564,8 +564,7 @@ static int a2150_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) static int a2150_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned int status; @@ -661,7 +660,7 @@ static void a2150_alloc_irq_and_dma(struct comedi_device *dev, } else { dev->irq = irq_num; devpriv->irq_dma_bits = IRQ_LVL_BITS(irq_num) | - DMA_CHAN_BITS(dma_chan); + DMA_CHAN_BITS(dma_chan); } } @@ -770,11 +769,12 @@ static void a2150_detach(struct comedi_device *dev) }; static struct comedi_driver ni_at_a2150_driver = { - .driver_name = "ni_at_a2150", - .module = THIS_MODULE, - .attach = a2150_attach, - .detach = a2150_detach, + .driver_name = "ni_at_a2150", + .module = THIS_MODULE, + .attach = a2150_attach, + .detach = a2150_detach, }; + module_comedi_driver(ni_at_a2150_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/ni_at_ao.c b/drivers/comedi/drivers/ni_at_ao.c index 2a0fb4d460db..b269de5888b2 100644 --- a/drivers/comedi/drivers/ni_at_ao.c +++ b/drivers/comedi/drivers/ni_at_ao.c @@ -96,12 +96,12 @@ struct atao_board { static const struct atao_board atao_boards[] = { { - .name = "at-ao-6", - .n_ao_chans = 6, - }, { - .name = "at-ao-10", - .n_ao_chans = 10, - }, + .name = "at-ao-6", + .n_ao_chans = 6, + }, { + .name = "at-ao-10", + .n_ao_chans = 10, + }, }; struct atao_private { @@ -125,8 +125,7 @@ static void atao_select_reg_group(struct comedi_device *dev, int group) static int atao_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int val = s->readback[chan]; @@ -152,8 +151,7 @@ static int atao_ao_insn_write(struct comedi_device *dev, static int atao_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { if (comedi_dio_update_state(s, data)) outw(s->state, dev->iobase + ATAO_DIO_REG); @@ -165,8 +163,7 @@ static int atao_dio_insn_bits(struct comedi_device *dev, static int atao_dio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct atao_private *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -231,8 +228,7 @@ static int atao_dio_insn_config(struct comedi_device *dev, */ static int atao_calib_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); @@ -316,12 +312,12 @@ static int atao_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* Analog Output subdevice */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = board->n_ao_chans; - s->maxdata = 0x0fff; - s->range_table = it->options[3] ? &range_unipolar10 : &range_bipolar10; - s->insn_write = atao_ao_insn_write; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = board->n_ao_chans; + s->maxdata = 0x0fff; + s->range_table = it->options[3] ? &range_unipolar10 : &range_bipolar10; + s->insn_write = atao_ao_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) @@ -329,21 +325,21 @@ static int atao_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* Digital I/O subdevice */ s = &dev->subdevices[1]; - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 8; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = atao_dio_insn_bits; - s->insn_config = atao_dio_insn_config; + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 8; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = atao_dio_insn_bits; + s->insn_config = atao_dio_insn_config; /* caldac subdevice */ s = &dev->subdevices[2]; - s->type = COMEDI_SUBD_CALIB; - s->subdev_flags = SDF_WRITABLE | SDF_INTERNAL; - s->n_chan = (board->n_ao_chans * 2) + 1; - s->maxdata = 0xff; - s->insn_write = atao_calib_insn_write; + s->type = COMEDI_SUBD_CALIB; + s->subdev_flags = SDF_WRITABLE | SDF_INTERNAL; + s->n_chan = (board->n_ao_chans * 2) + 1; + s->maxdata = 0xff; + s->insn_write = atao_calib_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) @@ -351,7 +347,7 @@ static int atao_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* EEPROM subdevice */ s = &dev->subdevices[3]; - s->type = COMEDI_SUBD_UNUSED; + s->type = COMEDI_SUBD_UNUSED; atao_reset(dev); @@ -359,14 +355,15 @@ static int atao_attach(struct comedi_device *dev, struct comedi_devconfig *it) } static struct comedi_driver ni_at_ao_driver = { - .driver_name = "ni_at_ao", - .module = THIS_MODULE, - .attach = atao_attach, - .detach = comedi_legacy_detach, - .board_name = &atao_boards[0].name, - .offset = sizeof(struct atao_board), - .num_names = ARRAY_SIZE(atao_boards), + .driver_name = "ni_at_ao", + .module = THIS_MODULE, + .attach = atao_attach, + .detach = comedi_legacy_detach, + .board_name = &atao_boards[0].name, + .offset = sizeof(struct atao_board), + .num_names = ARRAY_SIZE(atao_boards), }; + module_comedi_driver(ni_at_ao_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/ni_atmio.c b/drivers/comedi/drivers/ni_atmio.c index 56c78da475e7..0323dde61859 100644 --- a/drivers/comedi/drivers/ni_atmio.c +++ b/drivers/comedi/drivers/ni_atmio.c @@ -83,122 +79,123 @@ /* AT specific setup */ static const struct ni_board_struct ni_boards[] = { { - .name = "at-mio-16e-1", - .device_id = 44, - .isapnp_id = 0x0000, /* XXX unknown */ - .n_adchan = 16, - .ai_maxdata = 0x0fff, - .ai_fifo_depth = 8192, - .gainlkup = ai_gain_16, - .ai_speed = 800, - .n_aochan = 2, - .ao_maxdata = 0x0fff, - .ao_fifo_depth = 2048, - .ao_range_table = &range_ni_E_ao_ext, - .ao_speed = 1000, - .caldac = { mb88341 }, - }, { - .name = "at-mio-16e-2", - .device_id = 25, - .isapnp_id = 0x1900, - .n_adchan = 16, - .ai_maxdata = 0x0fff, - .ai_fifo_depth = 2048, - .gainlkup = ai_gain_16, - .ai_speed = 2000, - .n_aochan = 2, - .ao_maxdata = 0x0fff, - .ao_fifo_depth = 2048, - .ao_range_table = &range_ni_E_ao_ext, - .ao_speed = 1000, - .caldac = { mb88341 }, - }, { - .name = "at-mio-16e-10", - .device_id = 36, - .isapnp_id = 0x2400, - .n_adchan = 16, - .ai_maxdata = 0x0fff, - .ai_fifo_depth = 512, - .gainlkup = ai_gain_16, - .ai_speed = 10000, - .n_aochan = 2, - .ao_maxdata = 0x0fff, - .ao_range_table = &range_ni_E_ao_ext, - .ao_speed = 10000, - .caldac = { ad8804_debug }, - }, { - .name = "at-mio-16de-10", - .device_id = 37, - .isapnp_id = 0x2500, - .n_adchan = 16, - .ai_maxdata = 0x0fff, - .ai_fifo_depth = 512, - .gainlkup = ai_gain_16, - .ai_speed = 10000, - .n_aochan = 2, - .ao_maxdata = 0x0fff, - .ao_range_table = &range_ni_E_ao_ext, - .ao_speed = 10000, - .caldac = { ad8804_debug }, - .has_8255 = 1, - }, { - .name = "at-mio-64e-3", - .device_id = 38, - .isapnp_id = 0x2600, - .n_adchan = 64, - .ai_maxdata = 0x0fff, - .ai_fifo_depth = 2048, - .gainlkup = ai_gain_16, - .ai_speed = 2000, - .n_aochan = 2, - .ao_maxdata = 0x0fff, - .ao_fifo_depth = 2048, - .ao_range_table = &range_ni_E_ao_ext, - .ao_speed = 1000, - .caldac = { ad8804_debug }, - }, { - .name = "at-mio-16xe-50", - .device_id = 39, - .isapnp_id = 0x2700, - .n_adchan = 16, - .ai_maxdata = 0xffff, - .ai_fifo_depth = 512, - .alwaysdither = 1, - .gainlkup = ai_gain_8, - .ai_speed = 50000, - .n_aochan = 2, - .ao_maxdata = 0x0fff, - .ao_range_table = &range_bipolar10, - .ao_speed = 50000, - .caldac = { dac8800, dac8043 }, - }, { - .name = "at-mio-16xe-10", - .device_id = 50, - .isapnp_id = 0x0000, /* XXX unknown */ - .n_adchan = 16, - .ai_maxdata = 0xffff, - .ai_fifo_depth = 512, - .alwaysdither = 1, - .gainlkup = ai_gain_14, - .ai_speed = 10000, - .n_aochan = 2, - .ao_maxdata = 0xffff, - .ao_fifo_depth = 2048, - .ao_range_table = &range_ni_E_ao_ext, - .ao_speed = 1000, - .caldac = { dac8800, dac8043, ad8522 }, - }, { - .name = "at-ai-16xe-10", - .device_id = 51, - .isapnp_id = 0x0000, /* XXX unknown */ - .n_adchan = 16, - .ai_maxdata = 0xffff, - .ai_fifo_depth = 512, - .alwaysdither = 1, /* unknown */ - .gainlkup = ai_gain_14, - .ai_speed = 10000, - .caldac = { dac8800, dac8043, ad8522 }, - }, + .name = "at-mio-16e-1", + .device_id = 44, + .isapnp_id = 0x0000, /* XXX unknown */ + .n_adchan = 16, + .ai_maxdata = 0x0fff, + .ai_fifo_depth = 8192, + .gainlkup = ai_gain_16, + .ai_speed = 800, + .n_aochan = 2, + .ao_maxdata = 0x0fff, + .ao_fifo_depth = 2048, + .ao_range_table = &range_ni_E_ao_ext, + .ao_speed = 1000, + .caldac = { mb88341}, + }, { + .name = "at-mio-16e-2", + .device_id = 25, + .isapnp_id = 0x1900, + .n_adchan = 16, + .ai_maxdata = 0x0fff, + .ai_fifo_depth = 2048, + .gainlkup = ai_gain_16, + .ai_speed = 2000, + .n_aochan = 2, + .ao_maxdata = 0x0fff, + .ao_fifo_depth = 2048, + .ao_range_table = &range_ni_E_ao_ext, + .ao_speed = 1000, + .caldac = { mb88341}, + }, { + .name = "at-mio-16e-10", + .device_id = 36, + .isapnp_id = 0x2400, + .n_adchan = 16, + .ai_maxdata = 0x0fff, + .ai_fifo_depth = 512, + .gainlkup = ai_gain_16, + .ai_speed = 10000, + .n_aochan = 2, + .ao_maxdata = 0x0fff, + .ao_range_table = &range_ni_E_ao_ext, + .ao_speed = 10000, + .caldac = { ad8804_debug}, + }, { + .name = "at-mio-16de-10", + .device_id = 37, + .isapnp_id = 0x2500, + .n_adchan = 16, + .ai_maxdata = 0x0fff, + .ai_fifo_depth = 512, + .gainlkup = ai_gain_16, + .ai_speed = 10000, + .n_aochan = 2, + .ao_maxdata = 0x0fff, + .ao_range_table = &range_ni_E_ao_ext, + .ao_speed = 10000, + .caldac = { ad8804_debug}, + .has_8255 = 1, + }, { + .name = "at-mio-64e-3", + .device_id = 38, + .isapnp_id = 0x2600, + .n_adchan = 64, + .ai_maxdata = 0x0fff, + .ai_fifo_depth = 2048, + .gainlkup = ai_gain_16, + .ai_speed = 2000, + .n_aochan = 2, + .ao_maxdata = 0x0fff, + .ao_fifo_depth = 2048, + .ao_range_table = &range_ni_E_ao_ext, + .ao_speed = 1000, + .caldac = { ad8804_debug}, + }, { + .name = "at-mio-16xe-50", + .device_id = 39, + .isapnp_id = 0x2700, + .n_adchan = 16, + .ai_maxdata = 0xffff, + .ai_fifo_depth = 512, + .alwaysdither = 1, + .gainlkup = ai_gain_8, + .ai_speed = 50000, + .n_aochan = 2, + .ao_maxdata = 0x0fff, + .ao_range_table = &range_bipolar10, + .ao_speed = 50000, + .caldac = { dac8800, dac8043}, + }, { + .name = "at-mio-16xe-10", + .device_id = 50, + .isapnp_id = 0x0000, /* XXX unknown */ + .n_adchan = 16, + .ai_maxdata = 0xffff, + .ai_fifo_depth = 512, + .alwaysdither = 1, + .gainlkup = ai_gain_14, + .ai_speed = 10000, + .n_aochan = 2, + .ao_maxdata = 0xffff, + .ao_fifo_depth = 2048, + .ao_range_table = &range_ni_E_ao_ext, + .ao_speed = 1000, + .caldac = { dac8800, dac8043, ad8522}, + }, { + .name = "at-ai-16xe-10", + .device_id = 51, + .isapnp_id = 0x0000, /* XXX unknown */ + .n_adchan = 16, + .ai_maxdata = 0xffff, + .ai_fifo_depth = 512, + .alwaysdither = 1, /* unknown */ + .gainlkup = ai_gain_14, + .ai_speed = 10000, + .caldac = { + dac8800, dac8043, ad8522}, + }, }; static const int ni_irqpin[] = { @@ -208,12 +209,12 @@ static const int ni_irqpin[] = { #include "ni_mio_common.c" static const struct pnp_device_id device_ids[] = { - {.id = "NIC1900", .driver_data = 0}, - {.id = "NIC2400", .driver_data = 0}, - {.id = "NIC2500", .driver_data = 0}, - {.id = "NIC2600", .driver_data = 0}, - {.id = "NIC2700", .driver_data = 0}, - {.id = ""} + {.id = "NIC1900", .driver_data = 0 }, + {.id = "NIC2400", .driver_data = 0 }, + {.id = "NIC2500", .driver_data = 0 }, + {.id = "NIC2600", .driver_data = 0 }, + {.id = "NIC2700", .driver_data = 0 }, + {.id = "" } }; MODULE_DEVICE_TABLE(pnp, device_ids); @@ -225,10 +226,9 @@ static int ni_isapnp_find_board(struct pnp_dev **dev) for (i = 0; i < ARRAY_SIZE(ni_boards); i++) { isapnp_dev = - pnp_find_dev(NULL, - ISAPNP_VENDOR('N', 'I', 'C'), - ISAPNP_FUNCTION(ni_boards[i].isapnp_id), - NULL); + pnp_find_dev(NULL, + ISAPNP_VENDOR('N', 'I', 'C'), + ISAPNP_FUNCTION(ni_boards[i].isapnp_id), NULL); if (!isapnp_dev || !isapnp_dev->card) continue; @@ -318,8 +318,7 @@ static int ni_atmio_attach(struct comedi_device *dev, if (irq != 0) { if (irq > 15 || ni_irqpin[irq] == -1) return -EINVAL; - ret = request_irq(irq, ni_E_interrupt, 0, - dev->board_name, dev); + ret = request_irq(irq, ni_E_interrupt, 0, dev->board_name, dev); if (ret < 0) return -EINVAL; dev->irq = irq; @@ -347,14 +346,14 @@ static void ni_atmio_detach(struct comedi_device *dev) } static struct comedi_driver ni_atmio_driver = { - .driver_name = "ni_atmio", - .module = THIS_MODULE, - .attach = ni_atmio_attach, - .detach = ni_atmio_detach, + .driver_name = "ni_atmio", + .module = THIS_MODULE, + .attach = ni_atmio_attach, + .detach = ni_atmio_detach, }; + module_comedi_driver(ni_atmio_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); MODULE_DESCRIPTION("Comedi low-level driver"); MODULE_LICENSE("GPL"); - diff --git a/drivers/comedi/drivers/ni_atmio16d.c b/drivers/comedi/drivers/ni_atmio16d.c index dffce1aa3e69..298777ceede6 100644 --- a/drivers/comedi/drivers/ni_atmio16d.c +++ b/drivers/comedi/drivers/ni_atmio16d.c @@ -109,29 +109,29 @@ struct atmio16_board_t { /* range structs */ static const struct comedi_lrange range_atmio16d_ai_10_bipolar = { 4, { - BIP_RANGE(10), - BIP_RANGE(1), - BIP_RANGE(0.1), - BIP_RANGE(0.02) - } + BIP_RANGE(10), + BIP_RANGE(1), + BIP_RANGE(0.1), + BIP_RANGE(0.02) + } }; static const struct comedi_lrange range_atmio16d_ai_5_bipolar = { 4, { - BIP_RANGE(5), - BIP_RANGE(0.5), - BIP_RANGE(0.05), - BIP_RANGE(0.01) - } + BIP_RANGE(5), + BIP_RANGE(0.5), + BIP_RANGE(0.05), + BIP_RANGE(0.01) + } }; static const struct comedi_lrange range_atmio16d_ai_unipolar = { 4, { - UNI_RANGE(10), - UNI_RANGE(1), - UNI_RANGE(0.1), - UNI_RANGE(0.02) - } + UNI_RANGE(10), + UNI_RANGE(1), + UNI_RANGE(0.1), + UNI_RANGE(0.02) + } }; /* private data struct */ @@ -143,8 +143,8 @@ struct atmio16d_private { enum { dac_internal, dac_external } dac0_reference, dac1_reference; enum { dac_2comp, dac_straight } dac0_coding, dac1_coding; const struct comedi_lrange *ao_range_type_list[2]; - unsigned int com_reg_1_state; /* current state of command register 1 */ - unsigned int com_reg_2_state; /* current state of command register 2 */ + unsigned int com_reg_1_state; /* current state of command register 1 */ + unsigned int com_reg_2_state; /* current state of command register 2 */ }; static void reset_counters(struct comedi_device *dev) @@ -274,7 +274,7 @@ static int atmio16d_ai_cmdtest(struct comedi_device *dev, if (cmd->stop_src == TRIG_COUNT) err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); - else /* TRIG_NONE */ + else /* TRIG_NONE */ err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) @@ -331,7 +331,7 @@ static int atmio16d_ai_cmd(struct comedi_device *dev, } else if (cmd->convert_arg < 655360000) { base_clock = CLOCK_100_KHZ; timer = cmd->convert_arg / 10000; - } else /* cmd->convert_arg < 6553600000 */ { + } else { /* cmd->convert_arg < 6553600000 */ base_clock = CLOCK_10_KHZ; timer = cmd->convert_arg / 100000; } @@ -397,7 +397,7 @@ static int atmio16d_ai_cmd(struct comedi_device *dev, } else if (cmd->scan_begin_arg < 655360000) { base_clock = CLOCK_100_KHZ; timer = cmd->scan_begin_arg / 10000; - } else /* cmd->scan_begin_arg < 6553600000 */ { + } else { /* cmd->scan_begin_arg < 6553600000 */ base_clock = CLOCK_10_KHZ; timer = cmd->scan_begin_arg / 100000; } @@ -440,8 +440,7 @@ static int atmio16d_ai_cancel(struct comedi_device *dev, static int atmio16d_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned int status; @@ -497,8 +496,7 @@ static int atmio16d_ai_insn_read(struct comedi_device *dev, static int atmio16d_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct atmio16d_private *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -527,8 +525,7 @@ static int atmio16d_ao_insn_write(struct comedi_device *dev, static int atmio16d_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { if (comedi_dio_update_state(s, data)) outw(s->state, dev->iobase + MIO_16_DIG_OUT_REG); @@ -693,8 +690,7 @@ static int atmio16d_attach(struct comedi_device *dev, s->n_chan = 0; s->maxdata = 0 #endif - - return 0; + return 0; } static void atmio16d_detach(struct comedi_device *dev) @@ -705,23 +701,24 @@ static void atmio16d_detach(struct comedi_device *dev) static const struct atmio16_board_t atmio16_boards[] = { { - .name = "atmio16", - .has_8255 = 0, - }, { - .name = "atmio16d", - .has_8255 = 1, - }, + .name = "atmio16", + .has_8255 = 0, + }, { + .name = "atmio16d", + .has_8255 = 1, + }, }; static struct comedi_driver atmio16d_driver = { - .driver_name = "atmio16", - .module = THIS_MODULE, - .attach = atmio16d_attach, - .detach = atmio16d_detach, - .board_name = &atmio16_boards[0].name, - .num_names = ARRAY_SIZE(atmio16_boards), - .offset = sizeof(struct atmio16_board_t), + .driver_name = "atmio16", + .module = THIS_MODULE, + .attach = atmio16d_attach, + .detach = atmio16d_detach, + .board_name = &atmio16_boards[0].name, + .num_names = ARRAY_SIZE(atmio16_boards), + .offset = sizeof(struct atmio16_board_t), }; + module_comedi_driver(atmio16d_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/ni_daq_700.c b/drivers/comedi/drivers/ni_daq_700.c index d40fc89f9cef..6a06ae7a8540 100644 --- a/drivers/comedi/drivers/ni_daq_700.c +++ b/drivers/comedi/drivers/ni_daq_700.c @@ -60,21 +60,20 @@ #define CMO_R 0x0B /* RO 8bit */ #define TIC_R 0x06 /* WO 8bit */ /* daqcard700 modes */ -#define CMD_R3_DIFF 0x04 /* diff mode */ +#define CMD_R3_DIFF 0x04 /* diff mode */ static const struct comedi_lrange range_daq700_ai = { 3, { - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(2.5) - } + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(2.5) + } }; static int daq700_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int mask; unsigned int val; @@ -95,8 +94,7 @@ static int daq700_dio_insn_bits(struct comedi_device *dev, static int daq700_dio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { int ret; @@ -112,8 +110,7 @@ static int daq700_dio_insn_config(struct comedi_device *dev, static int daq700_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned int status; @@ -135,17 +132,17 @@ static int daq700_ai_rinsn(struct comedi_device *dev, int n; int d; int ret; - unsigned int chan = CR_CHAN(insn->chanspec); - unsigned int aref = CR_AREF(insn->chanspec); - unsigned int range = CR_RANGE(insn->chanspec); - unsigned int r3_bits = 0; + unsigned int chan = CR_CHAN(insn->chanspec); + unsigned int aref = CR_AREF(insn->chanspec); + unsigned int range = CR_RANGE(insn->chanspec); + unsigned int r3_bits = 0; /* set channel input modes */ if (aref == AREF_DIFF) r3_bits |= CMD_R3_DIFF; /* write channel mode/range */ if (range >= 1) - range++; /* convert range to hardware value */ + range++; /* convert range to hardware value */ outb(r3_bits | (range & 0x03), dev->iobase + CMD_R3); /* write channel to multiplexer */ @@ -157,8 +154,8 @@ static int daq700_ai_rinsn(struct comedi_device *dev, /* convert n samples */ for (n = 0; n < insn->n; n++) { /* trigger conversion with out0 L to H */ - outb(0x00, dev->iobase + CMD_R2); /* enable ADC conversions */ - outb(0x30, dev->iobase + CMO_R); /* mode 0 out0 L, from H */ + outb(0x00, dev->iobase + CMD_R2); /* enable ADC conversions */ + outb(0x30, dev->iobase + CMO_R); /* mode 0 out0 L, from H */ outb(0x00, dev->iobase + ADCLEAR_R); /* clear the ADC FIFO */ /* read 16bit junk from FIFO to clear */ inw(dev->iobase + ADFIFO_R); @@ -203,11 +200,10 @@ static void daq700_ai_config(struct comedi_device *dev, outb(0x32, iobase + CMO_R); /* config counter mode1, out0 to H */ outb(0x00, iobase + TIC_R); /* clear counter interrupt */ outb(0x00, iobase + ADCLEAR_R); /* clear the ADC FIFO */ - inw(iobase + ADFIFO_R); /* read 16bit junk from FIFO to clear */ + inw(iobase + ADFIFO_R); /* read 16bit junk from FIFO to clear */ } -static int daq700_auto_attach(struct comedi_device *dev, - unsigned long context) +static int daq700_auto_attach(struct comedi_device *dev, unsigned long context) { struct pcmcia_device *link = comedi_to_pcmcia_dev(dev); struct comedi_subdevice *s; @@ -225,14 +221,14 @@ static int daq700_auto_attach(struct comedi_device *dev, /* DAQCard-700 dio */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 16; - s->range_table = &range_digital; - s->maxdata = 1; - s->insn_bits = daq700_dio_insn_bits; - s->insn_config = daq700_dio_insn_config; - s->io_bits = 0x00ff; + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 16; + s->range_table = &range_digital; + s->maxdata = 1; + s->insn_bits = daq700_dio_insn_bits; + s->insn_config = daq700_dio_insn_config; + s->io_bits = 0x00ff; /* DAQCard-700 ai */ s = &dev->subdevices[1]; @@ -248,10 +244,10 @@ static int daq700_auto_attach(struct comedi_device *dev, } static struct comedi_driver daq700_driver = { - .driver_name = "ni_daq_700", - .module = THIS_MODULE, - .auto_attach = daq700_auto_attach, - .detach = comedi_pcmcia_disable, + .driver_name = "ni_daq_700", + .module = THIS_MODULE, + .auto_attach = daq700_auto_attach, + .detach = comedi_pcmcia_disable, }; static int daq700_cs_attach(struct pcmcia_device *link) @@ -263,18 +259,20 @@ static const struct pcmcia_device_id daq700_cs_ids[] = { PCMCIA_DEVICE_MANF_CARD(0x010b, 0x4743), PCMCIA_DEVICE_NULL }; + MODULE_DEVICE_TABLE(pcmcia, daq700_cs_ids); static struct pcmcia_driver daq700_cs_driver = { - .name = "ni_daq_700", - .owner = THIS_MODULE, - .id_table = daq700_cs_ids, - .probe = daq700_cs_attach, - .remove = comedi_pcmcia_auto_unconfig, + .name = "ni_daq_700", + .owner = THIS_MODULE, + .id_table = daq700_cs_ids, + .probe = daq700_cs_attach, + .remove = comedi_pcmcia_auto_unconfig, }; + module_comedi_pcmcia_driver(daq700_driver, daq700_cs_driver); MODULE_AUTHOR("Fred Brooks <nsaspook@xxxxxxxxxxxx>"); -MODULE_DESCRIPTION( - "Comedi driver for National Instruments PCMCIA DAQCard-700 DIO/AI"); +MODULE_DESCRIPTION + ("Comedi driver for National Instruments PCMCIA DAQCard-700 DIO/AI"); MODULE_LICENSE("GPL"); diff --git a/drivers/comedi/drivers/ni_daq_dio24.c b/drivers/comedi/drivers/ni_daq_dio24.c index 44fb65afc218..1bb9a2ff47ee 100644 --- a/drivers/comedi/drivers/ni_daq_dio24.c +++ b/drivers/comedi/drivers/ni_daq_dio24.c @@ -27,8 +27,7 @@ #include "8255.h" -static int dio24_auto_attach(struct comedi_device *dev, - unsigned long context) +static int dio24_auto_attach(struct comedi_device *dev, unsigned long context) { struct pcmcia_device *link = comedi_to_pcmcia_dev(dev); struct comedi_subdevice *s; @@ -50,10 +49,10 @@ static int dio24_auto_attach(struct comedi_device *dev, } static struct comedi_driver driver_dio24 = { - .driver_name = "ni_daq_dio24", - .module = THIS_MODULE, - .auto_attach = dio24_auto_attach, - .detach = comedi_pcmcia_disable, + .driver_name = "ni_daq_dio24", + .module = THIS_MODULE, + .auto_attach = dio24_auto_attach, + .detach = comedi_pcmcia_disable, }; static int dio24_cs_attach(struct pcmcia_device *link) @@ -65,18 +64,20 @@ static const struct pcmcia_device_id dio24_cs_ids[] = { PCMCIA_DEVICE_MANF_CARD(0x010b, 0x475c), /* daqcard-dio24 */ PCMCIA_DEVICE_NULL }; + MODULE_DEVICE_TABLE(pcmcia, dio24_cs_ids); static struct pcmcia_driver dio24_cs_driver = { - .name = "ni_daq_dio24", - .owner = THIS_MODULE, - .id_table = dio24_cs_ids, - .probe = dio24_cs_attach, - .remove = comedi_pcmcia_auto_unconfig, + .name = "ni_daq_dio24", + .owner = THIS_MODULE, + .id_table = dio24_cs_ids, + .probe = dio24_cs_attach, + .remove = comedi_pcmcia_auto_unconfig, }; + module_comedi_pcmcia_driver(driver_dio24, dio24_cs_driver); MODULE_AUTHOR("Daniel Vecino Castel <dvecino@xxxxxxx>"); -MODULE_DESCRIPTION( - "Comedi driver for National Instruments PCMCIA DAQ-Card DIO-24"); +MODULE_DESCRIPTION + ("Comedi driver for National Instruments PCMCIA DAQ-Card DIO-24"); MODULE_LICENSE("GPL"); diff --git a/drivers/comedi/drivers/ni_labpc.c b/drivers/comedi/drivers/ni_labpc.c index 1f4a07bd1d26..d0faabf653f7 100644 --- a/drivers/comedi/drivers/ni_labpc.c +++ b/drivers/comedi/drivers/ni_labpc.c @@ -56,21 +56,21 @@ static const struct labpc_boardinfo labpc_boards[] = { { - .name = "lab-pc-1200", - .ai_speed = 10000, - .ai_scan_up = 1, - .has_ao = 1, - .is_labpc1200 = 1, - }, { - .name = "lab-pc-1200ai", - .ai_speed = 10000, - .ai_scan_up = 1, - .is_labpc1200 = 1, - }, { - .name = "lab-pc+", - .ai_speed = 12000, - .has_ao = 1, - }, + .name = "lab-pc-1200", + .ai_speed = 10000, + .ai_scan_up = 1, + .has_ao = 1, + .is_labpc1200 = 1, + }, { + .name = "lab-pc-1200ai", + .ai_speed = 10000, + .ai_scan_up = 1, + .is_labpc1200 = 1, + }, { + .name = "lab-pc+", + .ai_speed = 12000, + .has_ao = 1, + }, }; static int labpc_attach(struct comedi_device *dev, struct comedi_devconfig *it) @@ -101,14 +101,15 @@ static void labpc_detach(struct comedi_device *dev) } static struct comedi_driver labpc_driver = { - .driver_name = "ni_labpc", - .module = THIS_MODULE, - .attach = labpc_attach, - .detach = labpc_detach, - .num_names = ARRAY_SIZE(labpc_boards), - .board_name = &labpc_boards[0].name, - .offset = sizeof(struct labpc_boardinfo), + .driver_name = "ni_labpc", + .module = THIS_MODULE, + .attach = labpc_attach, + .detach = labpc_detach, + .num_names = ARRAY_SIZE(labpc_boards), + .board_name = &labpc_boards[0].name, + .offset = sizeof(struct labpc_boardinfo), }; + module_comedi_driver(labpc_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/ni_labpc.h b/drivers/comedi/drivers/ni_labpc.h index 728e901f53cd..79d1499f68ec 100644 --- a/drivers/comedi/drivers/ni_labpc.h +++ b/drivers/comedi/drivers/ni_labpc.h @@ -14,9 +14,9 @@ enum transfer_type { fifo_not_empty_transfer, fifo_half_full_transfer, struct labpc_boardinfo { const char *name; - int ai_speed; /* maximum input speed in ns */ - unsigned ai_scan_up:1; /* can auto scan up in ai channels */ - unsigned has_ao:1; /* has analog outputs */ + int ai_speed; /* maximum input speed in ns */ + unsigned ai_scan_up:1; /* can auto scan up in ai channels */ + unsigned has_ao:1; /* has analog outputs */ unsigned is_labpc1200:1; /* has extra regs compared to pc+ */ }; @@ -43,9 +43,10 @@ struct labpc_private { * function pointers so we can use inb/outb or readb/writeb as * appropriate */ - unsigned int (*read_byte)(struct comedi_device *dev, unsigned long reg); - void (*write_byte)(struct comedi_device *dev, - unsigned int byte, unsigned long reg); + unsigned int (*read_byte)(struct comedi_device *dev, + unsigned long reg); + void (*write_byte)(struct comedi_device *dev, unsigned int byte, + unsigned long reg); }; int labpc_common_attach(struct comedi_device *dev, diff --git a/drivers/comedi/drivers/ni_labpc_common.c b/drivers/comedi/drivers/ni_labpc_common.c index dd97946eacaf..3961ba9d6a07 100644 --- a/drivers/comedi/drivers/ni_labpc_common.c +++ b/drivers/comedi/drivers/ni_labpc_common.c @@ -30,49 +30,49 @@ enum scan_mode { static const struct comedi_lrange range_labpc_plus_ai = { 16, { - BIP_RANGE(5), - BIP_RANGE(4), - BIP_RANGE(2.5), - BIP_RANGE(1), - BIP_RANGE(0.5), - BIP_RANGE(0.25), - BIP_RANGE(0.1), - BIP_RANGE(0.05), - UNI_RANGE(10), - UNI_RANGE(8), - UNI_RANGE(5), - UNI_RANGE(2), - UNI_RANGE(1), - UNI_RANGE(0.5), - UNI_RANGE(0.2), - UNI_RANGE(0.1) - } + BIP_RANGE(5), + BIP_RANGE(4), + BIP_RANGE(2.5), + BIP_RANGE(1), + BIP_RANGE(0.5), + BIP_RANGE(0.25), + BIP_RANGE(0.1), + BIP_RANGE(0.05), + UNI_RANGE(10), + UNI_RANGE(8), + UNI_RANGE(5), + UNI_RANGE(2), + UNI_RANGE(1), + UNI_RANGE(0.5), + UNI_RANGE(0.2), + UNI_RANGE(0.1) + } }; static const struct comedi_lrange range_labpc_1200_ai = { 14, { - BIP_RANGE(5), - BIP_RANGE(2.5), - BIP_RANGE(1), - BIP_RANGE(0.5), - BIP_RANGE(0.25), - BIP_RANGE(0.1), - BIP_RANGE(0.05), - UNI_RANGE(10), - UNI_RANGE(5), - UNI_RANGE(2), - UNI_RANGE(1), - UNI_RANGE(0.5), - UNI_RANGE(0.2), - UNI_RANGE(0.1) - } + BIP_RANGE(5), + BIP_RANGE(2.5), + BIP_RANGE(1), + BIP_RANGE(0.5), + BIP_RANGE(0.25), + BIP_RANGE(0.1), + BIP_RANGE(0.05), + UNI_RANGE(10), + UNI_RANGE(5), + UNI_RANGE(2), + UNI_RANGE(1), + UNI_RANGE(0.5), + UNI_RANGE(0.2), + UNI_RANGE(0.1) + } }; static const struct comedi_lrange range_labpc_ao = { 2, { - BIP_RANGE(5), - UNI_RANGE(10) - } + BIP_RANGE(5), + UNI_RANGE(10) + } }; /* @@ -120,8 +120,7 @@ static int labpc_cancel(struct comedi_device *dev, struct comedi_subdevice *s) static void labpc_ai_set_chan_and_gain(struct comedi_device *dev, enum scan_mode mode, unsigned int chan, - unsigned int range, - unsigned int aref) + unsigned int range, unsigned int aref) { const struct labpc_boardinfo *board = dev->board_ptr; struct labpc_private *devpriv = dev->private; @@ -150,8 +149,7 @@ static void labpc_setup_cmd6_reg(struct comedi_device *dev, enum scan_mode mode, enum transfer_type xfer, unsigned int range, - unsigned int aref, - bool ena_intr) + unsigned int aref, bool ena_intr) { const struct labpc_boardinfo *board = dev->board_ptr; struct labpc_private *devpriv = dev->private; @@ -211,8 +209,7 @@ static void labpc_clear_adc_fifo(struct comedi_device *dev) static int labpc_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { struct labpc_private *devpriv = dev->private; @@ -224,8 +221,7 @@ static int labpc_ai_eoc(struct comedi_device *dev, static int labpc_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct labpc_private *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -296,8 +292,7 @@ static void labpc_set_ai_convert_period(struct comedi_cmd *cmd, if (cmd->convert_src != TRIG_TIMER) return; - if (mode == MODE_SINGLE_CHAN && - cmd->scan_begin_src == TRIG_TIMER) { + if (mode == MODE_SINGLE_CHAN && cmd->scan_begin_src == TRIG_TIMER) { cmd->scan_begin_arg = ns; if (cmd->convert_arg > cmd->scan_begin_arg) cmd->convert_arg = cmd->scan_begin_arg; @@ -350,7 +345,7 @@ static void labpc_adc_timing(struct comedi_device *dev, struct comedi_cmd *cmd, * clock speed on convert and scan counters) */ pacer->next_div1 = (scan_period - 1) / - (pacer->osc_base * I8254_MAX_COUNT) + 1; + (pacer->osc_base * I8254_MAX_COUNT) + 1; comedi_check_trigger_arg_min(&pacer->next_div1, 2); comedi_check_trigger_arg_max(&pacer->next_div1, @@ -560,13 +555,14 @@ static int labpc_ai_cmdtest(struct comedi_device *dev, /* make sure scan timing is not too fast */ if (cmd->scan_begin_src == TRIG_TIMER) { if (cmd->convert_src == TRIG_TIMER) { - err |= comedi_check_trigger_arg_min( - &cmd->scan_begin_arg, - cmd->convert_arg * cmd->chanlist_len); + err |= + comedi_check_trigger_arg_min(&cmd->scan_begin_arg, + cmd->convert_arg * + cmd->chanlist_len); } - err |= comedi_check_trigger_arg_min( - &cmd->scan_begin_arg, - board->ai_speed * cmd->chanlist_len); + err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, + board->ai_speed * + cmd->chanlist_len); } switch (cmd->stop_src) { @@ -617,8 +613,7 @@ static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) struct comedi_cmd *cmd = &async->cmd; enum scan_mode mode = labpc_ai_scan_mode(cmd); unsigned int chanspec = (mode == MODE_MULT_CHAN_UP) ? - cmd->chanlist[cmd->chanlist_len - 1] : - cmd->chanlist[0]; + cmd->chanlist[cmd->chanlist_len - 1] : cmd->chanlist[0]; unsigned int chan = CR_CHAN(chanspec); unsigned int range = CR_RANGE(chanspec); unsigned int aref = CR_AREF(chanspec); @@ -640,15 +635,14 @@ static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) */ comedi_8254_load(devpriv->counter, 1, 3, I8254_MODE0 | I8254_BINARY); - } else { + } else { /* just put counter a1 in mode 0 to set its output low */ comedi_8254_set_mode(devpriv->counter, 1, I8254_MODE0 | I8254_BINARY); } /* figure out what method we will use to transfer data */ - if (devpriv->dma && - (cmd->flags & (CMDF_WAKE_EOS | CMDF_PRIORITY)) == 0) { + if (devpriv->dma && (cmd->flags & (CMDF_WAKE_EOS | CMDF_PRIORITY)) == 0) { /* * dma unsafe at RT priority, * and too much setup time for CMDF_WAKE_EOS @@ -689,8 +683,7 @@ static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) /* load count */ devpriv->write_byte(dev, 0x1, INTERVAL_STROBE_REG); - if (cmd->convert_src == TRIG_TIMER || - cmd->scan_begin_src == TRIG_TIMER) { + if (cmd->convert_src == TRIG_TIMER || cmd->scan_begin_src == TRIG_TIMER) { struct comedi_8254 *pacer = dev->pacer; struct comedi_8254 *counter = devpriv->counter; @@ -775,8 +768,7 @@ static int labpc_drain_fifo(struct comedi_device *dev) devpriv->stat1 = devpriv->read_byte(dev, STAT1_REG); - for (i = 0; (devpriv->stat1 & STAT1_DAVAIL) && i < timeout; - i++) { + for (i = 0; (devpriv->stat1 & STAT1_DAVAIL) && i < timeout; i++) { /* quit if we have all the data we want */ if (cmd->stop_src == TRIG_COUNT) { if (devpriv->count == 0) @@ -900,8 +892,7 @@ static void labpc_ao_write(struct comedi_device *dev, static int labpc_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { const struct labpc_boardinfo *board = dev->board_ptr; struct labpc_private *devpriv = dev->private; @@ -1119,8 +1110,7 @@ static void write_caldac(struct comedi_device *dev, unsigned int channel, static int labpc_calib_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); @@ -1142,8 +1132,7 @@ static int labpc_calib_insn_write(struct comedi_device *dev, static int labpc_eeprom_ready(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned int status; @@ -1156,8 +1145,7 @@ static int labpc_eeprom_ready(struct comedi_device *dev, static int labpc_eeprom_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); int ret; @@ -1248,31 +1236,31 @@ int labpc_common_attach(struct comedi_device *dev, /* analog input subdevice */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_COMMON | SDF_DIFF; - s->n_chan = 8; - s->len_chanlist = 8; - s->maxdata = 0x0fff; - s->range_table = board->is_labpc1200 ? - &range_labpc_1200_ai : &range_labpc_plus_ai; - s->insn_read = labpc_ai_insn_read; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_COMMON | SDF_DIFF; + s->n_chan = 8; + s->len_chanlist = 8; + s->maxdata = 0x0fff; + s->range_table = board->is_labpc1200 ? + &range_labpc_1200_ai : &range_labpc_plus_ai; + s->insn_read = labpc_ai_insn_read; if (dev->irq) { dev->read_subdev = s; - s->subdev_flags |= SDF_CMD_READ; - s->do_cmd = labpc_ai_cmd; - s->do_cmdtest = labpc_ai_cmdtest; - s->cancel = labpc_cancel; + s->subdev_flags |= SDF_CMD_READ; + s->do_cmd = labpc_ai_cmd; + s->do_cmdtest = labpc_ai_cmdtest; + s->cancel = labpc_cancel; } /* analog output */ s = &dev->subdevices[1]; if (board->has_ao) { - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_GROUND; - s->n_chan = 2; - s->maxdata = 0x0fff; - s->range_table = &range_labpc_ao; - s->insn_write = labpc_ao_insn_write; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_GROUND; + s->n_chan = 2; + s->maxdata = 0x0fff; + s->range_table = &range_labpc_ao; + s->insn_write = labpc_ao_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) @@ -1282,7 +1270,7 @@ int labpc_common_attach(struct comedi_device *dev, for (i = 0; i < s->n_chan; i++) labpc_ao_write(dev, s, i, s->maxdata / 2); } else { - s->type = COMEDI_SUBD_UNUSED; + s->type = COMEDI_SUBD_UNUSED; } /* 8255 dio */ @@ -1297,11 +1285,11 @@ int labpc_common_attach(struct comedi_device *dev, /* calibration subdevices for boards that have one */ s = &dev->subdevices[3]; if (board->is_labpc1200) { - s->type = COMEDI_SUBD_CALIB; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_INTERNAL; - s->n_chan = 16; - s->maxdata = 0xff; - s->insn_write = labpc_calib_insn_write; + s->type = COMEDI_SUBD_CALIB; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_INTERNAL; + s->n_chan = 16; + s->maxdata = 0xff; + s->insn_write = labpc_calib_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) @@ -1312,17 +1300,17 @@ int labpc_common_attach(struct comedi_device *dev, s->readback[i] = s->maxdata / 2; } } else { - s->type = COMEDI_SUBD_UNUSED; + s->type = COMEDI_SUBD_UNUSED; } /* EEPROM (256 bytes) */ s = &dev->subdevices[4]; if (board->is_labpc1200) { - s->type = COMEDI_SUBD_MEMORY; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_INTERNAL; - s->n_chan = 256; - s->maxdata = 0xff; - s->insn_write = labpc_eeprom_insn_write; + s->type = COMEDI_SUBD_MEMORY; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_INTERNAL; + s->n_chan = 256; + s->maxdata = 0xff; + s->insn_write = labpc_eeprom_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) @@ -1331,11 +1319,12 @@ int labpc_common_attach(struct comedi_device *dev, for (i = 0; i < s->n_chan; i++) s->readback[i] = labpc_eeprom_read(dev, i); } else { - s->type = COMEDI_SUBD_UNUSED; + s->type = COMEDI_SUBD_UNUSED; } return 0; } + EXPORT_SYMBOL_GPL(labpc_common_attach); void labpc_common_detach(struct comedi_device *dev) @@ -1345,17 +1334,20 @@ void labpc_common_detach(struct comedi_device *dev) if (devpriv) kfree(devpriv->counter); } + EXPORT_SYMBOL_GPL(labpc_common_detach); static int __init labpc_common_init(void) { return 0; } + module_init(labpc_common_init); static void __exit labpc_common_exit(void) { } + module_exit(labpc_common_exit); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/ni_labpc_cs.c b/drivers/comedi/drivers/ni_labpc_cs.c index 4f7e2fe21254..4b84fe2e618b 100644 --- a/drivers/comedi/drivers/ni_labpc_cs.c +++ b/drivers/comedi/drivers/ni_labpc_cs.c @@ -45,11 +45,11 @@ static const struct labpc_boardinfo labpc_cs_boards[] = { { - .name = "daqcard-1200", - .ai_speed = 10000, - .has_ao = 1, - .is_labpc1200 = 1, - }, + .name = "daqcard-1200", + .ai_speed = 10000, + .has_ao = 1, + .is_labpc1200 = 1, + }, }; static int labpc_cs_auto_attach(struct comedi_device *dev, @@ -62,7 +62,7 @@ static int labpc_cs_auto_attach(struct comedi_device *dev, dev->board_ptr = &labpc_cs_boards[0]; link->config_flags |= CONF_AUTO_SET_IO | - CONF_ENABLE_IRQ | CONF_ENABLE_PULSE_IRQ; + CONF_ENABLE_IRQ | CONF_ENABLE_PULSE_IRQ; ret = comedi_pcmcia_enable(dev, NULL); if (ret) return ret; @@ -81,10 +81,10 @@ static void labpc_cs_detach(struct comedi_device *dev) } static struct comedi_driver driver_labpc_cs = { - .driver_name = "ni_labpc_cs", - .module = THIS_MODULE, - .auto_attach = labpc_cs_auto_attach, - .detach = labpc_cs_detach, + .driver_name = "ni_labpc_cs", + .module = THIS_MODULE, + .auto_attach = labpc_cs_auto_attach, + .detach = labpc_cs_detach, }; static int labpc_cs_attach(struct pcmcia_device *link) @@ -96,15 +96,17 @@ static const struct pcmcia_device_id labpc_cs_ids[] = { PCMCIA_DEVICE_MANF_CARD(0x010b, 0x0103), /* daqcard-1200 */ PCMCIA_DEVICE_NULL }; + MODULE_DEVICE_TABLE(pcmcia, labpc_cs_ids); static struct pcmcia_driver labpc_cs_driver = { - .name = "daqcard-1200", - .owner = THIS_MODULE, - .id_table = labpc_cs_ids, - .probe = labpc_cs_attach, - .remove = comedi_pcmcia_auto_unconfig, + .name = "daqcard-1200", + .owner = THIS_MODULE, + .id_table = labpc_cs_ids, + .probe = labpc_cs_attach, + .remove = comedi_pcmcia_auto_unconfig, }; + module_comedi_pcmcia_driver(driver_labpc_cs, labpc_cs_driver); MODULE_DESCRIPTION("Comedi driver for National Instruments Lab-PC"); diff --git a/drivers/comedi/drivers/ni_labpc_isadma.c b/drivers/comedi/drivers/ni_labpc_isadma.c index a551aca6e615..a14a11db10bf 100644 --- a/drivers/comedi/drivers/ni_labpc_isadma.c +++ b/drivers/comedi/drivers/ni_labpc_isadma.c @@ -67,6 +67,7 @@ void labpc_setup_dma(struct comedi_device *dev, struct comedi_subdevice *s) /* set CMD3 bits for caller to enable DMA and interrupt */ devpriv->cmd3 |= (CMD3_DMAEN | CMD3_DMATCINTEN); } + EXPORT_SYMBOL_GPL(labpc_setup_dma); void labpc_drain_dma(struct comedi_device *dev) @@ -110,6 +111,7 @@ void labpc_drain_dma(struct comedi_device *dev) comedi_buf_write_samples(s, desc->virt_addr, nsamples); } + EXPORT_SYMBOL_GPL(labpc_drain_dma); static void handle_isa_dma(struct comedi_device *dev) @@ -139,6 +141,7 @@ void labpc_handle_dma_status(struct comedi_device *dev) (board->is_labpc1200 && devpriv->stat2 & STAT2_OUTA1)) handle_isa_dma(dev); } + EXPORT_SYMBOL_GPL(labpc_handle_dma_status); void labpc_init_dma_chan(struct comedi_device *dev, unsigned int dma_chan) @@ -154,6 +157,7 @@ void labpc_init_dma_chan(struct comedi_device *dev, unsigned int dma_chan) LABPC_ISADMA_BUFFER_SIZE, COMEDI_ISADMA_READ); } + EXPORT_SYMBOL_GPL(labpc_init_dma_chan); void labpc_free_dma_chan(struct comedi_device *dev) @@ -163,17 +167,20 @@ void labpc_free_dma_chan(struct comedi_device *dev) if (devpriv) comedi_isadma_free(devpriv->dma); } + EXPORT_SYMBOL_GPL(labpc_free_dma_chan); static int __init ni_labpc_isadma_init_module(void) { return 0; } + module_init(ni_labpc_isadma_init_module); static void __exit ni_labpc_isadma_cleanup_module(void) { } + module_exit(ni_labpc_isadma_cleanup_module); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/ni_labpc_pci.c b/drivers/comedi/drivers/ni_labpc_pci.c index ec180b0fedf7..a7b3c108e238 100644 --- a/drivers/comedi/drivers/ni_labpc_pci.c +++ b/drivers/comedi/drivers/ni_labpc_pci.c @@ -33,12 +33,12 @@ enum labpc_pci_boardid { static const struct labpc_boardinfo labpc_pci_boards[] = { [BOARD_NI_PCI1200] = { - .name = "ni_pci-1200", - .ai_speed = 10000, - .ai_scan_up = 1, - .has_ao = 1, - .is_labpc1200 = 1, - }, + .name = "ni_pci-1200", + .ai_speed = 10000, + .ai_scan_up = 1, + .has_ao = 1, + .is_labpc1200 = 1, + }, }; /* ripped from mite.h and mite_setup2() to avoid mite dependency */ @@ -100,31 +100,32 @@ static void labpc_pci_detach(struct comedi_device *dev) } static struct comedi_driver labpc_pci_comedi_driver = { - .driver_name = "labpc_pci", - .module = THIS_MODULE, - .auto_attach = labpc_pci_auto_attach, - .detach = labpc_pci_detach, + .driver_name = "labpc_pci", + .module = THIS_MODULE, + .auto_attach = labpc_pci_auto_attach, + .detach = labpc_pci_detach, }; static const struct pci_device_id labpc_pci_table[] = { { PCI_VDEVICE(NI, 0x161), BOARD_NI_PCI1200 }, { 0 } }; + MODULE_DEVICE_TABLE(pci, labpc_pci_table); -static int labpc_pci_probe(struct pci_dev *dev, - const struct pci_device_id *id) +static int labpc_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) { return comedi_pci_auto_config(dev, &labpc_pci_comedi_driver, id->driver_data); } static struct pci_driver labpc_pci_driver = { - .name = "labpc_pci", - .id_table = labpc_pci_table, - .probe = labpc_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "labpc_pci", + .id_table = labpc_pci_table, + .probe = labpc_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(labpc_pci_comedi_driver, labpc_pci_driver); MODULE_DESCRIPTION("Comedi: National Instruments Lab-PC PCI-1200 driver"); diff --git a/drivers/comedi/drivers/ni_labpc_regs.h b/drivers/comedi/drivers/ni_labpc_regs.h index ace40065a25b..6b1b06840b45 100644 --- a/drivers/comedi/drivers/ni_labpc_regs.h +++ b/drivers/comedi/drivers/ni_labpc_regs.h @@ -37,8 +37,8 @@ #define CMD3_ERRINTEN BIT(4) #define CMD3_FIFOINTEN BIT(5) #define ADC_START_CONVERT_REG 0x03 /* W: Start Convert reg */ -#define DAC_LSB_REG(x) (0x04 + 2 * (x)) /* W: DAC0/1 LSB reg */ -#define DAC_MSB_REG(x) (0x05 + 2 * (x)) /* W: DAC0/1 MSB reg */ +#define DAC_LSB_REG(x) (0x04 + 2 * (x)) /* W: DAC0/1 LSB reg */ +#define DAC_MSB_REG(x) (0x05 + 2 * (x)) /* W: DAC0/1 MSB reg */ #define ADC_FIFO_CLEAR_REG 0x08 /* W: A/D FIFO Clear reg */ #define ADC_FIFO_REG 0x0a /* R: A/D FIFO reg */ #define DMATC_CLEAR_REG 0x0a /* W: DMA Interrupt Clear reg */ diff --git a/drivers/comedi/drivers/ni_mio_common.c b/drivers/comedi/drivers/ni_mio_common.c index 4f80a4991f95..3f6685c14c5f 100644 --- a/drivers/comedi/drivers/ni_mio_common.c +++ b/drivers/comedi/drivers/ni_mio_common.c @@ -51,122 +51,123 @@ /* Note: this table must match the ai_gain_* definitions */ static const short ni_gainlkup[][16] = { - [ai_gain_16] = {0, 1, 2, 3, 4, 5, 6, 7, - 0x100, 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107}, - [ai_gain_8] = {1, 2, 4, 7, 0x101, 0x102, 0x104, 0x107}, - [ai_gain_14] = {1, 2, 3, 4, 5, 6, 7, - 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107}, - [ai_gain_4] = {0, 1, 4, 7}, - [ai_gain_611x] = {0x00a, 0x00b, 0x001, 0x002, - 0x003, 0x004, 0x005, 0x006}, - [ai_gain_622x] = {0, 1, 4, 5}, - [ai_gain_628x] = {1, 2, 3, 4, 5, 6, 7}, - [ai_gain_6143] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + [ai_gain_16] = { 0, 1, 2, 3, 4, 5, 6, 7, + 0x100, 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, + 0x107 }, + [ai_gain_8] = { 1, 2, 4, 7, 0x101, 0x102, 0x104, 0x107 }, + [ai_gain_14] = { 1, 2, 3, 4, 5, 6, 7, + 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107 }, + [ai_gain_4] = { 0, 1, 4, 7 }, + [ai_gain_611x] = { 0x00a, 0x00b, 0x001, 0x002, + 0x003, 0x004, 0x005, 0x006 }, + [ai_gain_622x] = { 0, 1, 4, 5 }, + [ai_gain_628x] = { 1, 2, 3, 4, 5, 6, 7 }, + [ai_gain_6143] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, }; static const struct comedi_lrange range_ni_E_ai = { 16, { - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(2.5), - BIP_RANGE(1), - BIP_RANGE(0.5), - BIP_RANGE(0.25), - BIP_RANGE(0.1), - BIP_RANGE(0.05), - UNI_RANGE(20), - UNI_RANGE(10), - UNI_RANGE(5), - UNI_RANGE(2), - UNI_RANGE(1), - UNI_RANGE(0.5), - UNI_RANGE(0.2), - UNI_RANGE(0.1) - } + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(2.5), + BIP_RANGE(1), + BIP_RANGE(0.5), + BIP_RANGE(0.25), + BIP_RANGE(0.1), + BIP_RANGE(0.05), + UNI_RANGE(20), + UNI_RANGE(10), + UNI_RANGE(5), + UNI_RANGE(2), + UNI_RANGE(1), + UNI_RANGE(0.5), + UNI_RANGE(0.2), + UNI_RANGE(0.1) + } }; static const struct comedi_lrange range_ni_E_ai_limited = { 8, { - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(1), - BIP_RANGE(0.1), - UNI_RANGE(10), - UNI_RANGE(5), - UNI_RANGE(1), - UNI_RANGE(0.1) - } + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(1), + BIP_RANGE(0.1), + UNI_RANGE(10), + UNI_RANGE(5), + UNI_RANGE(1), + UNI_RANGE(0.1) + } }; static const struct comedi_lrange range_ni_E_ai_limited14 = { 14, { - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(2), - BIP_RANGE(1), - BIP_RANGE(0.5), - BIP_RANGE(0.2), - BIP_RANGE(0.1), - UNI_RANGE(10), - UNI_RANGE(5), - UNI_RANGE(2), - UNI_RANGE(1), - UNI_RANGE(0.5), - UNI_RANGE(0.2), - UNI_RANGE(0.1) - } + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(2), + BIP_RANGE(1), + BIP_RANGE(0.5), + BIP_RANGE(0.2), + BIP_RANGE(0.1), + UNI_RANGE(10), + UNI_RANGE(5), + UNI_RANGE(2), + UNI_RANGE(1), + UNI_RANGE(0.5), + UNI_RANGE(0.2), + UNI_RANGE(0.1) + } }; static const struct comedi_lrange range_ni_E_ai_bipolar4 = { 4, { - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(0.5), - BIP_RANGE(0.05) - } + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(0.5), + BIP_RANGE(0.05) + } }; static const struct comedi_lrange range_ni_E_ai_611x = { 8, { - BIP_RANGE(50), - BIP_RANGE(20), - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(2), - BIP_RANGE(1), - BIP_RANGE(0.5), - BIP_RANGE(0.2) - } + BIP_RANGE(50), + BIP_RANGE(20), + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(2), + BIP_RANGE(1), + BIP_RANGE(0.5), + BIP_RANGE(0.2) + } }; static const struct comedi_lrange range_ni_M_ai_622x = { 4, { - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(1), - BIP_RANGE(0.2) - } + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(1), + BIP_RANGE(0.2) + } }; static const struct comedi_lrange range_ni_M_ai_628x = { 7, { - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(2), - BIP_RANGE(1), - BIP_RANGE(0.5), - BIP_RANGE(0.2), - BIP_RANGE(0.1) - } + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(2), + BIP_RANGE(1), + BIP_RANGE(0.5), + BIP_RANGE(0.2), + BIP_RANGE(0.1) + } }; static const struct comedi_lrange range_ni_E_ao_ext = { 4, { - BIP_RANGE(10), - UNI_RANGE(10), - RANGE_ext(-1, 1), - RANGE_ext(0, 1) - } + BIP_RANGE(10), + UNI_RANGE(10), + RANGE_ext(-1, 1), + RANGE_ext(0, 1) + } }; static const struct comedi_lrange *const ni_range_lkup[] = { @@ -290,74 +291,74 @@ struct mio_regmap { }; static const struct mio_regmap m_series_stc_write_regmap[] = { - [NISTC_INTA_ACK_REG] = { 0x104, 2 }, - [NISTC_INTB_ACK_REG] = { 0x106, 2 }, - [NISTC_AI_CMD2_REG] = { 0x108, 2 }, - [NISTC_AO_CMD2_REG] = { 0x10a, 2 }, - [NISTC_G0_CMD_REG] = { 0x10c, 2 }, - [NISTC_G1_CMD_REG] = { 0x10e, 2 }, - [NISTC_AI_CMD1_REG] = { 0x110, 2 }, - [NISTC_AO_CMD1_REG] = { 0x112, 2 }, + [NISTC_INTA_ACK_REG] = { 0x104, 2 }, + [NISTC_INTB_ACK_REG] = { 0x106, 2 }, + [NISTC_AI_CMD2_REG] = { 0x108, 2 }, + [NISTC_AO_CMD2_REG] = { 0x10a, 2 }, + [NISTC_G0_CMD_REG] = { 0x10c, 2 }, + [NISTC_G1_CMD_REG] = { 0x10e, 2 }, + [NISTC_AI_CMD1_REG] = { 0x110, 2 }, + [NISTC_AO_CMD1_REG] = { 0x112, 2 }, /* * NISTC_DIO_OUT_REG maps to: * { NI_M_DIO_REG, 4 } and { NI_M_SCXI_SER_DO_REG, 1 } */ - [NISTC_DIO_OUT_REG] = { 0, 0 }, /* DOES NOT MAP CLEANLY */ - [NISTC_DIO_CTRL_REG] = { 0, 0 }, /* DOES NOT MAP CLEANLY */ - [NISTC_AI_MODE1_REG] = { 0x118, 2 }, - [NISTC_AI_MODE2_REG] = { 0x11a, 2 }, - [NISTC_AI_SI_LOADA_REG] = { 0x11c, 4 }, - [NISTC_AI_SI_LOADB_REG] = { 0x120, 4 }, - [NISTC_AI_SC_LOADA_REG] = { 0x124, 4 }, - [NISTC_AI_SC_LOADB_REG] = { 0x128, 4 }, - [NISTC_AI_SI2_LOADA_REG] = { 0x12c, 4 }, - [NISTC_AI_SI2_LOADB_REG] = { 0x130, 4 }, - [NISTC_G0_MODE_REG] = { 0x134, 2 }, - [NISTC_G1_MODE_REG] = { 0x136, 2 }, - [NISTC_G0_LOADA_REG] = { 0x138, 4 }, - [NISTC_G0_LOADB_REG] = { 0x13c, 4 }, - [NISTC_G1_LOADA_REG] = { 0x140, 4 }, - [NISTC_G1_LOADB_REG] = { 0x144, 4 }, - [NISTC_G0_INPUT_SEL_REG] = { 0x148, 2 }, - [NISTC_G1_INPUT_SEL_REG] = { 0x14a, 2 }, - [NISTC_AO_MODE1_REG] = { 0x14c, 2 }, - [NISTC_AO_MODE2_REG] = { 0x14e, 2 }, - [NISTC_AO_UI_LOADA_REG] = { 0x150, 4 }, - [NISTC_AO_UI_LOADB_REG] = { 0x154, 4 }, - [NISTC_AO_BC_LOADA_REG] = { 0x158, 4 }, - [NISTC_AO_BC_LOADB_REG] = { 0x15c, 4 }, - [NISTC_AO_UC_LOADA_REG] = { 0x160, 4 }, - [NISTC_AO_UC_LOADB_REG] = { 0x164, 4 }, - [NISTC_CLK_FOUT_REG] = { 0x170, 2 }, - [NISTC_IO_BIDIR_PIN_REG] = { 0x172, 2 }, - [NISTC_RTSI_TRIG_DIR_REG] = { 0x174, 2 }, - [NISTC_INT_CTRL_REG] = { 0x176, 2 }, - [NISTC_AI_OUT_CTRL_REG] = { 0x178, 2 }, - [NISTC_ATRIG_ETC_REG] = { 0x17a, 2 }, - [NISTC_AI_START_STOP_REG] = { 0x17c, 2 }, - [NISTC_AI_TRIG_SEL_REG] = { 0x17e, 2 }, - [NISTC_AI_DIV_LOADA_REG] = { 0x180, 4 }, - [NISTC_AO_START_SEL_REG] = { 0x184, 2 }, - [NISTC_AO_TRIG_SEL_REG] = { 0x186, 2 }, - [NISTC_G0_AUTOINC_REG] = { 0x188, 2 }, - [NISTC_G1_AUTOINC_REG] = { 0x18a, 2 }, - [NISTC_AO_MODE3_REG] = { 0x18c, 2 }, - [NISTC_RESET_REG] = { 0x190, 2 }, - [NISTC_INTA_ENA_REG] = { 0x192, 2 }, - [NISTC_INTA2_ENA_REG] = { 0, 0 }, /* E-Series only */ - [NISTC_INTB_ENA_REG] = { 0x196, 2 }, - [NISTC_INTB2_ENA_REG] = { 0, 0 }, /* E-Series only */ - [NISTC_AI_PERSONAL_REG] = { 0x19a, 2 }, - [NISTC_AO_PERSONAL_REG] = { 0x19c, 2 }, - [NISTC_RTSI_TRIGA_OUT_REG] = { 0x19e, 2 }, - [NISTC_RTSI_TRIGB_OUT_REG] = { 0x1a0, 2 }, + [NISTC_DIO_OUT_REG] = { 0, 0 }, /* DOES NOT MAP CLEANLY */ + [NISTC_DIO_CTRL_REG] = { 0, 0 }, /* DOES NOT MAP CLEANLY */ + [NISTC_AI_MODE1_REG] = { 0x118, 2 }, + [NISTC_AI_MODE2_REG] = { 0x11a, 2 }, + [NISTC_AI_SI_LOADA_REG] = { 0x11c, 4 }, + [NISTC_AI_SI_LOADB_REG] = { 0x120, 4 }, + [NISTC_AI_SC_LOADA_REG] = { 0x124, 4 }, + [NISTC_AI_SC_LOADB_REG] = { 0x128, 4 }, + [NISTC_AI_SI2_LOADA_REG] = { 0x12c, 4 }, + [NISTC_AI_SI2_LOADB_REG] = { 0x130, 4 }, + [NISTC_G0_MODE_REG] = { 0x134, 2 }, + [NISTC_G1_MODE_REG] = { 0x136, 2 }, + [NISTC_G0_LOADA_REG] = { 0x138, 4 }, + [NISTC_G0_LOADB_REG] = { 0x13c, 4 }, + [NISTC_G1_LOADA_REG] = { 0x140, 4 }, + [NISTC_G1_LOADB_REG] = { 0x144, 4 }, + [NISTC_G0_INPUT_SEL_REG] = { 0x148, 2 }, + [NISTC_G1_INPUT_SEL_REG] = { 0x14a, 2 }, + [NISTC_AO_MODE1_REG] = { 0x14c, 2 }, + [NISTC_AO_MODE2_REG] = { 0x14e, 2 }, + [NISTC_AO_UI_LOADA_REG] = { 0x150, 4 }, + [NISTC_AO_UI_LOADB_REG] = { 0x154, 4 }, + [NISTC_AO_BC_LOADA_REG] = { 0x158, 4 }, + [NISTC_AO_BC_LOADB_REG] = { 0x15c, 4 }, + [NISTC_AO_UC_LOADA_REG] = { 0x160, 4 }, + [NISTC_AO_UC_LOADB_REG] = { 0x164, 4 }, + [NISTC_CLK_FOUT_REG] = { 0x170, 2 }, + [NISTC_IO_BIDIR_PIN_REG] = { 0x172, 2 }, + [NISTC_RTSI_TRIG_DIR_REG] = { 0x174, 2 }, + [NISTC_INT_CTRL_REG] = { 0x176, 2 }, + [NISTC_AI_OUT_CTRL_REG] = { 0x178, 2 }, + [NISTC_ATRIG_ETC_REG] = { 0x17a, 2 }, + [NISTC_AI_START_STOP_REG] = { 0x17c, 2 }, + [NISTC_AI_TRIG_SEL_REG] = { 0x17e, 2 }, + [NISTC_AI_DIV_LOADA_REG] = { 0x180, 4 }, + [NISTC_AO_START_SEL_REG] = { 0x184, 2 }, + [NISTC_AO_TRIG_SEL_REG] = { 0x186, 2 }, + [NISTC_G0_AUTOINC_REG] = { 0x188, 2 }, + [NISTC_G1_AUTOINC_REG] = { 0x18a, 2 }, + [NISTC_AO_MODE3_REG] = { 0x18c, 2 }, + [NISTC_RESET_REG] = { 0x190, 2 }, + [NISTC_INTA_ENA_REG] = { 0x192, 2 }, + [NISTC_INTA2_ENA_REG] = { 0, 0 }, /* E-Series only */ + [NISTC_INTB_ENA_REG] = { 0x196, 2 }, + [NISTC_INTB2_ENA_REG] = { 0, 0 }, /* E-Series only */ + [NISTC_AI_PERSONAL_REG] = { 0x19a, 2 }, + [NISTC_AO_PERSONAL_REG] = { 0x19c, 2 }, + [NISTC_RTSI_TRIGA_OUT_REG] = { 0x19e, 2 }, + [NISTC_RTSI_TRIGB_OUT_REG] = { 0x1a0, 2 }, /* doc for following line: mhddk/nimseries/ChipObjects/tMSeries.h */ - [NISTC_RTSI_BOARD_REG] = { 0x1a2, 2 }, - [NISTC_CFG_MEM_CLR_REG] = { 0x1a4, 2 }, - [NISTC_ADC_FIFO_CLR_REG] = { 0x1a6, 2 }, - [NISTC_DAC_FIFO_CLR_REG] = { 0x1a8, 2 }, - [NISTC_AO_OUT_CTRL_REG] = { 0x1ac, 2 }, - [NISTC_AI_MODE3_REG] = { 0x1ae, 2 }, + [NISTC_RTSI_BOARD_REG] = { 0x1a2, 2 }, + [NISTC_CFG_MEM_CLR_REG] = { 0x1a4, 2 }, + [NISTC_ADC_FIFO_CLR_REG] = { 0x1a6, 2 }, + [NISTC_DAC_FIFO_CLR_REG] = { 0x1a8, 2 }, + [NISTC_AO_OUT_CTRL_REG] = { 0x1ac, 2 }, + [NISTC_AI_MODE3_REG] = { 0x1ae, 2 }, }; static void m_series_stc_write(struct comedi_device *dev, @@ -388,24 +389,24 @@ static void m_series_stc_write(struct comedi_device *dev, } static const struct mio_regmap m_series_stc_read_regmap[] = { - [NISTC_AI_STATUS1_REG] = { 0x104, 2 }, - [NISTC_AO_STATUS1_REG] = { 0x106, 2 }, - [NISTC_G01_STATUS_REG] = { 0x108, 2 }, - [NISTC_AI_STATUS2_REG] = { 0, 0 }, /* Unknown */ - [NISTC_AO_STATUS2_REG] = { 0x10c, 2 }, - [NISTC_DIO_IN_REG] = { 0, 0 }, /* Unknown */ - [NISTC_G0_HW_SAVE_REG] = { 0x110, 4 }, - [NISTC_G1_HW_SAVE_REG] = { 0x114, 4 }, - [NISTC_G0_SAVE_REG] = { 0x118, 4 }, - [NISTC_G1_SAVE_REG] = { 0x11c, 4 }, - [NISTC_AO_UI_SAVE_REG] = { 0x120, 4 }, - [NISTC_AO_BC_SAVE_REG] = { 0x124, 4 }, - [NISTC_AO_UC_SAVE_REG] = { 0x128, 4 }, - [NISTC_STATUS1_REG] = { 0x136, 2 }, - [NISTC_DIO_SERIAL_IN_REG] = { 0x009, 1 }, - [NISTC_STATUS2_REG] = { 0x13a, 2 }, - [NISTC_AI_SI_SAVE_REG] = { 0x180, 4 }, - [NISTC_AI_SC_SAVE_REG] = { 0x184, 4 }, + [NISTC_AI_STATUS1_REG] = { 0x104, 2 }, + [NISTC_AO_STATUS1_REG] = { 0x106, 2 }, + [NISTC_G01_STATUS_REG] = { 0x108, 2 }, + [NISTC_AI_STATUS2_REG] = { 0, 0 }, /* Unknown */ + [NISTC_AO_STATUS2_REG] = { 0x10c, 2 }, + [NISTC_DIO_IN_REG] = { 0, 0 }, /* Unknown */ + [NISTC_G0_HW_SAVE_REG] = { 0x110, 4 }, + [NISTC_G1_HW_SAVE_REG] = { 0x114, 4 }, + [NISTC_G0_SAVE_REG] = { 0x118, 4 }, + [NISTC_G1_SAVE_REG] = { 0x11c, 4 }, + [NISTC_AO_UI_SAVE_REG] = { 0x120, 4 }, + [NISTC_AO_BC_SAVE_REG] = { 0x124, 4 }, + [NISTC_AO_UC_SAVE_REG] = { 0x128, 4 }, + [NISTC_STATUS1_REG] = { 0x136, 2 }, + [NISTC_DIO_SERIAL_IN_REG] = { 0x009, 1 }, + [NISTC_STATUS2_REG] = { 0x13a, 2 }, + [NISTC_AI_SI_SAVE_REG] = { 0x180, 4 }, + [NISTC_AI_SC_SAVE_REG] = { 0x184, 4 }, }; static unsigned int m_series_stc_read(struct comedi_device *dev, @@ -435,8 +436,7 @@ static unsigned int m_series_stc_read(struct comedi_device *dev, } } -static void ni_stc_writew(struct comedi_device *dev, - unsigned int data, int reg) +static void ni_stc_writew(struct comedi_device *dev, unsigned int data, int reg) { struct ni_private *devpriv = dev->private; unsigned long flags; @@ -455,8 +455,7 @@ static void ni_stc_writew(struct comedi_device *dev, } } -static void ni_stc_writel(struct comedi_device *dev, - unsigned int data, int reg) +static void ni_stc_writel(struct comedi_device *dev, unsigned int data, int reg) { struct ni_private *devpriv = dev->private; @@ -723,8 +722,8 @@ static void ni_release_gpct_mite_channel(struct comedi_device *dev, ni_set_bitfield(dev, NI_E_DMA_G0_G1_SEL_REG, NI_E_DMA_G0_G1_SEL_MASK(gpct_index), 0); - ni_tio_set_mite_channel(&devpriv->counter_dev->counters[gpct_index], - NULL); + ni_tio_set_mite_channel(&devpriv->counter_dev-> + counters[gpct_index], NULL); mite_release_channel(mite_chan); } spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags); @@ -1152,12 +1151,12 @@ static void ni_handle_fifo_dregs(struct comedi_device *dev) unsigned short fe; /* fifo empty */ fe = ni_stc_readw(dev, NISTC_AI_STATUS1_REG) & - NISTC_AI_STATUS1_FIFO_E; + NISTC_AI_STATUS1_FIFO_E; while (fe == 0) { for (i = 0; i < ARRAY_SIZE(devpriv->ai_fifo_buffer); i++) { fe = ni_stc_readw(dev, NISTC_AI_STATUS1_REG) & - NISTC_AI_STATUS1_FIFO_E; + NISTC_AI_STATUS1_FIFO_E; if (fe) break; devpriv->ai_fifo_buffer[i] = @@ -1521,22 +1520,19 @@ static int ni_ai_reset(struct comedi_device *dev, struct comedi_subdevice *s) ni_writeb(dev, NI_E_MISC_CMD_EXT_ATRIG, NI_E_MISC_CMD_REG); ni_stc_writew(dev, NISTC_AI_CMD1_DISARM, NISTC_AI_CMD1_REG); - ni_stc_writew(dev, NISTC_AI_MODE1_START_STOP | - NISTC_AI_MODE1_RSVD - /*| NISTC_AI_MODE1_TRIGGER_ONCE */, + ni_stc_writew(dev, NISTC_AI_MODE1_START_STOP | NISTC_AI_MODE1_RSVD + /*| NISTC_AI_MODE1_TRIGGER_ONCE */, NISTC_AI_MODE1_REG); ni_stc_writew(dev, 0, NISTC_AI_MODE2_REG); /* generate FIFO interrupts on non-empty */ - ni_stc_writew(dev, NISTC_AI_MODE3_FIFO_MODE_NE, - NISTC_AI_MODE3_REG); + ni_stc_writew(dev, NISTC_AI_MODE3_FIFO_MODE_NE, NISTC_AI_MODE3_REG); ai_personal = NISTC_AI_PERSONAL_SHIFTIN_PW | - NISTC_AI_PERSONAL_SOC_POLARITY | - NISTC_AI_PERSONAL_LOCALMUX_CLK_PW; + NISTC_AI_PERSONAL_SOC_POLARITY | NISTC_AI_PERSONAL_LOCALMUX_CLK_PW; ai_out_ctrl = NISTC_AI_OUT_CTRL_SCAN_IN_PROG_SEL(3) | - NISTC_AI_OUT_CTRL_EXTMUX_CLK_SEL(0) | - NISTC_AI_OUT_CTRL_LOCALMUX_CLK_SEL(2) | - NISTC_AI_OUT_CTRL_SC_TC_SEL(3); + NISTC_AI_OUT_CTRL_EXTMUX_CLK_SEL(0) | + NISTC_AI_OUT_CTRL_LOCALMUX_CLK_SEL(2) | + NISTC_AI_OUT_CTRL_SC_TC_SEL(3); if (devpriv->is_611x) { ai_out_ctrl |= NISTC_AI_OUT_CTRL_CONVERT_HIGH; } else if (devpriv->is_6143) { @@ -1623,9 +1619,9 @@ static void ni_m_series_load_channelgain_list(struct comedi_device *dev, range_code = ni_gainlkup[board->gainlkup][range]; dither = (list[0] & CR_ALT_FILTER) != 0; bypass_bits = NI_M_CFG_BYPASS_FIFO | - NI_M_CFG_BYPASS_AI_CHAN(chan) | - NI_M_CFG_BYPASS_AI_GAIN(range_code) | - devpriv->ai_calib_source; + NI_M_CFG_BYPASS_AI_CHAN(chan) | + NI_M_CFG_BYPASS_AI_GAIN(range_code) | + devpriv->ai_calib_source; if (dither) bypass_bits |= NI_M_CFG_BYPASS_AI_DITHER; /* don't use 2's complement encoding */ @@ -1736,7 +1732,7 @@ static void ni_load_channelgain_list(struct comedi_device *dev, !devpriv->ai_calib_source_enabled) { /* Strobe Relay enable bit */ ni_writew(dev, devpriv->ai_calib_source | - NI6143_CALIB_CHAN_RELAY_ON, + NI6143_CALIB_CHAN_RELAY_ON, NI6143_CALIB_CHAN_REG); ni_writew(dev, devpriv->ai_calib_source, NI6143_CALIB_CHAN_REG); @@ -1747,7 +1743,7 @@ static void ni_load_channelgain_list(struct comedi_device *dev, devpriv->ai_calib_source_enabled) { /* Strobe Relay disable bit */ ni_writew(dev, devpriv->ai_calib_source | - NI6143_CALIB_CHAN_RELAY_OFF, + NI6143_CALIB_CHAN_RELAY_OFF, NI6143_CALIB_CHAN_REG); ni_writew(dev, devpriv->ai_calib_source, NI6143_CALIB_CHAN_REG); @@ -1820,8 +1816,7 @@ static void ni_load_channelgain_list(struct comedi_device *dev, static int ni_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct ni_private *devpriv = dev->private; unsigned int mask = s->maxdata; @@ -2053,10 +2048,11 @@ static int ni_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, if (cmd->scan_begin_src == TRIG_TIMER) { err |= comedi_check_trigger_arg_min(&cmd->scan_begin_arg, - ni_min_ai_scan_period_ns(dev, cmd->chanlist_len)); - err |= comedi_check_trigger_arg_max(&cmd->scan_begin_arg, - devpriv->clock_ns * - 0xffffff); + ni_min_ai_scan_period_ns + (dev, cmd->chanlist_len)); + err |= + comedi_check_trigger_arg_max(&cmd->scan_begin_arg, + devpriv->clock_ns * 0xffffff); } else if (cmd->scan_begin_src == TRIG_EXT) { /* external trigger */ err |= ni_check_trigger_arg_roffs(CR_CHAN(cmd->scan_begin_arg), @@ -2143,8 +2139,7 @@ static int ni_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, } static int ni_ai_inttrig(struct comedi_device *dev, - struct comedi_subdevice *s, - unsigned int trig_num) + struct comedi_subdevice *s, unsigned int trig_num) { struct ni_private *devpriv = dev->private; struct comedi_cmd *cmd = &s->async->cmd; @@ -2194,14 +2189,14 @@ static int ni_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) case TRIG_INT: case TRIG_NOW: ai_trig |= NISTC_AI_TRIG_START1_EDGE | - NISTC_AI_TRIG_START1_SEL(0); + NISTC_AI_TRIG_START1_SEL(0); break; case TRIG_EXT: - ai_trig |= NISTC_AI_TRIG_START1_SEL( - ni_get_reg_value_roffs( - CR_CHAN(cmd->start_arg), - NI_AI_StartTrigger, - &devpriv->routing_tables, 1)); + ai_trig |= + NISTC_AI_TRIG_START1_SEL(ni_get_reg_value_roffs + (CR_CHAN(cmd->start_arg), + NI_AI_StartTrigger, + &devpriv->routing_tables, 1)); if (cmd->start_arg & CR_INVERT) ai_trig |= NISTC_AI_TRIG_START1_POLARITY; @@ -2219,8 +2214,7 @@ static int ni_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) if (cmd->chanlist_len == 1 || devpriv->is_611x || devpriv->is_6143) { /* logic low */ start_stop_select |= NISTC_AI_STOP_POLARITY | - NISTC_AI_STOP_SEL(31) | - NISTC_AI_STOP_SYNC; + NISTC_AI_STOP_SEL(31) | NISTC_AI_STOP_SYNC; } else { /* ai configuration memory */ start_stop_select |= NISTC_AI_STOP_SEL(19); @@ -2240,8 +2234,7 @@ static int ni_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) ni_stc_writel(dev, stop_count, NISTC_AI_SC_LOADA_REG); mode1 |= NISTC_AI_MODE1_START_STOP | - NISTC_AI_MODE1_RSVD | - NISTC_AI_MODE1_TRIGGER_ONCE; + NISTC_AI_MODE1_RSVD | NISTC_AI_MODE1_TRIGGER_ONCE; ni_stc_writew(dev, mode1, NISTC_AI_MODE1_REG); /* load SC (Scan Count) */ ni_stc_writew(dev, NISTC_AI_CMD1_SC_LOAD, NISTC_AI_CMD1_REG); @@ -2255,7 +2248,7 @@ static int ni_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) */ if (cmd->chanlist_len > 1) start_stop_select |= NISTC_AI_STOP_POLARITY | - NISTC_AI_STOP_EDGE; + NISTC_AI_STOP_EDGE; } break; case TRIG_NONE: @@ -2263,8 +2256,7 @@ static int ni_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) ni_stc_writel(dev, 0, NISTC_AI_SC_LOADA_REG); mode1 |= NISTC_AI_MODE1_START_STOP | - NISTC_AI_MODE1_RSVD | - NISTC_AI_MODE1_CONTINUOUS; + NISTC_AI_MODE1_RSVD | NISTC_AI_MODE1_CONTINUOUS; ni_stc_writew(dev, mode1, NISTC_AI_MODE1_REG); /* load SC (Scan Count) */ @@ -2279,14 +2271,14 @@ static int ni_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) * NISTC_AI_MODE3_SI_TRIG_DELAY=0 * NISTC_AI_MODE2_PRE_TRIGGER=0 * NISTC_AI_START_STOP_REG: - * NISTC_AI_START_POLARITY=0 (?) rising edge - * NISTC_AI_START_EDGE=1 edge triggered - * NISTC_AI_START_SYNC=1 (?) - * NISTC_AI_START_SEL=0 SI_TC - * NISTC_AI_STOP_POLARITY=0 rising edge - * NISTC_AI_STOP_EDGE=0 level + * NISTC_AI_START_POLARITY=0 (?) rising edge + * NISTC_AI_START_EDGE=1 edge triggered + * NISTC_AI_START_SYNC=1 (?) + * NISTC_AI_START_SEL=0 SI_TC + * NISTC_AI_STOP_POLARITY=0 rising edge + * NISTC_AI_STOP_EDGE=0 level * NISTC_AI_STOP_SYNC=1 - * NISTC_AI_STOP_SEL=19 external pin (configuration mem) + * NISTC_AI_STOP_SEL=19 external pin (configuration mem) */ start_stop_select |= NISTC_AI_START_EDGE | NISTC_AI_START_SYNC; ni_stc_writew(dev, start_stop_select, NISTC_AI_START_STOP_REG); @@ -2312,11 +2304,11 @@ static int ni_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) (cmd->convert_arg & ~CR_EDGE)) start_stop_select |= NISTC_AI_START_SYNC; - start_stop_select |= NISTC_AI_START_SEL( - ni_get_reg_value_roffs( - CR_CHAN(cmd->scan_begin_arg), - NI_AI_SampleClock, - &devpriv->routing_tables, 1)); + start_stop_select |= + NISTC_AI_START_SEL(ni_get_reg_value_roffs + (CR_CHAN(cmd->scan_begin_arg), + NI_AI_SampleClock, + &devpriv->routing_tables, 1)); ni_stc_writew(dev, start_stop_select, NISTC_AI_START_STOP_REG); break; } @@ -2344,9 +2336,9 @@ static int ni_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) ni_stc_writew(dev, mode2, NISTC_AI_MODE2_REG); break; case TRIG_EXT: - mode1 |= NISTC_AI_MODE1_CONVERT_SRC( - ni_get_reg_value_roffs( - CR_CHAN(cmd->convert_arg), + mode1 |= + NISTC_AI_MODE1_CONVERT_SRC(ni_get_reg_value_roffs + (CR_CHAN(cmd->convert_arg), NI_AI_ConvertClock, &devpriv->routing_tables, 1)); if ((cmd->convert_arg & CR_INVERT) == 0) @@ -2354,7 +2346,7 @@ static int ni_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) ni_stc_writew(dev, mode1, NISTC_AI_MODE1_REG); mode2 |= NISTC_AI_MODE2_SC_GATE_ENA | - NISTC_AI_MODE2_START_STOP_GATE_ENA; + NISTC_AI_MODE2_START_STOP_GATE_ENA; ni_stc_writew(dev, mode2, NISTC_AI_MODE2_REG); break; @@ -2363,7 +2355,7 @@ static int ni_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) if (dev->irq) { /* interrupt on FIFO, errors, SC_TC */ interrupt_a_enable |= NISTC_INTA_ENA_AI_ERR | - NISTC_INTA_ENA_AI_SC_TC; + NISTC_INTA_ENA_AI_SC_TC; #ifndef PCIDMA interrupt_a_enable |= NISTC_INTA_ENA_AI_FIFO; @@ -2424,17 +2416,14 @@ static int ni_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) switch (cmd->scan_begin_src) { case TRIG_TIMER: ni_stc_writew(dev, NISTC_AI_CMD1_SI2_ARM | - NISTC_AI_CMD1_SI_ARM | - NISTC_AI_CMD1_DIV_ARM | - NISTC_AI_CMD1_SC_ARM, - NISTC_AI_CMD1_REG); + NISTC_AI_CMD1_SI_ARM | + NISTC_AI_CMD1_DIV_ARM | + NISTC_AI_CMD1_SC_ARM, NISTC_AI_CMD1_REG); break; case TRIG_EXT: - ni_stc_writew(dev, NISTC_AI_CMD1_SI2_ARM | - NISTC_AI_CMD1_SI_ARM | /* XXX ? */ - NISTC_AI_CMD1_DIV_ARM | - NISTC_AI_CMD1_SC_ARM, - NISTC_AI_CMD1_REG); + ni_stc_writew(dev, NISTC_AI_CMD1_SI2_ARM | NISTC_AI_CMD1_SI_ARM | /* XXX ? */ + NISTC_AI_CMD1_DIV_ARM | + NISTC_AI_CMD1_SC_ARM, NISTC_AI_CMD1_REG); break; } @@ -2449,12 +2438,11 @@ static int ni_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) if (cmd->start_src == TRIG_NOW) { ni_stc_writew(dev, NISTC_AI_CMD2_START1_PULSE | - devpriv->ai_cmd2, - NISTC_AI_CMD2_REG); + devpriv->ai_cmd2, NISTC_AI_CMD2_REG); s->async->inttrig = NULL; } else if (cmd->start_src == TRIG_EXT) { s->async->inttrig = NULL; - } else { /* TRIG_INT */ + } else { /* TRIG_INT */ s->async->inttrig = ni_ai_inttrig; } @@ -2505,7 +2493,7 @@ static int ni_ai_insn_config(struct comedi_device *dev, /* data[3] : chanlist_len */ data[1] = ni_min_ai_scan_period_ns(dev, data[3]); if (devpriv->is_611x || devpriv->is_6143) - data[2] = 0; /* simultaneous output */ + data[2] = 0; /* simultaneous output */ else data[2] = board->ai_speed; return 0; @@ -2679,8 +2667,7 @@ static int ni_ao_config_chanlist(struct comedi_device *dev, static int ni_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct ni_private *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -2744,8 +2731,7 @@ static int ni_ao_insn_write(struct comedi_device *dev, * Note that this function _must_ happen after a user has written data to the * output buffers via either mmap or write(fileno,...). */ -static int ni_ao_arm(struct comedi_device *dev, - struct comedi_subdevice *s) +static int ni_ao_arm(struct comedi_device *dev, struct comedi_subdevice *s) { struct ni_private *devpriv = dev->private; int ret; @@ -2810,10 +2796,9 @@ static int ni_ao_arm(struct comedi_device *dev, ni_set_bits(dev, NISTC_INTB_ENA_REG, interrupt_b_bits, 1); ni_stc_writew(dev, NISTC_AO_CMD1_UI_ARM | - NISTC_AO_CMD1_UC_ARM | - NISTC_AO_CMD1_BC_ARM | - devpriv->ao_cmd1, - NISTC_AO_CMD1_REG); + NISTC_AO_CMD1_UC_ARM | + NISTC_AO_CMD1_BC_ARM | + devpriv->ao_cmd1, NISTC_AO_CMD1_REG); return 0; } @@ -2859,8 +2844,7 @@ static int ni_ao_insn_config(struct comedi_device *dev, } static int ni_ao_inttrig(struct comedi_device *dev, - struct comedi_subdevice *s, - unsigned int trig_num) + struct comedi_subdevice *s, unsigned int trig_num) { struct ni_private *devpriv = dev->private; struct comedi_cmd *cmd = &s->async->cmd; @@ -2911,25 +2895,24 @@ static void ni_ao_cmd_personalize(struct comedi_device *dev, ni_stc_writew(dev, NISTC_RESET_AO_CFG_START, NISTC_RESET_REG); bits = - /* fast CPU interface--only eseries */ - /* ((slow CPU interface) ? 0 : AO_Fast_CPU) | */ - NISTC_AO_PERSONAL_BC_SRC_SEL | - 0 /* (use_original_pulse ? 0 : NISTC_AO_PERSONAL_UPDATE_TIMEBASE) */ | - /* - * FIXME: start setting following bit when appropriate. Need to - * determine whether board is E4 or E1. - * FROM MHHDK: - * if board is E4 or E1 - * Set bit "NISTC_AO_PERSONAL_UPDATE_PW" to 0 - * else - * set it to 1 - */ - NISTC_AO_PERSONAL_UPDATE_PW | - /* FIXME: when should we set following bit to zero? */ - NISTC_AO_PERSONAL_TMRDACWR_PW | - (board->ao_fifo_depth ? - NISTC_AO_PERSONAL_FIFO_ENA : NISTC_AO_PERSONAL_DMA_PIO_CTRL) - ; + /* fast CPU interface--only eseries */ + /* ((slow CPU interface) ? 0 : AO_Fast_CPU) | */ + NISTC_AO_PERSONAL_BC_SRC_SEL | 0 /* (use_original_pulse ? 0 : NISTC_AO_PERSONAL_UPDATE_TIMEBASE) */ + | + /* + * FIXME: start setting following bit when appropriate. Need to + * determine whether board is E4 or E1. + * FROM MHHDK: + * if board is E4 or E1 + * Set bit "NISTC_AO_PERSONAL_UPDATE_PW" to 0 + * else + * set it to 1 + */ + NISTC_AO_PERSONAL_UPDATE_PW | + /* FIXME: when should we set following bit to zero? */ + NISTC_AO_PERSONAL_TMRDACWR_PW | + (board->ao_fifo_depth ? + NISTC_AO_PERSONAL_FIFO_ENA : NISTC_AO_PERSONAL_DMA_PIO_CTRL); #if 0 /* * FIXME: @@ -2969,14 +2952,13 @@ static void ni_ao_cmd_set_trigger(struct comedi_device *dev, ni_stc_writew(dev, devpriv->ao_mode1, NISTC_AO_MODE1_REG); if (cmd->start_src == TRIG_INT) { - trigsel = NISTC_AO_TRIG_START1_EDGE | - NISTC_AO_TRIG_START1_SYNC; - } else { /* TRIG_EXT */ - trigsel = NISTC_AO_TRIG_START1_SEL( - ni_get_reg_value_roffs( - CR_CHAN(cmd->start_arg), - NI_AO_StartTrigger, - &devpriv->routing_tables, 1)); + trigsel = NISTC_AO_TRIG_START1_EDGE | NISTC_AO_TRIG_START1_SYNC; + } else { /* TRIG_EXT */ + trigsel = + NISTC_AO_TRIG_START1_SEL(ni_get_reg_value_roffs + (CR_CHAN(cmd->start_arg), + NI_AO_StartTrigger, + &devpriv->routing_tables, 1)); /* 0=active high, 1=active low. see daq-stc 3-24 (p186) */ if (cmd->start_arg & CR_INVERT) @@ -3023,7 +3005,7 @@ static void ni_ao_cmd_set_counters(struct comedi_device *dev, * ignoring BC_TC, then we will need to find a way to ignore that * interrupt in continuous mode. */ - ni_stc_writel(dev, 0, NISTC_AO_BC_LOADA_REG); /* iter once */ + ni_stc_writel(dev, 0, NISTC_AO_BC_LOADA_REG); /* iter once */ /* sync (issue command to load number of buffer iterations -1) */ ni_stc_writew(dev, NISTC_AO_CMD1_BC_LOAD, NISTC_AO_CMD1_REG); @@ -3043,7 +3025,7 @@ static void ni_ao_cmd_set_counters(struct comedi_device *dev, */ { unsigned int stop_arg = cmd->stop_arg > 0 ? - (cmd->stop_arg & 0xffffff) : 0xffffff; + (cmd->stop_arg & 0xffffff) : 0xffffff; if (devpriv->is_m_series) { /* @@ -3084,15 +3066,15 @@ static void ni_ao_cmd_set_update(struct comedi_device *dev, * zero out these bit fields to be set below. Does an ao-reset do this * automatically? */ - devpriv->ao_mode1 &= ~(NISTC_AO_MODE1_UI_SRC_MASK | - NISTC_AO_MODE1_UI_SRC_POLARITY | - NISTC_AO_MODE1_UPDATE_SRC_MASK | - NISTC_AO_MODE1_UPDATE_SRC_POLARITY); + devpriv->ao_mode1 &= ~(NISTC_AO_MODE1_UI_SRC_MASK | + NISTC_AO_MODE1_UI_SRC_POLARITY | + NISTC_AO_MODE1_UPDATE_SRC_MASK | + NISTC_AO_MODE1_UPDATE_SRC_POLARITY); if (cmd->scan_begin_src == TRIG_TIMER) { unsigned int trigvar; - devpriv->ao_cmd2 &= ~NISTC_AO_CMD2_BC_GATE_ENA; + devpriv->ao_cmd2 &= ~NISTC_AO_CMD2_BC_GATE_ENA; /* * NOTE: there are several other ways of configuring internal @@ -3133,14 +3115,14 @@ static void ni_ao_cmd_set_update(struct comedi_device *dev, ni_stc_writel(dev, 1, NISTC_AO_UI_LOADA_REG); ni_stc_writew(dev, NISTC_AO_CMD1_UI_LOAD, NISTC_AO_CMD1_REG); ni_stc_writel(dev, trigvar, NISTC_AO_UI_LOADA_REG); - } else { /* TRIG_EXT */ + } else { /* TRIG_EXT */ /* FIXME: assert scan_begin_arg != 0, ret failure otherwise */ - devpriv->ao_cmd2 |= NISTC_AO_CMD2_BC_GATE_ENA; - devpriv->ao_mode1 |= NISTC_AO_MODE1_UPDATE_SRC( - ni_get_reg_value( - CR_CHAN(cmd->scan_begin_arg), - NI_AO_SampleClock, - &devpriv->routing_tables)); + devpriv->ao_cmd2 |= NISTC_AO_CMD2_BC_GATE_ENA; + devpriv->ao_mode1 |= + NISTC_AO_MODE1_UPDATE_SRC(ni_get_reg_value + (CR_CHAN(cmd->scan_begin_arg), + NI_AO_SampleClock, + &devpriv->routing_tables)); if (cmd->scan_begin_arg & CR_INVERT) devpriv->ao_mode1 |= NISTC_AO_MODE1_UPDATE_SRC_POLARITY; } @@ -3153,7 +3135,7 @@ static void ni_ao_cmd_set_update(struct comedi_device *dev, /* Configure DAQ-STC for Timed update mode */ devpriv->ao_cmd1 |= NISTC_AO_CMD1_DAC1_UPDATE_MODE | - NISTC_AO_CMD1_DAC0_UPDATE_MODE; + NISTC_AO_CMD1_DAC0_UPDATE_MODE; /* We are not using UPDATE2-->don't have to set DACx_Source_Select */ ni_stc_writew(dev, devpriv->ao_cmd1, NISTC_AO_CMD1_REG); @@ -3187,7 +3169,7 @@ static void ni_ao_cmd_set_channels(struct comedi_device *dev, if (cmd->scan_end_arg > 1) { devpriv->ao_mode1 |= NISTC_AO_MODE1_MULTI_CHAN; bits = NISTC_AO_OUT_CTRL_CHANS(cmd->scan_end_arg - 1) - | NISTC_AO_OUT_CTRL_UPDATE_SEL_HIGHZ; + | NISTC_AO_OUT_CTRL_UPDATE_SEL_HIGHZ; } else { devpriv->ao_mode1 &= ~NISTC_AO_MODE1_MULTI_CHAN; @@ -3195,12 +3177,12 @@ static void ni_ao_cmd_set_channels(struct comedi_device *dev, if (devpriv->is_m_series | devpriv->is_6xxx) bits |= NISTC_AO_OUT_CTRL_CHANS(0); else - bits |= NISTC_AO_OUT_CTRL_CHANS( - CR_CHAN(cmd->chanlist[0])); + bits |= + NISTC_AO_OUT_CTRL_CHANS(CR_CHAN(cmd->chanlist[0])); } ni_stc_writew(dev, devpriv->ao_mode1, NISTC_AO_MODE1_REG); - ni_stc_writew(dev, bits, NISTC_AO_OUT_CTRL_REG); + ni_stc_writew(dev, bits, NISTC_AO_OUT_CTRL_REG); ni_stc_writew(dev, NISTC_RESET_AO_CFG_END, NISTC_RESET_REG); } @@ -3408,8 +3390,8 @@ static int ni_ao_reset(struct comedi_device *dev, struct comedi_subdevice *s) * (clear bunch of registers--mseries mhddk examples do not include * this) */ - devpriv->ao_cmd1 = 0; - devpriv->ao_cmd2 = 0; + devpriv->ao_cmd1 = 0; + devpriv->ao_cmd2 = 0; devpriv->ao_mode1 = 0; devpriv->ao_mode2 = 0; if (devpriv->is_m_series) @@ -3451,8 +3433,7 @@ static int ni_ao_reset(struct comedi_device *dev, struct comedi_subdevice *s) static int ni_dio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct ni_private *devpriv = dev->private; int ret; @@ -3470,8 +3451,7 @@ static int ni_dio_insn_config(struct comedi_device *dev, static int ni_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct ni_private *devpriv = dev->private; @@ -3609,8 +3589,7 @@ static int ni_cdio_cmdtest(struct comedi_device *dev, } static int ni_cdo_inttrig(struct comedi_device *dev, - struct comedi_subdevice *s, - unsigned int trig_num) + struct comedi_subdevice *s, unsigned int trig_num) { struct comedi_cmd *cmd = &s->async->cmd; const unsigned int timeout = 1000; @@ -3656,9 +3635,8 @@ static int ni_cdo_inttrig(struct comedi_device *dev, return -EIO; } ni_writel(dev, NI_M_CDO_CMD_ARM | - NI_M_CDO_CMD_ERR_INT_ENA_SET | - NI_M_CDO_CMD_F_E_INT_ENA_SET, - NI_M_CDIO_CMD_REG); + NI_M_CDO_CMD_ERR_INT_ENA_SET | + NI_M_CDO_CMD_F_E_INT_ENA_SET, NI_M_CDIO_CMD_REG); return retval; } @@ -3675,12 +3653,11 @@ static int ni_cdio_cmd(struct comedi_device *dev, struct comedi_subdevice *s) * for completeness, test whether the cmd is output or input(?) */ cdo_mode_bits = NI_M_CDO_MODE_FIFO_MODE | - NI_M_CDO_MODE_HALT_ON_ERROR | - NI_M_CDO_MODE_SAMPLE_SRC( - ni_get_reg_value( - CR_CHAN(cmd->scan_begin_arg), - NI_DO_SampleClock, - &devpriv->routing_tables)); + NI_M_CDO_MODE_HALT_ON_ERROR | + NI_M_CDO_MODE_SAMPLE_SRC(ni_get_reg_value + (CR_CHAN(cmd->scan_begin_arg), + NI_DO_SampleClock, + &devpriv->routing_tables)); if (cmd->scan_begin_arg & CR_INVERT) cdo_mode_bits |= NI_M_CDO_MODE_POLARITY; ni_writel(dev, cdo_mode_bits, NI_M_CDO_MODE_REG); @@ -3709,10 +3686,9 @@ static int ni_cdio_cmd(struct comedi_device *dev, struct comedi_subdevice *s) static int ni_cdio_cancel(struct comedi_device *dev, struct comedi_subdevice *s) { ni_writel(dev, NI_M_CDO_CMD_DISARM | - NI_M_CDO_CMD_ERR_INT_ENA_CLR | - NI_M_CDO_CMD_F_E_INT_ENA_CLR | - NI_M_CDO_CMD_F_REQ_INT_ENA_CLR, - NI_M_CDIO_CMD_REG); + NI_M_CDO_CMD_ERR_INT_ENA_CLR | + NI_M_CDO_CMD_F_E_INT_ENA_CLR | + NI_M_CDO_CMD_F_REQ_INT_ENA_CLR, NI_M_CDIO_CMD_REG); /* * XXX not sure what interrupt C group does * ni_writeb(dev, 0, NI_M_INTC_ENA_REG); @@ -3737,13 +3713,11 @@ static void handle_cdio_interrupt(struct comedi_device *dev) cdio_status = ni_readl(dev, NI_M_CDIO_STATUS_REG); if (cdio_status & NI_M_CDIO_STATUS_CDO_ERROR) { /* XXX just guessing this is needed and does something useful */ - ni_writel(dev, NI_M_CDO_CMD_ERR_INT_CONFIRM, - NI_M_CDIO_CMD_REG); + ni_writel(dev, NI_M_CDO_CMD_ERR_INT_CONFIRM, NI_M_CDIO_CMD_REG); s->async->events |= COMEDI_CB_OVERFLOW; } if (cdio_status & NI_M_CDIO_STATUS_CDO_FIFO_EMPTY) { - ni_writel(dev, NI_M_CDO_CMD_F_E_INT_ENA_CLR, - NI_M_CDIO_CMD_REG); + ni_writel(dev, NI_M_CDO_CMD_F_E_INT_ENA_CLR, NI_M_CDIO_CMD_REG); /* s->async->events |= COMEDI_CB_EOA; */ } comedi_handle_events(dev, s); @@ -3850,8 +3824,7 @@ static int ni_serial_sw_readwrite8(struct comedi_device *dev, static int ni_serial_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct ni_private *devpriv = dev->private; unsigned int clk_fout = devpriv->clock_and_fout; @@ -3885,13 +3858,13 @@ static int ni_serial_insn_config(struct comedi_device *dev, } else if (data[1] <= SERIAL_1_2US) { devpriv->dio_control &= ~NISTC_DIO_CTRL_HW_SER_TIMEBASE; clk_fout |= NISTC_CLK_FOUT_SLOW_TIMEBASE | - NISTC_CLK_FOUT_DIO_SER_OUT_DIV2; + NISTC_CLK_FOUT_DIO_SER_OUT_DIV2; data[1] = SERIAL_1_2US; devpriv->serial_interval_ns = data[1]; } else if (data[1] <= SERIAL_10US) { devpriv->dio_control |= NISTC_DIO_CTRL_HW_SER_TIMEBASE; clk_fout |= NISTC_CLK_FOUT_SLOW_TIMEBASE | - NISTC_CLK_FOUT_DIO_SER_OUT_DIV2; + NISTC_CLK_FOUT_DIO_SER_OUT_DIV2; /* * Note: NISTC_CLK_FOUT_DIO_SER_OUT_DIV2 only affects * 600ns/1.2us. If you turn divide_by_2 off with the @@ -3953,42 +3926,42 @@ static void init_ao_67xx(struct comedi_device *dev, struct comedi_subdevice *s) } static const struct mio_regmap ni_gpct_to_stc_regmap[] = { - [NITIO_G0_AUTO_INC] = { NISTC_G0_AUTOINC_REG, 2 }, - [NITIO_G1_AUTO_INC] = { NISTC_G1_AUTOINC_REG, 2 }, - [NITIO_G0_CMD] = { NISTC_G0_CMD_REG, 2 }, - [NITIO_G1_CMD] = { NISTC_G1_CMD_REG, 2 }, - [NITIO_G0_HW_SAVE] = { NISTC_G0_HW_SAVE_REG, 4 }, - [NITIO_G1_HW_SAVE] = { NISTC_G1_HW_SAVE_REG, 4 }, - [NITIO_G0_SW_SAVE] = { NISTC_G0_SAVE_REG, 4 }, - [NITIO_G1_SW_SAVE] = { NISTC_G1_SAVE_REG, 4 }, - [NITIO_G0_MODE] = { NISTC_G0_MODE_REG, 2 }, - [NITIO_G1_MODE] = { NISTC_G1_MODE_REG, 2 }, - [NITIO_G0_LOADA] = { NISTC_G0_LOADA_REG, 4 }, - [NITIO_G1_LOADA] = { NISTC_G1_LOADA_REG, 4 }, - [NITIO_G0_LOADB] = { NISTC_G0_LOADB_REG, 4 }, - [NITIO_G1_LOADB] = { NISTC_G1_LOADB_REG, 4 }, - [NITIO_G0_INPUT_SEL] = { NISTC_G0_INPUT_SEL_REG, 2 }, - [NITIO_G1_INPUT_SEL] = { NISTC_G1_INPUT_SEL_REG, 2 }, - [NITIO_G0_CNT_MODE] = { 0x1b0, 2 }, /* M-Series only */ - [NITIO_G1_CNT_MODE] = { 0x1b2, 2 }, /* M-Series only */ - [NITIO_G0_GATE2] = { 0x1b4, 2 }, /* M-Series only */ - [NITIO_G1_GATE2] = { 0x1b6, 2 }, /* M-Series only */ - [NITIO_G01_STATUS] = { NISTC_G01_STATUS_REG, 2 }, - [NITIO_G01_RESET] = { NISTC_RESET_REG, 2 }, - [NITIO_G01_STATUS1] = { NISTC_STATUS1_REG, 2 }, - [NITIO_G01_STATUS2] = { NISTC_STATUS2_REG, 2 }, - [NITIO_G0_DMA_CFG] = { 0x1b8, 2 }, /* M-Series only */ - [NITIO_G1_DMA_CFG] = { 0x1ba, 2 }, /* M-Series only */ - [NITIO_G0_DMA_STATUS] = { 0x1b8, 2 }, /* M-Series only */ - [NITIO_G1_DMA_STATUS] = { 0x1ba, 2 }, /* M-Series only */ - [NITIO_G0_ABZ] = { 0x1c0, 2 }, /* M-Series only */ - [NITIO_G1_ABZ] = { 0x1c2, 2 }, /* M-Series only */ - [NITIO_G0_INT_ACK] = { NISTC_INTA_ACK_REG, 2 }, - [NITIO_G1_INT_ACK] = { NISTC_INTB_ACK_REG, 2 }, - [NITIO_G0_STATUS] = { NISTC_AI_STATUS1_REG, 2 }, - [NITIO_G1_STATUS] = { NISTC_AO_STATUS1_REG, 2 }, - [NITIO_G0_INT_ENA] = { NISTC_INTA_ENA_REG, 2 }, - [NITIO_G1_INT_ENA] = { NISTC_INTB_ENA_REG, 2 }, + [NITIO_G0_AUTO_INC] = { NISTC_G0_AUTOINC_REG, 2 }, + [NITIO_G1_AUTO_INC] = { NISTC_G1_AUTOINC_REG, 2 }, + [NITIO_G0_CMD] = { NISTC_G0_CMD_REG, 2 }, + [NITIO_G1_CMD] = { NISTC_G1_CMD_REG, 2 }, + [NITIO_G0_HW_SAVE] = { NISTC_G0_HW_SAVE_REG, 4 }, + [NITIO_G1_HW_SAVE] = { NISTC_G1_HW_SAVE_REG, 4 }, + [NITIO_G0_SW_SAVE] = { NISTC_G0_SAVE_REG, 4 }, + [NITIO_G1_SW_SAVE] = { NISTC_G1_SAVE_REG, 4 }, + [NITIO_G0_MODE] = { NISTC_G0_MODE_REG, 2 }, + [NITIO_G1_MODE] = { NISTC_G1_MODE_REG, 2 }, + [NITIO_G0_LOADA] = { NISTC_G0_LOADA_REG, 4 }, + [NITIO_G1_LOADA] = { NISTC_G1_LOADA_REG, 4 }, + [NITIO_G0_LOADB] = { NISTC_G0_LOADB_REG, 4 }, + [NITIO_G1_LOADB] = { NISTC_G1_LOADB_REG, 4 }, + [NITIO_G0_INPUT_SEL] = { NISTC_G0_INPUT_SEL_REG, 2 }, + [NITIO_G1_INPUT_SEL] = { NISTC_G1_INPUT_SEL_REG, 2 }, + [NITIO_G0_CNT_MODE] = { 0x1b0, 2 }, /* M-Series only */ + [NITIO_G1_CNT_MODE] = { 0x1b2, 2 }, /* M-Series only */ + [NITIO_G0_GATE2] = { 0x1b4, 2 }, /* M-Series only */ + [NITIO_G1_GATE2] = { 0x1b6, 2 }, /* M-Series only */ + [NITIO_G01_STATUS] = { NISTC_G01_STATUS_REG, 2 }, + [NITIO_G01_RESET] = { NISTC_RESET_REG, 2 }, + [NITIO_G01_STATUS1] = { NISTC_STATUS1_REG, 2 }, + [NITIO_G01_STATUS2] = { NISTC_STATUS2_REG, 2 }, + [NITIO_G0_DMA_CFG] = { 0x1b8, 2 }, /* M-Series only */ + [NITIO_G1_DMA_CFG] = { 0x1ba, 2 }, /* M-Series only */ + [NITIO_G0_DMA_STATUS] = { 0x1b8, 2 }, /* M-Series only */ + [NITIO_G1_DMA_STATUS] = { 0x1ba, 2 }, /* M-Series only */ + [NITIO_G0_ABZ] = { 0x1c0, 2 }, /* M-Series only */ + [NITIO_G1_ABZ] = { 0x1c2, 2 }, /* M-Series only */ + [NITIO_G0_INT_ACK] = { NISTC_INTA_ACK_REG, 2 }, + [NITIO_G1_INT_ACK] = { NISTC_INTB_ACK_REG, 2 }, + [NITIO_G0_STATUS] = { NISTC_AI_STATUS1_REG, 2 }, + [NITIO_G1_STATUS] = { NISTC_AO_STATUS1_REG, 2 }, + [NITIO_G0_INT_ENA] = { NISTC_INTA_ENA_REG, 2 }, + [NITIO_G1_INT_ENA] = { NISTC_INTB_ENA_REG, 2 }, }; static unsigned int ni_gpct_to_stc_register(struct comedi_device *dev, @@ -4083,8 +4056,7 @@ static unsigned int ni_gpct_read_register(struct ni_gpct *counter, static int ni_freq_out_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct ni_private *devpriv = dev->private; unsigned int val = NISTC_CLK_FOUT_TO_DIVIDER(devpriv->clock_and_fout); @@ -4098,8 +4070,7 @@ static int ni_freq_out_insn_read(struct comedi_device *dev, static int ni_freq_out_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct ni_private *devpriv = dev->private; @@ -4121,8 +4092,7 @@ static int ni_freq_out_insn_write(struct comedi_device *dev, static int ni_freq_out_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct ni_private *devpriv = dev->private; @@ -4177,8 +4147,7 @@ static int ni_get_pwm_config(struct comedi_device *dev, unsigned int *data) static int ni_m_series_pwm_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct ni_private *devpriv = dev->private; unsigned int up_count, down_count; @@ -4194,8 +4163,7 @@ static int ni_m_series_pwm_config(struct comedi_device *dev, up_count = data[2] / devpriv->clock_ns; break; case CMDF_ROUND_UP: - up_count = - DIV_ROUND_UP(data[2], devpriv->clock_ns); + up_count = DIV_ROUND_UP(data[2], devpriv->clock_ns); break; default: return -EINVAL; @@ -4209,8 +4177,7 @@ static int ni_m_series_pwm_config(struct comedi_device *dev, down_count = data[4] / devpriv->clock_ns; break; case CMDF_ROUND_UP: - down_count = - DIV_ROUND_UP(data[4], devpriv->clock_ns); + down_count = DIV_ROUND_UP(data[4], devpriv->clock_ns); break; default: return -EINVAL; @@ -4222,8 +4189,7 @@ static int ni_m_series_pwm_config(struct comedi_device *dev, return -EAGAIN; } ni_writel(dev, NI_M_CAL_PWM_HIGH_TIME(up_count) | - NI_M_CAL_PWM_LOW_TIME(down_count), - NI_M_CAL_PWM_REG); + NI_M_CAL_PWM_LOW_TIME(down_count), NI_M_CAL_PWM_REG); devpriv->pwm_up_count = up_count; devpriv->pwm_down_count = down_count; return 5; @@ -4237,8 +4203,7 @@ static int ni_m_series_pwm_config(struct comedi_device *dev, static int ni_6143_pwm_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct ni_private *devpriv = dev->private; unsigned int up_count, down_count; @@ -4254,8 +4219,7 @@ static int ni_6143_pwm_config(struct comedi_device *dev, up_count = data[2] / devpriv->clock_ns; break; case CMDF_ROUND_UP: - up_count = - DIV_ROUND_UP(data[2], devpriv->clock_ns); + up_count = DIV_ROUND_UP(data[2], devpriv->clock_ns); break; default: return -EINVAL; @@ -4269,8 +4233,7 @@ static int ni_6143_pwm_config(struct comedi_device *dev, down_count = data[4] / devpriv->clock_ns; break; case CMDF_ROUND_UP: - down_count = - DIV_ROUND_UP(data[4], devpriv->clock_ns); + down_count = DIV_ROUND_UP(data[4], devpriv->clock_ns); break; default: return -EINVAL; @@ -4349,13 +4312,13 @@ struct caldac_struct { }; static struct caldac_struct caldacs[] = { - [mb88341] = {12, 8, pack_mb88341}, - [dac8800] = {8, 8, pack_dac8800}, - [dac8043] = {1, 12, pack_dac8043}, - [ad8522] = {2, 12, pack_ad8522}, - [ad8804] = {12, 8, pack_ad8804}, - [ad8842] = {8, 8, pack_ad8842}, - [ad8804_debug] = {16, 8, pack_ad8804}, + [mb88341] = { 12, 8, pack_mb88341 }, + [dac8800] = { 8, 8, pack_dac8800 }, + [dac8043] = { 1, 12, pack_dac8043 }, + [ad8522] = { 2, 12, pack_ad8522 }, + [ad8804] = { 12, 8, pack_ad8804 }, + [ad8842] = { 8, 8, pack_ad8842 }, + [ad8804_debug] = { 16, 8, pack_ad8804 }, }; static void ni_write_caldac(struct comedi_device *dev, int addr, int val) @@ -4401,8 +4364,7 @@ static void ni_write_caldac(struct comedi_device *dev, int addr, int val) static int ni_calib_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { if (insn->n) { /* only bother writing the last sample to the channel */ @@ -4415,8 +4377,7 @@ static int ni_calib_insn_write(struct comedi_device *dev, static int ni_calib_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct ni_private *devpriv = dev->private; unsigned int i; @@ -4514,8 +4475,7 @@ static int ni_read_eeprom(struct comedi_device *dev, int addr) static int ni_eeprom_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int val; unsigned int i; @@ -4590,7 +4550,8 @@ static unsigned int ni_m_series_get_pfi_routing(struct comedi_device *dev, const unsigned int array_offset = chan / 3; return NI_M_PFI_OUT_SEL_TO_SRC(chan, - devpriv->pfi_output_select_reg[array_offset]); + devpriv->pfi_output_select_reg + [array_offset]); } static int ni_m_series_set_pfi_routing(struct comedi_device *dev, @@ -4621,8 +4582,8 @@ static unsigned int ni_get_pfi_routing(struct comedi_device *dev, chan -= NI_PFI(0); } return (devpriv->is_m_series) - ? ni_m_series_get_pfi_routing(dev, chan) - : ni_old_get_pfi_routing(dev, chan); + ? ni_m_series_get_pfi_routing(dev, chan) + : ni_old_get_pfi_routing(dev, chan); } /* Sets the output mux for the specified PFI channel. */ @@ -4636,8 +4597,8 @@ static int ni_set_pfi_routing(struct comedi_device *dev, chan -= NI_PFI(0); } return (devpriv->is_m_series) - ? ni_m_series_set_pfi_routing(dev, chan, source) - : ni_old_set_pfi_routing(dev, chan, source); + ? ni_m_series_set_pfi_routing(dev, chan, source) + : ni_old_set_pfi_routing(dev, chan, source); } static int ni_config_pfi_filter(struct comedi_device *dev, @@ -4682,13 +4643,12 @@ static int ni_get_pfi_direction(struct comedi_device *dev, int chan) chan -= NI_PFI(0); } return devpriv->io_bidirection_pin_reg & (1 << chan) ? - COMEDI_OUTPUT : COMEDI_INPUT; + COMEDI_OUTPUT : COMEDI_INPUT; } static int ni_pfi_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan; @@ -4720,8 +4680,7 @@ static int ni_pfi_insn_config(struct comedi_device *dev, static int ni_pfi_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct ni_private *devpriv = dev->private; @@ -4778,8 +4737,7 @@ static void cs5529_command(struct comedi_device *dev, unsigned short value) "possible problem - never saw adc go busy?\n"); } -static int cs5529_do_conversion(struct comedi_device *dev, - unsigned short *data) +static int cs5529_do_conversion(struct comedi_device *dev, unsigned short *data) { int retval; unsigned short status; @@ -4811,8 +4769,7 @@ static int cs5529_do_conversion(struct comedi_device *dev, static int cs5529_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { int n, retval; unsigned short sample; @@ -4848,14 +4805,13 @@ static void cs5529_config_write(struct comedi_device *dev, unsigned int value, reg_select_bits &= CS5529_CMD_REG_MASK; cs5529_command(dev, CS5529_CMD_CB | reg_select_bits); if (cs5529_wait_for_idle(dev)) - dev_err(dev->class_dev, - "timeout or signal in %s\n", __func__); + dev_err(dev->class_dev, "timeout or signal in %s\n", __func__); } static int init_cs5529(struct comedi_device *dev) { unsigned int config_bits = CS5529_CFG_PORT_FLAG | - CS5529_CFG_WORD_RATE_2180; + CS5529_CFG_WORD_RATE_2180; #if 1 /* do self-calibration */ @@ -4869,8 +4825,7 @@ static int init_cs5529(struct comedi_device *dev) cs5529_config_write(dev, config_bits | CS5529_CFG_CALIB_OFFSET_SELF, CS5529_CFG_REG); if (cs5529_wait_for_idle(dev)) - dev_err(dev->class_dev, - "timeout or signal in %s\n", __func__); + dev_err(dev->class_dev, "timeout or signal in %s\n", __func__); #endif return 0; } @@ -4890,7 +4845,7 @@ static int ni_mseries_get_pll_parameters(unsigned int reference_period_ns, unsigned int best_mult = 1; static const unsigned int pico_per_nano = 1000; const unsigned int reference_picosec = reference_period_ns * - pico_per_nano; + pico_per_nano; /* * m-series wants the phased-locked loop to output 80MHz, which is * divided by 4 to 20 MHz for most timing clocks @@ -4953,7 +4908,7 @@ static int ni_mseries_set_pll_master_clock(struct comedi_device *dev, NISTC_RTSI_TRIG_DIR_REG); pll_control_bits = NI_M_PLL_CTRL_ENA | NI_M_PLL_CTRL_VCO_MODE_75_150MHZ; devpriv->clock_and_fout2 |= NI_M_CLK_FOUT2_TIMEBASE1_PLL | - NI_M_CLK_FOUT2_TIMEBASE3_PLL; + NI_M_CLK_FOUT2_TIMEBASE3_PLL; devpriv->clock_and_fout2 &= ~NI_M_CLK_FOUT2_PLL_SRC_MASK; switch (source) { case NI_MIO_PLL_PXI_STAR_TRIGGER_CLOCK: @@ -4967,7 +4922,7 @@ static int ni_mseries_set_pll_master_clock(struct comedi_device *dev, for (rtsi = 0; rtsi <= NI_M_MAX_RTSI_CHAN; ++rtsi) { if (source == NI_MIO_PLL_RTSI_CLOCK(rtsi)) { devpriv->clock_and_fout2 |= - NI_M_CLK_FOUT2_PLL_SRC_RTSI(rtsi); + NI_M_CLK_FOUT2_PLL_SRC_RTSI(rtsi); break; } } @@ -4980,14 +4935,13 @@ static int ni_mseries_set_pll_master_clock(struct comedi_device *dev, &freq_multiplier, &devpriv->clock_ns); if (retval < 0) { - dev_err(dev->class_dev, - "bug, failed to find pll parameters\n"); + dev_err(dev->class_dev, "bug, failed to find pll parameters\n"); return retval; } ni_writew(dev, devpriv->clock_and_fout2, NI_M_CLK_FOUT2_REG); pll_control_bits |= NI_M_PLL_CTRL_DIVISOR(freq_divider) | - NI_M_PLL_CTRL_MULTIPLIER(freq_multiplier); + NI_M_PLL_CTRL_MULTIPLIER(freq_multiplier); ni_writew(dev, pll_control_bits, NI_M_PLL_CTRL_REG); devpriv->clock_source = source; @@ -5187,19 +5141,18 @@ static int ni_get_rtsi_direction(struct comedi_device *dev, int chan) if (chan < max_chan) { return (devpriv->rtsi_trig_direction_reg & NISTC_RTSI_TRIG_DIR(chan, devpriv->is_m_series)) - ? COMEDI_OUTPUT : COMEDI_INPUT; + ? COMEDI_OUTPUT : COMEDI_INPUT; } else if (chan == NISTC_RTSI_TRIG_OLD_CLK_CHAN) { return (devpriv->rtsi_trig_direction_reg & NISTC_RTSI_TRIG_DRV_CLK) - ? COMEDI_OUTPUT : COMEDI_INPUT; + ? COMEDI_OUTPUT : COMEDI_INPUT; } return -EINVAL; } static int ni_rtsi_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct ni_private *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -5209,14 +5162,14 @@ static int ni_rtsi_insn_config(struct comedi_device *dev, case COMEDI_INPUT: ni_set_rtsi_direction(dev, chan, data[0]); break; - case INSN_CONFIG_DIO_QUERY: { - int ret = ni_get_rtsi_direction(dev, chan); + case INSN_CONFIG_DIO_QUERY:{ + int ret = ni_get_rtsi_direction(dev, chan); - if (ret < 0) - return ret; - data[1] = ret; - return 2; - } + if (ret < 0) + return ret; + data[1] = ret; + return 2; + } case INSN_CONFIG_SET_CLOCK_SRC: return ni_set_master_clock(dev, data[1], data[2]); case INSN_CONFIG_GET_CLOCK_SRC: @@ -5225,14 +5178,14 @@ static int ni_rtsi_insn_config(struct comedi_device *dev, return 3; case INSN_CONFIG_SET_ROUTING: return ni_set_rtsi_routing(dev, chan, data[1]); - case INSN_CONFIG_GET_ROUTING: { - int ret = ni_get_rtsi_routing(dev, chan); + case INSN_CONFIG_GET_ROUTING:{ + int ret = ni_get_rtsi_routing(dev, chan); - if (ret < 0) - return ret; - data[1] = ret; - return 2; - } + if (ret < 0) + return ret; + data[1] = ret; + return 2; + } default: return -EINVAL; } @@ -5241,8 +5194,7 @@ static int ni_rtsi_insn_config(struct comedi_device *dev, static int ni_rtsi_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { data[1] = 0; @@ -5277,17 +5229,17 @@ static void set_rgout0_reg(int reg, struct comedi_device *dev) if (devpriv->is_m_series) { devpriv->rtsi_trig_direction_reg &= - ~NISTC_RTSI_TRIG_DIR_SUB_SEL1; + ~NISTC_RTSI_TRIG_DIR_SUB_SEL1; devpriv->rtsi_trig_direction_reg |= - (reg << NISTC_RTSI_TRIG_DIR_SUB_SEL1_SHIFT) & - NISTC_RTSI_TRIG_DIR_SUB_SEL1; + (reg << NISTC_RTSI_TRIG_DIR_SUB_SEL1_SHIFT) & + NISTC_RTSI_TRIG_DIR_SUB_SEL1; ni_stc_writew(dev, devpriv->rtsi_trig_direction_reg, NISTC_RTSI_TRIG_DIR_REG); } else { devpriv->rtsi_trig_b_output_reg &= ~NISTC_RTSI_TRIGB_SUB_SEL1; devpriv->rtsi_trig_b_output_reg |= - (reg << NISTC_RTSI_TRIGB_SUB_SEL1_SHIFT) & - NISTC_RTSI_TRIGB_SUB_SEL1; + (reg << NISTC_RTSI_TRIGB_SUB_SEL1_SHIFT) & + NISTC_RTSI_TRIGB_SUB_SEL1; ni_stc_writew(dev, devpriv->rtsi_trig_b_output_reg, NISTC_RTSI_TRIGB_OUT_REG); } @@ -5362,7 +5314,7 @@ static int decr_rgout0_src_use(int src, struct comedi_device *dev) if (devpriv->rgout0_usage > 0 && get_rgout0_reg(dev) == reg) { --devpriv->rgout0_usage; if (!devpriv->rgout0_usage) - set_rgout0_reg(0, dev); /* ok default? */ + set_rgout0_reg(0, dev); /* ok default? */ return 0; } return -EINVAL; @@ -5377,7 +5329,7 @@ static int decr_rgout0_src_use(int src, struct comedi_device *dev) static void set_ith_rtsi_brd_reg(int i, int reg, struct comedi_device *dev) { struct ni_private *devpriv = dev->private; - int reg_i_sz = 3; /* value for e-series */ + int reg_i_sz = 3; /* value for e-series */ int reg_i_mask; int reg_i_shift; @@ -5387,7 +5339,7 @@ static void set_ith_rtsi_brd_reg(int i, int reg, struct comedi_device *dev) reg_i_shift = i * reg_i_sz; /* clear out the current reg_i for ith brd */ - devpriv->rtsi_shared_mux_reg &= ~(reg_i_mask << reg_i_shift); + devpriv->rtsi_shared_mux_reg &= ~(reg_i_mask << reg_i_shift); /* (softcopy) write the new reg_i for ith brd */ devpriv->rtsi_shared_mux_reg |= (reg & reg_i_mask) << reg_i_shift; /* (hardcopy) write the new reg_i for ith brd */ @@ -5397,7 +5349,7 @@ static void set_ith_rtsi_brd_reg(int i, int reg, struct comedi_device *dev) static int get_ith_rtsi_brd_reg(int i, struct comedi_device *dev) { struct ni_private *devpriv = dev->private; - int reg_i_sz = 3; /* value for e-series */ + int reg_i_sz = 3; /* value for e-series */ int reg_i_mask; int reg_i_shift; @@ -5452,7 +5404,7 @@ static int incr_rtsi_brd_src_use(int src, struct comedi_device *dev) &devpriv->routing_tables); if (reg < 0) - continue; /* invalid route */ + continue; /* invalid route */ if (!devpriv->rtsi_shared_mux_usage[i]) { if (first_available < 0) @@ -5507,7 +5459,7 @@ static int decr_rtsi_brd_src_use(int src, int rtsi_brd, get_ith_rtsi_brd_reg(i, dev) == reg) { --devpriv->rtsi_shared_mux_usage[i]; if (!devpriv->rtsi_shared_mux_usage[i]) - set_ith_rtsi_brd_reg(i, 0, dev); /* ok default? */ + set_ith_rtsi_brd_reg(i, 0, dev); /* ok default? */ return 0; } @@ -5611,7 +5563,7 @@ static inline int ni_set_gout_routing(unsigned int src, unsigned int dest, devpriv->an_trig_etc_reg &= ~NISTC_ATRIG_ETC_GPFO_0_SEL(-1); /* set reg */ devpriv->an_trig_etc_reg |= NISTC_ATRIG_ETC_GPFO_0_ENA - | NISTC_ATRIG_ETC_GPFO_0_SEL(src); + | NISTC_ATRIG_ETC_GPFO_0_SEL(src); break; case 1: /* clear reg */ @@ -5649,13 +5601,13 @@ static int get_output_select_source(int dest, struct comedi_device *dev) reg = ni_get_rtsi_routing(dev, dest); if (reg == NI_RTSI_OUTPUT_RGOUT0) { - dest = NI_RGOUT0; /* prepare for lookup below */ + dest = NI_RGOUT0; /* prepare for lookup below */ reg = get_rgout0_reg(dev); } else if (reg >= NI_RTSI_OUTPUT_RTSI_BRD(0) && reg <= NI_RTSI_OUTPUT_RTSI_BRD(3)) { const int i = reg - NI_RTSI_OUTPUT_RTSI_BRD(0); - dest = NI_RTSI_BRD(i); /* prepare for lookup */ + dest = NI_RTSI_BRD(i); /* prepare for lookup */ reg = get_ith_rtsi_brd_reg(i, dev); } } @@ -5672,8 +5624,9 @@ static int get_output_select_source(int dest, struct comedi_device *dev) } else if (channel_is_ctr(dest)) { reg = ni_tio_get_routing(devpriv->counter_dev, dest); } else { - dev_dbg(dev->class_dev, "%s: unhandled destination (%d) queried\n", - __func__, dest); + dev_dbg(dev->class_dev, + "%s: unhandled destination (%d) queried\n", __func__, + dest); } if (reg >= 0) @@ -5742,8 +5695,9 @@ static int connect_route(unsigned int src, unsigned int dest, return brd; /* Now lookup the register value for (brd->dest) */ - reg = ni_lookup_route_register( - brd, dest, &devpriv->routing_tables); + reg = + ni_lookup_route_register(brd, dest, + &devpriv->routing_tables); } ni_set_rtsi_direction(dev, dest, COMEDI_OUTPUT); @@ -5799,9 +5753,10 @@ static int disconnect_route(unsigned int src, unsigned int dest, return ret; } else if (ni_rtsi_route_requires_mux(reg)) { /* find which RTSI_BRD line is source for rtsi pin */ - int brd = ni_find_route_source( - ni_get_rtsi_routing(dev, dest), dest, - &devpriv->routing_tables); + int brd = + ni_find_route_source(ni_get_rtsi_routing(dev, dest), + dest, + &devpriv->routing_tables); if (brd < 0) return brd; @@ -5833,8 +5788,7 @@ static int disconnect_route(unsigned int src, unsigned int dest, } static int ni_global_insn_config(struct comedi_device *dev, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { switch (data[0]) { case INSN_DEVICE_CONFIG_TEST_ROUTE: @@ -5844,10 +5798,10 @@ static int ni_global_insn_config(struct comedi_device *dev, return connect_route(data[1], data[2], dev); case INSN_DEVICE_CONFIG_DISCONNECT_ROUTE: return disconnect_route(data[1], data[2], dev); - /* - * This case is already handled one level up. - * case INSN_DEVICE_CONFIG_GET_ROUTES: - */ + /* + * This case is already handled one level up. + * case INSN_DEVICE_CONFIG_GET_ROUTES: + */ default: return -EINVAL; } @@ -5976,15 +5930,17 @@ static int ni_E_init(struct comedi_device *dev, int ret; int i; const char *dev_family = devpriv->is_m_series ? "ni_mseries" - : "ni_eseries"; + : "ni_eseries"; /* prepare the device for globally-named routes. */ if (ni_assign_device_routes(dev_family, board->name, board->alt_route_name, &devpriv->routing_tables) < 0) { - dev_warn(dev->class_dev, "%s: %s device has no signal routing table.\n", + dev_warn(dev->class_dev, + "%s: %s device has no signal routing table.\n", __func__, board->name); - dev_warn(dev->class_dev, "%s: High level NI signal names will not be available for this %s board.\n", + dev_warn(dev->class_dev, + "%s: High level NI signal names will not be available for this %s board.\n", __func__, board->name); } else { /* @@ -6002,9 +5958,8 @@ static int ni_E_init(struct comedi_device *dev, /* initialize clock dividers */ devpriv->clock_and_fout = NISTC_CLK_FOUT_SLOW_DIV2 | - NISTC_CLK_FOUT_SLOW_TIMEBASE | - NISTC_CLK_FOUT_TO_BOARD_DIV2 | - NISTC_CLK_FOUT_TO_BOARD; + NISTC_CLK_FOUT_SLOW_TIMEBASE | + NISTC_CLK_FOUT_TO_BOARD_DIV2 | NISTC_CLK_FOUT_TO_BOARD; if (!devpriv->is_6xxx) { /* BEAM is this needed for PCI-6143 ?? */ devpriv->clock_and_fout |= (NISTC_CLK_FOUT_AI_OUT_DIV2 | @@ -6019,28 +5974,28 @@ static int ni_E_init(struct comedi_device *dev, /* Analog Input subdevice */ s = &dev->subdevices[NI_AI_SUBDEV]; if (board->n_adchan) { - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_DIFF | SDF_DITHER; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_DIFF | SDF_DITHER; if (!devpriv->is_611x) - s->subdev_flags |= SDF_GROUND | SDF_COMMON | SDF_OTHER; + s->subdev_flags |= SDF_GROUND | SDF_COMMON | SDF_OTHER; if (board->ai_maxdata > 0xffff) - s->subdev_flags |= SDF_LSAMPL; + s->subdev_flags |= SDF_LSAMPL; if (devpriv->is_m_series) - s->subdev_flags |= SDF_SOFT_CALIBRATED; - s->n_chan = board->n_adchan; - s->maxdata = board->ai_maxdata; - s->range_table = ni_range_lkup[board->gainlkup]; - s->insn_read = ni_ai_insn_read; - s->insn_config = ni_ai_insn_config; + s->subdev_flags |= SDF_SOFT_CALIBRATED; + s->n_chan = board->n_adchan; + s->maxdata = board->ai_maxdata; + s->range_table = ni_range_lkup[board->gainlkup]; + s->insn_read = ni_ai_insn_read; + s->insn_config = ni_ai_insn_config; if (dev->irq) { dev->read_subdev = s; - s->subdev_flags |= SDF_CMD_READ; - s->len_chanlist = 512; - s->do_cmdtest = ni_ai_cmdtest; - s->do_cmd = ni_ai_cmd; - s->cancel = ni_ai_reset; - s->poll = ni_ai_poll; - s->munge = ni_ai_munge; + s->subdev_flags |= SDF_CMD_READ; + s->len_chanlist = 512; + s->do_cmdtest = ni_ai_cmdtest; + s->do_cmd = ni_ai_cmd; + s->cancel = ni_ai_reset; + s->poll = ni_ai_poll; + s->munge = ni_ai_munge; if (devpriv->mite) s->async_dma_dir = DMA_FROM_DEVICE; @@ -6049,21 +6004,21 @@ static int ni_E_init(struct comedi_device *dev, /* reset the analog input configuration */ ni_ai_reset(dev, s); } else { - s->type = COMEDI_SUBD_UNUSED; + s->type = COMEDI_SUBD_UNUSED; } /* Analog Output subdevice */ s = &dev->subdevices[NI_AO_SUBDEV]; if (board->n_aochan) { - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE | SDF_DEGLITCH | SDF_GROUND; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE | SDF_DEGLITCH | SDF_GROUND; if (devpriv->is_m_series) - s->subdev_flags |= SDF_SOFT_CALIBRATED; - s->n_chan = board->n_aochan; - s->maxdata = board->ao_maxdata; - s->range_table = board->ao_range_table; - s->insn_config = ni_ao_insn_config; - s->insn_write = ni_ao_insn_write; + s->subdev_flags |= SDF_SOFT_CALIBRATED; + s->n_chan = board->n_aochan; + s->maxdata = board->ao_maxdata; + s->range_table = board->ao_range_table; + s->insn_config = ni_ao_insn_config; + s->insn_write = ni_ao_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) @@ -6075,13 +6030,13 @@ static int ni_E_init(struct comedi_device *dev, */ if (dev->irq && (board->ao_fifo_depth || devpriv->mite)) { dev->write_subdev = s; - s->subdev_flags |= SDF_CMD_WRITE; - s->len_chanlist = s->n_chan; - s->do_cmdtest = ni_ao_cmdtest; - s->do_cmd = ni_ao_cmd; - s->cancel = ni_ao_reset; + s->subdev_flags |= SDF_CMD_WRITE; + s->len_chanlist = s->n_chan; + s->do_cmdtest = ni_ao_cmdtest; + s->do_cmd = ni_ao_cmd; + s->cancel = ni_ao_reset; if (!devpriv->is_m_series) - s->munge = ni_ao_munge; + s->munge = ni_ao_munge; if (devpriv->mite) s->async_dma_dir = DMA_TO_DEVICE; @@ -6093,27 +6048,27 @@ static int ni_E_init(struct comedi_device *dev, /* reset the analog output configuration */ ni_ao_reset(dev, s); } else { - s->type = COMEDI_SUBD_UNUSED; + s->type = COMEDI_SUBD_UNUSED; } /* Digital I/O subdevice */ s = &dev->subdevices[NI_DIO_SUBDEV]; - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_WRITABLE | SDF_READABLE; - s->n_chan = board->has_32dio_chan ? 32 : 8; - s->maxdata = 1; - s->range_table = &range_digital; + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_WRITABLE | SDF_READABLE; + s->n_chan = board->has_32dio_chan ? 32 : 8; + s->maxdata = 1; + s->range_table = &range_digital; if (devpriv->is_m_series) { #ifdef PCIDMA - s->subdev_flags |= SDF_LSAMPL; - s->insn_bits = ni_m_series_dio_insn_bits; - s->insn_config = ni_m_series_dio_insn_config; + s->subdev_flags |= SDF_LSAMPL; + s->insn_bits = ni_m_series_dio_insn_bits; + s->insn_config = ni_m_series_dio_insn_config; if (dev->irq) { - s->subdev_flags |= SDF_CMD_WRITE /* | SDF_CMD_READ */; - s->len_chanlist = s->n_chan; - s->do_cmdtest = ni_cdio_cmdtest; - s->do_cmd = ni_cdio_cmd; - s->cancel = ni_cdio_cancel; + s->subdev_flags |= SDF_CMD_WRITE /* | SDF_CMD_READ */; + s->len_chanlist = s->n_chan; + s->do_cmdtest = ni_cdio_cmdtest; + s->do_cmd = ni_cdio_cmd; + s->cancel = ni_cdio_cancel; /* M-series boards use DMA */ s->async_dma_dir = DMA_BIDIRECTIONAL; @@ -6121,13 +6076,12 @@ static int ni_E_init(struct comedi_device *dev, /* reset DIO and set all channels to inputs */ ni_writel(dev, NI_M_CDO_CMD_RESET | - NI_M_CDI_CMD_RESET, - NI_M_CDIO_CMD_REG); + NI_M_CDI_CMD_RESET, NI_M_CDIO_CMD_REG); ni_writel(dev, s->io_bits, NI_M_DIO_DIR_REG); #endif /* PCIDMA */ } else { - s->insn_bits = ni_dio_insn_bits; - s->insn_config = ni_dio_insn_config; + s->insn_bits = ni_dio_insn_bits; + s->insn_config = ni_dio_insn_config; /* set all channels to inputs */ devpriv->dio_control = NISTC_DIO_CTRL_DIR(s->io_bits); @@ -6151,22 +6105,22 @@ static int ni_E_init(struct comedi_device *dev, /* Calibration subdevice */ s = &dev->subdevices[NI_CALIBRATION_SUBDEV]; - s->type = COMEDI_SUBD_CALIB; - s->subdev_flags = SDF_INTERNAL; - s->n_chan = 1; - s->maxdata = 0; + s->type = COMEDI_SUBD_CALIB; + s->subdev_flags = SDF_INTERNAL; + s->n_chan = 1; + s->maxdata = 0; if (devpriv->is_m_series) { /* internal PWM output used for AI nonlinearity calibration */ - s->insn_config = ni_m_series_pwm_config; + s->insn_config = ni_m_series_pwm_config; ni_writel(dev, 0x0, NI_M_CAL_PWM_REG); } else if (devpriv->is_6143) { /* internal PWM output used for AI nonlinearity calibration */ - s->insn_config = ni_6143_pwm_config; + s->insn_config = ni_6143_pwm_config; } else { - s->subdev_flags |= SDF_WRITABLE; - s->insn_read = ni_calib_insn_read; - s->insn_write = ni_calib_insn_write; + s->subdev_flags |= SDF_WRITABLE; + s->insn_read = ni_calib_insn_read; + s->insn_write = ni_calib_insn_write; /* setup the caldacs and find the real n_chan and maxdata */ caldac_setup(dev, s); @@ -6174,25 +6128,25 @@ static int ni_E_init(struct comedi_device *dev, /* EEPROM subdevice */ s = &dev->subdevices[NI_EEPROM_SUBDEV]; - s->type = COMEDI_SUBD_MEMORY; - s->subdev_flags = SDF_READABLE | SDF_INTERNAL; - s->maxdata = 0xff; + s->type = COMEDI_SUBD_MEMORY; + s->subdev_flags = SDF_READABLE | SDF_INTERNAL; + s->maxdata = 0xff; if (devpriv->is_m_series) { - s->n_chan = M_SERIES_EEPROM_SIZE; - s->insn_read = ni_m_series_eeprom_insn_read; + s->n_chan = M_SERIES_EEPROM_SIZE; + s->insn_read = ni_m_series_eeprom_insn_read; } else { - s->n_chan = 512; - s->insn_read = ni_eeprom_insn_read; + s->n_chan = 512; + s->insn_read = ni_eeprom_insn_read; } /* Digital I/O (PFI) subdevice */ s = &dev->subdevices[NI_PFI_DIO_SUBDEV]; - s->type = COMEDI_SUBD_DIO; - s->maxdata = 1; + s->type = COMEDI_SUBD_DIO; + s->maxdata = 1; if (devpriv->is_m_series) { - s->n_chan = 16; - s->insn_bits = ni_pfi_insn_bits; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_INTERNAL; + s->n_chan = 16; + s->insn_bits = ni_pfi_insn_bits; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_INTERNAL; ni_writew(dev, s->state, NI_M_PFI_DO_REG); for (i = 0; i < NUM_PFI_OUTPUT_SELECT_REGS; ++i) { @@ -6200,10 +6154,10 @@ static int ni_E_init(struct comedi_device *dev, NI_M_PFI_OUT_SEL_REG(i)); } } else { - s->n_chan = 10; - s->subdev_flags = SDF_INTERNAL; + s->n_chan = 10; + s->subdev_flags = SDF_INTERNAL; } - s->insn_config = ni_pfi_insn_config; + s->insn_config = ni_pfi_insn_config; ni_set_bits(dev, NISTC_IO_BIDIR_PIN_REG, ~0, 0); @@ -6245,14 +6199,16 @@ static int ni_E_init(struct comedi_device *dev, /* allocate and initialize the gpct counter device */ devpriv->counter_dev = ni_gpct_device_construct(dev, - ni_gpct_write_register, - ni_gpct_read_register, - (devpriv->is_m_series) - ? ni_gpct_variant_m_series - : ni_gpct_variant_e_series, - NUM_GPCT, - NUM_GPCT, - &devpriv->routing_tables); + ni_gpct_write_register, + ni_gpct_read_register, + (devpriv->is_m_series) + ? + ni_gpct_variant_m_series + : + ni_gpct_variant_e_series, + NUM_GPCT, NUM_GPCT, + &devpriv-> + routing_tables); if (!devpriv->counter_dev) return -ENOMEM; @@ -6264,41 +6220,40 @@ static int ni_E_init(struct comedi_device *dev, ni_tio_init_counter(gpct); s = &dev->subdevices[NI_GPCT_SUBDEV(i)]; - s->type = COMEDI_SUBD_COUNTER; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_LSAMPL; - s->n_chan = 3; - s->maxdata = (devpriv->is_m_series) ? 0xffffffff - : 0x00ffffff; - s->insn_read = ni_tio_insn_read; - s->insn_write = ni_tio_insn_write; - s->insn_config = ni_tio_insn_config; + s->type = COMEDI_SUBD_COUNTER; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_LSAMPL; + s->n_chan = 3; + s->maxdata = (devpriv->is_m_series) ? 0xffffffff : 0x00ffffff; + s->insn_read = ni_tio_insn_read; + s->insn_write = ni_tio_insn_write; + s->insn_config = ni_tio_insn_config; #ifdef PCIDMA if (dev->irq && devpriv->mite) { - s->subdev_flags |= SDF_CMD_READ /* | SDF_CMD_WRITE */; - s->len_chanlist = 1; - s->do_cmdtest = ni_tio_cmdtest; - s->do_cmd = ni_gpct_cmd; - s->cancel = ni_gpct_cancel; + s->subdev_flags |= SDF_CMD_READ /* | SDF_CMD_WRITE */; + s->len_chanlist = 1; + s->do_cmdtest = ni_tio_cmdtest; + s->do_cmd = ni_gpct_cmd; + s->cancel = ni_gpct_cancel; s->async_dma_dir = DMA_BIDIRECTIONAL; } #endif - s->private = gpct; + s->private = gpct; } /* Initialize GPFO_{0,1} to produce output of counters */ - ni_set_gout_routing(0, 0, dev); /* output of counter 0; DAQ STC, p338 */ - ni_set_gout_routing(0, 1, dev); /* output of counter 1; DAQ STC, p338 */ + ni_set_gout_routing(0, 0, dev); /* output of counter 0; DAQ STC, p338 */ + ni_set_gout_routing(0, 1, dev); /* output of counter 1; DAQ STC, p338 */ /* Frequency output subdevice */ s = &dev->subdevices[NI_FREQ_OUT_SUBDEV]; - s->type = COMEDI_SUBD_COUNTER; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 1; - s->maxdata = 0xf; - s->insn_read = ni_freq_out_insn_read; - s->insn_write = ni_freq_out_insn_write; - s->insn_config = ni_freq_out_insn_config; + s->type = COMEDI_SUBD_COUNTER; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 1; + s->maxdata = 0xf; + s->insn_read = ni_freq_out_insn_read; + s->insn_write = ni_freq_out_insn_write; + s->insn_config = ni_freq_out_insn_config; if (dev->irq) { ni_stc_writew(dev, diff --git a/drivers/comedi/drivers/ni_mio_cs.c b/drivers/comedi/drivers/ni_mio_cs.c index 4f37b4e58f09..d67fb658af55 100644 --- a/drivers/comedi/drivers/ni_mio_cs.c +++ b/drivers/comedi/drivers/ni_mio_cs.c @@ -39,76 +39,76 @@ static const struct ni_board_struct ni_boards[] = { { - .name = "DAQCard-ai-16xe-50", - .device_id = 0x010d, - .n_adchan = 16, - .ai_maxdata = 0xffff, - .ai_fifo_depth = 1024, - .gainlkup = ai_gain_8, - .ai_speed = 5000, - .caldac = { dac8800, dac8043 }, - }, { - .name = "DAQCard-ai-16e-4", - .device_id = 0x010c, - .n_adchan = 16, - .ai_maxdata = 0x0fff, - .ai_fifo_depth = 1024, - .gainlkup = ai_gain_16, - .ai_speed = 4000, - .caldac = { mb88341 }, /* verified */ - }, { - .name = "DAQCard-6062E", - .device_id = 0x02c4, - .n_adchan = 16, - .ai_maxdata = 0x0fff, - .ai_fifo_depth = 8192, - .gainlkup = ai_gain_16, - .ai_speed = 2000, - .n_aochan = 2, - .ao_maxdata = 0x0fff, - .ao_fifo_depth = 2048, - .ao_range_table = &range_bipolar10, - .ao_speed = 1176, - .caldac = { ad8804_debug }, /* verified */ - }, { - /* specs incorrect! */ - .name = "DAQCard-6024E", - .device_id = 0x075e, - .n_adchan = 16, - .ai_maxdata = 0x0fff, - .ai_fifo_depth = 1024, - .gainlkup = ai_gain_4, - .ai_speed = 5000, - .n_aochan = 2, - .ao_maxdata = 0x0fff, - .ao_range_table = &range_bipolar10, - .ao_speed = 1000000, - .caldac = { ad8804_debug }, - }, { - /* specs incorrect! */ - .name = "DAQCard-6036E", - .device_id = 0x0245, - .n_adchan = 16, - .ai_maxdata = 0xffff, - .ai_fifo_depth = 1024, - .alwaysdither = 1, - .gainlkup = ai_gain_4, - .ai_speed = 5000, - .n_aochan = 2, - .ao_maxdata = 0xffff, - .ao_range_table = &range_bipolar10, - .ao_speed = 1000000, - .caldac = { ad8804_debug }, - }, + .name = "DAQCard-ai-16xe-50", + .device_id = 0x010d, + .n_adchan = 16, + .ai_maxdata = 0xffff, + .ai_fifo_depth = 1024, + .gainlkup = ai_gain_8, + .ai_speed = 5000, + .caldac = { dac8800, dac8043}, + }, { + .name = "DAQCard-ai-16e-4", + .device_id = 0x010c, + .n_adchan = 16, + .ai_maxdata = 0x0fff, + .ai_fifo_depth = 1024, + .gainlkup = ai_gain_16, + .ai_speed = 4000, + .caldac = { mb88341}, /* verified */ + }, { + .name = "DAQCard-6062E", + .device_id = 0x02c4, + .n_adchan = 16, + .ai_maxdata = 0x0fff, + .ai_fifo_depth = 8192, + .gainlkup = ai_gain_16, + .ai_speed = 2000, + .n_aochan = 2, + .ao_maxdata = 0x0fff, + .ao_fifo_depth = 2048, + .ao_range_table = &range_bipolar10, + .ao_speed = 1176, + .caldac = { ad8804_debug}, /* verified */ + }, { + /* specs incorrect! */ + .name = "DAQCard-6024E", + .device_id = 0x075e, + .n_adchan = 16, + .ai_maxdata = 0x0fff, + .ai_fifo_depth = 1024, + .gainlkup = ai_gain_4, + .ai_speed = 5000, + .n_aochan = 2, + .ao_maxdata = 0x0fff, + .ao_range_table = &range_bipolar10, + .ao_speed = 1000000, + .caldac = { ad8804_debug}, + }, { + /* specs incorrect! */ + .name = "DAQCard-6036E", + .device_id = 0x0245, + .n_adchan = 16, + .ai_maxdata = 0xffff, + .ai_fifo_depth = 1024, + .alwaysdither = 1, + .gainlkup = ai_gain_4, + .ai_speed = 5000, + .n_aochan = 2, + .ao_maxdata = 0xffff, + .ao_range_table = &range_bipolar10, + .ao_speed = 1000000, + .caldac = { ad8804_debug}, + }, #if 0 { - .name = "DAQCard-6715", - .device_id = 0x0000, /* unknown */ - .n_aochan = 8, - .ao_maxdata = 0x0fff, - .ao_671x = 8192, - .caldac = { mb88341, mb88341 }, - }, + .name = "DAQCard-6715", + .device_id = 0x0000, /* unknown */ + .n_aochan = 8, + .ao_maxdata = 0x0fff, + .ao_671x = 8192, + .caldac = { mb88341, mb88341}, + }, #endif }; @@ -144,8 +144,7 @@ static int mio_pcmcia_config_loop(struct pcmcia_device *p_dev, void *priv_data) return -ENODEV; } -static int mio_cs_auto_attach(struct comedi_device *dev, - unsigned long context) +static int mio_cs_auto_attach(struct comedi_device *dev, unsigned long context) { struct pcmcia_device *link = comedi_to_pcmcia_dev(dev); static const struct ni_board_struct *board; @@ -183,10 +182,10 @@ static void mio_cs_detach(struct comedi_device *dev) } static struct comedi_driver driver_ni_mio_cs = { - .driver_name = "ni_mio_cs", - .module = THIS_MODULE, - .auto_attach = mio_cs_auto_attach, - .detach = mio_cs_detach, + .driver_name = "ni_mio_cs", + .module = THIS_MODULE, + .auto_attach = mio_cs_auto_attach, + .detach = mio_cs_detach, }; static int cs_attach(struct pcmcia_device *link) @@ -202,15 +201,17 @@ static const struct pcmcia_device_id ni_mio_cs_ids[] = { PCMCIA_DEVICE_MANF_CARD(0x010b, 0x0245), /* DAQCard-6036E */ PCMCIA_DEVICE_NULL }; + MODULE_DEVICE_TABLE(pcmcia, ni_mio_cs_ids); static struct pcmcia_driver ni_mio_cs_driver = { - .name = "ni_mio_cs", - .owner = THIS_MODULE, - .id_table = ni_mio_cs_ids, - .probe = cs_attach, - .remove = comedi_pcmcia_auto_unconfig, + .name = "ni_mio_cs", + .owner = THIS_MODULE, + .id_table = ni_mio_cs_ids, + .probe = cs_attach, + .remove = comedi_pcmcia_auto_unconfig, }; + module_comedi_pcmcia_driver(driver_ni_mio_cs, ni_mio_cs_driver); MODULE_DESCRIPTION("Comedi driver for National Instruments DAQCard E series"); diff --git a/drivers/comedi/drivers/ni_pcidio.c b/drivers/comedi/drivers/ni_pcidio.c index 623f8d08d13a..640b8f0341ab 100644 --- a/drivers/comedi/drivers/ni_pcidio.c +++ b/drivers/comedi/drivers/ni_pcidio.c @@ -267,18 +267,18 @@ struct nidio_board { static const struct nidio_board nidio_boards[] = { [BOARD_PCIDIO_32HS] = { - .name = "pci-dio-32hs", - .dio_speed = 50, - }, + .name = "pci-dio-32hs", + .dio_speed = 50, + }, [BOARD_PXI6533] = { - .name = "pxi-6533", - .dio_speed = 50, - }, + .name = "pxi-6533", + .dio_speed = 50, + }, [BOARD_PCI6534] = { - .name = "pci-6534", - .uses_firmware = 1, - .dio_speed = 50, - }, + .name = "pci-6534", + .uses_firmware = 1, + .dio_speed = 50, + }, }; struct nidio96_private { @@ -419,8 +419,7 @@ static irqreturn_t nidio_interrupt(int irq, void *d) dev_dbg(dev->class_dev, "too much work in interrupt\n"); writeb(0x00, dev->mmio + - MASTER_DMA_AND_INTERRUPT_CONTROL - ); + MASTER_DMA_AND_INTERRUPT_CONTROL); goto out; } auxdata = readl(dev->mmio + GROUP_1_FIFO); @@ -466,8 +465,7 @@ static irqreturn_t nidio_interrupt(int irq, void *d) static int ni_pcidio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { int ret; @@ -491,8 +489,7 @@ static int ni_pcidio_insn_config(struct comedi_device *dev, static int ni_pcidio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { if (comedi_dio_update_state(s, data)) writel(s->state, dev->mmio + PORT_IO(0)); @@ -579,7 +576,7 @@ static int ni_pcidio_cmdtest(struct comedi_device *dev, if (cmd->stop_src == TRIG_COUNT) err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); - else /* TRIG_NONE */ + else /* TRIG_NONE */ err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) @@ -600,8 +597,7 @@ static int ni_pcidio_cmdtest(struct comedi_device *dev, } static int ni_pcidio_inttrig(struct comedi_device *dev, - struct comedi_subdevice *s, - unsigned int trig_num) + struct comedi_subdevice *s, unsigned int trig_num) { struct nidio96_private *devpriv = dev->private; struct comedi_cmd *cmd = &s->async->cmd; @@ -670,7 +666,7 @@ static int ni_pcidio_cmd(struct comedi_device *dev, struct comedi_subdevice *s) writeb(4, dev->mmio + BLOCK_MODE); if (!(cmd->scan_begin_arg & CR_INVERT)) /* Leading Edge */ writeb(0, dev->mmio + LINE_POLARITIES); - else /* Trailing Edge */ + else /* Trailing Edge */ writeb(2, dev->mmio + LINE_POLARITIES); writeb(0x00, dev->mmio + ACK_SER); writel(1, dev->mmio + START_DELAY); @@ -684,8 +680,7 @@ static int ni_pcidio_cmd(struct comedi_device *dev, struct comedi_subdevice *s) } if (cmd->stop_src == TRIG_COUNT) { - writel(cmd->stop_arg, - dev->mmio + TRANSFER_COUNT); + writel(cmd->stop_arg, dev->mmio + TRANSFER_COUNT); } else { /* XXX */ } @@ -754,7 +749,7 @@ static int ni_pcidio_change(struct comedi_device *dev, } static int pci_6534_load_fpga(struct comedi_device *dev, - const u8 *data, size_t data_len, + const u8 *data, size_t data_len, unsigned long context) { static const int timeout = 1000; @@ -857,8 +852,7 @@ static int pci_6534_upload_firmware(struct comedi_device *dev) /* load main FPGA first, then the two scarabs */ for (n = 2; n >= 0; n--) { ret = comedi_load_firmware(dev, &devpriv->mite->pcidev->dev, - fw_file[n], - pci_6534_load_fpga, n); + fw_file[n], pci_6534_load_fpga, n); if (ret == 0 && n == 2) pci_6534_init_main_fpga(dev); if (ret < 0) @@ -877,8 +871,7 @@ static void nidio_reset_board(struct comedi_device *dev) writeb(0, dev->mmio + MASTER_DMA_AND_INTERRUPT_CONTROL); } -static int nidio_auto_attach(struct comedi_device *dev, - unsigned long context) +static int nidio_auto_attach(struct comedi_device *dev, unsigned long context) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); const struct nidio_board *board = NULL; @@ -932,8 +925,8 @@ static int nidio_auto_attach(struct comedi_device *dev, dev->read_subdev = s; s->type = COMEDI_SUBD_DIO; s->subdev_flags = - SDF_READABLE | SDF_WRITABLE | SDF_LSAMPL | SDF_PACKED | - SDF_CMD_READ; + SDF_READABLE | SDF_WRITABLE | SDF_LSAMPL | SDF_PACKED | + SDF_CMD_READ; s->n_chan = 32; s->range_table = &range_digital; s->maxdata = 1; @@ -977,10 +970,10 @@ static void nidio_detach(struct comedi_device *dev) } static struct comedi_driver ni_pcidio_driver = { - .driver_name = "ni_pcidio", - .module = THIS_MODULE, - .auto_attach = nidio_auto_attach, - .detach = nidio_detach, + .driver_name = "ni_pcidio", + .module = THIS_MODULE, + .auto_attach = nidio_auto_attach, + .detach = nidio_detach, }; static int ni_pcidio_pci_probe(struct pci_dev *dev, @@ -995,14 +988,16 @@ static const struct pci_device_id ni_pcidio_pci_table[] = { { PCI_VDEVICE(NI, 0x1320), BOARD_PXI6533 }, { 0 } }; + MODULE_DEVICE_TABLE(pci, ni_pcidio_pci_table); static struct pci_driver ni_pcidio_pci_driver = { - .name = "ni_pcidio", - .id_table = ni_pcidio_pci_table, - .probe = ni_pcidio_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "ni_pcidio", + .id_table = ni_pcidio_pci_table, + .probe = ni_pcidio_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(ni_pcidio_driver, ni_pcidio_pci_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/ni_pcimio.c b/drivers/comedi/drivers/ni_pcimio.c index 6c813a490ba5..3d633a68ad18 100644 --- a/drivers/comedi/drivers/ni_pcimio.c +++ b/drivers/comedi/drivers/ni_pcimio.c @@ -114,24 +114,24 @@ */ static const struct comedi_lrange range_ni_M_628x_ao = { 8, { - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(2), - BIP_RANGE(1), - RANGE(-5, 15), - UNI_RANGE(10), - RANGE(3, 7), - RANGE(4, 6), - RANGE_ext(-1, 1) - } + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(2), + BIP_RANGE(1), + RANGE(-5, 15), + UNI_RANGE(10), + RANGE(3, 7), + RANGE(4, 6), + RANGE_ext(-1, 1) + } }; static const struct comedi_lrange range_ni_M_625x_ao = { 3, { - BIP_RANGE(10), - BIP_RANGE(5), - RANGE_ext(-1, 1) - } + BIP_RANGE(10), + BIP_RANGE(5), + RANGE_ext(-1, 1) + } }; enum ni_pcimio_boardid { @@ -207,939 +199,941 @@ enum ni_pcimio_boardid { static const struct ni_board_struct ni_boards[] = { [BOARD_PCIMIO_16XE_50] = { - .name = "pci-mio-16xe-50", - .n_adchan = 16, - .ai_maxdata = 0xffff, - .ai_fifo_depth = 2048, - .alwaysdither = 1, - .gainlkup = ai_gain_8, - .ai_speed = 50000, - .n_aochan = 2, - .ao_maxdata = 0x0fff, - .ao_range_table = &range_bipolar10, - .ao_speed = 50000, - .caldac = { dac8800, dac8043 }, - }, + .name = "pci-mio-16xe-50", + .n_adchan = 16, + .ai_maxdata = 0xffff, + .ai_fifo_depth = 2048, + .alwaysdither = 1, + .gainlkup = ai_gain_8, + .ai_speed = 50000, + .n_aochan = 2, + .ao_maxdata = 0x0fff, + .ao_range_table = &range_bipolar10, + .ao_speed = 50000, + .caldac = { dac8800, dac8043}, + }, [BOARD_PCIMIO_16XE_10] = { - .name = "pci-mio-16xe-10", /* aka pci-6030E */ - .n_adchan = 16, - .ai_maxdata = 0xffff, - .ai_fifo_depth = 512, - .alwaysdither = 1, - .gainlkup = ai_gain_14, - .ai_speed = 10000, - .n_aochan = 2, - .ao_maxdata = 0xffff, - .ao_fifo_depth = 2048, - .ao_range_table = &range_ni_E_ao_ext, - .ao_speed = 10000, - .caldac = { dac8800, dac8043, ad8522 }, - }, + .name = "pci-mio-16xe-10", /* aka pci-6030E */ + .n_adchan = 16, + .ai_maxdata = 0xffff, + .ai_fifo_depth = 512, + .alwaysdither = 1, + .gainlkup = ai_gain_14, + .ai_speed = 10000, + .n_aochan = 2, + .ao_maxdata = 0xffff, + .ao_fifo_depth = 2048, + .ao_range_table = &range_ni_E_ao_ext, + .ao_speed = 10000, + .caldac = { dac8800, dac8043, ad8522}, + }, [BOARD_PCI6014] = { - .name = "pci-6014", - .n_adchan = 16, - .ai_maxdata = 0xffff, - .ai_fifo_depth = 512, - .alwaysdither = 1, - .gainlkup = ai_gain_4, - .ai_speed = 5000, - .n_aochan = 2, - .ao_maxdata = 0xffff, - .ao_range_table = &range_bipolar10, - .ao_speed = 100000, - .caldac = { ad8804_debug }, - }, + .name = "pci-6014", + .n_adchan = 16, + .ai_maxdata = 0xffff, + .ai_fifo_depth = 512, + .alwaysdither = 1, + .gainlkup = ai_gain_4, + .ai_speed = 5000, + .n_aochan = 2, + .ao_maxdata = 0xffff, + .ao_range_table = &range_bipolar10, + .ao_speed = 100000, + .caldac = { ad8804_debug}, + }, [BOARD_PXI6030E] = { - .name = "pxi-6030e", - .n_adchan = 16, - .ai_maxdata = 0xffff, - .ai_fifo_depth = 512, - .alwaysdither = 1, - .gainlkup = ai_gain_14, - .ai_speed = 10000, - .n_aochan = 2, - .ao_maxdata = 0xffff, - .ao_fifo_depth = 2048, - .ao_range_table = &range_ni_E_ao_ext, - .ao_speed = 10000, - .caldac = { dac8800, dac8043, ad8522 }, - }, + .name = "pxi-6030e", + .n_adchan = 16, + .ai_maxdata = 0xffff, + .ai_fifo_depth = 512, + .alwaysdither = 1, + .gainlkup = ai_gain_14, + .ai_speed = 10000, + .n_aochan = 2, + .ao_maxdata = 0xffff, + .ao_fifo_depth = 2048, + .ao_range_table = &range_ni_E_ao_ext, + .ao_speed = 10000, + .caldac = { dac8800, dac8043, ad8522}, + }, [BOARD_PCIMIO_16E_1] = { - .name = "pci-mio-16e-1", /* aka pci-6070e */ - .n_adchan = 16, - .ai_maxdata = 0x0fff, - .ai_fifo_depth = 512, - .gainlkup = ai_gain_16, - .ai_speed = 800, - .n_aochan = 2, - .ao_maxdata = 0x0fff, - .ao_fifo_depth = 2048, - .ao_range_table = &range_ni_E_ao_ext, - .ao_speed = 1000, - .caldac = { mb88341 }, - }, + .name = "pci-mio-16e-1", /* aka pci-6070e */ + .n_adchan = 16, + .ai_maxdata = 0x0fff, + .ai_fifo_depth = 512, + .gainlkup = ai_gain_16, + .ai_speed = 800, + .n_aochan = 2, + .ao_maxdata = 0x0fff, + .ao_fifo_depth = 2048, + .ao_range_table = &range_ni_E_ao_ext, + .ao_speed = 1000, + .caldac = { mb88341}, + }, [BOARD_PCIMIO_16E_4] = { - .name = "pci-mio-16e-4", /* aka pci-6040e */ - .n_adchan = 16, - .ai_maxdata = 0x0fff, - .ai_fifo_depth = 512, - .gainlkup = ai_gain_16, - /* - * there have been reported problems with - * full speed on this board - */ - .ai_speed = 2000, - .n_aochan = 2, - .ao_maxdata = 0x0fff, - .ao_fifo_depth = 512, - .ao_range_table = &range_ni_E_ao_ext, - .ao_speed = 1000, - .caldac = { ad8804_debug }, /* doc says mb88341 */ - }, + .name = "pci-mio-16e-4", /* aka pci-6040e */ + .n_adchan = 16, + .ai_maxdata = 0x0fff, + .ai_fifo_depth = 512, + .gainlkup = ai_gain_16, + /* + * there have been reported problems with + * full speed on this board + */ + .ai_speed = 2000, + .n_aochan = 2, + .ao_maxdata = 0x0fff, + .ao_fifo_depth = 512, + .ao_range_table = &range_ni_E_ao_ext, + .ao_speed = 1000, + .caldac = { ad8804_debug}, /* doc says mb88341 */ + }, [BOARD_PXI6040E] = { - .name = "pxi-6040e", - .n_adchan = 16, - .ai_maxdata = 0x0fff, - .ai_fifo_depth = 512, - .gainlkup = ai_gain_16, - .ai_speed = 2000, - .n_aochan = 2, - .ao_maxdata = 0x0fff, - .ao_fifo_depth = 512, - .ao_range_table = &range_ni_E_ao_ext, - .ao_speed = 1000, - .caldac = { mb88341 }, - }, + .name = "pxi-6040e", + .n_adchan = 16, + .ai_maxdata = 0x0fff, + .ai_fifo_depth = 512, + .gainlkup = ai_gain_16, + .ai_speed = 2000, + .n_aochan = 2, + .ao_maxdata = 0x0fff, + .ao_fifo_depth = 512, + .ao_range_table = &range_ni_E_ao_ext, + .ao_speed = 1000, + .caldac = { mb88341}, + }, [BOARD_PCI6031E] = { - .name = "pci-6031e", - .n_adchan = 64, - .ai_maxdata = 0xffff, - .ai_fifo_depth = 512, - .alwaysdither = 1, - .gainlkup = ai_gain_14, - .ai_speed = 10000, - .n_aochan = 2, - .ao_maxdata = 0xffff, - .ao_fifo_depth = 2048, - .ao_range_table = &range_ni_E_ao_ext, - .ao_speed = 10000, - .caldac = { dac8800, dac8043, ad8522 }, - }, + .name = "pci-6031e", + .n_adchan = 64, + .ai_maxdata = 0xffff, + .ai_fifo_depth = 512, + .alwaysdither = 1, + .gainlkup = ai_gain_14, + .ai_speed = 10000, + .n_aochan = 2, + .ao_maxdata = 0xffff, + .ao_fifo_depth = 2048, + .ao_range_table = &range_ni_E_ao_ext, + .ao_speed = 10000, + .caldac = { dac8800, dac8043, ad8522}, + }, [BOARD_PCI6032E] = { - .name = "pci-6032e", - .n_adchan = 16, - .ai_maxdata = 0xffff, - .ai_fifo_depth = 512, - .alwaysdither = 1, - .gainlkup = ai_gain_14, - .ai_speed = 10000, - .caldac = { dac8800, dac8043, ad8522 }, - }, + .name = "pci-6032e", + .n_adchan = 16, + .ai_maxdata = 0xffff, + .ai_fifo_depth = 512, + .alwaysdither = 1, + .gainlkup = ai_gain_14, + .ai_speed = 10000, + .caldac = { dac8800, dac8043, ad8522}, + }, [BOARD_PCI6033E] = { - .name = "pci-6033e", - .n_adchan = 64, - .ai_maxdata = 0xffff, - .ai_fifo_depth = 512, - .alwaysdither = 1, - .gainlkup = ai_gain_14, - .ai_speed = 10000, - .caldac = { dac8800, dac8043, ad8522 }, - }, + .name = "pci-6033e", + .n_adchan = 64, + .ai_maxdata = 0xffff, + .ai_fifo_depth = 512, + .alwaysdither = 1, + .gainlkup = ai_gain_14, + .ai_speed = 10000, + .caldac = { dac8800, dac8043, ad8522}, + }, [BOARD_PCI6071E] = { - .name = "pci-6071e", - .n_adchan = 64, - .ai_maxdata = 0x0fff, - .ai_fifo_depth = 512, - .alwaysdither = 1, - .gainlkup = ai_gain_16, - .ai_speed = 800, - .n_aochan = 2, - .ao_maxdata = 0x0fff, - .ao_fifo_depth = 2048, - .ao_range_table = &range_ni_E_ao_ext, - .ao_speed = 1000, - .caldac = { ad8804_debug }, - }, + .name = "pci-6071e", + .n_adchan = 64, + .ai_maxdata = 0x0fff, + .ai_fifo_depth = 512, + .alwaysdither = 1, + .gainlkup = ai_gain_16, + .ai_speed = 800, + .n_aochan = 2, + .ao_maxdata = 0x0fff, + .ao_fifo_depth = 2048, + .ao_range_table = &range_ni_E_ao_ext, + .ao_speed = 1000, + .caldac = { ad8804_debug}, + }, [BOARD_PCI6023E] = { - .name = "pci-6023e", - .n_adchan = 16, - .ai_maxdata = 0x0fff, - .ai_fifo_depth = 512, - .gainlkup = ai_gain_4, - .ai_speed = 5000, - .caldac = { ad8804_debug }, /* manual is wrong */ - }, + .name = "pci-6023e", + .n_adchan = 16, + .ai_maxdata = 0x0fff, + .ai_fifo_depth = 512, + .gainlkup = ai_gain_4, + .ai_speed = 5000, + .caldac = { ad8804_debug}, /* manual is wrong */ + }, [BOARD_PCI6024E] = { - .name = "pci-6024e", - .n_adchan = 16, - .ai_maxdata = 0x0fff, - .ai_fifo_depth = 512, - .gainlkup = ai_gain_4, - .ai_speed = 5000, - .n_aochan = 2, - .ao_maxdata = 0x0fff, - .ao_range_table = &range_bipolar10, - .ao_speed = 100000, - .caldac = { ad8804_debug }, /* manual is wrong */ - }, + .name = "pci-6024e", + .n_adchan = 16, + .ai_maxdata = 0x0fff, + .ai_fifo_depth = 512, + .gainlkup = ai_gain_4, + .ai_speed = 5000, + .n_aochan = 2, + .ao_maxdata = 0x0fff, + .ao_range_table = &range_bipolar10, + .ao_speed = 100000, + .caldac = { ad8804_debug}, /* manual is wrong */ + }, [BOARD_PCI6025E] = { - .name = "pci-6025e", - .n_adchan = 16, - .ai_maxdata = 0x0fff, - .ai_fifo_depth = 512, - .gainlkup = ai_gain_4, - .ai_speed = 5000, - .n_aochan = 2, - .ao_maxdata = 0x0fff, - .ao_range_table = &range_bipolar10, - .ao_speed = 100000, - .caldac = { ad8804_debug }, /* manual is wrong */ - .has_8255 = 1, - }, + .name = "pci-6025e", + .n_adchan = 16, + .ai_maxdata = 0x0fff, + .ai_fifo_depth = 512, + .gainlkup = ai_gain_4, + .ai_speed = 5000, + .n_aochan = 2, + .ao_maxdata = 0x0fff, + .ao_range_table = &range_bipolar10, + .ao_speed = 100000, + .caldac = { ad8804_debug}, /* manual is wrong */ + .has_8255 = 1, + }, [BOARD_PXI6025E] = { - .name = "pxi-6025e", - .n_adchan = 16, - .ai_maxdata = 0x0fff, - .ai_fifo_depth = 512, - .gainlkup = ai_gain_4, - .ai_speed = 5000, - .n_aochan = 2, - .ao_maxdata = 0x0fff, - .ao_range_table = &range_ni_E_ao_ext, - .ao_speed = 100000, - .caldac = { ad8804_debug }, /* manual is wrong */ - .has_8255 = 1, - }, + .name = "pxi-6025e", + .n_adchan = 16, + .ai_maxdata = 0x0fff, + .ai_fifo_depth = 512, + .gainlkup = ai_gain_4, + .ai_speed = 5000, + .n_aochan = 2, + .ao_maxdata = 0x0fff, + .ao_range_table = &range_ni_E_ao_ext, + .ao_speed = 100000, + .caldac = { ad8804_debug}, /* manual is wrong */ + .has_8255 = 1, + }, [BOARD_PCI6034E] = { - .name = "pci-6034e", - .n_adchan = 16, - .ai_maxdata = 0xffff, - .ai_fifo_depth = 512, - .alwaysdither = 1, - .gainlkup = ai_gain_4, - .ai_speed = 5000, - .caldac = { ad8804_debug }, - }, + .name = "pci-6034e", + .n_adchan = 16, + .ai_maxdata = 0xffff, + .ai_fifo_depth = 512, + .alwaysdither = 1, + .gainlkup = ai_gain_4, + .ai_speed = 5000, + .caldac = { ad8804_debug}, + }, [BOARD_PCI6035E] = { - .name = "pci-6035e", - .n_adchan = 16, - .ai_maxdata = 0xffff, - .ai_fifo_depth = 512, - .alwaysdither = 1, - .gainlkup = ai_gain_4, - .ai_speed = 5000, - .n_aochan = 2, - .ao_maxdata = 0x0fff, - .ao_range_table = &range_bipolar10, - .ao_speed = 100000, - .caldac = { ad8804_debug }, - }, + .name = "pci-6035e", + .n_adchan = 16, + .ai_maxdata = 0xffff, + .ai_fifo_depth = 512, + .alwaysdither = 1, + .gainlkup = ai_gain_4, + .ai_speed = 5000, + .n_aochan = 2, + .ao_maxdata = 0x0fff, + .ao_range_table = &range_bipolar10, + .ao_speed = 100000, + .caldac = { ad8804_debug}, + }, [BOARD_PCI6052E] = { - .name = "pci-6052e", - .n_adchan = 16, - .ai_maxdata = 0xffff, - .ai_fifo_depth = 512, - .alwaysdither = 1, - .gainlkup = ai_gain_16, - .ai_speed = 3000, - .n_aochan = 2, - .ao_maxdata = 0xffff, - .ao_fifo_depth = 2048, - .ao_range_table = &range_ni_E_ao_ext, - .ao_speed = 3000, - /* manual is wrong */ - .caldac = { ad8804_debug, ad8804_debug, ad8522 }, - }, + .name = "pci-6052e", + .n_adchan = 16, + .ai_maxdata = 0xffff, + .ai_fifo_depth = 512, + .alwaysdither = 1, + .gainlkup = ai_gain_16, + .ai_speed = 3000, + .n_aochan = 2, + .ao_maxdata = 0xffff, + .ao_fifo_depth = 2048, + .ao_range_table = &range_ni_E_ao_ext, + .ao_speed = 3000, + /* manual is wrong */ + .caldac = { ad8804_debug, ad8804_debug, ad8522}, + }, [BOARD_PCI6110] = { - .name = "pci-6110", - .n_adchan = 4, - .ai_maxdata = 0x0fff, - .ai_fifo_depth = 8192, - .alwaysdither = 0, - .gainlkup = ai_gain_611x, - .ai_speed = 200, - .n_aochan = 2, - .ao_maxdata = 0xffff, - .reg_type = ni_reg_611x, - .ao_range_table = &range_bipolar10, - .ao_fifo_depth = 2048, - .ao_speed = 250, - .caldac = { ad8804, ad8804 }, - }, + .name = "pci-6110", + .n_adchan = 4, + .ai_maxdata = 0x0fff, + .ai_fifo_depth = 8192, + .alwaysdither = 0, + .gainlkup = ai_gain_611x, + .ai_speed = 200, + .n_aochan = 2, + .ao_maxdata = 0xffff, + .reg_type = ni_reg_611x, + .ao_range_table = &range_bipolar10, + .ao_fifo_depth = 2048, + .ao_speed = 250, + .caldac = { ad8804, ad8804}, + }, [BOARD_PCI6111] = { - .name = "pci-6111", - .n_adchan = 2, - .ai_maxdata = 0x0fff, - .ai_fifo_depth = 8192, - .gainlkup = ai_gain_611x, - .ai_speed = 200, - .n_aochan = 2, - .ao_maxdata = 0xffff, - .reg_type = ni_reg_611x, - .ao_range_table = &range_bipolar10, - .ao_fifo_depth = 2048, - .ao_speed = 250, - .caldac = { ad8804, ad8804 }, - }, + .name = "pci-6111", + .n_adchan = 2, + .ai_maxdata = 0x0fff, + .ai_fifo_depth = 8192, + .gainlkup = ai_gain_611x, + .ai_speed = 200, + .n_aochan = 2, + .ao_maxdata = 0xffff, + .reg_type = ni_reg_611x, + .ao_range_table = &range_bipolar10, + .ao_fifo_depth = 2048, + .ao_speed = 250, + .caldac = { ad8804, ad8804}, + }, #if 0 /* The 6115 boards probably need their own driver */ [BOARD_PCI6115] = { /* .device_id = 0x2ed0, */ - .name = "pci-6115", - .n_adchan = 4, - .ai_maxdata = 0x0fff, - .ai_fifo_depth = 8192, - .gainlkup = ai_gain_611x, - .ai_speed = 100, - .n_aochan = 2, - .ao_maxdata = 0xffff, - .ao_671x = 1, - .ao_fifo_depth = 2048, - .ao_speed = 250, - .reg_611x = 1, - /* XXX */ - .caldac = { ad8804_debug, ad8804_debug, ad8804_debug }, - }, + .name = "pci-6115", + .n_adchan = 4, + .ai_maxdata = 0x0fff, + .ai_fifo_depth = 8192, + .gainlkup = ai_gain_611x, + .ai_speed = 100, + .n_aochan = 2, + .ao_maxdata = 0xffff, + .ao_671x = 1, + .ao_fifo_depth = 2048, + .ao_speed = 250, + .reg_611x = 1, + /* XXX */ + .caldac = { + ad8804_debug, ad8804_debug, ad8804_debug}, + }, #endif #if 0 [BOARD_PXI6115] = { /* .device_id = ????, */ - .name = "pxi-6115", - .n_adchan = 4, - .ai_maxdata = 0x0fff, - .ai_fifo_depth = 8192, - .gainlkup = ai_gain_611x, - .ai_speed = 100, - .n_aochan = 2, - .ao_maxdata = 0xffff, - .ao_671x = 1, - .ao_fifo_depth = 2048, - .ao_speed = 250, - .reg_611x = 1, - /* XXX */ - .caldac = { ad8804_debug, ad8804_debug, ad8804_debug }, - }, + .name = "pxi-6115", + .n_adchan = 4, + .ai_maxdata = 0x0fff, + .ai_fifo_depth = 8192, + .gainlkup = ai_gain_611x, + .ai_speed = 100, + .n_aochan = 2, + .ao_maxdata = 0xffff, + .ao_671x = 1, + .ao_fifo_depth = 2048, + .ao_speed = 250, + .reg_611x = 1, + /* XXX */ + .caldac = { + ad8804_debug, ad8804_debug, ad8804_debug}, + }, #endif [BOARD_PCI6711] = { - .name = "pci-6711", - .n_aochan = 4, - .ao_maxdata = 0x0fff, - /* data sheet says 8192, but fifo really holds 16384 samples */ - .ao_fifo_depth = 16384, - .ao_range_table = &range_bipolar10, - .ao_speed = 1000, - .reg_type = ni_reg_6711, - .caldac = { ad8804_debug }, - }, + .name = "pci-6711", + .n_aochan = 4, + .ao_maxdata = 0x0fff, + /* data sheet says 8192, but fifo really holds 16384 samples */ + .ao_fifo_depth = 16384, + .ao_range_table = &range_bipolar10, + .ao_speed = 1000, + .reg_type = ni_reg_6711, + .caldac = { ad8804_debug}, + }, [BOARD_PXI6711] = { - .name = "pxi-6711", - .n_aochan = 4, - .ao_maxdata = 0x0fff, - .ao_fifo_depth = 16384, - .ao_range_table = &range_bipolar10, - .ao_speed = 1000, - .reg_type = ni_reg_6711, - .caldac = { ad8804_debug }, - }, + .name = "pxi-6711", + .n_aochan = 4, + .ao_maxdata = 0x0fff, + .ao_fifo_depth = 16384, + .ao_range_table = &range_bipolar10, + .ao_speed = 1000, + .reg_type = ni_reg_6711, + .caldac = { ad8804_debug}, + }, [BOARD_PCI6713] = { - .name = "pci-6713", - .n_aochan = 8, - .ao_maxdata = 0x0fff, - .ao_fifo_depth = 16384, - .ao_range_table = &range_bipolar10, - .ao_speed = 1000, - .reg_type = ni_reg_6713, - .caldac = { ad8804_debug, ad8804_debug }, - }, + .name = "pci-6713", + .n_aochan = 8, + .ao_maxdata = 0x0fff, + .ao_fifo_depth = 16384, + .ao_range_table = &range_bipolar10, + .ao_speed = 1000, + .reg_type = ni_reg_6713, + .caldac = { ad8804_debug, ad8804_debug}, + }, [BOARD_PXI6713] = { - .name = "pxi-6713", - .n_aochan = 8, - .ao_maxdata = 0x0fff, - .ao_fifo_depth = 16384, - .ao_range_table = &range_bipolar10, - .ao_speed = 1000, - .reg_type = ni_reg_6713, - .caldac = { ad8804_debug, ad8804_debug }, - }, + .name = "pxi-6713", + .n_aochan = 8, + .ao_maxdata = 0x0fff, + .ao_fifo_depth = 16384, + .ao_range_table = &range_bipolar10, + .ao_speed = 1000, + .reg_type = ni_reg_6713, + .caldac = { ad8804_debug, ad8804_debug}, + }, [BOARD_PCI6731] = { - .name = "pci-6731", - .n_aochan = 4, - .ao_maxdata = 0xffff, - .ao_fifo_depth = 8192, - .ao_range_table = &range_bipolar10, - .ao_speed = 1000, - .reg_type = ni_reg_6711, - .caldac = { ad8804_debug }, - }, + .name = "pci-6731", + .n_aochan = 4, + .ao_maxdata = 0xffff, + .ao_fifo_depth = 8192, + .ao_range_table = &range_bipolar10, + .ao_speed = 1000, + .reg_type = ni_reg_6711, + .caldac = { ad8804_debug}, + }, #if 0 [BOARD_PXI6731] = { /* .device_id = ????, */ - .name = "pxi-6731", - .n_aochan = 4, - .ao_maxdata = 0xffff, - .ao_fifo_depth = 8192, - .ao_range_table = &range_bipolar10, - .reg_type = ni_reg_6711, - .caldac = { ad8804_debug }, - }, + .name = "pxi-6731", + .n_aochan = 4, + .ao_maxdata = 0xffff, + .ao_fifo_depth = 8192, + .ao_range_table = &range_bipolar10, + .reg_type = ni_reg_6711, + .caldac = { ad8804_debug}, + }, #endif [BOARD_PCI6733] = { - .name = "pci-6733", - .n_aochan = 8, - .ao_maxdata = 0xffff, - .ao_fifo_depth = 16384, - .ao_range_table = &range_bipolar10, - .ao_speed = 1000, - .reg_type = ni_reg_6713, - .caldac = { ad8804_debug, ad8804_debug }, - }, + .name = "pci-6733", + .n_aochan = 8, + .ao_maxdata = 0xffff, + .ao_fifo_depth = 16384, + .ao_range_table = &range_bipolar10, + .ao_speed = 1000, + .reg_type = ni_reg_6713, + .caldac = { ad8804_debug, ad8804_debug}, + }, [BOARD_PXI6733] = { - .name = "pxi-6733", - .n_aochan = 8, - .ao_maxdata = 0xffff, - .ao_fifo_depth = 16384, - .ao_range_table = &range_bipolar10, - .ao_speed = 1000, - .reg_type = ni_reg_6713, - .caldac = { ad8804_debug, ad8804_debug }, - }, + .name = "pxi-6733", + .n_aochan = 8, + .ao_maxdata = 0xffff, + .ao_fifo_depth = 16384, + .ao_range_table = &range_bipolar10, + .ao_speed = 1000, + .reg_type = ni_reg_6713, + .caldac = { ad8804_debug, ad8804_debug}, + }, [BOARD_PXI6071E] = { - .name = "pxi-6071e", - .n_adchan = 64, - .ai_maxdata = 0x0fff, - .ai_fifo_depth = 512, - .alwaysdither = 1, - .gainlkup = ai_gain_16, - .ai_speed = 800, - .n_aochan = 2, - .ao_maxdata = 0x0fff, - .ao_fifo_depth = 2048, - .ao_range_table = &range_ni_E_ao_ext, - .ao_speed = 1000, - .caldac = { ad8804_debug }, - }, + .name = "pxi-6071e", + .n_adchan = 64, + .ai_maxdata = 0x0fff, + .ai_fifo_depth = 512, + .alwaysdither = 1, + .gainlkup = ai_gain_16, + .ai_speed = 800, + .n_aochan = 2, + .ao_maxdata = 0x0fff, + .ao_fifo_depth = 2048, + .ao_range_table = &range_ni_E_ao_ext, + .ao_speed = 1000, + .caldac = { ad8804_debug}, + }, [BOARD_PXI6070E] = { - .name = "pxi-6070e", - .n_adchan = 16, - .ai_maxdata = 0x0fff, - .ai_fifo_depth = 512, - .alwaysdither = 1, - .gainlkup = ai_gain_16, - .ai_speed = 800, - .n_aochan = 2, - .ao_maxdata = 0x0fff, - .ao_fifo_depth = 2048, - .ao_range_table = &range_ni_E_ao_ext, - .ao_speed = 1000, - .caldac = { ad8804_debug }, - }, + .name = "pxi-6070e", + .n_adchan = 16, + .ai_maxdata = 0x0fff, + .ai_fifo_depth = 512, + .alwaysdither = 1, + .gainlkup = ai_gain_16, + .ai_speed = 800, + .n_aochan = 2, + .ao_maxdata = 0x0fff, + .ao_fifo_depth = 2048, + .ao_range_table = &range_ni_E_ao_ext, + .ao_speed = 1000, + .caldac = { ad8804_debug}, + }, [BOARD_PXI6052E] = { - .name = "pxi-6052e", - .n_adchan = 16, - .ai_maxdata = 0xffff, - .ai_fifo_depth = 512, - .alwaysdither = 1, - .gainlkup = ai_gain_16, - .ai_speed = 3000, - .n_aochan = 2, - .ao_maxdata = 0xffff, - .ao_fifo_depth = 2048, - .ao_range_table = &range_ni_E_ao_ext, - .ao_speed = 3000, - .caldac = { mb88341, mb88341, ad8522 }, - }, + .name = "pxi-6052e", + .n_adchan = 16, + .ai_maxdata = 0xffff, + .ai_fifo_depth = 512, + .alwaysdither = 1, + .gainlkup = ai_gain_16, + .ai_speed = 3000, + .n_aochan = 2, + .ao_maxdata = 0xffff, + .ao_fifo_depth = 2048, + .ao_range_table = &range_ni_E_ao_ext, + .ao_speed = 3000, + .caldac = { mb88341, mb88341, ad8522}, + }, [BOARD_PXI6031E] = { - .name = "pxi-6031e", - .n_adchan = 64, - .ai_maxdata = 0xffff, - .ai_fifo_depth = 512, - .alwaysdither = 1, - .gainlkup = ai_gain_14, - .ai_speed = 10000, - .n_aochan = 2, - .ao_maxdata = 0xffff, - .ao_fifo_depth = 2048, - .ao_range_table = &range_ni_E_ao_ext, - .ao_speed = 10000, - .caldac = { dac8800, dac8043, ad8522 }, - }, + .name = "pxi-6031e", + .n_adchan = 64, + .ai_maxdata = 0xffff, + .ai_fifo_depth = 512, + .alwaysdither = 1, + .gainlkup = ai_gain_14, + .ai_speed = 10000, + .n_aochan = 2, + .ao_maxdata = 0xffff, + .ao_fifo_depth = 2048, + .ao_range_table = &range_ni_E_ao_ext, + .ao_speed = 10000, + .caldac = { dac8800, dac8043, ad8522}, + }, [BOARD_PCI6036E] = { - .name = "pci-6036e", - .n_adchan = 16, - .ai_maxdata = 0xffff, - .ai_fifo_depth = 512, - .alwaysdither = 1, - .gainlkup = ai_gain_4, - .ai_speed = 5000, - .n_aochan = 2, - .ao_maxdata = 0xffff, - .ao_range_table = &range_bipolar10, - .ao_speed = 100000, - .caldac = { ad8804_debug }, - }, + .name = "pci-6036e", + .n_adchan = 16, + .ai_maxdata = 0xffff, + .ai_fifo_depth = 512, + .alwaysdither = 1, + .gainlkup = ai_gain_4, + .ai_speed = 5000, + .n_aochan = 2, + .ao_maxdata = 0xffff, + .ao_range_table = &range_bipolar10, + .ao_speed = 100000, + .caldac = { ad8804_debug}, + }, [BOARD_PCI6220] = { - .name = "pci-6220", - .n_adchan = 16, - .ai_maxdata = 0xffff, - .ai_fifo_depth = 512, /* FIXME: guess */ - .gainlkup = ai_gain_622x, - .ai_speed = 4000, - .reg_type = ni_reg_622x, - .caldac = { caldac_none }, - }, + .name = "pci-6220", + .n_adchan = 16, + .ai_maxdata = 0xffff, + .ai_fifo_depth = 512, /* FIXME: guess */ + .gainlkup = ai_gain_622x, + .ai_speed = 4000, + .reg_type = ni_reg_622x, + .caldac = { caldac_none}, + }, [BOARD_PXI6220] = { - .name = "pxi-6220", - .n_adchan = 16, - .ai_maxdata = 0xffff, - .ai_fifo_depth = 512, /* FIXME: guess */ - .gainlkup = ai_gain_622x, - .ai_speed = 4000, - .reg_type = ni_reg_622x, - .caldac = { caldac_none }, - .dio_speed = 1000, - }, + .name = "pxi-6220", + .n_adchan = 16, + .ai_maxdata = 0xffff, + .ai_fifo_depth = 512, /* FIXME: guess */ + .gainlkup = ai_gain_622x, + .ai_speed = 4000, + .reg_type = ni_reg_622x, + .caldac = { caldac_none}, + .dio_speed = 1000, + }, [BOARD_PCI6221] = { - .name = "pci-6221", - .n_adchan = 16, - .ai_maxdata = 0xffff, - .ai_fifo_depth = 4095, - .gainlkup = ai_gain_622x, - .ai_speed = 4000, - .n_aochan = 2, - .ao_maxdata = 0xffff, - .ao_fifo_depth = 8191, - .ao_range_table = &range_bipolar10, - .reg_type = ni_reg_622x, - .ao_speed = 1200, - .caldac = { caldac_none }, - .dio_speed = 1000, - }, + .name = "pci-6221", + .n_adchan = 16, + .ai_maxdata = 0xffff, + .ai_fifo_depth = 4095, + .gainlkup = ai_gain_622x, + .ai_speed = 4000, + .n_aochan = 2, + .ao_maxdata = 0xffff, + .ao_fifo_depth = 8191, + .ao_range_table = &range_bipolar10, + .reg_type = ni_reg_622x, + .ao_speed = 1200, + .caldac = { caldac_none}, + .dio_speed = 1000, + }, [BOARD_PCI6221_37PIN] = { - .name = "pci-6221_37pin", - .n_adchan = 16, - .ai_maxdata = 0xffff, - .ai_fifo_depth = 4095, - .gainlkup = ai_gain_622x, - .ai_speed = 4000, - .n_aochan = 2, - .ao_maxdata = 0xffff, - .ao_fifo_depth = 8191, - .ao_range_table = &range_bipolar10, - .reg_type = ni_reg_622x, - .ao_speed = 1200, - .caldac = { caldac_none }, - }, + .name = "pci-6221_37pin", + .n_adchan = 16, + .ai_maxdata = 0xffff, + .ai_fifo_depth = 4095, + .gainlkup = ai_gain_622x, + .ai_speed = 4000, + .n_aochan = 2, + .ao_maxdata = 0xffff, + .ao_fifo_depth = 8191, + .ao_range_table = &range_bipolar10, + .reg_type = ni_reg_622x, + .ao_speed = 1200, + .caldac = { caldac_none}, + }, [BOARD_PXI6221] = { - .name = "pxi-6221", - .n_adchan = 16, - .ai_maxdata = 0xffff, - .ai_fifo_depth = 4095, - .gainlkup = ai_gain_622x, - .ai_speed = 4000, - .n_aochan = 2, - .ao_maxdata = 0xffff, - .ao_fifo_depth = 8191, - .ao_range_table = &range_bipolar10, - .reg_type = ni_reg_622x, - .ao_speed = 1200, - .caldac = { caldac_none }, - .dio_speed = 1000, - }, + .name = "pxi-6221", + .n_adchan = 16, + .ai_maxdata = 0xffff, + .ai_fifo_depth = 4095, + .gainlkup = ai_gain_622x, + .ai_speed = 4000, + .n_aochan = 2, + .ao_maxdata = 0xffff, + .ao_fifo_depth = 8191, + .ao_range_table = &range_bipolar10, + .reg_type = ni_reg_622x, + .ao_speed = 1200, + .caldac = { caldac_none}, + .dio_speed = 1000, + }, [BOARD_PCI6224] = { - .name = "pci-6224", - .n_adchan = 32, - .ai_maxdata = 0xffff, - .ai_fifo_depth = 4095, - .gainlkup = ai_gain_622x, - .ai_speed = 4000, - .reg_type = ni_reg_622x, - .has_32dio_chan = 1, - .caldac = { caldac_none }, - .dio_speed = 1000, - }, + .name = "pci-6224", + .n_adchan = 32, + .ai_maxdata = 0xffff, + .ai_fifo_depth = 4095, + .gainlkup = ai_gain_622x, + .ai_speed = 4000, + .reg_type = ni_reg_622x, + .has_32dio_chan = 1, + .caldac = { caldac_none}, + .dio_speed = 1000, + }, [BOARD_PXI6224] = { - .name = "pxi-6224", - .n_adchan = 32, - .ai_maxdata = 0xffff, - .ai_fifo_depth = 4095, - .gainlkup = ai_gain_622x, - .ai_speed = 4000, - .reg_type = ni_reg_622x, - .has_32dio_chan = 1, - .caldac = { caldac_none }, - .dio_speed = 1000, - }, + .name = "pxi-6224", + .n_adchan = 32, + .ai_maxdata = 0xffff, + .ai_fifo_depth = 4095, + .gainlkup = ai_gain_622x, + .ai_speed = 4000, + .reg_type = ni_reg_622x, + .has_32dio_chan = 1, + .caldac = { caldac_none}, + .dio_speed = 1000, + }, [BOARD_PCI6225] = { - .name = "pci-6225", - .n_adchan = 80, - .ai_maxdata = 0xffff, - .ai_fifo_depth = 4095, - .gainlkup = ai_gain_622x, - .ai_speed = 4000, - .n_aochan = 2, - .ao_maxdata = 0xffff, - .ao_fifo_depth = 8191, - .ao_range_table = &range_bipolar10, - .reg_type = ni_reg_622x, - .ao_speed = 1200, - .has_32dio_chan = 1, - .caldac = { caldac_none }, - .dio_speed = 1000, - }, + .name = "pci-6225", + .n_adchan = 80, + .ai_maxdata = 0xffff, + .ai_fifo_depth = 4095, + .gainlkup = ai_gain_622x, + .ai_speed = 4000, + .n_aochan = 2, + .ao_maxdata = 0xffff, + .ao_fifo_depth = 8191, + .ao_range_table = &range_bipolar10, + .reg_type = ni_reg_622x, + .ao_speed = 1200, + .has_32dio_chan = 1, + .caldac = { caldac_none}, + .dio_speed = 1000, + }, [BOARD_PXI6225] = { - .name = "pxi-6225", - .n_adchan = 80, - .ai_maxdata = 0xffff, - .ai_fifo_depth = 4095, - .gainlkup = ai_gain_622x, - .ai_speed = 4000, - .n_aochan = 2, - .ao_maxdata = 0xffff, - .ao_fifo_depth = 8191, - .ao_range_table = &range_bipolar10, - .reg_type = ni_reg_622x, - .ao_speed = 1200, - .has_32dio_chan = 1, - .caldac = { caldac_none }, - .dio_speed = 1000, - }, + .name = "pxi-6225", + .n_adchan = 80, + .ai_maxdata = 0xffff, + .ai_fifo_depth = 4095, + .gainlkup = ai_gain_622x, + .ai_speed = 4000, + .n_aochan = 2, + .ao_maxdata = 0xffff, + .ao_fifo_depth = 8191, + .ao_range_table = &range_bipolar10, + .reg_type = ni_reg_622x, + .ao_speed = 1200, + .has_32dio_chan = 1, + .caldac = { caldac_none}, + .dio_speed = 1000, + }, [BOARD_PCI6229] = { - .name = "pci-6229", - .n_adchan = 32, - .ai_maxdata = 0xffff, - .ai_fifo_depth = 4095, - .gainlkup = ai_gain_622x, - .ai_speed = 4000, - .n_aochan = 4, - .ao_maxdata = 0xffff, - .ao_fifo_depth = 8191, - .ao_range_table = &range_bipolar10, - .reg_type = ni_reg_622x, - .ao_speed = 1200, - .has_32dio_chan = 1, - .caldac = { caldac_none }, - }, + .name = "pci-6229", + .n_adchan = 32, + .ai_maxdata = 0xffff, + .ai_fifo_depth = 4095, + .gainlkup = ai_gain_622x, + .ai_speed = 4000, + .n_aochan = 4, + .ao_maxdata = 0xffff, + .ao_fifo_depth = 8191, + .ao_range_table = &range_bipolar10, + .reg_type = ni_reg_622x, + .ao_speed = 1200, + .has_32dio_chan = 1, + .caldac = { caldac_none}, + }, [BOARD_PXI6229] = { - .name = "pxi-6229", - .n_adchan = 32, - .ai_maxdata = 0xffff, - .ai_fifo_depth = 4095, - .gainlkup = ai_gain_622x, - .ai_speed = 4000, - .n_aochan = 4, - .ao_maxdata = 0xffff, - .ao_fifo_depth = 8191, - .ao_range_table = &range_bipolar10, - .reg_type = ni_reg_622x, - .ao_speed = 1200, - .has_32dio_chan = 1, - .caldac = { caldac_none }, - .dio_speed = 1000, - }, + .name = "pxi-6229", + .n_adchan = 32, + .ai_maxdata = 0xffff, + .ai_fifo_depth = 4095, + .gainlkup = ai_gain_622x, + .ai_speed = 4000, + .n_aochan = 4, + .ao_maxdata = 0xffff, + .ao_fifo_depth = 8191, + .ao_range_table = &range_bipolar10, + .reg_type = ni_reg_622x, + .ao_speed = 1200, + .has_32dio_chan = 1, + .caldac = { caldac_none}, + .dio_speed = 1000, + }, [BOARD_PCI6250] = { - .name = "pci-6250", - .n_adchan = 16, - .ai_maxdata = 0xffff, - .ai_fifo_depth = 4095, - .gainlkup = ai_gain_628x, - .ai_speed = 800, - .reg_type = ni_reg_625x, - .caldac = { caldac_none }, - }, + .name = "pci-6250", + .n_adchan = 16, + .ai_maxdata = 0xffff, + .ai_fifo_depth = 4095, + .gainlkup = ai_gain_628x, + .ai_speed = 800, + .reg_type = ni_reg_625x, + .caldac = { caldac_none}, + }, [BOARD_PXI6250] = { - .name = "pxi-6250", - .n_adchan = 16, - .ai_maxdata = 0xffff, - .ai_fifo_depth = 4095, - .gainlkup = ai_gain_628x, - .ai_speed = 800, - .reg_type = ni_reg_625x, - .caldac = { caldac_none }, - .dio_speed = 100, - }, + .name = "pxi-6250", + .n_adchan = 16, + .ai_maxdata = 0xffff, + .ai_fifo_depth = 4095, + .gainlkup = ai_gain_628x, + .ai_speed = 800, + .reg_type = ni_reg_625x, + .caldac = { caldac_none}, + .dio_speed = 100, + }, [BOARD_PCI6251] = { - .name = "pci-6251", - .n_adchan = 16, - .ai_maxdata = 0xffff, - .ai_fifo_depth = 4095, - .gainlkup = ai_gain_628x, - .ai_speed = 800, - .n_aochan = 2, - .ao_maxdata = 0xffff, - .ao_fifo_depth = 8191, - .ao_range_table = &range_ni_M_625x_ao, - .reg_type = ni_reg_625x, - .ao_speed = 350, - .caldac = { caldac_none }, - .dio_speed = 100, - }, + .name = "pci-6251", + .n_adchan = 16, + .ai_maxdata = 0xffff, + .ai_fifo_depth = 4095, + .gainlkup = ai_gain_628x, + .ai_speed = 800, + .n_aochan = 2, + .ao_maxdata = 0xffff, + .ao_fifo_depth = 8191, + .ao_range_table = &range_ni_M_625x_ao, + .reg_type = ni_reg_625x, + .ao_speed = 350, + .caldac = { caldac_none}, + .dio_speed = 100, + }, [BOARD_PXI6251] = { - .name = "pxi-6251", - .n_adchan = 16, - .ai_maxdata = 0xffff, - .ai_fifo_depth = 4095, - .gainlkup = ai_gain_628x, - .ai_speed = 800, - .n_aochan = 2, - .ao_maxdata = 0xffff, - .ao_fifo_depth = 8191, - .ao_range_table = &range_ni_M_625x_ao, - .reg_type = ni_reg_625x, - .ao_speed = 350, - .caldac = { caldac_none }, - .dio_speed = 100, - }, + .name = "pxi-6251", + .n_adchan = 16, + .ai_maxdata = 0xffff, + .ai_fifo_depth = 4095, + .gainlkup = ai_gain_628x, + .ai_speed = 800, + .n_aochan = 2, + .ao_maxdata = 0xffff, + .ao_fifo_depth = 8191, + .ao_range_table = &range_ni_M_625x_ao, + .reg_type = ni_reg_625x, + .ao_speed = 350, + .caldac = { caldac_none}, + .dio_speed = 100, + }, [BOARD_PCIE6251] = { - .name = "pcie-6251", - .alt_route_name = "pci-6251", - .n_adchan = 16, - .ai_maxdata = 0xffff, - .ai_fifo_depth = 4095, - .gainlkup = ai_gain_628x, - .ai_speed = 800, - .n_aochan = 2, - .ao_maxdata = 0xffff, - .ao_fifo_depth = 8191, - .ao_range_table = &range_ni_M_625x_ao, - .reg_type = ni_reg_625x, - .ao_speed = 350, - .caldac = { caldac_none }, - .dio_speed = 100, - }, + .name = "pcie-6251", + .alt_route_name = "pci-6251", + .n_adchan = 16, + .ai_maxdata = 0xffff, + .ai_fifo_depth = 4095, + .gainlkup = ai_gain_628x, + .ai_speed = 800, + .n_aochan = 2, + .ao_maxdata = 0xffff, + .ao_fifo_depth = 8191, + .ao_range_table = &range_ni_M_625x_ao, + .reg_type = ni_reg_625x, + .ao_speed = 350, + .caldac = { caldac_none}, + .dio_speed = 100, + }, [BOARD_PXIE6251] = { - .name = "pxie-6251", - .n_adchan = 16, - .ai_maxdata = 0xffff, - .ai_fifo_depth = 4095, - .gainlkup = ai_gain_628x, - .ai_speed = 800, - .n_aochan = 2, - .ao_maxdata = 0xffff, - .ao_fifo_depth = 8191, - .ao_range_table = &range_ni_M_625x_ao, - .reg_type = ni_reg_625x, - .ao_speed = 350, - .caldac = { caldac_none }, - .dio_speed = 100, - }, + .name = "pxie-6251", + .n_adchan = 16, + .ai_maxdata = 0xffff, + .ai_fifo_depth = 4095, + .gainlkup = ai_gain_628x, + .ai_speed = 800, + .n_aochan = 2, + .ao_maxdata = 0xffff, + .ao_fifo_depth = 8191, + .ao_range_table = &range_ni_M_625x_ao, + .reg_type = ni_reg_625x, + .ao_speed = 350, + .caldac = { caldac_none}, + .dio_speed = 100, + }, [BOARD_PCI6254] = { - .name = "pci-6254", - .n_adchan = 32, - .ai_maxdata = 0xffff, - .ai_fifo_depth = 4095, - .gainlkup = ai_gain_628x, - .ai_speed = 800, - .reg_type = ni_reg_625x, - .has_32dio_chan = 1, - .caldac = { caldac_none }, - }, + .name = "pci-6254", + .n_adchan = 32, + .ai_maxdata = 0xffff, + .ai_fifo_depth = 4095, + .gainlkup = ai_gain_628x, + .ai_speed = 800, + .reg_type = ni_reg_625x, + .has_32dio_chan = 1, + .caldac = { caldac_none}, + }, [BOARD_PXI6254] = { - .name = "pxi-6254", - .n_adchan = 32, - .ai_maxdata = 0xffff, - .ai_fifo_depth = 4095, - .gainlkup = ai_gain_628x, - .ai_speed = 800, - .reg_type = ni_reg_625x, - .has_32dio_chan = 1, - .caldac = { caldac_none }, - .dio_speed = 100, - }, + .name = "pxi-6254", + .n_adchan = 32, + .ai_maxdata = 0xffff, + .ai_fifo_depth = 4095, + .gainlkup = ai_gain_628x, + .ai_speed = 800, + .reg_type = ni_reg_625x, + .has_32dio_chan = 1, + .caldac = { caldac_none}, + .dio_speed = 100, + }, [BOARD_PCI6259] = { - .name = "pci-6259", - .n_adchan = 32, - .ai_maxdata = 0xffff, - .ai_fifo_depth = 4095, - .gainlkup = ai_gain_628x, - .ai_speed = 800, - .n_aochan = 4, - .ao_maxdata = 0xffff, - .ao_fifo_depth = 8191, - .ao_range_table = &range_ni_M_625x_ao, - .reg_type = ni_reg_625x, - .ao_speed = 350, - .has_32dio_chan = 1, - .caldac = { caldac_none }, - }, + .name = "pci-6259", + .n_adchan = 32, + .ai_maxdata = 0xffff, + .ai_fifo_depth = 4095, + .gainlkup = ai_gain_628x, + .ai_speed = 800, + .n_aochan = 4, + .ao_maxdata = 0xffff, + .ao_fifo_depth = 8191, + .ao_range_table = &range_ni_M_625x_ao, + .reg_type = ni_reg_625x, + .ao_speed = 350, + .has_32dio_chan = 1, + .caldac = { caldac_none}, + }, [BOARD_PXI6259] = { - .name = "pxi-6259", - .n_adchan = 32, - .ai_maxdata = 0xffff, - .ai_fifo_depth = 4095, - .gainlkup = ai_gain_628x, - .ai_speed = 800, - .n_aochan = 4, - .ao_maxdata = 0xffff, - .ao_fifo_depth = 8191, - .ao_range_table = &range_ni_M_625x_ao, - .reg_type = ni_reg_625x, - .ao_speed = 350, - .has_32dio_chan = 1, - .caldac = { caldac_none }, - .dio_speed = 100, - }, + .name = "pxi-6259", + .n_adchan = 32, + .ai_maxdata = 0xffff, + .ai_fifo_depth = 4095, + .gainlkup = ai_gain_628x, + .ai_speed = 800, + .n_aochan = 4, + .ao_maxdata = 0xffff, + .ao_fifo_depth = 8191, + .ao_range_table = &range_ni_M_625x_ao, + .reg_type = ni_reg_625x, + .ao_speed = 350, + .has_32dio_chan = 1, + .caldac = { caldac_none}, + .dio_speed = 100, + }, [BOARD_PCIE6259] = { - .name = "pcie-6259", - .alt_route_name = "pci-6259", - .n_adchan = 32, - .ai_maxdata = 0xffff, - .ai_fifo_depth = 4095, - .gainlkup = ai_gain_628x, - .ai_speed = 800, - .n_aochan = 4, - .ao_maxdata = 0xffff, - .ao_fifo_depth = 8191, - .ao_range_table = &range_ni_M_625x_ao, - .reg_type = ni_reg_625x, - .ao_speed = 350, - .has_32dio_chan = 1, - .caldac = { caldac_none }, - }, + .name = "pcie-6259", + .alt_route_name = "pci-6259", + .n_adchan = 32, + .ai_maxdata = 0xffff, + .ai_fifo_depth = 4095, + .gainlkup = ai_gain_628x, + .ai_speed = 800, + .n_aochan = 4, + .ao_maxdata = 0xffff, + .ao_fifo_depth = 8191, + .ao_range_table = &range_ni_M_625x_ao, + .reg_type = ni_reg_625x, + .ao_speed = 350, + .has_32dio_chan = 1, + .caldac = { caldac_none}, + }, [BOARD_PXIE6259] = { - .name = "pxie-6259", - .n_adchan = 32, - .ai_maxdata = 0xffff, - .ai_fifo_depth = 4095, - .gainlkup = ai_gain_628x, - .ai_speed = 800, - .n_aochan = 4, - .ao_maxdata = 0xffff, - .ao_fifo_depth = 8191, - .ao_range_table = &range_ni_M_625x_ao, - .reg_type = ni_reg_625x, - .ao_speed = 350, - .has_32dio_chan = 1, - .caldac = { caldac_none }, - .dio_speed = 100, - }, + .name = "pxie-6259", + .n_adchan = 32, + .ai_maxdata = 0xffff, + .ai_fifo_depth = 4095, + .gainlkup = ai_gain_628x, + .ai_speed = 800, + .n_aochan = 4, + .ao_maxdata = 0xffff, + .ao_fifo_depth = 8191, + .ao_range_table = &range_ni_M_625x_ao, + .reg_type = ni_reg_625x, + .ao_speed = 350, + .has_32dio_chan = 1, + .caldac = { caldac_none}, + .dio_speed = 100, + }, [BOARD_PCI6280] = { - .name = "pci-6280", - .n_adchan = 16, - .ai_maxdata = 0x3ffff, - .ai_fifo_depth = 2047, - .gainlkup = ai_gain_628x, - .ai_speed = 1600, - .ao_fifo_depth = 8191, - .reg_type = ni_reg_628x, - .caldac = { caldac_none }, - }, + .name = "pci-6280", + .n_adchan = 16, + .ai_maxdata = 0x3ffff, + .ai_fifo_depth = 2047, + .gainlkup = ai_gain_628x, + .ai_speed = 1600, + .ao_fifo_depth = 8191, + .reg_type = ni_reg_628x, + .caldac = { caldac_none}, + }, [BOARD_PXI6280] = { - .name = "pxi-6280", - .n_adchan = 16, - .ai_maxdata = 0x3ffff, - .ai_fifo_depth = 2047, - .gainlkup = ai_gain_628x, - .ai_speed = 1600, - .ao_fifo_depth = 8191, - .reg_type = ni_reg_628x, - .caldac = { caldac_none }, - .dio_speed = 100, - }, + .name = "pxi-6280", + .n_adchan = 16, + .ai_maxdata = 0x3ffff, + .ai_fifo_depth = 2047, + .gainlkup = ai_gain_628x, + .ai_speed = 1600, + .ao_fifo_depth = 8191, + .reg_type = ni_reg_628x, + .caldac = { caldac_none}, + .dio_speed = 100, + }, [BOARD_PCI6281] = { - .name = "pci-6281", - .n_adchan = 16, - .ai_maxdata = 0x3ffff, - .ai_fifo_depth = 2047, - .gainlkup = ai_gain_628x, - .ai_speed = 1600, - .n_aochan = 2, - .ao_maxdata = 0xffff, - .ao_fifo_depth = 8191, - .ao_range_table = &range_ni_M_628x_ao, - .reg_type = ni_reg_628x, - .ao_speed = 350, - .caldac = { caldac_none }, - .dio_speed = 100, - }, + .name = "pci-6281", + .n_adchan = 16, + .ai_maxdata = 0x3ffff, + .ai_fifo_depth = 2047, + .gainlkup = ai_gain_628x, + .ai_speed = 1600, + .n_aochan = 2, + .ao_maxdata = 0xffff, + .ao_fifo_depth = 8191, + .ao_range_table = &range_ni_M_628x_ao, + .reg_type = ni_reg_628x, + .ao_speed = 350, + .caldac = { caldac_none}, + .dio_speed = 100, + }, [BOARD_PXI6281] = { - .name = "pxi-6281", - .n_adchan = 16, - .ai_maxdata = 0x3ffff, - .ai_fifo_depth = 2047, - .gainlkup = ai_gain_628x, - .ai_speed = 1600, - .n_aochan = 2, - .ao_maxdata = 0xffff, - .ao_fifo_depth = 8191, - .ao_range_table = &range_ni_M_628x_ao, - .reg_type = ni_reg_628x, - .ao_speed = 350, - .caldac = { caldac_none }, - .dio_speed = 100, - }, + .name = "pxi-6281", + .n_adchan = 16, + .ai_maxdata = 0x3ffff, + .ai_fifo_depth = 2047, + .gainlkup = ai_gain_628x, + .ai_speed = 1600, + .n_aochan = 2, + .ao_maxdata = 0xffff, + .ao_fifo_depth = 8191, + .ao_range_table = &range_ni_M_628x_ao, + .reg_type = ni_reg_628x, + .ao_speed = 350, + .caldac = { caldac_none}, + .dio_speed = 100, + }, [BOARD_PCI6284] = { - .name = "pci-6284", - .n_adchan = 32, - .ai_maxdata = 0x3ffff, - .ai_fifo_depth = 2047, - .gainlkup = ai_gain_628x, - .ai_speed = 1600, - .reg_type = ni_reg_628x, - .has_32dio_chan = 1, - .caldac = { caldac_none }, - }, + .name = "pci-6284", + .n_adchan = 32, + .ai_maxdata = 0x3ffff, + .ai_fifo_depth = 2047, + .gainlkup = ai_gain_628x, + .ai_speed = 1600, + .reg_type = ni_reg_628x, + .has_32dio_chan = 1, + .caldac = { caldac_none}, + }, [BOARD_PXI6284] = { - .name = "pxi-6284", - .n_adchan = 32, - .ai_maxdata = 0x3ffff, - .ai_fifo_depth = 2047, - .gainlkup = ai_gain_628x, - .ai_speed = 1600, - .reg_type = ni_reg_628x, - .has_32dio_chan = 1, - .caldac = { caldac_none }, - .dio_speed = 100, - }, + .name = "pxi-6284", + .n_adchan = 32, + .ai_maxdata = 0x3ffff, + .ai_fifo_depth = 2047, + .gainlkup = ai_gain_628x, + .ai_speed = 1600, + .reg_type = ni_reg_628x, + .has_32dio_chan = 1, + .caldac = { caldac_none}, + .dio_speed = 100, + }, [BOARD_PCI6289] = { - .name = "pci-6289", - .n_adchan = 32, - .ai_maxdata = 0x3ffff, - .ai_fifo_depth = 2047, - .gainlkup = ai_gain_628x, - .ai_speed = 1600, - .n_aochan = 4, - .ao_maxdata = 0xffff, - .ao_fifo_depth = 8191, - .ao_range_table = &range_ni_M_628x_ao, - .reg_type = ni_reg_628x, - .ao_speed = 350, - .has_32dio_chan = 1, - .caldac = { caldac_none }, - }, + .name = "pci-6289", + .n_adchan = 32, + .ai_maxdata = 0x3ffff, + .ai_fifo_depth = 2047, + .gainlkup = ai_gain_628x, + .ai_speed = 1600, + .n_aochan = 4, + .ao_maxdata = 0xffff, + .ao_fifo_depth = 8191, + .ao_range_table = &range_ni_M_628x_ao, + .reg_type = ni_reg_628x, + .ao_speed = 350, + .has_32dio_chan = 1, + .caldac = { caldac_none}, + }, [BOARD_PXI6289] = { - .name = "pxi-6289", - .n_adchan = 32, - .ai_maxdata = 0x3ffff, - .ai_fifo_depth = 2047, - .gainlkup = ai_gain_628x, - .ai_speed = 1600, - .n_aochan = 4, - .ao_maxdata = 0xffff, - .ao_fifo_depth = 8191, - .ao_range_table = &range_ni_M_628x_ao, - .reg_type = ni_reg_628x, - .ao_speed = 350, - .has_32dio_chan = 1, - .caldac = { caldac_none }, - .dio_speed = 100, - }, + .name = "pxi-6289", + .n_adchan = 32, + .ai_maxdata = 0x3ffff, + .ai_fifo_depth = 2047, + .gainlkup = ai_gain_628x, + .ai_speed = 1600, + .n_aochan = 4, + .ao_maxdata = 0xffff, + .ao_fifo_depth = 8191, + .ao_range_table = &range_ni_M_628x_ao, + .reg_type = ni_reg_628x, + .ao_speed = 350, + .has_32dio_chan = 1, + .caldac = { caldac_none}, + .dio_speed = 100, + }, [BOARD_PCI6143] = { - .name = "pci-6143", - .n_adchan = 8, - .ai_maxdata = 0xffff, - .ai_fifo_depth = 1024, - .gainlkup = ai_gain_6143, - .ai_speed = 4000, - .reg_type = ni_reg_6143, - .caldac = { ad8804_debug, ad8804_debug }, - }, + .name = "pci-6143", + .n_adchan = 8, + .ai_maxdata = 0xffff, + .ai_fifo_depth = 1024, + .gainlkup = ai_gain_6143, + .ai_speed = 4000, + .reg_type = ni_reg_6143, + .caldac = { ad8804_debug, ad8804_debug}, + }, [BOARD_PXI6143] = { - .name = "pxi-6143", - .n_adchan = 8, - .ai_maxdata = 0xffff, - .ai_fifo_depth = 1024, - .gainlkup = ai_gain_6143, - .ai_speed = 4000, - .reg_type = ni_reg_6143, - .caldac = { ad8804_debug, ad8804_debug }, - }, + .name = "pxi-6143", + .n_adchan = 8, + .ai_maxdata = 0xffff, + .ai_fifo_depth = 1024, + .gainlkup = ai_gain_6143, + .ai_speed = 4000, + .reg_type = ni_reg_6143, + .caldac = { ad8804_debug, ad8804_debug}, + }, }; #include "ni_mio_common.c" @@ -1289,8 +1291,7 @@ static void pcimio_detach(struct comedi_device *dev) comedi_pci_disable(dev); } -static int pcimio_auto_attach(struct comedi_device *dev, - unsigned long context) +static int pcimio_auto_attach(struct comedi_device *dev, unsigned long context) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); const struct ni_board_struct *board = NULL; @@ -1382,10 +1383,10 @@ static int pcimio_auto_attach(struct comedi_device *dev, } static struct comedi_driver ni_pcimio_driver = { - .driver_name = "ni_pcimio", - .module = THIS_MODULE, - .auto_attach = pcimio_auto_attach, - .detach = pcimio_detach, + .driver_name = "ni_pcimio", + .module = THIS_MODULE, + .auto_attach = pcimio_auto_attach, + .detach = pcimio_detach, }; static int ni_pcimio_pci_probe(struct pci_dev *dev, @@ -1462,14 +1463,16 @@ static const struct pci_device_id ni_pcimio_pci_table[] = { { PCI_VDEVICE(NI, 0x72e9), BOARD_PXIE6259 }, { 0 } }; + MODULE_DEVICE_TABLE(pci, ni_pcimio_pci_table); static struct pci_driver ni_pcimio_pci_driver = { - .name = "ni_pcimio", - .id_table = ni_pcimio_pci_table, - .probe = ni_pcimio_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "ni_pcimio", + .id_table = ni_pcimio_pci_table, + .probe = ni_pcimio_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(ni_pcimio_driver, ni_pcimio_pci_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/ni_routes.c b/drivers/comedi/drivers/ni_routes.c index f0f8cd424b30..26414f3bf5d8 100644 --- a/drivers/comedi/drivers/ni_routes.c +++ b/drivers/comedi/drivers/ni_routes.c @@ -69,8 +69,8 @@ static const u8 *ni_find_route_values(const char *device_family) /* * Find the valid routes for a board. */ -static const struct ni_device_routes * -ni_find_valid_routes(const char *board_name) +static const struct ni_device_routes *ni_find_valid_routes(const char + *board_name) { const struct ni_device_routes *dr = NULL; int i; @@ -143,6 +143,7 @@ int ni_assign_device_routes(const char *device_family, return ni_find_device_routes(device_family, board_name, alt_board_name, tables); } + EXPORT_SYMBOL_GPL(ni_assign_device_routes); /** @@ -159,7 +160,7 @@ unsigned int ni_count_valid_routes(const struct ni_route_tables *tables) int j; for (j = 0; j < R->n_src; ++j) { - const int src = R->src[j]; + const int src = R->src[j]; const int dest = R->dest; const u8 *rv = tables->route_values; @@ -178,6 +179,7 @@ unsigned int ni_count_valid_routes(const struct ni_route_tables *tables) } return total; } + EXPORT_SYMBOL_GPL(ni_count_valid_routes); /** @@ -194,8 +196,7 @@ EXPORT_SYMBOL_GPL(ni_count_valid_routes); * valid routes copied. */ unsigned int ni_get_valid_routes(const struct ni_route_tables *tables, - unsigned int n_pairs, - unsigned int *pair_data) + unsigned int n_pairs, unsigned int *pair_data) { unsigned int n_valid = ni_count_valid_routes(tables); int i; @@ -213,7 +214,7 @@ unsigned int ni_get_valid_routes(const struct ni_route_tables *tables, int j; for (j = 0; j < R->n_src; ++j) { - const int src = R->src[j]; + const int src = R->src[j]; const int dest = R->dest; bool valid = false; const u8 *rv = tables->route_values; @@ -243,6 +244,7 @@ unsigned int ni_get_valid_routes(const struct ni_route_tables *tables, } return n_valid; } + EXPORT_SYMBOL_GPL(ni_get_valid_routes); /* @@ -273,6 +275,7 @@ bool ni_is_cmd_dest(int dest) return true; return false; } + EXPORT_SYMBOL_GPL(ni_is_cmd_dest); /* **** BEGIN Routes sort routines **** */ @@ -332,6 +335,7 @@ void ni_sort_device_routes(struct ni_device_routes *valid_routes) sizeof(int), _ni_sort_srccmp, NULL); } } + EXPORT_SYMBOL_GPL(ni_sort_device_routes); /* sort all valid device signal routes in prep for use */ @@ -377,14 +381,14 @@ static int _ni_bsearch_srccmp(const void *vkey, const void *velt) * Return: NULL if no route_set is found with the specified @destination; * otherwise, a pointer to the route_set if found. */ -const struct ni_route_set * -ni_find_route_set(const int destination, - const struct ni_device_routes *valid_routes) +const struct ni_route_set *ni_find_route_set(const int destination, const struct ni_device_routes + *valid_routes) { return bsearch(&destination, valid_routes->routes, valid_routes->n_route_sets, sizeof(struct ni_route_set), _ni_bsearch_destcmp); } + EXPORT_SYMBOL_GPL(ni_find_route_set); /* @@ -401,6 +405,7 @@ bool ni_route_set_has_source(const struct ni_route_set *routes, return false; return true; } + EXPORT_SYMBOL_GPL(ni_route_set_has_source); /** @@ -432,6 +437,7 @@ s8 ni_lookup_route_register(int src, int dest, /* mask out the valid-value marking bit */ return UNMARK(regval); } + EXPORT_SYMBOL_GPL(ni_lookup_route_register); /** @@ -468,7 +474,7 @@ s8 ni_route_to_register(const int src, const int dest, const struct ni_route_tables *tables) { const struct ni_route_set *routes = - ni_find_route_set(dest, tables->valid_routes); + ni_find_route_set(dest, tables->valid_routes); const u8 *rv; s8 regval; @@ -504,6 +510,7 @@ s8 ni_route_to_register(const int src, const int dest, /* mask out the valid-value marking bit */ return UNMARK(regval); } + EXPORT_SYMBOL_GPL(ni_route_to_register); /* @@ -527,7 +534,7 @@ int ni_find_route_source(const u8 src_sel_reg_value, int dest, if (!tables->route_values) return -EINVAL; - dest = B(dest); /* subtract NI names offset */ + dest = B(dest); /* subtract NI names offset */ /* ensure we are not going to under/over run the route value table */ if (dest < 0 || dest >= NI_NUM_NAMES) return -EINVAL; @@ -537,6 +544,7 @@ int ni_find_route_source(const u8 src_sel_reg_value, int dest, return src + NI_NAMES_BASE; return -EINVAL; } + EXPORT_SYMBOL_GPL(ni_find_route_source); /* **** END Routes search routines **** */ diff --git a/drivers/comedi/drivers/ni_routes.h b/drivers/comedi/drivers/ni_routes.h index 036982315584..e306d3ef7915 100644 --- a/drivers/comedi/drivers/ni_routes.h +++ b/drivers/comedi/drivers/ni_routes.h @@ -87,9 +87,8 @@ int ni_assign_device_routes(const char *device_family, * Return: NULL if no route_set is found with the specified @destination; * otherwise, a pointer to the route_set if found. */ -const struct ni_route_set * -ni_find_route_set(const int destination, - const struct ni_device_routes *valid_routes); +const struct ni_route_set *ni_find_route_set(const int destination, const struct ni_device_routes + *valid_routes); /* * ni_route_set_has_source() - Determines whether the given source is in @@ -185,7 +184,7 @@ static inline bool channel_is_rtsi(int channel) static inline bool channel_is_ctr(int channel) { return channel >= NI_COUNTER_NAMES_BASE && - channel <= NI_COUNTER_NAMES_MAX; + channel <= NI_COUNTER_NAMES_MAX; } /* @@ -208,8 +207,7 @@ unsigned int ni_count_valid_routes(const struct ni_route_tables *tables); * valid routes copied. */ unsigned int ni_get_valid_routes(const struct ni_route_tables *tables, - unsigned int n_pairs, - unsigned int *pair_data); + unsigned int n_pairs, unsigned int *pair_data); /* * ni_sort_device_routes() - Sort the list of valid device signal routes in @@ -311,9 +309,9 @@ static inline int ni_get_reg_value(const int src, const int dest, * valid for the destination; -EINVAL otherwise. */ static inline -int ni_check_trigger_arg_roffs(int src, const int dest, - const struct ni_route_tables *tables, - const int direct_reg_offset) + int ni_check_trigger_arg_roffs(int src, const int dest, + const struct ni_route_tables *tables, + const int direct_reg_offset) { if (ni_get_reg_value_roffs(src, dest, tables, direct_reg_offset) < 0) return -EINVAL; diff --git a/drivers/comedi/drivers/ni_stc.h b/drivers/comedi/drivers/ni_stc.h index fbc0b753a0f5..5b041c22ec75 100644 --- a/drivers/comedi/drivers/ni_stc.h +++ b/drivers/comedi/drivers/ni_stc.h @@ -291,8 +291,8 @@ #define NISTC_ATRIG_ETC_DRV BIT(4) #define NISTC_ATRIG_ETC_ENA BIT(3) #define NISTC_ATRIG_ETC_MODE(x) (((x) & 0x7) << 0) -#define NISTC_GPFO_0_G_OUT 0 /* input to GPFO_0_SEL for Ctr0Out */ -#define NISTC_GPFO_1_G_OUT 0 /* input to GPFO_1_SEL for Ctr1Out */ +#define NISTC_GPFO_0_G_OUT 0 /* input to GPFO_0_SEL for Ctr0Out */ +#define NISTC_GPFO_1_G_OUT 0 /* input to GPFO_1_SEL for Ctr1Out */ #define NISTC_AI_START_STOP_REG 62 #define NISTC_AI_START_POLARITY BIT(15) @@ -593,7 +593,7 @@ #define NI_E_AO_DEGLITCH BIT(1) #define NI_E_AO_CFG_BIP BIT(0) -#define NI_E_DAC_DIRECT_DATA_REG(x) (0x18 + ((x) * 2)) /* w16 */ +#define NI_E_DAC_DIRECT_DATA_REG(x) (0x18 + ((x) * 2)) /* w16 */ #define NI_E_8255_BASE 0x19 /* rw8 */ @@ -633,12 +633,12 @@ #define NI6143_CALIB_CHAN_RELAY_ON BIT(15) #define NI6143_CALIB_CHAN_RELAY_OFF BIT(14) #define NI6143_CALIB_CHAN(x) (((x) & 0xf) << 0) -#define NI6143_CALIB_CHAN_GND_GND NI6143_CALIB_CHAN(0) /* Offset Cal */ -#define NI6143_CALIB_CHAN_2V5_GND NI6143_CALIB_CHAN(2) /* 2.5V ref */ -#define NI6143_CALIB_CHAN_PWM_GND NI6143_CALIB_CHAN(5) /* +-5V Self Cal */ -#define NI6143_CALIB_CHAN_2V5_PWM NI6143_CALIB_CHAN(10) /* PWM Cal */ -#define NI6143_CALIB_CHAN_PWM_PWM NI6143_CALIB_CHAN(13) /* CMRR */ -#define NI6143_CALIB_CHAN_GND_PWM NI6143_CALIB_CHAN(14) /* PWM Cal */ +#define NI6143_CALIB_CHAN_GND_GND NI6143_CALIB_CHAN(0) /* Offset Cal */ +#define NI6143_CALIB_CHAN_2V5_GND NI6143_CALIB_CHAN(2) /* 2.5V ref */ +#define NI6143_CALIB_CHAN_PWM_GND NI6143_CALIB_CHAN(5) /* +-5V Self Cal */ +#define NI6143_CALIB_CHAN_2V5_PWM NI6143_CALIB_CHAN(10) /* PWM Cal */ +#define NI6143_CALIB_CHAN_PWM_PWM NI6143_CALIB_CHAN(13) /* CMRR */ +#define NI6143_CALIB_CHAN_GND_PWM NI6143_CALIB_CHAN(14) /* PWM Cal */ #define NI6143_CALIB_LO_TIME_REG 0x20 /* w16 */ #define NI6143_CALIB_HI_TIME_REG 0x22 /* w16 */ #define NI6143_RELAY_COUNTER_LOAD_REG 0x4c /* w32 */ @@ -962,7 +962,7 @@ struct ni_board_struct { int reg_type; unsigned int has_8255:1; unsigned int has_32dio_chan:1; - unsigned int dio_speed; /* not for e-series */ + unsigned int dio_speed; /* not for e-series */ enum caldac_enum caldac[3]; }; diff --git a/drivers/comedi/drivers/ni_tio.c b/drivers/comedi/drivers/ni_tio.c index da6826d77e60..0861a69ed61f 100644 --- a/drivers/comedi/drivers/ni_tio.c +++ b/drivers/comedi/drivers/ni_tio.c @@ -152,6 +152,7 @@ void ni_tio_write(struct ni_gpct *counter, unsigned int value, if (reg < NITIO_NUM_REGS) counter->counter_dev->write(counter, value, reg); } + EXPORT_SYMBOL_GPL(ni_tio_write); /** @@ -165,6 +166,7 @@ unsigned int ni_tio_read(struct ni_gpct *counter, enum ni_gpct_register reg) return counter->counter_dev->read(counter, reg); return 0; } + EXPORT_SYMBOL_GPL(ni_tio_read); static void ni_tio_reset_count_and_disarm(struct ni_gpct *counter) @@ -176,7 +178,7 @@ static void ni_tio_reset_count_and_disarm(struct ni_gpct *counter) static int ni_tio_clock_period_ps(const struct ni_gpct *counter, unsigned int generic_clock_source, - u64 *period_ps) + u64 *period_ps) { u64 clock_period_ps; @@ -254,6 +256,7 @@ void ni_tio_set_bits(struct ni_gpct *counter, enum ni_gpct_register reg, { ni_tio_set_bits_transient(counter, reg, mask, value, 0x0); } + EXPORT_SYMBOL_GPL(ni_tio_set_bits); /** @@ -280,6 +283,7 @@ unsigned int ni_tio_get_soft_copy(const struct ni_gpct *counter, } return value; } + EXPORT_SYMBOL_GPL(ni_tio_get_soft_copy); static unsigned int ni_tio_clock_src_modifiers(const struct ni_gpct *counter) @@ -287,7 +291,7 @@ static unsigned int ni_tio_clock_src_modifiers(const struct ni_gpct *counter) struct ni_gpct_device *counter_dev = counter->counter_dev; unsigned int cidx = counter->counter_index; unsigned int counting_mode_bits = - ni_tio_get_soft_copy(counter, NITIO_CNT_MODE_REG(cidx)); + ni_tio_get_soft_copy(counter, NITIO_CNT_MODE_REG(cidx)); unsigned int bits = 0; if (ni_tio_get_soft_copy(counter, NITIO_INPUT_SEL_REG(cidx)) & @@ -593,7 +597,7 @@ int ni_tio_arm(struct ni_gpct *counter, bool arm, unsigned int start_trigger) */ if (mask && (start_trigger & NI_GPCT_ARM_UNKNOWN)) { bits |= GI_HW_ARM_ENA | - (GI_HW_ARM_SEL(start_trigger) & mask); + (GI_HW_ARM_SEL(start_trigger) & mask); } else { return -EINVAL; } @@ -610,6 +614,7 @@ int ni_tio_arm(struct ni_gpct *counter, bool arm, unsigned int start_trigger) 0, 0, transient_bits); return 0; } + EXPORT_SYMBOL_GPL(ni_tio_arm); static int ni_660x_clk_src(unsigned int clock_source, unsigned int *bits) @@ -858,8 +863,7 @@ static inline void ni_tio_set_gate_mode(struct ni_gpct *counter, mode_bits |= GI_LEVEL_GATING; } ni_tio_set_bits(counter, NITIO_MODE_REG(counter->counter_index), - GI_GATE_POL_INVERT | GI_GATING_MODE_MASK, - mode_bits); + GI_GATE_POL_INVERT | GI_GATING_MODE_MASK, mode_bits); } /* @@ -1052,6 +1056,7 @@ int ni_tio_set_gate_src_raw(struct ni_gpct *counter, } return 0; } + EXPORT_SYMBOL_GPL(ni_tio_set_gate_src_raw); int ni_tio_set_gate_src(struct ni_gpct *counter, @@ -1114,6 +1119,7 @@ int ni_tio_set_gate_src(struct ni_gpct *counter, } return 0; } + EXPORT_SYMBOL_GPL(ni_tio_set_gate_src); static int ni_tio_set_other_src(struct ni_gpct *counter, unsigned int index, @@ -1134,10 +1140,10 @@ static int ni_tio_set_other_src(struct ni_gpct *counter, unsigned int index, (index >= NI_CtrA(0) && index <= NI_CtrA(-1))) { shift = 10; } else if (index == NI_GPCT_SOURCE_ENCODER_B || - (index >= NI_CtrB(0) && index <= NI_CtrB(-1))) { + (index >= NI_CtrB(0) && index <= NI_CtrB(-1))) { shift = 5; } else if (index == NI_GPCT_SOURCE_ENCODER_Z || - (index >= NI_CtrZ(0) && index <= NI_CtrZ(-1))) { + (index >= NI_CtrZ(0) && index <= NI_CtrZ(-1))) { shift = 0; } else { return -EINVAL; @@ -1171,10 +1177,10 @@ static int ni_tio_get_other_src(struct ni_gpct *counter, unsigned int index, (index >= NI_CtrA(0) && index <= NI_CtrA(-1))) { shift = 10; } else if (index == NI_GPCT_SOURCE_ENCODER_B || - (index >= NI_CtrB(0) && index <= NI_CtrB(-1))) { + (index >= NI_CtrB(0) && index <= NI_CtrB(-1))) { shift = 5; } else if (index == NI_GPCT_SOURCE_ENCODER_Z || - (index >= NI_CtrZ(0) && index <= NI_CtrZ(-1))) { + (index >= NI_CtrZ(0) && index <= NI_CtrZ(-1))) { shift = 0; } else { return -EINVAL; @@ -1343,7 +1349,8 @@ static int ni_m_gate2_to_generic_gate(unsigned int gate, unsigned int *src) static inline unsigned int ni_tio_get_gate_mode(struct ni_gpct *counter) { unsigned int mode = ni_tio_get_soft_copy(counter, - NITIO_MODE_REG(counter->counter_index)); + NITIO_MODE_REG + (counter->counter_index)); unsigned int ret = 0; if ((mode & GI_GATING_MODE_MASK) == GI_GATING_DISABLED) @@ -1359,7 +1366,8 @@ static inline unsigned int ni_tio_get_gate_mode(struct ni_gpct *counter) static inline unsigned int ni_tio_get_gate2_mode(struct ni_gpct *counter) { unsigned int mode = ni_tio_get_soft_copy(counter, - NITIO_GATE2_REG(counter->counter_index)); + NITIO_GATE2_REG + (counter->counter_index)); unsigned int ret = 0; if (!(mode & GI_GATE2_MODE)) @@ -1373,13 +1381,15 @@ static inline unsigned int ni_tio_get_gate2_mode(struct ni_gpct *counter) static inline unsigned int ni_tio_get_gate_val(struct ni_gpct *counter) { return GI_BITS_TO_GATE(ni_tio_get_soft_copy(counter, - NITIO_INPUT_SEL_REG(counter->counter_index))); + NITIO_INPUT_SEL_REG + (counter->counter_index))); } static inline unsigned int ni_tio_get_gate2_val(struct ni_gpct *counter) { return GI_BITS_TO_GATE2(ni_tio_get_soft_copy(counter, - NITIO_GATE2_REG(counter->counter_index))); + NITIO_GATE2_REG + (counter->counter_index))); } static int ni_tio_get_gate_src(struct ni_gpct *counter, unsigned int gate_index, @@ -1434,11 +1444,11 @@ static int ni_tio_get_gate_src_raw(struct ni_gpct *counter, switch (gate_index) { case 0: *gate_source = ni_tio_get_gate_mode(counter) - | ni_tio_get_gate_val(counter); + | ni_tio_get_gate_val(counter); break; case 1: *gate_source = ni_tio_get_gate2_mode(counter) - | ni_tio_get_gate2_val(counter); + | ni_tio_get_gate2_val(counter); break; default: return -EINVAL; @@ -1448,8 +1458,7 @@ static int ni_tio_get_gate_src_raw(struct ni_gpct *counter, int ni_tio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct ni_gpct *counter = s->private; unsigned int cidx = counter->counter_index; @@ -1499,6 +1508,7 @@ int ni_tio_insn_config(struct comedi_device *dev, } return ret ? ret : insn->n; } + EXPORT_SYMBOL_GPL(ni_tio_insn_config); /* @@ -1525,12 +1535,12 @@ int ni_tio_get_routing(struct ni_gpct_device *counter_dev, unsigned int dest) ret = ni_tio_get_gate_src_raw(counter, 0, ®); } else if (dest >= NI_CtrAux(0) && dest <= NI_CtrAux(-1)) { ret = ni_tio_get_gate_src_raw(counter, 1, ®); - /* - * This case is not possible through this interface. A user must use - * INSN_CONFIG_SET_CLOCK_SRC instead. - * } else if (dest >= NI_CtrSource(0) && dest <= NI_CtrSource(-1)) { - * ret = ni_tio_set_clock_src(counter, ®, &period_ns); - */ + /* + * This case is not possible through this interface. A user must use + * INSN_CONFIG_SET_CLOCK_SRC instead. + * } else if (dest >= NI_CtrSource(0) && dest <= NI_CtrSource(-1)) { + * ret = ni_tio_set_clock_src(counter, ®, &period_ns); + */ } if (ret) @@ -1538,6 +1548,7 @@ int ni_tio_get_routing(struct ni_gpct_device *counter_dev, unsigned int dest) return reg; } + EXPORT_SYMBOL_GPL(ni_tio_get_routing); /** @@ -1566,18 +1577,19 @@ int ni_tio_set_routing(struct ni_gpct_device *counter_dev, unsigned int dest, ret = ni_tio_set_gate_src_raw(counter, 0, reg); } else if (dest >= NI_CtrAux(0) && dest <= NI_CtrAux(-1)) { ret = ni_tio_set_gate_src_raw(counter, 1, reg); - /* - * This case is not possible through this interface. A user must use - * INSN_CONFIG_SET_CLOCK_SRC instead. - * } else if (dest >= NI_CtrSource(0) && dest <= NI_CtrSource(-1)) { - * ret = ni_tio_set_clock_src(counter, reg, period_ns); - */ + /* + * This case is not possible through this interface. A user must use + * INSN_CONFIG_SET_CLOCK_SRC instead. + * } else if (dest >= NI_CtrSource(0) && dest <= NI_CtrSource(-1)) { + * ret = ni_tio_set_clock_src(counter, reg, period_ns); + */ } else { return -EINVAL; } return ret; } + EXPORT_SYMBOL_GPL(ni_tio_set_routing); /* @@ -1595,11 +1607,12 @@ int ni_tio_unset_routing(struct ni_gpct_device *counter_dev, unsigned int dest) * This case is not possible through this interface. A user must use * INSN_CONFIG_SET_CLOCK_SRC instead. * if (dest >= NI_CtrSource(0) && dest <= NI_CtrSource(-1)) - * return ni_tio_set_clock_src(counter, reg, period_ns); + * return ni_tio_set_clock_src(counter, reg, period_ns); */ return -EINVAL; } + EXPORT_SYMBOL_GPL(ni_tio_unset_routing); static unsigned int ni_tio_read_sw_save_reg(struct comedi_device *dev, @@ -1631,8 +1644,7 @@ static unsigned int ni_tio_read_sw_save_reg(struct comedi_device *dev, int ni_tio_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct ni_gpct *counter = s->private; struct ni_gpct_device *counter_dev = counter->counter_dev; @@ -1658,6 +1670,7 @@ int ni_tio_insn_read(struct comedi_device *dev, } return insn->n; } + EXPORT_SYMBOL_GPL(ni_tio_insn_read); static unsigned int ni_tio_next_load_register(struct ni_gpct *counter) @@ -1666,14 +1679,13 @@ static unsigned int ni_tio_next_load_register(struct ni_gpct *counter) unsigned int bits = ni_tio_read(counter, NITIO_SHARED_STATUS_REG(cidx)); return (bits & GI_NEXT_LOAD_SRC(cidx)) - ? NITIO_LOADB_REG(cidx) - : NITIO_LOADA_REG(cidx); + ? NITIO_LOADB_REG(cidx) + : NITIO_LOADA_REG(cidx); } int ni_tio_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct ni_gpct *counter = s->private; struct ni_gpct_device *counter_dev = counter->counter_dev; @@ -1718,6 +1730,7 @@ int ni_tio_insn_write(struct comedi_device *dev, } return insn->n; } + EXPORT_SYMBOL_GPL(ni_tio_insn_write); void ni_tio_init_counter(struct ni_gpct *counter) @@ -1732,8 +1745,7 @@ void ni_tio_init_counter(struct ni_gpct *counter) counter_dev->regs[chip][NITIO_AUTO_INC_REG(cidx)] = 0x0; ni_tio_write(counter, 0x0, NITIO_AUTO_INC_REG(cidx)); - ni_tio_set_bits(counter, NITIO_CMD_REG(cidx), - ~0, GI_SYNC_GATE); + ni_tio_set_bits(counter, NITIO_CMD_REG(cidx), ~0, GI_SYNC_GATE); ni_tio_set_bits(counter, NITIO_MODE_REG(cidx), ~0, 0); @@ -1757,19 +1769,28 @@ void ni_tio_init_counter(struct ni_gpct *counter) ni_tio_set_bits(counter, NITIO_INT_ENA_REG(cidx), ~0, 0x0); } + EXPORT_SYMBOL_GPL(ni_tio_init_counter); -struct ni_gpct_device * -ni_gpct_device_construct(struct comedi_device *dev, - void (*write)(struct ni_gpct *counter, - unsigned int value, - enum ni_gpct_register reg), - unsigned int (*read)(struct ni_gpct *counter, - enum ni_gpct_register reg), - enum ni_gpct_variant variant, - unsigned int num_counters, - unsigned int counters_per_chip, - const struct ni_route_tables *routing_tables) +struct ni_gpct_device *ni_gpct_device_construct(struct comedi_device *dev, + void (*write)(struct ni_gpct * + counter, + unsigned int + value, + enum + ni_gpct_register + reg), + unsigned int (*read)(struct + ni_gpct * + counter, + enum + ni_gpct_register + reg), + enum ni_gpct_variant variant, + unsigned int num_counters, + unsigned int counters_per_chip, + const struct ni_route_tables + *routing_tables) { struct ni_gpct_device *counter_dev; struct ni_gpct *counter; @@ -1814,6 +1835,7 @@ ni_gpct_device_construct(struct comedi_device *dev, return counter_dev; } + EXPORT_SYMBOL_GPL(ni_gpct_device_construct); void ni_gpct_device_destroy(struct ni_gpct_device *counter_dev) @@ -1824,17 +1846,20 @@ void ni_gpct_device_destroy(struct ni_gpct_device *counter_dev) kfree(counter_dev->counters); kfree(counter_dev); } + EXPORT_SYMBOL_GPL(ni_gpct_device_destroy); static int __init ni_tio_init_module(void) { return 0; } + module_init(ni_tio_init_module); static void __exit ni_tio_cleanup_module(void) { } + module_exit(ni_tio_cleanup_module); MODULE_AUTHOR("Comedi <comedi@xxxxxxxxxx>"); diff --git a/drivers/comedi/drivers/ni_tio.h b/drivers/comedi/drivers/ni_tio.h index e7b05718df9b..ebc5a0900c9e 100644 --- a/drivers/comedi/drivers/ni_tio.h +++ b/drivers/comedi/drivers/ni_tio.h @@ -101,29 +101,35 @@ struct ni_gpct { struct ni_gpct_device { struct comedi_device *dev; - void (*write)(struct ni_gpct *counter, unsigned int value, + void (*write)(struct ni_gpct *counter, unsigned int value, enum ni_gpct_register); - unsigned int (*read)(struct ni_gpct *counter, enum ni_gpct_register); + unsigned int (*read)(struct ni_gpct *counter, enum ni_gpct_register); enum ni_gpct_variant variant; struct ni_gpct *counters; unsigned int num_counters; unsigned int num_chips; - unsigned int (*regs)[NITIO_NUM_REGS]; /* [num_chips][NITIO_NUM_REGS] */ - spinlock_t regs_lock; /* protects 'regs' */ - const struct ni_route_tables *routing_tables; /* link to routes */ + unsigned int (*regs)[NITIO_NUM_REGS]; /* [num_chips][NITIO_NUM_REGS] */ + spinlock_t regs_lock; /* protects 'regs' */ + const struct ni_route_tables *routing_tables; /* link to routes */ }; -struct ni_gpct_device * -ni_gpct_device_construct(struct comedi_device *dev, - void (*write)(struct ni_gpct *counter, - unsigned int value, - enum ni_gpct_register), - unsigned int (*read)(struct ni_gpct *counter, - enum ni_gpct_register), - enum ni_gpct_variant, - unsigned int num_counters, - unsigned int counters_per_chip, - const struct ni_route_tables *routing_tables); +struct ni_gpct_device *ni_gpct_device_construct(struct comedi_device *dev, + void (*write)(struct ni_gpct * + counter, + unsigned int + value, + enum + ni_gpct_register), + unsigned int (*read)(struct + ni_gpct * + counter, + enum + ni_gpct_register), + enum ni_gpct_variant, + unsigned int num_counters, + unsigned int counters_per_chip, + const struct ni_route_tables + *routing_tables); void ni_gpct_device_destroy(struct ni_gpct_device *counter_dev); void ni_tio_init_counter(struct ni_gpct *counter); int ni_tio_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, diff --git a/drivers/comedi/drivers/ni_tiocmd.c b/drivers/comedi/drivers/ni_tiocmd.c index ab6d9e8269f3..7b395bc59028 100644 --- a/drivers/comedi/drivers/ni_tiocmd.c +++ b/drivers/comedi/drivers/ni_tiocmd.c @@ -102,7 +102,7 @@ static int ni_tio_input_cmd(struct comedi_subdevice *s) struct ni_gpct *counter = s->private; struct ni_gpct_device *counter_dev = counter->counter_dev; const struct ni_route_tables *routing_tables = - counter_dev->routing_tables; + counter_dev->routing_tables; unsigned int cidx = counter->counter_index; struct comedi_async *async = s->async; struct comedi_cmd *cmd = &async->cmd; @@ -125,7 +125,7 @@ static int ni_tio_input_cmd(struct comedi_subdevice *s) if (cmd->start_src == TRIG_INT) { async->inttrig = &ni_tio_input_inttrig; - } else { /* TRIG_NOW || TRIG_EXT || TRIG_OTHER */ + } else { /* TRIG_NOW || TRIG_EXT || TRIG_OTHER */ async->inttrig = NULL; mite_dma_arm(counter->mite_chan); @@ -137,8 +137,8 @@ static int ni_tio_input_cmd(struct comedi_subdevice *s) if (reg >= NI_NAMES_BASE) { /* using a device-global name. lookup reg */ reg = ni_get_reg_value(reg, - NI_CtrArmStartTrigger(cidx), - routing_tables); + NI_CtrArmStartTrigger + (cidx), routing_tables); /* mark this as a raw register value */ reg |= NI_GPCT_HW_ARM; } @@ -163,7 +163,7 @@ static int ni_tio_cmd_setup(struct comedi_subdevice *s) struct ni_gpct *counter = s->private; unsigned int cidx = counter->counter_index; const struct ni_route_tables *routing_tables = - counter->counter_dev->routing_tables; + counter->counter_dev->routing_tables; int set_gate_source = 0; unsigned int gate_source; int retval = 0; @@ -228,16 +228,16 @@ int ni_tio_cmd(struct comedi_device *dev, struct comedi_subdevice *s) spin_unlock_irqrestore(&counter->lock, flags); return retval; } + EXPORT_SYMBOL_GPL(ni_tio_cmd); int ni_tio_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_cmd *cmd) + struct comedi_subdevice *s, struct comedi_cmd *cmd) { struct ni_gpct *counter = s->private; unsigned int cidx = counter->counter_index; const struct ni_route_tables *routing_tables = - counter->counter_dev->routing_tables; + counter->counter_dev->routing_tables; int err = 0; unsigned int sources; @@ -291,8 +291,8 @@ int ni_tio_cmdtest(struct comedi_device *dev, * should be uncommented: * * err |= ni_check_trigger_arg(CR_CHAN(cmd->start_arg), - * NI_CtrArmStartTrigger(cidx), - * routing_tables); + * NI_CtrArmStartTrigger(cidx), + * routing_tables); */ break; } @@ -327,6 +327,7 @@ int ni_tio_cmdtest(struct comedi_device *dev, return 0; } + EXPORT_SYMBOL_GPL(ni_tio_cmdtest); int ni_tio_cancel(struct ni_gpct *counter) @@ -345,6 +346,7 @@ int ni_tio_cancel(struct ni_gpct *counter) GI_GATE_INTERRUPT_ENABLE(cidx), 0x0); return 0; } + EXPORT_SYMBOL_GPL(ni_tio_cancel); static int should_ack_gate(struct ni_gpct *counter) @@ -383,14 +385,14 @@ static int should_ack_gate(struct ni_gpct *counter) static void ni_tio_acknowledge_and_confirm(struct ni_gpct *counter, int *gate_error, - int *tc_error, - int *perm_stale_data) + int *tc_error, int *perm_stale_data) { unsigned int cidx = counter->counter_index; const unsigned short gxx_status = ni_tio_read(counter, - NITIO_SHARED_STATUS_REG(cidx)); + NITIO_SHARED_STATUS_REG + (cidx)); const unsigned short gi_status = ni_tio_read(counter, - NITIO_STATUS_REG(cidx)); + NITIO_STATUS_REG(cidx)); unsigned int ack = 0; if (gate_error) @@ -443,6 +445,7 @@ void ni_tio_acknowledge(struct ni_gpct *counter) { ni_tio_acknowledge_and_confirm(counter, NULL, NULL, NULL); } + EXPORT_SYMBOL_GPL(ni_tio_acknowledge); void ni_tio_handle_interrupt(struct ni_gpct *counter, @@ -481,6 +484,7 @@ void ni_tio_handle_interrupt(struct ni_gpct *counter, mite_ack_linkc(counter->mite_chan, s, true); spin_unlock_irqrestore(&counter->lock, flags); } + EXPORT_SYMBOL_GPL(ni_tio_handle_interrupt); void ni_tio_set_mite_channel(struct ni_gpct *counter, @@ -492,17 +496,20 @@ void ni_tio_set_mite_channel(struct ni_gpct *counter, counter->mite_chan = mite_chan; spin_unlock_irqrestore(&counter->lock, flags); } + EXPORT_SYMBOL_GPL(ni_tio_set_mite_channel); static int __init ni_tiocmd_init_module(void) { return 0; } + module_init(ni_tiocmd_init_module); static void __exit ni_tiocmd_cleanup_module(void) { } + module_exit(ni_tiocmd_cleanup_module); MODULE_AUTHOR("Comedi <comedi@xxxxxxxxxx>"); diff --git a/drivers/comedi/drivers/ni_usb6501.c b/drivers/comedi/drivers/ni_usb6501.c index 5b6d9d783b2f..cfb8b095c688 100644 --- a/drivers/comedi/drivers/ni_usb6501.c +++ b/drivers/comedi/drivers/ni_usb6501.c @@ -93,56 +93,66 @@ #define NI6501_TIMEOUT 1000 /* Port request packets */ -static const u8 READ_PORT_REQUEST[] = {0x00, 0x01, 0x00, 0x10, - 0x00, 0x0C, 0x01, 0x0E, - 0x02, 0x10, 0x00, 0x00, - 0x00, 0x03, 0x00, 0x00}; - -static const u8 WRITE_PORT_REQUEST[] = {0x00, 0x01, 0x00, 0x14, - 0x00, 0x10, 0x01, 0x0F, - 0x02, 0x10, 0x00, 0x00, - 0x00, 0x03, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00}; - -static const u8 SET_PORT_DIR_REQUEST[] = {0x00, 0x01, 0x00, 0x18, - 0x00, 0x14, 0x01, 0x12, - 0x02, 0x10, 0x00, 0x00, - 0x00, 0x05, 0x00, 0x00, - 0x00, 0x00, 0x05, 0x00, - 0x00, 0x00, 0x00, 0x00}; +static const u8 READ_PORT_REQUEST[] = { 0x00, 0x01, 0x00, 0x10, + 0x00, 0x0C, 0x01, 0x0E, + 0x02, 0x10, 0x00, 0x00, + 0x00, 0x03, 0x00, 0x00 +}; + +static const u8 WRITE_PORT_REQUEST[] = { 0x00, 0x01, 0x00, 0x14, + 0x00, 0x10, 0x01, 0x0F, + 0x02, 0x10, 0x00, 0x00, + 0x00, 0x03, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00 +}; + +static const u8 SET_PORT_DIR_REQUEST[] = { 0x00, 0x01, 0x00, 0x18, + 0x00, 0x14, 0x01, 0x12, + 0x02, 0x10, 0x00, 0x00, + 0x00, 0x05, 0x00, 0x00, + 0x00, 0x00, 0x05, 0x00, + 0x00, 0x00, 0x00, 0x00 +}; /* Counter request packets */ -static const u8 START_COUNTER_REQUEST[] = {0x00, 0x01, 0x00, 0x0C, - 0x00, 0x08, 0x01, 0x09, - 0x02, 0x20, 0x00, 0x00}; +static const u8 START_COUNTER_REQUEST[] = { 0x00, 0x01, 0x00, 0x0C, + 0x00, 0x08, 0x01, 0x09, + 0x02, 0x20, 0x00, 0x00 +}; -static const u8 STOP_COUNTER_REQUEST[] = {0x00, 0x01, 0x00, 0x0C, - 0x00, 0x08, 0x01, 0x0C, - 0x02, 0x20, 0x00, 0x00}; +static const u8 STOP_COUNTER_REQUEST[] = { 0x00, 0x01, 0x00, 0x0C, + 0x00, 0x08, 0x01, 0x0C, + 0x02, 0x20, 0x00, 0x00 +}; -static const u8 READ_COUNTER_REQUEST[] = {0x00, 0x01, 0x00, 0x0C, - 0x00, 0x08, 0x01, 0x0E, - 0x02, 0x20, 0x00, 0x00}; +static const u8 READ_COUNTER_REQUEST[] = { 0x00, 0x01, 0x00, 0x0C, + 0x00, 0x08, 0x01, 0x0E, + 0x02, 0x20, 0x00, 0x00 +}; -static const u8 WRITE_COUNTER_REQUEST[] = {0x00, 0x01, 0x00, 0x10, - 0x00, 0x0C, 0x01, 0x0F, - 0x02, 0x20, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00}; +static const u8 WRITE_COUNTER_REQUEST[] = { 0x00, 0x01, 0x00, 0x10, + 0x00, 0x0C, 0x01, 0x0F, + 0x02, 0x20, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 +}; /* Response packets */ -static const u8 GENERIC_RESPONSE[] = {0x00, 0x01, 0x00, 0x0C, - 0x00, 0x08, 0x01, 0x00, - 0x00, 0x00, 0x00, 0x02}; +static const u8 GENERIC_RESPONSE[] = { 0x00, 0x01, 0x00, 0x0C, + 0x00, 0x08, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x02 +}; -static const u8 READ_PORT_RESPONSE[] = {0x00, 0x01, 0x00, 0x10, - 0x00, 0x0C, 0x01, 0x00, - 0x00, 0x00, 0x00, 0x02, - 0x00, 0x03, 0x00, 0x00}; +static const u8 READ_PORT_RESPONSE[] = { 0x00, 0x01, 0x00, 0x10, + 0x00, 0x0C, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x02, + 0x00, 0x03, 0x00, 0x00 +}; -static const u8 READ_COUNTER_RESPONSE[] = {0x00, 0x01, 0x00, 0x10, - 0x00, 0x0C, 0x01, 0x00, - 0x00, 0x00, 0x00, 0x02, - 0x00, 0x00, 0x00, 0x00}; +static const u8 READ_COUNTER_RESPONSE[] = { 0x00, 0x01, 0x00, 0x10, + 0x00, 0x0C, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x00 +}; enum commands { READ_PORT, @@ -163,7 +173,7 @@ struct ni6501_private { }; static int ni6501_port_command(struct comedi_device *dev, int command, - unsigned int val, u8 *bitmap) + unsigned int val, u8 *bitmap) { struct usb_device *usb = comedi_to_usb_dev(dev); struct ni6501_private *devpriv = dev->private; @@ -207,9 +217,7 @@ static int ni6501_port_command(struct comedi_device *dev, int command, usb_sndbulkpipe(usb, devpriv->ep_tx->bEndpointAddress), devpriv->usb_tx_buf, - request_size, - NULL, - NI6501_TIMEOUT); + request_size, NULL, NI6501_TIMEOUT); if (ret) goto end; @@ -217,9 +225,7 @@ static int ni6501_port_command(struct comedi_device *dev, int command, usb_rcvbulkpipe(usb, devpriv->ep_rx->bEndpointAddress), devpriv->usb_rx_buf, - response_size, - NULL, - NI6501_TIMEOUT); + response_size, NULL, NI6501_TIMEOUT); if (ret) goto end; @@ -245,7 +251,7 @@ static int ni6501_port_command(struct comedi_device *dev, int command, } static int ni6501_counter_command(struct comedi_device *dev, int command, - u32 *val) + u32 *val) { struct usb_device *usb = comedi_to_usb_dev(dev); struct ni6501_private *devpriv = dev->private; @@ -253,7 +259,7 @@ static int ni6501_counter_command(struct comedi_device *dev, int command, u8 *tx = devpriv->usb_tx_buf; int ret; - if ((command == READ_COUNTER || command == WRITE_COUNTER) && !val) + if ((command == READ_COUNTER || command == WRITE_COUNTER) && !val) return -EINVAL; mutex_lock(&devpriv->mut); @@ -279,8 +285,8 @@ static int ni6501_counter_command(struct comedi_device *dev, int command, response_size = sizeof(GENERIC_RESPONSE); memcpy(tx, WRITE_COUNTER_REQUEST, request_size); /* Setup tx packet: bytes 12,13,14,15 hold the */ - /* u32 counter value (Big Endian) */ - *((__be32 *)&tx[12]) = cpu_to_be32(*val); + /* u32 counter value (Big Endian) */ + *((__be32 *) &tx[12]) = cpu_to_be32(*val); break; default: ret = -EINVAL; @@ -291,9 +297,7 @@ static int ni6501_counter_command(struct comedi_device *dev, int command, usb_sndbulkpipe(usb, devpriv->ep_tx->bEndpointAddress), devpriv->usb_tx_buf, - request_size, - NULL, - NI6501_TIMEOUT); + request_size, NULL, NI6501_TIMEOUT); if (ret) goto end; @@ -301,9 +305,7 @@ static int ni6501_counter_command(struct comedi_device *dev, int command, usb_rcvbulkpipe(usb, devpriv->ep_rx->bEndpointAddress), devpriv->usb_rx_buf, - response_size, - NULL, - NI6501_TIMEOUT); + response_size, NULL, NI6501_TIMEOUT); if (ret) goto end; @@ -313,8 +315,8 @@ static int ni6501_counter_command(struct comedi_device *dev, int command, int i; /* Read counter value: bytes 12,13,14,15 of rx packet */ - /* hold the u32 counter value (Big Endian) */ - *val = be32_to_cpu(*((__be32 *)&devpriv->usb_rx_buf[12])); + /* hold the u32 counter value (Big Endian) */ + *val = be32_to_cpu(*((__be32 *) &devpriv->usb_rx_buf[12])); /* mask counter value for comparing */ for (i = 12; i < sizeof(READ_COUNTER_RESPONSE); ++i) @@ -336,8 +338,7 @@ static int ni6501_counter_command(struct comedi_device *dev, int command, static int ni6501_dio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { int ret; @@ -354,8 +355,7 @@ static int ni6501_dio_insn_config(struct comedi_device *dev, static int ni6501_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int mask; int ret; @@ -388,8 +388,7 @@ static int ni6501_dio_insn_bits(struct comedi_device *dev, static int ni6501_cnt_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { int ret; u32 val = 0; @@ -416,15 +415,14 @@ static int ni6501_cnt_insn_config(struct comedi_device *dev, static int ni6501_cnt_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { int ret; u32 val; unsigned int i; for (i = 0; i < insn->n; i++) { - ret = ni6501_counter_command(dev, READ_COUNTER, &val); + ret = ni6501_counter_command(dev, READ_COUNTER, &val); if (ret) return ret; data[i] = val; @@ -435,8 +433,7 @@ static int ni6501_cnt_insn_read(struct comedi_device *dev, static int ni6501_cnt_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { int ret; @@ -504,8 +501,7 @@ static int ni6501_find_endpoints(struct comedi_device *dev) return 0; } -static int ni6501_auto_attach(struct comedi_device *dev, - unsigned long context) +static int ni6501_auto_attach(struct comedi_device *dev, unsigned long context) { struct usb_interface *intf = comedi_to_usb_interface(dev); struct ni6501_private *devpriv; @@ -533,23 +529,23 @@ static int ni6501_auto_attach(struct comedi_device *dev, /* Digital Input/Output subdevice */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 24; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = ni6501_dio_insn_bits; - s->insn_config = ni6501_dio_insn_config; + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 24; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = ni6501_dio_insn_bits; + s->insn_config = ni6501_dio_insn_config; /* Counter subdevice */ s = &dev->subdevices[1]; - s->type = COMEDI_SUBD_COUNTER; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_LSAMPL; - s->n_chan = 1; - s->maxdata = 0xffffffff; - s->insn_read = ni6501_cnt_insn_read; - s->insn_write = ni6501_cnt_insn_write; - s->insn_config = ni6501_cnt_insn_config; + s->type = COMEDI_SUBD_COUNTER; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_LSAMPL; + s->n_chan = 1; + s->maxdata = 0xffffffff; + s->insn_read = ni6501_cnt_insn_read; + s->insn_write = ni6501_cnt_insn_write; + s->insn_config = ni6501_cnt_insn_config; return 0; } @@ -571,10 +567,10 @@ static void ni6501_detach(struct comedi_device *dev) } static struct comedi_driver ni6501_driver = { - .module = THIS_MODULE, - .driver_name = "ni6501", - .auto_attach = ni6501_auto_attach, - .detach = ni6501_detach, + .module = THIS_MODULE, + .driver_name = "ni6501", + .auto_attach = ni6501_auto_attach, + .detach = ni6501_detach, }; static int ni6501_usb_probe(struct usb_interface *intf, @@ -587,14 +583,16 @@ static const struct usb_device_id ni6501_usb_table[] = { { USB_DEVICE(0x3923, 0x718a) }, { } }; + MODULE_DEVICE_TABLE(usb, ni6501_usb_table); static struct usb_driver ni6501_usb_driver = { - .name = "ni6501", - .id_table = ni6501_usb_table, - .probe = ni6501_usb_probe, - .disconnect = comedi_usb_auto_unconfig, + .name = "ni6501", + .id_table = ni6501_usb_table, + .probe = ni6501_usb_probe, + .disconnect = comedi_usb_auto_unconfig, }; + module_comedi_usb_driver(ni6501_driver, ni6501_usb_driver); MODULE_AUTHOR("Luca Ellero"); diff --git a/drivers/comedi/drivers/pcl711.c b/drivers/comedi/drivers/pcl711.c index bd6f42fe9e3c..910b25140ff3 100644 --- a/drivers/comedi/drivers/pcl711.c +++ b/drivers/comedi/drivers/pcl711.c @@ -46,7 +46,7 @@ #define PCL711_DI_LSB_REG 0x06 #define PCL711_DI_MSB_REG 0x07 #define PCL711_INT_STAT_REG 0x08 -#define PCL711_INT_STAT_CLR (0 << 0) /* any value will work */ +#define PCL711_INT_STAT_CLR (0 << 0) /* any value will work */ #define PCL711_AI_GAIN_REG 0x09 #define PCL711_AI_GAIN(x) (((x) & 0xf) << 0) #define PCL711_MUX_REG 0x0a @@ -64,49 +64,49 @@ #define PCL711_MODE_PACER_IRQ PCL711_MODE(6) #define PCL711_MODE_IRQ(x) (((x) & 0x7) << 4) #define PCL711_SOFTTRIG_REG 0x0c -#define PCL711_SOFTTRIG (0 << 0) /* any value will work */ +#define PCL711_SOFTTRIG (0 << 0) /* any value will work */ #define PCL711_DO_LSB_REG 0x0d #define PCL711_DO_MSB_REG 0x0e static const struct comedi_lrange range_pcl711b_ai = { 5, { - BIP_RANGE(5), - BIP_RANGE(2.5), - BIP_RANGE(1.25), - BIP_RANGE(0.625), - BIP_RANGE(0.3125) - } + BIP_RANGE(5), + BIP_RANGE(2.5), + BIP_RANGE(1.25), + BIP_RANGE(0.625), + BIP_RANGE(0.3125) + } }; static const struct comedi_lrange range_acl8112hg_ai = { 12, { - BIP_RANGE(5), - BIP_RANGE(0.5), - BIP_RANGE(0.05), - BIP_RANGE(0.005), - UNI_RANGE(10), - UNI_RANGE(1), - UNI_RANGE(0.1), - UNI_RANGE(0.01), - BIP_RANGE(10), - BIP_RANGE(1), - BIP_RANGE(0.1), - BIP_RANGE(0.01) - } + BIP_RANGE(5), + BIP_RANGE(0.5), + BIP_RANGE(0.05), + BIP_RANGE(0.005), + UNI_RANGE(10), + UNI_RANGE(1), + UNI_RANGE(0.1), + UNI_RANGE(0.01), + BIP_RANGE(10), + BIP_RANGE(1), + BIP_RANGE(0.1), + BIP_RANGE(0.01) + } }; static const struct comedi_lrange range_acl8112dg_ai = { 9, { - BIP_RANGE(5), - BIP_RANGE(2.5), - BIP_RANGE(1.25), - BIP_RANGE(0.625), - UNI_RANGE(10), - UNI_RANGE(5), - UNI_RANGE(2.5), - UNI_RANGE(1.25), - BIP_RANGE(10) - } + BIP_RANGE(5), + BIP_RANGE(2.5), + BIP_RANGE(1.25), + BIP_RANGE(0.625), + UNI_RANGE(10), + UNI_RANGE(5), + UNI_RANGE(2.5), + UNI_RANGE(1.25), + BIP_RANGE(10) + } }; struct pcl711_board { @@ -119,29 +119,29 @@ struct pcl711_board { static const struct pcl711_board boardtypes[] = { { - .name = "pcl711", - .n_aichan = 8, - .n_aochan = 1, - .ai_range_type = &range_bipolar5, - }, { - .name = "pcl711b", - .n_aichan = 8, - .n_aochan = 1, - .maxirq = 7, - .ai_range_type = &range_pcl711b_ai, - }, { - .name = "acl8112hg", - .n_aichan = 16, - .n_aochan = 2, - .maxirq = 15, - .ai_range_type = &range_acl8112hg_ai, - }, { - .name = "acl8112dg", - .n_aichan = 16, - .n_aochan = 2, - .maxirq = 15, - .ai_range_type = &range_acl8112dg_ai, - }, + .name = "pcl711", + .n_aichan = 8, + .n_aochan = 1, + .ai_range_type = &range_bipolar5, + }, { + .name = "pcl711b", + .n_aichan = 8, + .n_aochan = 1, + .maxirq = 7, + .ai_range_type = &range_pcl711b_ai, + }, { + .name = "acl8112hg", + .n_aichan = 16, + .n_aochan = 2, + .maxirq = 15, + .ai_range_type = &range_acl8112hg_ai, + }, { + .name = "acl8112dg", + .n_aichan = 16, + .n_aochan = 2, + .maxirq = 15, + .ai_range_type = &range_acl8112dg_ai, + }, }; static void pcl711_ai_set_mode(struct comedi_device *dev, unsigned int mode) @@ -234,8 +234,7 @@ static void pcl711_set_changain(struct comedi_device *dev, static int pcl711_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned int status; @@ -247,8 +246,7 @@ static int pcl711_ai_eoc(struct comedi_device *dev, static int pcl711_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { int ret; int i; @@ -315,7 +313,7 @@ static int pcl711_ai_cmdtest(struct comedi_device *dev, if (cmd->stop_src == TRIG_COUNT) err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); - else /* TRIG_NONE */ + else /* TRIG_NONE */ err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) @@ -363,8 +361,7 @@ static void pcl711_ao_write(struct comedi_device *dev, static int pcl711_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int val = s->readback[chan]; @@ -381,8 +378,7 @@ static int pcl711_ao_insn_write(struct comedi_device *dev, static int pcl711_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int val; @@ -396,8 +392,7 @@ static int pcl711_di_insn_bits(struct comedi_device *dev, static int pcl711_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int mask; @@ -442,31 +437,31 @@ static int pcl711_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* Analog Input subdevice */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_GROUND; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_GROUND; if (board->n_aichan > 8) - s->subdev_flags |= SDF_DIFF; - s->n_chan = board->n_aichan; - s->maxdata = 0xfff; - s->range_table = board->ai_range_type; - s->insn_read = pcl711_ai_insn_read; + s->subdev_flags |= SDF_DIFF; + s->n_chan = board->n_aichan; + s->maxdata = 0xfff; + s->range_table = board->ai_range_type; + s->insn_read = pcl711_ai_insn_read; if (dev->irq) { dev->read_subdev = s; - s->subdev_flags |= SDF_CMD_READ; - s->len_chanlist = 1; - s->do_cmdtest = pcl711_ai_cmdtest; - s->do_cmd = pcl711_ai_cmd; - s->cancel = pcl711_ai_cancel; + s->subdev_flags |= SDF_CMD_READ; + s->len_chanlist = 1; + s->do_cmdtest = pcl711_ai_cmdtest; + s->do_cmd = pcl711_ai_cmd; + s->cancel = pcl711_ai_cancel; } /* Analog Output subdevice */ s = &dev->subdevices[1]; - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = board->n_aochan; - s->maxdata = 0xfff; - s->range_table = &range_bipolar5; - s->insn_write = pcl711_ao_insn_write; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = board->n_aochan; + s->maxdata = 0xfff; + s->range_table = &range_bipolar5; + s->insn_write = pcl711_ao_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) @@ -474,21 +469,21 @@ static int pcl711_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* Digital Input subdevice */ s = &dev->subdevices[2]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 16; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = pcl711_di_insn_bits; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 16; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = pcl711_di_insn_bits; /* Digital Output subdevice */ s = &dev->subdevices[3]; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 16; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = pcl711_do_insn_bits; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 16; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = pcl711_do_insn_bits; /* clear DAC */ pcl711_ao_write(dev, 0, 0x0); @@ -498,14 +493,15 @@ static int pcl711_attach(struct comedi_device *dev, struct comedi_devconfig *it) } static struct comedi_driver pcl711_driver = { - .driver_name = "pcl711", - .module = THIS_MODULE, - .attach = pcl711_attach, - .detach = comedi_legacy_detach, - .board_name = &boardtypes[0].name, - .num_names = ARRAY_SIZE(boardtypes), - .offset = sizeof(struct pcl711_board), + .driver_name = "pcl711", + .module = THIS_MODULE, + .attach = pcl711_attach, + .detach = comedi_legacy_detach, + .board_name = &boardtypes[0].name, + .num_names = ARRAY_SIZE(boardtypes), + .offset = sizeof(struct pcl711_board), }; + module_comedi_driver(pcl711_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/pcl724.c b/drivers/comedi/drivers/pcl724.c index 1a5799278a7a..367506350437 100644 --- a/drivers/comedi/drivers/pcl724.c +++ b/drivers/comedi/drivers/pcl724.c @@ -39,41 +39,41 @@ struct pcl724_board { static const struct pcl724_board boardtypes[] = { { - .name = "pcl724", - .io_range = 0x04, - .numofports = 1, /* 24 DIO channels */ - }, { - .name = "pcl722", - .io_range = 0x20, - .can_have96 = 1, - .numofports = 6, /* 144 (or 96) DIO channels */ - }, { - .name = "pcl731", - .io_range = 0x08, - .numofports = 2, /* 48 DIO channels */ - }, { - .name = "acl7122", - .io_range = 0x20, - .can_have96 = 1, - .numofports = 6, /* 144 (or 96) DIO channels */ - }, { - .name = "acl7124", - .io_range = 0x04, - .numofports = 1, /* 24 DIO channels */ - }, { - .name = "pet48dio", - .io_range = 0x02, - .is_pet48 = 1, - .numofports = 2, /* 48 DIO channels */ - }, { - .name = "pcmio48", - .io_range = 0x08, - .numofports = 2, /* 48 DIO channels */ - }, { - .name = "onyx-mm-dio", - .io_range = 0x10, - .numofports = 2, /* 48 DIO channels */ - }, + .name = "pcl724", + .io_range = 0x04, + .numofports = 1, /* 24 DIO channels */ + }, { + .name = "pcl722", + .io_range = 0x20, + .can_have96 = 1, + .numofports = 6, /* 144 (or 96) DIO channels */ + }, { + .name = "pcl731", + .io_range = 0x08, + .numofports = 2, /* 48 DIO channels */ + }, { + .name = "acl7122", + .io_range = 0x20, + .can_have96 = 1, + .numofports = 6, /* 144 (or 96) DIO channels */ + }, { + .name = "acl7124", + .io_range = 0x04, + .numofports = 1, /* 24 DIO channels */ + }, { + .name = "pet48dio", + .io_range = 0x02, + .is_pet48 = 1, + .numofports = 2, /* 48 DIO channels */ + }, { + .name = "pcmio48", + .io_range = 0x08, + .numofports = 2, /* 48 DIO channels */ + }, { + .name = "onyx-mm-dio", + .io_range = 0x10, + .numofports = 2, /* 48 DIO channels */ + }, }; static int pcl724_8255mapped_io(struct comedi_device *dev, @@ -92,8 +92,7 @@ static int pcl724_8255mapped_io(struct comedi_device *dev, return inb(iobase + 1); } -static int pcl724_attach(struct comedi_device *dev, - struct comedi_devconfig *it) +static int pcl724_attach(struct comedi_device *dev, struct comedi_devconfig *it) { const struct pcl724_board *board = dev->board_ptr; struct comedi_subdevice *s; @@ -107,8 +106,7 @@ static int pcl724_attach(struct comedi_device *dev, n_subdevices = board->numofports; /* Handle PCL-724 in 96 DIO configuration */ - if (board->can_have96 && - (it->options[2] == 1 || it->options[2] == 96)) { + if (board->can_have96 && (it->options[2] == 1 || it->options[2] == 96)) { iorange = 0x10; n_subdevices = 4; } @@ -138,14 +136,15 @@ static int pcl724_attach(struct comedi_device *dev, } static struct comedi_driver pcl724_driver = { - .driver_name = "pcl724", - .module = THIS_MODULE, - .attach = pcl724_attach, - .detach = comedi_legacy_detach, - .board_name = &boardtypes[0].name, - .num_names = ARRAY_SIZE(boardtypes), - .offset = sizeof(struct pcl724_board), + .driver_name = "pcl724", + .module = THIS_MODULE, + .attach = pcl724_attach, + .detach = comedi_legacy_detach, + .board_name = &boardtypes[0].name, + .num_names = ARRAY_SIZE(boardtypes), + .offset = sizeof(struct pcl724_board), }; + module_comedi_driver(pcl724_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/pcl726.c b/drivers/comedi/drivers/pcl726.c index 88f25d7e76f7..04a69b843dee 100644 --- a/drivers/comedi/drivers/pcl726.c +++ b/drivers/comedi/drivers/pcl726.c @@ -103,41 +103,41 @@ struct pcl726_board { static const struct pcl726_board pcl726_boards[] = { { - .name = "pcl726", - .io_len = 0x10, - .ao_ranges = &rangelist_726[0], - .ao_num_ranges = ARRAY_SIZE(rangelist_726), - .ao_nchan = 6, - .have_dio = 1, - }, { - .name = "pcl727", - .io_len = 0x20, - .ao_ranges = &rangelist_727[0], - .ao_num_ranges = ARRAY_SIZE(rangelist_727), - .ao_nchan = 12, - .have_dio = 1, - .is_pcl727 = 1, - }, { - .name = "pcl728", - .io_len = 0x08, - .ao_num_ranges = ARRAY_SIZE(rangelist_728), - .ao_ranges = &rangelist_728[0], - .ao_nchan = 2, - }, { - .name = "acl6126", - .io_len = 0x10, - .irq_mask = 0x96e8, - .ao_num_ranges = ARRAY_SIZE(rangelist_726), - .ao_ranges = &rangelist_726[0], - .ao_nchan = 6, - .have_dio = 1, - }, { - .name = "acl6128", - .io_len = 0x08, - .ao_num_ranges = ARRAY_SIZE(rangelist_728), - .ao_ranges = &rangelist_728[0], - .ao_nchan = 2, - }, + .name = "pcl726", + .io_len = 0x10, + .ao_ranges = &rangelist_726[0], + .ao_num_ranges = ARRAY_SIZE(rangelist_726), + .ao_nchan = 6, + .have_dio = 1, + }, { + .name = "pcl727", + .io_len = 0x20, + .ao_ranges = &rangelist_727[0], + .ao_num_ranges = ARRAY_SIZE(rangelist_727), + .ao_nchan = 12, + .have_dio = 1, + .is_pcl727 = 1, + }, { + .name = "pcl728", + .io_len = 0x08, + .ao_num_ranges = ARRAY_SIZE(rangelist_728), + .ao_ranges = &rangelist_728[0], + .ao_nchan = 2, + }, { + .name = "acl6126", + .io_len = 0x10, + .irq_mask = 0x96e8, + .ao_num_ranges = ARRAY_SIZE(rangelist_726), + .ao_ranges = &rangelist_726[0], + .ao_nchan = 6, + .have_dio = 1, + }, { + .name = "acl6128", + .io_len = 0x08, + .ao_num_ranges = ARRAY_SIZE(rangelist_728), + .ao_ranges = &rangelist_728[0], + .ao_nchan = 2, + }, }; struct pcl726_private { @@ -147,8 +147,7 @@ struct pcl726_private { static int pcl726_intr_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { data[1] = 0; return insn->n; @@ -233,8 +232,7 @@ static irqreturn_t pcl726_interrupt(int irq, void *d) static int pcl726_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int range = CR_RANGE(insn->chanspec); @@ -259,8 +257,7 @@ static int pcl726_ao_insn_write(struct comedi_device *dev, static int pcl726_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { const struct pcl726_board *board = dev->board_ptr; unsigned int val; @@ -280,8 +277,7 @@ static int pcl726_di_insn_bits(struct comedi_device *dev, static int pcl726_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { const struct pcl726_board *board = dev->board_ptr; unsigned long io = dev->iobase; @@ -307,8 +303,7 @@ static int pcl726_do_insn_bits(struct comedi_device *dev, return insn->n; } -static int pcl726_attach(struct comedi_device *dev, - struct comedi_devconfig *it) +static int pcl726_attach(struct comedi_device *dev, struct comedi_devconfig *it) { const struct pcl726_board *board = dev->board_ptr; struct pcl726_private *devpriv; @@ -359,12 +354,12 @@ static int pcl726_attach(struct comedi_device *dev, /* Analog Output subdevice */ s = &dev->subdevices[subdev++]; - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE | SDF_GROUND; - s->n_chan = board->ao_nchan; - s->maxdata = 0x0fff; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE | SDF_GROUND; + s->n_chan = board->ao_nchan; + s->maxdata = 0x0fff; s->range_table_list = devpriv->rangelist; - s->insn_write = pcl726_ao_insn_write; + s->insn_write = pcl726_ao_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) @@ -373,51 +368,52 @@ static int pcl726_attach(struct comedi_device *dev, if (board->have_dio) { /* Digital Input subdevice */ s = &dev->subdevices[subdev++]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 16; - s->maxdata = 1; - s->insn_bits = pcl726_di_insn_bits; - s->range_table = &range_digital; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 16; + s->maxdata = 1; + s->insn_bits = pcl726_di_insn_bits; + s->range_table = &range_digital; /* Digital Output subdevice */ s = &dev->subdevices[subdev++]; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 16; - s->maxdata = 1; - s->insn_bits = pcl726_do_insn_bits; - s->range_table = &range_digital; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 16; + s->maxdata = 1; + s->insn_bits = pcl726_do_insn_bits; + s->range_table = &range_digital; } if (dev->irq) { /* Digital Input subdevice - Interrupt support */ s = &dev->subdevices[subdev++]; dev->read_subdev = s; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE | SDF_CMD_READ; - s->n_chan = 1; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = pcl726_intr_insn_bits; - s->len_chanlist = 1; - s->do_cmdtest = pcl726_intr_cmdtest; - s->do_cmd = pcl726_intr_cmd; - s->cancel = pcl726_intr_cancel; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE | SDF_CMD_READ; + s->n_chan = 1; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = pcl726_intr_insn_bits; + s->len_chanlist = 1; + s->do_cmdtest = pcl726_intr_cmdtest; + s->do_cmd = pcl726_intr_cmd; + s->cancel = pcl726_intr_cancel; } return 0; } static struct comedi_driver pcl726_driver = { - .driver_name = "pcl726", - .module = THIS_MODULE, - .attach = pcl726_attach, - .detach = comedi_legacy_detach, - .board_name = &pcl726_boards[0].name, - .num_names = ARRAY_SIZE(pcl726_boards), - .offset = sizeof(struct pcl726_board), + .driver_name = "pcl726", + .module = THIS_MODULE, + .attach = pcl726_attach, + .detach = comedi_legacy_detach, + .board_name = &pcl726_boards[0].name, + .num_names = ARRAY_SIZE(pcl726_boards), + .offset = sizeof(struct pcl726_board), }; + module_comedi_driver(pcl726_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/pcl730.c b/drivers/comedi/drivers/pcl730.c index 32a29129e6e8..1bb1e97c04f1 100644 --- a/drivers/comedi/drivers/pcl730.c +++ b/drivers/comedi/drivers/pcl730.c @@ -115,104 +115,116 @@ struct pcl730_board { static const struct pcl730_board pcl730_boards[] = { { - .name = "pcl730", - .io_range = 0x04, - .has_ttl_io = 1, - .n_subdevs = 4, - .n_iso_out_chan = 16, - .n_iso_in_chan = 16, - .n_ttl_chan = 16, - }, { - .name = "iso730", - .io_range = 0x04, - .n_subdevs = 4, - .n_iso_out_chan = 16, - .n_iso_in_chan = 16, - .n_ttl_chan = 16, - }, { - .name = "acl7130", - .io_range = 0x08, - .has_ttl_io = 1, - .n_subdevs = 4, - .n_iso_out_chan = 16, - .n_iso_in_chan = 16, - .n_ttl_chan = 16, - }, { - .name = "pcm3730", - .io_range = 0x04, - .has_ttl_io = 1, - .n_subdevs = 4, - .n_iso_out_chan = 8, - .n_iso_in_chan = 8, - .n_ttl_chan = 16, - }, { - .name = "pcl725", - .io_range = 0x02, - .is_pcl725 = 1, - .n_subdevs = 2, - .n_iso_out_chan = 8, - .n_iso_in_chan = 8, - }, { - .name = "p8r8dio", - .io_range = 0x02, - .is_pcl725 = 1, - .has_readback = 1, - .n_subdevs = 2, - .n_iso_out_chan = 8, - .n_iso_in_chan = 8, - }, { - .name = "acl7225b", - .io_range = 0x08, /* only 4 are used */ - .is_acl7225b = 1, - .has_readback = 1, - .n_subdevs = 2, - .n_iso_out_chan = 16, - .n_iso_in_chan = 16, - }, { - .name = "p16r16dio", - .io_range = 0x04, - .is_acl7225b = 1, - .has_readback = 1, - .n_subdevs = 2, - .n_iso_out_chan = 16, - .n_iso_in_chan = 16, - }, { - .name = "pcl733", - .io_range = 0x04, - .n_subdevs = 1, - .n_iso_in_chan = 32, - }, { - .name = "pcl734", - .io_range = 0x04, - .n_subdevs = 1, - .n_iso_out_chan = 32, - }, { - .name = "opmm-1616-xt", - .io_range = 0x10, - .is_acl7225b = 1, - .has_readback = 1, - .n_subdevs = 2, - .n_iso_out_chan = 16, - .n_iso_in_chan = 16, - }, { - .name = "pearl-mm-p", - .io_range = 0x02, - .n_subdevs = 1, - .n_iso_out_chan = 16, - }, { - .name = "ir104-pbf", - .io_range = 0x08, - .is_ir104 = 1, - .has_readback = 1, - .n_iso_out_chan = 20, - .n_iso_in_chan = 20, - }, + .name = "pcl730", + .io_range = 0x04, + .has_ttl_io = 1, + .n_subdevs = 4, + .n_iso_out_chan = 16, + .n_iso_in_chan = 16, + .n_ttl_chan = 16, + }, { + .name = "iso730", + .io_range = 0x04, + .n_subdevs = 4, + .n_iso_out_chan = 16, + .n_iso_in_chan = 16, + .n_ttl_chan = 16, + }, { + .name = "acl7130", + .io_range = 0x08, + .has_ttl_io = 1, + .n_subdevs = 4, + .n_iso_out_chan = 16, + .n_iso_in_chan = 16, + .n_ttl_chan = 16, + }, { + .name = "pcm3730", + .io_range = 0x04, + .has_ttl_io = 1, + .n_subdevs = 4, + .n_iso_out_chan = 8, + .n_iso_in_chan = 8, + .n_ttl_chan = 16, + }, { + .name = "pcl725", + .io_range = 0x02, + .is_pcl725 = 1, + .n_subdevs = 2, + .n_iso_out_chan = 8, + .n_iso_in_chan = 8, + }, { + .name = "p8r8dio", + .io_range = 0x02, + .is_pcl725 = 1, + .has_readback = 1, + .n_subdevs = 2, + .n_iso_out_chan = 8, + .n_iso_in_chan = 8, + }, { + .name = "acl7225b", + .io_range = 0x08, /* only 4 are used */ + .is_acl7225b = 1, + .has_readback = 1, + .n_subdevs = 2, + .n_iso_out_chan = 16, + .n_iso_in_chan = 16, + }, { + .name = "p16r16dio", + .io_range = 0x04, + .is_acl7225b = 1, + .has_readback = 1, + .n_subdevs = 2, + .n_iso_out_chan = 16, + .n_iso_in_chan = 16, + }, { + .name = "pcl733", + .io_range = 0x04, + .n_subdevs = 1, + .n_iso_in_chan = 32, + }, { + .name = "pcl734", + .io_range = 0x04, + .n_subdevs = 1, + .n_iso_out_chan = 32, + }, { + .name = + "opmm-1616-xt", + .io_range = 0x10, + .is_acl7225b = 1, + .has_readback = 1, + .n_subdevs = 2, + .n_iso_out_chan = 16, + .n_iso_in_chan = 16, + }, { + .name = + "pearl-mm-p", + .io_range = + 0x02, + .n_subdevs = 1, + .n_iso_out_chan + = 16, + }, { + .name = + "ir104-pbf", + .io_range = + 0x08, + .is_ir104 = + 1, + . + has_readback + = 1, + . + n_iso_out_chan + = 20, + . + n_iso_in_chan + = 20, + }, }; static int pcl730_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned long reg = (unsigned long)s->private; unsigned int mask; @@ -253,16 +265,14 @@ static unsigned int pcl730_get_bits(struct comedi_device *dev, static int pcl730_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { data[1] = pcl730_get_bits(dev, s); return insn->n; } -static int pcl730_attach(struct comedi_device *dev, - struct comedi_devconfig *it) +static int pcl730_attach(struct comedi_device *dev, struct comedi_devconfig *it) { const struct pcl730_board *board = dev->board_ptr; struct comedi_subdevice *s; @@ -282,13 +292,13 @@ static int pcl730_attach(struct comedi_device *dev, if (board->n_iso_out_chan) { /* Isolated Digital Outputs */ s = &dev->subdevices[subdev++]; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = board->n_iso_out_chan; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = pcl730_do_insn_bits; - s->private = (void *)0; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = board->n_iso_out_chan; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = pcl730_do_insn_bits; + s->private = (void *)0; /* get the initial state if supported */ if (board->has_readback) @@ -298,51 +308,52 @@ static int pcl730_attach(struct comedi_device *dev, if (board->n_iso_in_chan) { /* Isolated Digital Inputs */ s = &dev->subdevices[subdev++]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = board->n_iso_in_chan; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = pcl730_di_insn_bits; - s->private = board->is_ir104 ? (void *)4 : - board->is_acl7225b ? (void *)2 : - board->is_pcl725 ? (void *)1 : (void *)0; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = board->n_iso_in_chan; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = pcl730_di_insn_bits; + s->private = board->is_ir104 ? (void *)4 : + board->is_acl7225b ? (void *)2 : + board->is_pcl725 ? (void *)1 : (void *)0; } if (board->has_ttl_io) { /* TTL Digital Outputs */ s = &dev->subdevices[subdev++]; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = board->n_ttl_chan; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = pcl730_do_insn_bits; - s->private = (void *)2; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = board->n_ttl_chan; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = pcl730_do_insn_bits; + s->private = (void *)2; /* TTL Digital Inputs */ s = &dev->subdevices[subdev++]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = board->n_ttl_chan; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = pcl730_di_insn_bits; - s->private = (void *)2; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = board->n_ttl_chan; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = pcl730_di_insn_bits; + s->private = (void *)2; } return 0; } static struct comedi_driver pcl730_driver = { - .driver_name = "pcl730", - .module = THIS_MODULE, - .attach = pcl730_attach, - .detach = comedi_legacy_detach, - .board_name = &pcl730_boards[0].name, - .num_names = ARRAY_SIZE(pcl730_boards), - .offset = sizeof(struct pcl730_board), + .driver_name = "pcl730", + .module = THIS_MODULE, + .attach = pcl730_attach, + .detach = comedi_legacy_detach, + .board_name = &pcl730_boards[0].name, + .num_names = ARRAY_SIZE(pcl730_boards), + .offset = sizeof(struct pcl730_board), }; + module_comedi_driver(pcl730_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/pcl812.c b/drivers/comedi/drivers/pcl812.c index b87ab3840eee..95857eaa8628 100644 --- a/drivers/comedi/drivers/pcl812.c +++ b/drivers/comedi/drivers/pcl812.c @@ -152,182 +152,182 @@ static const struct comedi_lrange range_pcl812pg_ai = { 5, { - BIP_RANGE(5), - BIP_RANGE(2.5), - BIP_RANGE(1.25), - BIP_RANGE(0.625), - BIP_RANGE(0.3125) - } + BIP_RANGE(5), + BIP_RANGE(2.5), + BIP_RANGE(1.25), + BIP_RANGE(0.625), + BIP_RANGE(0.3125) + } }; static const struct comedi_lrange range_pcl812pg2_ai = { 5, { - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(2.5), - BIP_RANGE(1.25), - BIP_RANGE(0.625) - } + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(2.5), + BIP_RANGE(1.25), + BIP_RANGE(0.625) + } }; static const struct comedi_lrange range812_bipolar1_25 = { 1, { - BIP_RANGE(1.25) - } + BIP_RANGE(1.25) + } }; static const struct comedi_lrange range812_bipolar0_625 = { 1, { - BIP_RANGE(0.625) - } + BIP_RANGE(0.625) + } }; static const struct comedi_lrange range812_bipolar0_3125 = { 1, { - BIP_RANGE(0.3125) - } + BIP_RANGE(0.3125) + } }; static const struct comedi_lrange range_pcl813b_ai = { 4, { - BIP_RANGE(5), - BIP_RANGE(2.5), - BIP_RANGE(1.25), - BIP_RANGE(0.625) - } + BIP_RANGE(5), + BIP_RANGE(2.5), + BIP_RANGE(1.25), + BIP_RANGE(0.625) + } }; static const struct comedi_lrange range_pcl813b2_ai = { 4, { - UNI_RANGE(10), - UNI_RANGE(5), - UNI_RANGE(2.5), - UNI_RANGE(1.25) - } + UNI_RANGE(10), + UNI_RANGE(5), + UNI_RANGE(2.5), + UNI_RANGE(1.25) + } }; static const struct comedi_lrange range_iso813_1_ai = { 5, { - BIP_RANGE(5), - BIP_RANGE(2.5), - BIP_RANGE(1.25), - BIP_RANGE(0.625), - BIP_RANGE(0.3125) - } + BIP_RANGE(5), + BIP_RANGE(2.5), + BIP_RANGE(1.25), + BIP_RANGE(0.625), + BIP_RANGE(0.3125) + } }; static const struct comedi_lrange range_iso813_1_2_ai = { 5, { - UNI_RANGE(10), - UNI_RANGE(5), - UNI_RANGE(2.5), - UNI_RANGE(1.25), - UNI_RANGE(0.625) - } + UNI_RANGE(10), + UNI_RANGE(5), + UNI_RANGE(2.5), + UNI_RANGE(1.25), + UNI_RANGE(0.625) + } }; static const struct comedi_lrange range_iso813_2_ai = { 4, { - BIP_RANGE(5), - BIP_RANGE(2.5), - BIP_RANGE(1.25), - BIP_RANGE(0.625) - } + BIP_RANGE(5), + BIP_RANGE(2.5), + BIP_RANGE(1.25), + BIP_RANGE(0.625) + } }; static const struct comedi_lrange range_iso813_2_2_ai = { 4, { - UNI_RANGE(10), - UNI_RANGE(5), - UNI_RANGE(2.5), - UNI_RANGE(1.25) - } + UNI_RANGE(10), + UNI_RANGE(5), + UNI_RANGE(2.5), + UNI_RANGE(1.25) + } }; static const struct comedi_lrange range_acl8113_1_ai = { 4, { - BIP_RANGE(5), - BIP_RANGE(2.5), - BIP_RANGE(1.25), - BIP_RANGE(0.625) - } + BIP_RANGE(5), + BIP_RANGE(2.5), + BIP_RANGE(1.25), + BIP_RANGE(0.625) + } }; static const struct comedi_lrange range_acl8113_1_2_ai = { 4, { - UNI_RANGE(10), - UNI_RANGE(5), - UNI_RANGE(2.5), - UNI_RANGE(1.25) - } + UNI_RANGE(10), + UNI_RANGE(5), + UNI_RANGE(2.5), + UNI_RANGE(1.25) + } }; static const struct comedi_lrange range_acl8113_2_ai = { 3, { - BIP_RANGE(5), - BIP_RANGE(2.5), - BIP_RANGE(1.25) - } + BIP_RANGE(5), + BIP_RANGE(2.5), + BIP_RANGE(1.25) + } }; static const struct comedi_lrange range_acl8113_2_2_ai = { 3, { - UNI_RANGE(10), - UNI_RANGE(5), - UNI_RANGE(2.5) - } + UNI_RANGE(10), + UNI_RANGE(5), + UNI_RANGE(2.5) + } }; static const struct comedi_lrange range_acl8112dg_ai = { 9, { - BIP_RANGE(5), - BIP_RANGE(2.5), - BIP_RANGE(1.25), - BIP_RANGE(0.625), - UNI_RANGE(10), - UNI_RANGE(5), - UNI_RANGE(2.5), - UNI_RANGE(1.25), - BIP_RANGE(10) - } + BIP_RANGE(5), + BIP_RANGE(2.5), + BIP_RANGE(1.25), + BIP_RANGE(0.625), + UNI_RANGE(10), + UNI_RANGE(5), + UNI_RANGE(2.5), + UNI_RANGE(1.25), + BIP_RANGE(10) + } }; static const struct comedi_lrange range_acl8112hg_ai = { 12, { - BIP_RANGE(5), - BIP_RANGE(0.5), - BIP_RANGE(0.05), - BIP_RANGE(0.005), - UNI_RANGE(10), - UNI_RANGE(1), - UNI_RANGE(0.1), - UNI_RANGE(0.01), - BIP_RANGE(10), - BIP_RANGE(1), - BIP_RANGE(0.1), - BIP_RANGE(0.01) - } + BIP_RANGE(5), + BIP_RANGE(0.5), + BIP_RANGE(0.05), + BIP_RANGE(0.005), + UNI_RANGE(10), + UNI_RANGE(1), + UNI_RANGE(0.1), + UNI_RANGE(0.01), + BIP_RANGE(10), + BIP_RANGE(1), + BIP_RANGE(0.1), + BIP_RANGE(0.01) + } }; static const struct comedi_lrange range_a821pgh_ai = { 4, { - BIP_RANGE(5), - BIP_RANGE(0.5), - BIP_RANGE(0.05), - BIP_RANGE(0.005) - } + BIP_RANGE(5), + BIP_RANGE(0.5), + BIP_RANGE(0.05), + BIP_RANGE(0.005) + } }; enum pcl812_boardtype { - BOARD_PCL812PG = 0, /* and ACL-8112PG */ - BOARD_PCL813B = 1, - BOARD_PCL812 = 2, - BOARD_PCL813 = 3, - BOARD_ISO813 = 5, - BOARD_ACL8113 = 6, - BOARD_ACL8112 = 7, /* ACL-8112DG/HG, A-822PGL/PGH, A-823PGL/PGH */ - BOARD_ACL8216 = 8, /* and ICP DAS A-826PG */ - BOARD_A821 = 9, /* PGH, PGL, PGL/NDA versions */ + BOARD_PCL812PG = 0, /* and ACL-8112PG */ + BOARD_PCL813B = 1, + BOARD_PCL812 = 2, + BOARD_PCL813 = 3, + BOARD_ISO813 = 5, + BOARD_ACL8113 = 6, + BOARD_ACL8112 = 7, /* ACL-8112DG/HG, A-822PGL/PGH, A-823PGL/PGH */ + BOARD_ACL8216 = 8, /* and ICP DAS A-826PG */ + BOARD_A821 = 9, /* PGH, PGL, PGL/NDA versions */ }; struct pcl812_board { @@ -346,175 +346,283 @@ struct pcl812_board { static const struct pcl812_board boardtypes[] = { { - .name = "pcl812", - .board_type = BOARD_PCL812, - .n_aichan = 16, - .n_aochan = 2, - .ai_ns_min = 33000, - .rangelist_ai = &range_bipolar10, - .irq_bits = 0xdcfc, - .has_dma = 1, - .has_dio = 1, - }, { - .name = "pcl812pg", - .board_type = BOARD_PCL812PG, - .n_aichan = 16, - .n_aochan = 2, - .ai_ns_min = 33000, - .rangelist_ai = &range_pcl812pg_ai, - .irq_bits = 0xdcfc, - .has_dma = 1, - .has_dio = 1, - }, { - .name = "acl8112pg", - .board_type = BOARD_PCL812PG, - .n_aichan = 16, - .n_aochan = 2, - .ai_ns_min = 10000, - .rangelist_ai = &range_pcl812pg_ai, - .irq_bits = 0xdcfc, - .has_dma = 1, - .has_dio = 1, - }, { - .name = "acl8112dg", - .board_type = BOARD_ACL8112, - .n_aichan = 16, /* 8 differential */ - .n_aochan = 2, - .ai_ns_min = 10000, - .rangelist_ai = &range_acl8112dg_ai, - .irq_bits = 0xdcfc, - .has_dma = 1, - .has_mpc508_mux = 1, - .has_dio = 1, - }, { - .name = "acl8112hg", - .board_type = BOARD_ACL8112, - .n_aichan = 16, /* 8 differential */ - .n_aochan = 2, - .ai_ns_min = 10000, - .rangelist_ai = &range_acl8112hg_ai, - .irq_bits = 0xdcfc, - .has_dma = 1, - .has_mpc508_mux = 1, - .has_dio = 1, - }, { - .name = "a821pgl", - .board_type = BOARD_A821, - .n_aichan = 16, /* 8 differential */ - .n_aochan = 1, - .ai_ns_min = 10000, - .rangelist_ai = &range_pcl813b_ai, - .irq_bits = 0x000c, - .has_dio = 1, - }, { - .name = "a821pglnda", - .board_type = BOARD_A821, - .n_aichan = 16, /* 8 differential */ - .ai_ns_min = 10000, - .rangelist_ai = &range_pcl813b_ai, - .irq_bits = 0x000c, - }, { - .name = "a821pgh", - .board_type = BOARD_A821, - .n_aichan = 16, /* 8 differential */ - .n_aochan = 1, - .ai_ns_min = 10000, - .rangelist_ai = &range_a821pgh_ai, - .irq_bits = 0x000c, - .has_dio = 1, - }, { - .name = "a822pgl", - .board_type = BOARD_ACL8112, - .n_aichan = 16, /* 8 differential */ - .n_aochan = 2, - .ai_ns_min = 10000, - .rangelist_ai = &range_acl8112dg_ai, - .irq_bits = 0xdcfc, - .has_dma = 1, - .has_dio = 1, - }, { - .name = "a822pgh", - .board_type = BOARD_ACL8112, - .n_aichan = 16, /* 8 differential */ - .n_aochan = 2, - .ai_ns_min = 10000, - .rangelist_ai = &range_acl8112hg_ai, - .irq_bits = 0xdcfc, - .has_dma = 1, - .has_dio = 1, - }, { - .name = "a823pgl", - .board_type = BOARD_ACL8112, - .n_aichan = 16, /* 8 differential */ - .n_aochan = 2, - .ai_ns_min = 8000, - .rangelist_ai = &range_acl8112dg_ai, - .irq_bits = 0xdcfc, - .has_dma = 1, - .has_dio = 1, - }, { - .name = "a823pgh", - .board_type = BOARD_ACL8112, - .n_aichan = 16, /* 8 differential */ - .n_aochan = 2, - .ai_ns_min = 8000, - .rangelist_ai = &range_acl8112hg_ai, - .irq_bits = 0xdcfc, - .has_dma = 1, - .has_dio = 1, - }, { - .name = "pcl813", - .board_type = BOARD_PCL813, - .n_aichan = 32, - .rangelist_ai = &range_pcl813b_ai, - }, { - .name = "pcl813b", - .board_type = BOARD_PCL813B, - .n_aichan = 32, - .rangelist_ai = &range_pcl813b_ai, - }, { - .name = "acl8113", - .board_type = BOARD_ACL8113, - .n_aichan = 32, - .rangelist_ai = &range_acl8113_1_ai, - }, { - .name = "iso813", - .board_type = BOARD_ISO813, - .n_aichan = 32, - .rangelist_ai = &range_iso813_1_ai, - }, { - .name = "acl8216", - .board_type = BOARD_ACL8216, - .n_aichan = 16, /* 8 differential */ - .n_aochan = 2, - .ai_ns_min = 10000, - .rangelist_ai = &range_pcl813b2_ai, - .irq_bits = 0xdcfc, - .has_dma = 1, - .has_16bit_ai = 1, - .has_mpc508_mux = 1, - .has_dio = 1, - }, { - .name = "a826pg", - .board_type = BOARD_ACL8216, - .n_aichan = 16, /* 8 differential */ - .n_aochan = 2, - .ai_ns_min = 10000, - .rangelist_ai = &range_pcl813b2_ai, - .irq_bits = 0xdcfc, - .has_dma = 1, - .has_16bit_ai = 1, - .has_dio = 1, - }, + .name = "pcl812", + .board_type = BOARD_PCL812, + .n_aichan = 16, + .n_aochan = 2, + .ai_ns_min = 33000, + .rangelist_ai = &range_bipolar10, + .irq_bits = 0xdcfc, + .has_dma = 1, + .has_dio = 1, + }, { + .name = "pcl812pg", + .board_type = BOARD_PCL812PG, + .n_aichan = 16, + .n_aochan = 2, + .ai_ns_min = 33000, + .rangelist_ai = &range_pcl812pg_ai, + .irq_bits = 0xdcfc, + .has_dma = 1, + .has_dio = 1, + }, { + .name = "acl8112pg", + .board_type = BOARD_PCL812PG, + .n_aichan = 16, + .n_aochan = 2, + .ai_ns_min = 10000, + .rangelist_ai = &range_pcl812pg_ai, + .irq_bits = 0xdcfc, + .has_dma = 1, + .has_dio = 1, + }, { + .name = "acl8112dg", + .board_type = BOARD_ACL8112, + .n_aichan = 16, /* 8 differential */ + .n_aochan = 2, + .ai_ns_min = 10000, + .rangelist_ai = &range_acl8112dg_ai, + .irq_bits = 0xdcfc, + .has_dma = 1, + .has_mpc508_mux = 1, + .has_dio = 1, + }, { + .name = "acl8112hg", + .board_type = BOARD_ACL8112, + .n_aichan = 16, /* 8 differential */ + .n_aochan = 2, + .ai_ns_min = 10000, + .rangelist_ai = &range_acl8112hg_ai, + .irq_bits = 0xdcfc, + .has_dma = 1, + .has_mpc508_mux = 1, + .has_dio = 1, + }, { + .name = "a821pgl", + .board_type = BOARD_A821, + .n_aichan = 16, /* 8 differential */ + .n_aochan = 1, + .ai_ns_min = 10000, + .rangelist_ai = &range_pcl813b_ai, + .irq_bits = 0x000c, + .has_dio = 1, + }, { + .name = "a821pglnda", + .board_type = BOARD_A821, + .n_aichan = 16, /* 8 differential */ + .ai_ns_min = 10000, + .rangelist_ai = &range_pcl813b_ai, + .irq_bits = 0x000c, + }, { + .name = "a821pgh", + .board_type = BOARD_A821, + .n_aichan = 16, /* 8 differential */ + .n_aochan = 1, + .ai_ns_min = 10000, + .rangelist_ai = &range_a821pgh_ai, + .irq_bits = 0x000c, + .has_dio = 1, + }, { + .name = "a822pgl", + .board_type = BOARD_ACL8112, + .n_aichan = 16, /* 8 differential */ + .n_aochan = 2, + .ai_ns_min = 10000, + .rangelist_ai = + &range_acl8112dg_ai, + .irq_bits = 0xdcfc, + .has_dma = 1, + .has_dio = 1, + }, { + .name = "a822pgh", + .board_type = + BOARD_ACL8112, + .n_aichan = 16, /* 8 differential */ + .n_aochan = 2, + .ai_ns_min = 10000, + .rangelist_ai = + &range_acl8112hg_ai, + .irq_bits = 0xdcfc, + .has_dma = 1, + .has_dio = 1, + }, { + .name = "a823pgl", + .board_type = + BOARD_ACL8112, + .n_aichan = 16, /* 8 differential */ + .n_aochan = 2, + .ai_ns_min = 8000, + .rangelist_ai = + &range_acl8112dg_ai, + .irq_bits = 0xdcfc, + .has_dma = 1, + .has_dio = 1, + }, { + .name = + "a823pgh", + .board_type = + BOARD_ACL8112, + .n_aichan = 16, /* 8 differential */ + .n_aochan = 2, + .ai_ns_min = + 8000, + .rangelist_ai = + &range_acl8112hg_ai, + .irq_bits = + 0xdcfc, + .has_dma = 1, + .has_dio = 1, + }, { + .name = + "pcl813", + .board_type + = + BOARD_PCL813, + .n_aichan = + 32, + . + rangelist_ai + = + &range_pcl813b_ai, + }, { + .name + = + "pcl813b", + . + board_type + = + BOARD_PCL813B, + . + n_aichan + = 32, + . + rangelist_ai + = + &range_pcl813b_ai, + }, { + . + name + = + "acl8113", + . + board_type + = + BOARD_ACL8113, + . + n_aichan + = + 32, + . + rangelist_ai + = + &range_acl8113_1_ai, + }, { + . + name + = + "iso813", + . + board_type + = + BOARD_ISO813, + . + n_aichan + = + 32, + . + rangelist_ai + = + &range_iso813_1_ai, + }, { + . + name + = + "acl8216", + . + board_type + = + BOARD_ACL8216, + .n_aichan = 16, /* 8 differential */ + . + n_aochan + = + 2, + . + ai_ns_min + = + 10000, + . + rangelist_ai + = + &range_pcl813b2_ai, + . + irq_bits + = + 0xdcfc, + . + has_dma + = + 1, + . + has_16bit_ai + = + 1, + . + has_mpc508_mux + = + 1, + . + has_dio + = + 1, + }, { + . + name + = + "a826pg", + . + board_type + = + BOARD_ACL8216, + .n_aichan = 16, /* 8 differential */ + . + n_aochan + = + 2, + . + ai_ns_min + = + 10000, + . + rangelist_ai + = + &range_pcl813b2_ai, + . + irq_bits + = + 0xdcfc, + . + has_dma + = + 1, + . + has_16bit_ai + = + 1, + . + has_dio + = + 1, + }, }; struct pcl812_private { struct comedi_isadma *dma; unsigned char range_correction; /* =1 we must add 1 to range number */ unsigned int last_ai_chanspec; - unsigned char mode_reg_int; /* stored INT number for some cards */ - unsigned int ai_poll_ptr; /* how many samples transfer poll */ - unsigned int max_812_ai_mode0_rangewait; /* settling time for gain */ + unsigned char mode_reg_int; /* stored INT number for some cards */ + unsigned int ai_poll_ptr; /* how many samples transfer poll */ + unsigned int max_812_ai_mode0_rangewait; /* settling time for gain */ unsigned int use_diff:1; unsigned int use_mpc508:1; unsigned int use_ext_trg:1; @@ -611,8 +719,7 @@ static unsigned int pcl812_ai_get_sample(struct comedi_device *dev, static int pcl812_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned int status; @@ -670,7 +777,7 @@ static int pcl812_ai_cmdtest(struct comedi_device *dev, if (cmd->convert_src == TRIG_TIMER) { err |= comedi_check_trigger_arg_min(&cmd->convert_arg, board->ai_ns_min); - } else { /* TRIG_EXT */ + } else { /* TRIG_EXT */ err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); } @@ -680,7 +787,7 @@ static int pcl812_ai_cmdtest(struct comedi_device *dev, if (cmd->stop_src == TRIG_COUNT) err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); - else /* TRIG_NONE */ + else /* TRIG_NONE */ err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) @@ -711,7 +818,7 @@ static int pcl812_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) pcl812_ai_set_chan_range(dev, cmd->chanlist[0], 1); - if (dma) { /* check if we can use DMA transfer */ + if (dma) { /* check if we can use DMA transfer */ devpriv->ai_dma = 1; for (i = 1; i < cmd->chanlist_len; i++) if (cmd->chanlist[0] != cmd->chanlist[i]) { @@ -822,7 +929,7 @@ static void pcl812_handle_dma(struct comedi_device *dev, int bufptr; nsamples = comedi_bytes_to_samples(s, desc->size) - - devpriv->ai_poll_ptr; + devpriv->ai_poll_ptr; bufptr = devpriv->ai_poll_ptr; devpriv->ai_poll_ptr = 0; @@ -908,8 +1015,7 @@ static int pcl812_ai_cancel(struct comedi_device *dev, static int pcl812_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct pcl812_private *devpriv = dev->private; int ret = 0; @@ -939,8 +1045,7 @@ static int pcl812_ai_insn_read(struct comedi_device *dev, static int pcl812_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int val = s->readback[chan]; @@ -958,19 +1063,17 @@ static int pcl812_ao_insn_write(struct comedi_device *dev, static int pcl812_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { data[1] = inb(dev->iobase + PCL812_DI_LSB_REG) | - (inb(dev->iobase + PCL812_DI_MSB_REG) << 8); + (inb(dev->iobase + PCL812_DI_MSB_REG) << 8); return insn->n; } static int pcl812_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { if (comedi_dio_update_state(s, data)) { outb(s->state & 0xff, dev->iobase + PCL812_DO_LSB_REG); @@ -1178,7 +1281,7 @@ static int pcl812_attach(struct comedi_device *dev, struct comedi_devconfig *it) break; } - n_subdevices = 1; /* all boardtypes have analog inputs */ + n_subdevices = 1; /* all boardtypes have analog inputs */ if (board->n_aochan > 0) n_subdevices++; if (board->has_dio) @@ -1192,29 +1295,29 @@ static int pcl812_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* Analog Input subdevice */ s = &dev->subdevices[subdev]; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE; if (devpriv->use_diff) { - s->subdev_flags |= SDF_DIFF; - s->n_chan = board->n_aichan / 2; + s->subdev_flags |= SDF_DIFF; + s->n_chan = board->n_aichan / 2; } else { - s->subdev_flags |= SDF_GROUND; - s->n_chan = board->n_aichan; + s->subdev_flags |= SDF_GROUND; + s->n_chan = board->n_aichan; } - s->maxdata = board->has_16bit_ai ? 0xffff : 0x0fff; + s->maxdata = board->has_16bit_ai ? 0xffff : 0x0fff; pcl812_set_ai_range_table(dev, s, it); - s->insn_read = pcl812_ai_insn_read; + s->insn_read = pcl812_ai_insn_read; if (dev->irq) { dev->read_subdev = s; - s->subdev_flags |= SDF_CMD_READ; - s->len_chanlist = MAX_CHANLIST_LEN; - s->do_cmdtest = pcl812_ai_cmdtest; - s->do_cmd = pcl812_ai_cmd; - s->poll = pcl812_ai_poll; - s->cancel = pcl812_ai_cancel; + s->subdev_flags |= SDF_CMD_READ; + s->len_chanlist = MAX_CHANLIST_LEN; + s->do_cmdtest = pcl812_ai_cmdtest; + s->do_cmd = pcl812_ai_cmd; + s->poll = pcl812_ai_poll; + s->cancel = pcl812_ai_cancel; } devpriv->use_mpc508 = board->has_mpc508_mux; @@ -1224,10 +1327,10 @@ static int pcl812_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* analog output */ if (board->n_aochan > 0) { s = &dev->subdevices[subdev]; - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE | SDF_GROUND; - s->n_chan = board->n_aochan; - s->maxdata = 0xfff; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE | SDF_GROUND; + s->n_chan = board->n_aochan; + s->maxdata = 0xfff; switch (board->board_type) { case BOARD_A821: if (it->options[3] == 1) @@ -1255,7 +1358,7 @@ static int pcl812_attach(struct comedi_device *dev, struct comedi_devconfig *it) s->range_table = &range_unipolar5; break; } - s->insn_write = pcl812_ao_insn_write; + s->insn_write = pcl812_ao_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) @@ -1267,22 +1370,22 @@ static int pcl812_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (board->has_dio) { /* Digital Input subdevice */ s = &dev->subdevices[subdev]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 16; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = pcl812_di_insn_bits; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 16; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = pcl812_di_insn_bits; subdev++; /* Digital Output subdevice */ s = &dev->subdevices[subdev]; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 16; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = pcl812_do_insn_bits; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 16; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = pcl812_do_insn_bits; subdev++; } @@ -1293,7 +1396,7 @@ static int pcl812_attach(struct comedi_device *dev, struct comedi_devconfig *it) case BOARD_ACL8112: devpriv->max_812_ai_mode0_rangewait = 1; if (it->options[3] > 0) - /* we use external trigger */ + /* we use external trigger */ devpriv->use_ext_trg = 1; break; case BOARD_A821: @@ -1321,14 +1424,15 @@ static void pcl812_detach(struct comedi_device *dev) } static struct comedi_driver pcl812_driver = { - .driver_name = "pcl812", - .module = THIS_MODULE, - .attach = pcl812_attach, - .detach = pcl812_detach, - .board_name = &boardtypes[0].name, - .num_names = ARRAY_SIZE(boardtypes), - .offset = sizeof(struct pcl812_board), + .driver_name = "pcl812", + .module = THIS_MODULE, + .attach = pcl812_attach, + .detach = pcl812_detach, + .board_name = &boardtypes[0].name, + .num_names = ARRAY_SIZE(boardtypes), + .offset = sizeof(struct pcl812_board), }; + module_comedi_driver(pcl812_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/pcl816.c b/drivers/comedi/drivers/pcl816.c index c368a337a0ae..2dd0deb870e6 100644 --- a/drivers/comedi/drivers/pcl816.c +++ b/drivers/comedi/drivers/pcl816.c @@ -73,15 +73,15 @@ static const struct comedi_lrange range_pcl816 = { 8, { - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(2.5), - BIP_RANGE(1.25), - UNI_RANGE(10), - UNI_RANGE(5), - UNI_RANGE(2.5), - UNI_RANGE(1.25) - } + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(2.5), + BIP_RANGE(1.25), + UNI_RANGE(10), + UNI_RANGE(5), + UNI_RANGE(2.5), + UNI_RANGE(1.25) + } }; struct pcl816_board { @@ -92,14 +92,14 @@ struct pcl816_board { static const struct pcl816_board boardtypes[] = { { - .name = "pcl816", - .ai_maxdata = 0xffff, - .ai_chanlist = 1024, - }, { - .name = "pcl814b", - .ai_maxdata = 0x3fff, - .ai_chanlist = 1024, - }, + .name = "pcl816", + .ai_maxdata = 0xffff, + .ai_chanlist = 1024, + }, { + .name = "pcl814b", + .ai_maxdata = 0x3fff, + .ai_chanlist = 1024, + }, }; struct pcl816_private { @@ -134,8 +134,7 @@ static void pcl816_ai_setup_dma(struct comedi_device *dev, } static void pcl816_ai_set_chan_range(struct comedi_device *dev, - unsigned int chan, - unsigned int range) + unsigned int chan, unsigned int range) { outb(chan, dev->iobase + PCL816_MUX_REG); outb(range, dev->iobase + PCL816_RANGE_REG); @@ -196,8 +195,7 @@ static unsigned int pcl816_ai_get_sample(struct comedi_device *dev, static int pcl816_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned int status; @@ -260,7 +258,7 @@ static irqreturn_t pcl816_interrupt(int irq, void *d) } nsamples = comedi_bytes_to_samples(s, desc->size) - - devpriv->ai_poll_ptr; + devpriv->ai_poll_ptr; bufptr = devpriv->ai_poll_ptr; devpriv->ai_poll_ptr = 0; @@ -278,8 +276,7 @@ static irqreturn_t pcl816_interrupt(int irq, void *d) static int check_channel_list(struct comedi_device *dev, struct comedi_subdevice *s, - unsigned int *chanlist, - unsigned int chanlen) + unsigned int *chanlist, unsigned int chanlen) { unsigned int chansegment[16]; unsigned int i, nowmustbechan, seglen; @@ -329,7 +326,7 @@ static int check_channel_list(struct comedi_device *dev, seglen = 1; } - return seglen; /* we can serve this with MUX logic */ + return seglen; /* we can serve this with MUX logic */ } static int pcl816_ai_cmdtest(struct comedi_device *dev, @@ -366,7 +363,7 @@ static int pcl816_ai_cmdtest(struct comedi_device *dev, if (cmd->convert_src == TRIG_TIMER) err |= comedi_check_trigger_arg_min(&cmd->convert_arg, 10000); - else /* TRIG_EXT */ + else /* TRIG_EXT */ err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); err |= comedi_check_trigger_arg_is(&cmd->scan_end_arg, @@ -374,7 +371,7 @@ static int pcl816_ai_cmdtest(struct comedi_device *dev, if (cmd->stop_src == TRIG_COUNT) err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); - else /* TRIG_NONE */ + else /* TRIG_NONE */ err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) @@ -434,15 +431,14 @@ static int pcl816_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) comedi_8254_pacer_enable(dev->pacer, 1, 2, true); ctrl = PCL816_CTRL_INTEN | PCL816_CTRL_DMAEN | - PCL816_CTRL_DMASRC_SLOT(0); + PCL816_CTRL_DMASRC_SLOT(0); if (cmd->convert_src == TRIG_TIMER) ctrl |= PCL816_CTRL_PACER_TRIG; - else /* TRIG_EXT */ + else /* TRIG_EXT */ ctrl |= PCL816_CTRL_EXT_TRIG; outb(ctrl, dev->iobase + PCL816_CTRL_REG); - outb((dma->chan << 4) | dev->irq, - dev->iobase + PCL816_STATUS_REG); + outb((dma->chan << 4) | dev->irq, dev->iobase + PCL816_STATUS_REG); return 0; } @@ -501,8 +497,7 @@ static int pcl816_ai_cancel(struct comedi_device *dev, static int pcl816_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int range = CR_RANGE(insn->chanspec); @@ -532,19 +527,17 @@ static int pcl816_ai_insn_read(struct comedi_device *dev, static int pcl816_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { data[1] = inb(dev->iobase + PCL816_DO_DI_LSB_REG) | - (inb(dev->iobase + PCL816_DO_DI_MSB_REG) << 8); + (inb(dev->iobase + PCL816_DO_DI_MSB_REG) << 8); return insn->n; } static int pcl816_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { if (comedi_dio_update_state(s, data)) { outb(s->state & 0xff, dev->iobase + PCL816_DO_DI_LSB_REG); @@ -627,43 +620,43 @@ static int pcl816_attach(struct comedi_device *dev, struct comedi_devconfig *it) return ret; s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_CMD_READ | SDF_DIFF; - s->n_chan = 16; - s->maxdata = board->ai_maxdata; - s->range_table = &range_pcl816; - s->insn_read = pcl816_ai_insn_read; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_CMD_READ | SDF_DIFF; + s->n_chan = 16; + s->maxdata = board->ai_maxdata; + s->range_table = &range_pcl816; + s->insn_read = pcl816_ai_insn_read; if (dev->irq) { dev->read_subdev = s; - s->subdev_flags |= SDF_CMD_READ; - s->len_chanlist = board->ai_chanlist; - s->do_cmdtest = pcl816_ai_cmdtest; - s->do_cmd = pcl816_ai_cmd; - s->poll = pcl816_ai_poll; - s->cancel = pcl816_ai_cancel; + s->subdev_flags |= SDF_CMD_READ; + s->len_chanlist = board->ai_chanlist; + s->do_cmdtest = pcl816_ai_cmdtest; + s->do_cmd = pcl816_ai_cmd; + s->poll = pcl816_ai_poll; + s->cancel = pcl816_ai_cancel; } /* Piggyback Slot1 subdevice */ s = &dev->subdevices[1]; - s->type = COMEDI_SUBD_UNUSED; + s->type = COMEDI_SUBD_UNUSED; /* Digital Input subdevice */ s = &dev->subdevices[2]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 16; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = pcl816_di_insn_bits; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 16; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = pcl816_di_insn_bits; /* Digital Output subdevice */ s = &dev->subdevices[3]; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 16; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = pcl816_do_insn_bits; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 16; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = pcl816_do_insn_bits; pcl816_reset(dev); @@ -681,14 +674,15 @@ static void pcl816_detach(struct comedi_device *dev) } static struct comedi_driver pcl816_driver = { - .driver_name = "pcl816", - .module = THIS_MODULE, - .attach = pcl816_attach, - .detach = pcl816_detach, - .board_name = &boardtypes[0].name, - .num_names = ARRAY_SIZE(boardtypes), - .offset = sizeof(struct pcl816_board), + .driver_name = "pcl816", + .module = THIS_MODULE, + .attach = pcl816_attach, + .detach = pcl816_detach, + .board_name = &boardtypes[0].name, + .num_names = ARRAY_SIZE(boardtypes), + .offset = sizeof(struct pcl816_board), }; + module_comedi_driver(pcl816_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/pcl818.c b/drivers/comedi/drivers/pcl818.c index f4b4a686c710..773469178723 100644 --- a/drivers/comedi/drivers/pcl818.c +++ b/drivers/comedi/drivers/pcl818.c @@ -151,75 +151,75 @@ static const struct comedi_lrange range_pcl818h_ai = { 9, { - BIP_RANGE(5), - BIP_RANGE(2.5), - BIP_RANGE(1.25), - BIP_RANGE(0.625), - UNI_RANGE(10), - UNI_RANGE(5), - UNI_RANGE(2.5), - UNI_RANGE(1.25), - BIP_RANGE(10) - } + BIP_RANGE(5), + BIP_RANGE(2.5), + BIP_RANGE(1.25), + BIP_RANGE(0.625), + UNI_RANGE(10), + UNI_RANGE(5), + UNI_RANGE(2.5), + UNI_RANGE(1.25), + BIP_RANGE(10) + } }; static const struct comedi_lrange range_pcl818hg_ai = { 10, { - BIP_RANGE(5), - BIP_RANGE(0.5), - BIP_RANGE(0.05), - BIP_RANGE(0.005), - UNI_RANGE(10), - UNI_RANGE(1), - UNI_RANGE(0.1), - UNI_RANGE(0.01), - BIP_RANGE(10), - BIP_RANGE(1), - BIP_RANGE(0.1), - BIP_RANGE(0.01) - } + BIP_RANGE(5), + BIP_RANGE(0.5), + BIP_RANGE(0.05), + BIP_RANGE(0.005), + UNI_RANGE(10), + UNI_RANGE(1), + UNI_RANGE(0.1), + UNI_RANGE(0.01), + BIP_RANGE(10), + BIP_RANGE(1), + BIP_RANGE(0.1), + BIP_RANGE(0.01) + } }; static const struct comedi_lrange range_pcl818l_l_ai = { 4, { - BIP_RANGE(5), - BIP_RANGE(2.5), - BIP_RANGE(1.25), - BIP_RANGE(0.625) - } + BIP_RANGE(5), + BIP_RANGE(2.5), + BIP_RANGE(1.25), + BIP_RANGE(0.625) + } }; static const struct comedi_lrange range_pcl818l_h_ai = { 4, { - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(2.5), - BIP_RANGE(1.25) - } + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(2.5), + BIP_RANGE(1.25) + } }; static const struct comedi_lrange range718_bipolar1 = { 1, { - BIP_RANGE(1) - } + BIP_RANGE(1) + } }; static const struct comedi_lrange range718_bipolar0_5 = { 1, { - BIP_RANGE(0.5) - } + BIP_RANGE(0.5) + } }; static const struct comedi_lrange range718_unipolar2 = { 1, { - UNI_RANGE(2) - } + UNI_RANGE(2) + } }; static const struct comedi_lrange range718_unipolar1 = { 1, { - BIP_RANGE(1) - } + BIP_RANGE(1) + } }; struct pcl818_board { @@ -234,55 +234,55 @@ struct pcl818_board { static const struct pcl818_board boardtypes[] = { { - .name = "pcl818l", - .ns_min = 25000, - .n_aochan = 1, - .ai_range_type = &range_pcl818l_l_ai, - .has_dma = 1, - .is_818 = 1, - }, { - .name = "pcl818h", - .ns_min = 10000, - .n_aochan = 1, - .ai_range_type = &range_pcl818h_ai, - .has_dma = 1, - .is_818 = 1, - }, { - .name = "pcl818hd", - .ns_min = 10000, - .n_aochan = 1, - .ai_range_type = &range_pcl818h_ai, - .has_dma = 1, - .has_fifo = 1, - .is_818 = 1, - }, { - .name = "pcl818hg", - .ns_min = 10000, - .n_aochan = 1, - .ai_range_type = &range_pcl818hg_ai, - .has_dma = 1, - .has_fifo = 1, - .is_818 = 1, - }, { - .name = "pcl818", - .ns_min = 10000, - .n_aochan = 2, - .ai_range_type = &range_pcl818h_ai, - .has_dma = 1, - .is_818 = 1, - }, { - .name = "pcl718", - .ns_min = 16000, - .n_aochan = 2, - .ai_range_type = &range_unipolar5, - .has_dma = 1, - }, { - .name = "pcm3718", - .ns_min = 10000, - .ai_range_type = &range_pcl818h_ai, - .has_dma = 1, - .is_818 = 1, - }, + .name = "pcl818l", + .ns_min = 25000, + .n_aochan = 1, + .ai_range_type = &range_pcl818l_l_ai, + .has_dma = 1, + .is_818 = 1, + }, { + .name = "pcl818h", + .ns_min = 10000, + .n_aochan = 1, + .ai_range_type = &range_pcl818h_ai, + .has_dma = 1, + .is_818 = 1, + }, { + .name = "pcl818hd", + .ns_min = 10000, + .n_aochan = 1, + .ai_range_type = &range_pcl818h_ai, + .has_dma = 1, + .has_fifo = 1, + .is_818 = 1, + }, { + .name = "pcl818hg", + .ns_min = 10000, + .n_aochan = 1, + .ai_range_type = &range_pcl818hg_ai, + .has_dma = 1, + .has_fifo = 1, + .is_818 = 1, + }, { + .name = "pcl818", + .ns_min = 10000, + .n_aochan = 2, + .ai_range_type = &range_pcl818h_ai, + .has_dma = 1, + .is_818 = 1, + }, { + .name = "pcl718", + .ns_min = 16000, + .n_aochan = 2, + .ai_range_type = &range_unipolar5, + .has_dma = 1, + }, { + .name = "pcm3718", + .ns_min = 10000, + .ai_range_type = &range_pcl818h_ai, + .has_dma = 1, + .is_818 = 1, + }, }; struct pcl818_private { @@ -323,8 +323,7 @@ static void pcl818_ai_setup_dma(struct comedi_device *dev, } static void pcl818_ai_set_chan_range(struct comedi_device *dev, - unsigned int chan, - unsigned int range) + unsigned int chan, unsigned int range) { outb(chan, dev->iobase + PCL818_MUX_REG); outb(range, dev->iobase + PCL818_RANGE_REG); @@ -410,8 +409,7 @@ static unsigned int pcl818_ai_get_sample(struct comedi_device *dev, static int pcl818_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned int status; @@ -667,7 +665,7 @@ static int ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, if (cmd->convert_src == TRIG_TIMER) { err |= comedi_check_trigger_arg_min(&cmd->convert_arg, board->ns_min); - } else { /* TRIG_EXT */ + } else { /* TRIG_EXT */ err |= comedi_check_trigger_arg_is(&cmd->convert_arg, 0); } @@ -676,7 +674,7 @@ static int ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, if (cmd->stop_src == TRIG_COUNT) err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); - else /* TRIG_NONE */ + else /* TRIG_NONE */ err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) @@ -705,8 +703,7 @@ static int ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, return 0; } -static int pcl818_ai_cmd(struct comedi_device *dev, - struct comedi_subdevice *s) +static int pcl818_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) { struct pcl818_private *devpriv = dev->private; struct comedi_isadma *dma = devpriv->dma; @@ -739,7 +736,7 @@ static int pcl818_ai_cmd(struct comedi_device *dev, pcl818_ai_setup_dma(dev, s, 0); ctrl |= PCL818_CTRL_INTE | PCL818_CTRL_IRQ(dev->irq) | - PCL818_CTRL_DMAE; + PCL818_CTRL_DMAE; } else if (devpriv->usefifo) { /* enable FIFO */ outb(1, dev->iobase + PCL818_FI_ENABLE); @@ -799,8 +796,7 @@ static int pcl818_ai_cancel(struct comedi_device *dev, static int pcl818_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int range = CR_RANGE(insn->chanspec); @@ -829,8 +825,7 @@ static int pcl818_ai_insn_read(struct comedi_device *dev, static int pcl818_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int val = s->readback[chan]; @@ -850,19 +845,17 @@ static int pcl818_ao_insn_write(struct comedi_device *dev, static int pcl818_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { data[1] = inb(dev->iobase + PCL818_DO_DI_LSB_REG) | - (inb(dev->iobase + PCL818_DO_DI_MSB_REG) << 8); + (inb(dev->iobase + PCL818_DO_DI_MSB_REG) << 8); return insn->n; } static int pcl818_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { if (comedi_dio_update_state(s, data)) { outb(s->state & 0xff, dev->iobase + PCL818_DO_DI_LSB_REG); @@ -1035,37 +1028,37 @@ static int pcl818_attach(struct comedi_device *dev, struct comedi_devconfig *it) return ret; s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE; if (check_single_ended(dev->iobase)) { - s->n_chan = 16; - s->subdev_flags |= SDF_COMMON | SDF_GROUND; + s->n_chan = 16; + s->subdev_flags |= SDF_COMMON | SDF_GROUND; } else { - s->n_chan = 8; - s->subdev_flags |= SDF_DIFF; + s->n_chan = 8; + s->subdev_flags |= SDF_DIFF; } - s->maxdata = 0x0fff; + s->maxdata = 0x0fff; pcl818_set_ai_range_table(dev, s, it); - s->insn_read = pcl818_ai_insn_read; + s->insn_read = pcl818_ai_insn_read; if (dev->irq) { dev->read_subdev = s; - s->subdev_flags |= SDF_CMD_READ; - s->len_chanlist = s->n_chan; - s->do_cmdtest = ai_cmdtest; - s->do_cmd = pcl818_ai_cmd; - s->cancel = pcl818_ai_cancel; + s->subdev_flags |= SDF_CMD_READ; + s->len_chanlist = s->n_chan; + s->do_cmdtest = ai_cmdtest; + s->do_cmd = pcl818_ai_cmd; + s->cancel = pcl818_ai_cancel; } /* Analog Output subdevice */ s = &dev->subdevices[1]; if (board->n_aochan) { - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE | SDF_GROUND; - s->n_chan = board->n_aochan; - s->maxdata = 0x0fff; - s->range_table = &range_unipolar5; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE | SDF_GROUND; + s->n_chan = board->n_aochan; + s->maxdata = 0x0fff; + s->range_table = &range_unipolar5; if (board->is_818) { if ((it->options[4] == 1) || (it->options[4] == 10)) s->range_table = &range_unipolar10; @@ -1077,32 +1070,32 @@ static int pcl818_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (it->options[5] == 2) s->range_table = &range_unknown; } - s->insn_write = pcl818_ao_insn_write; + s->insn_write = pcl818_ao_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) return ret; } else { - s->type = COMEDI_SUBD_UNUSED; + s->type = COMEDI_SUBD_UNUSED; } /* Digital Input subdevice */ s = &dev->subdevices[2]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 16; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = pcl818_di_insn_bits; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 16; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = pcl818_di_insn_bits; /* Digital Output subdevice */ s = &dev->subdevices[3]; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 16; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = pcl818_do_insn_bits; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 16; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = pcl818_do_insn_bits; pcl818_reset(dev); @@ -1122,14 +1115,15 @@ static void pcl818_detach(struct comedi_device *dev) } static struct comedi_driver pcl818_driver = { - .driver_name = "pcl818", - .module = THIS_MODULE, - .attach = pcl818_attach, - .detach = pcl818_detach, - .board_name = &boardtypes[0].name, - .num_names = ARRAY_SIZE(boardtypes), - .offset = sizeof(struct pcl818_board), + .driver_name = "pcl818", + .module = THIS_MODULE, + .attach = pcl818_attach, + .detach = pcl818_detach, + .board_name = &boardtypes[0].name, + .num_names = ARRAY_SIZE(boardtypes), + .offset = sizeof(struct pcl818_board), }; + module_comedi_driver(pcl818_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/pcm3724.c b/drivers/comedi/drivers/pcm3724.c index 0cb1ad060402..87250afa391a 100644 --- a/drivers/comedi/drivers/pcm3724.c +++ b/drivers/comedi/drivers/pcm3724.c @@ -159,8 +159,7 @@ static void enable_chan(struct comedi_device *dev, struct comedi_subdevice *s, /* overriding the 8255 insn config */ static int subdev_3724_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int mask; @@ -215,11 +214,12 @@ static int pcm3724_attach(struct comedi_device *dev, } static struct comedi_driver pcm3724_driver = { - .driver_name = "pcm3724", - .module = THIS_MODULE, - .attach = pcm3724_attach, - .detach = comedi_legacy_detach, + .driver_name = "pcm3724", + .module = THIS_MODULE, + .attach = pcm3724_attach, + .detach = comedi_legacy_detach, }; + module_comedi_driver(pcm3724_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/pcmad.c b/drivers/comedi/drivers/pcmad.c index eec89a0afb2f..17300eea8c6e 100644 --- a/drivers/comedi/drivers/pcmad.c +++ b/drivers/comedi/drivers/pcmad.c @@ -43,18 +43,17 @@ struct pcmad_board_struct { static const struct pcmad_board_struct pcmad_boards[] = { { - .name = "pcmad12", - .ai_maxdata = 0x0fff, - }, { - .name = "pcmad16", - .ai_maxdata = 0xffff, - }, + .name = "pcmad12", + .ai_maxdata = 0x0fff, + }, { + .name = "pcmad16", + .ai_maxdata = 0xffff, + }, }; static int pcmad_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned int status; @@ -66,8 +65,7 @@ static int pcmad_ai_eoc(struct comedi_device *dev, static int pcmad_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int range = CR_RANGE(insn->chanspec); @@ -83,7 +81,7 @@ static int pcmad_ai_insn_read(struct comedi_device *dev, return ret; val = inb(dev->iobase + PCMAD_LSB) | - (inb(dev->iobase + PCMAD_MSB) << 8); + (inb(dev->iobase + PCMAD_MSB) << 8); /* data is shifted on the pcmad12, fix it */ if (s->maxdata == 0x0fff) @@ -115,33 +113,34 @@ static int pcmad_attach(struct comedi_device *dev, struct comedi_devconfig *it) return ret; s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_AI; + s->type = COMEDI_SUBD_AI; if (it->options[1]) { /* 8 differential channels */ - s->subdev_flags = SDF_READABLE | AREF_DIFF; - s->n_chan = 8; + s->subdev_flags = SDF_READABLE | AREF_DIFF; + s->n_chan = 8; } else { /* 16 single-ended channels */ - s->subdev_flags = SDF_READABLE | AREF_GROUND; - s->n_chan = 16; + s->subdev_flags = SDF_READABLE | AREF_GROUND; + s->n_chan = 16; } - s->len_chanlist = 1; - s->maxdata = board->ai_maxdata; - s->range_table = it->options[2] ? &range_bipolar10 : &range_unipolar5; - s->insn_read = pcmad_ai_insn_read; + s->len_chanlist = 1; + s->maxdata = board->ai_maxdata; + s->range_table = it->options[2] ? &range_bipolar10 : &range_unipolar5; + s->insn_read = pcmad_ai_insn_read; return 0; } static struct comedi_driver pcmad_driver = { - .driver_name = "pcmad", - .module = THIS_MODULE, - .attach = pcmad_attach, - .detach = comedi_legacy_detach, - .board_name = &pcmad_boards[0].name, - .num_names = ARRAY_SIZE(pcmad_boards), - .offset = sizeof(pcmad_boards[0]), + .driver_name = "pcmad", + .module = THIS_MODULE, + .attach = pcmad_attach, + .detach = comedi_legacy_detach, + .board_name = &pcmad_boards[0].name, + .num_names = ARRAY_SIZE(pcmad_boards), + .offset = sizeof(pcmad_boards[0]), }; + module_comedi_driver(pcmad_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/pcmda12.c b/drivers/comedi/drivers/pcmda12.c index 14ab1f0d1e9f..901cee3f9fa5 100644 --- a/drivers/comedi/drivers/pcmda12.c +++ b/drivers/comedi/drivers/pcmda12.c @@ -45,10 +45,10 @@ /* AI range is not configurable, it's set by jumpers on the board */ static const struct comedi_lrange pcmda12_ranges = { 3, { - UNI_RANGE(5), - UNI_RANGE(10), - BIP_RANGE(5) - } + UNI_RANGE(5), + UNI_RANGE(10), + BIP_RANGE(5) + } }; struct pcmda12_private { @@ -57,8 +57,7 @@ struct pcmda12_private { static int pcmda12_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct pcmda12_private *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -85,8 +84,7 @@ static int pcmda12_ao_insn_write(struct comedi_device *dev, static int pcmda12_ao_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct pcmda12_private *devpriv = dev->private; @@ -135,13 +133,13 @@ static int pcmda12_attach(struct comedi_device *dev, return ret; s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 8; - s->maxdata = 0x0fff; - s->range_table = &pcmda12_ranges; - s->insn_write = pcmda12_ao_insn_write; - s->insn_read = pcmda12_ao_insn_read; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 8; + s->maxdata = 0x0fff; + s->range_table = &pcmda12_ranges; + s->insn_write = pcmda12_ao_insn_write; + s->insn_read = pcmda12_ao_insn_read; ret = comedi_alloc_subdev_readback(s); if (ret) @@ -153,11 +151,12 @@ static int pcmda12_attach(struct comedi_device *dev, } static struct comedi_driver pcmda12_driver = { - .driver_name = "pcmda12", - .module = THIS_MODULE, - .attach = pcmda12_attach, - .detach = comedi_legacy_detach, + .driver_name = "pcmda12", + .module = THIS_MODULE, + .attach = pcmda12_attach, + .detach = comedi_legacy_detach, }; + module_comedi_driver(pcmda12_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/pcmmio.c b/drivers/comedi/drivers/pcmmio.c index 24a9568d3378..4e5ab0c5835a 100644 --- a/drivers/comedi/drivers/pcmmio.c +++ b/drivers/comedi/drivers/pcmmio.c @@ -157,22 +157,22 @@ static const struct comedi_lrange pcmmio_ai_ranges = { 4, { - BIP_RANGE(5), - BIP_RANGE(10), - UNI_RANGE(5), - UNI_RANGE(10) - } + BIP_RANGE(5), + BIP_RANGE(10), + UNI_RANGE(5), + UNI_RANGE(10) + } }; static const struct comedi_lrange pcmmio_ao_ranges = { 6, { - UNI_RANGE(5), - UNI_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(10), - BIP_RANGE(2.5), - RANGE(-2.5, 7.5) - } + UNI_RANGE(5), + UNI_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(10), + BIP_RANGE(2.5), + RANGE(-2.5, 7.5) + } }; struct pcmmio_private { @@ -241,8 +241,7 @@ static unsigned int pcmmio_dio_read(struct comedi_device *dev, */ static int pcmmio_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { /* subdevice 2 uses ports 0-2, subdevice 3 uses ports 3-5 */ int port = s->index == 2 ? 0 : 3; @@ -276,8 +275,7 @@ static int pcmmio_dio_insn_bits(struct comedi_device *dev, static int pcmmio_dio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { /* subdevice 2 uses ports 0-2, subdevice 3 uses ports 3-5 */ int port = s->index == 2 ? 0 : 3; @@ -456,7 +454,7 @@ static int pcmmio_cmd(struct comedi_device *dev, struct comedi_subdevice *s) /* Set up start of acquisition. */ if (cmd->start_src == TRIG_INT) s->async->inttrig = pcmmio_inttrig_start_intr; - else /* TRIG_NOW */ + else /* TRIG_NOW */ pcmmio_start_intr(dev, s); spin_unlock_irqrestore(&devpriv->spinlock, flags); @@ -465,8 +463,7 @@ static int pcmmio_cmd(struct comedi_device *dev, struct comedi_subdevice *s) } static int pcmmio_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_cmd *cmd) + struct comedi_subdevice *s, struct comedi_cmd *cmd) { int err = 0; @@ -501,7 +498,7 @@ static int pcmmio_cmdtest(struct comedi_device *dev, if (cmd->stop_src == TRIG_COUNT) err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); - else /* TRIG_NONE */ + else /* TRIG_NONE */ err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) @@ -516,8 +513,7 @@ static int pcmmio_cmdtest(struct comedi_device *dev, static int pcmmio_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned char status; @@ -529,8 +525,7 @@ static int pcmmio_ai_eoc(struct comedi_device *dev, static int pcmmio_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned long iobase = dev->iobase; unsigned int chan = CR_CHAN(insn->chanspec); @@ -599,8 +594,7 @@ static int pcmmio_ai_insn_read(struct comedi_device *dev, static int pcmmio_ao_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned char status; @@ -612,8 +606,7 @@ static int pcmmio_ao_eoc(struct comedi_device *dev, static int pcmmio_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned long iobase = dev->iobase; unsigned int chan = CR_CHAN(insn->chanspec); @@ -701,12 +694,12 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* Analog Input subdevice */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF; - s->n_chan = 16; - s->maxdata = 0xffff; - s->range_table = &pcmmio_ai_ranges; - s->insn_read = pcmmio_ai_insn_read; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF; + s->n_chan = 16; + s->maxdata = 0xffff; + s->range_table = &pcmmio_ai_ranges; + s->insn_read = pcmmio_ai_insn_read; /* initialize the resource enable register by clearing it */ outb(PCMMIO_AI_RES_ENA_CMD_REG_ACCESS, @@ -716,12 +709,12 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* Analog Output subdevice */ s = &dev->subdevices[1]; - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_READABLE; - s->n_chan = 8; - s->maxdata = 0xffff; - s->range_table = &pcmmio_ao_ranges; - s->insn_write = pcmmio_ao_insn_write; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_READABLE; + s->n_chan = 8; + s->maxdata = 0xffff; + s->range_table = &pcmmio_ao_ranges; + s->insn_write = pcmmio_ao_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) @@ -730,46 +723,47 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* initialize the resource enable register by clearing it */ outb(0, dev->iobase + PCMMIO_AO_RESOURCE_ENA_REG); outb(0, dev->iobase + PCMMIO_AO_2ND_DAC_OFFSET + - PCMMIO_AO_RESOURCE_ENA_REG); + PCMMIO_AO_RESOURCE_ENA_REG); /* Digital I/O subdevice with interrupt support */ s = &dev->subdevices[2]; - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 24; - s->maxdata = 1; - s->len_chanlist = 1; - s->range_table = &range_digital; - s->insn_bits = pcmmio_dio_insn_bits; - s->insn_config = pcmmio_dio_insn_config; + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 24; + s->maxdata = 1; + s->len_chanlist = 1; + s->range_table = &range_digital; + s->insn_bits = pcmmio_dio_insn_bits; + s->insn_config = pcmmio_dio_insn_config; if (dev->irq) { dev->read_subdev = s; - s->subdev_flags |= SDF_CMD_READ | SDF_LSAMPL | SDF_PACKED; - s->len_chanlist = s->n_chan; - s->cancel = pcmmio_cancel; - s->do_cmd = pcmmio_cmd; - s->do_cmdtest = pcmmio_cmdtest; + s->subdev_flags |= SDF_CMD_READ | SDF_LSAMPL | SDF_PACKED; + s->len_chanlist = s->n_chan; + s->cancel = pcmmio_cancel; + s->do_cmd = pcmmio_cmd; + s->do_cmdtest = pcmmio_cmdtest; } /* Digital I/O subdevice */ s = &dev->subdevices[3]; - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 24; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = pcmmio_dio_insn_bits; - s->insn_config = pcmmio_dio_insn_config; + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 24; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = pcmmio_dio_insn_bits; + s->insn_config = pcmmio_dio_insn_config; return 0; } static struct comedi_driver pcmmio_driver = { - .driver_name = "pcmmio", - .module = THIS_MODULE, - .attach = pcmmio_attach, - .detach = comedi_legacy_detach, + .driver_name = "pcmmio", + .module = THIS_MODULE, + .attach = pcmmio_attach, + .detach = comedi_legacy_detach, }; + module_comedi_driver(pcmmio_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/pcmuio.c b/drivers/comedi/drivers/pcmuio.c index b299d648a0eb..1ad0708b7640 100644 --- a/drivers/comedi/drivers/pcmuio.c +++ b/drivers/comedi/drivers/pcmuio.c @@ -106,12 +106,12 @@ struct pcmuio_board { static const struct pcmuio_board pcmuio_boards[] = { { - .name = "pcmuio48", - .num_asics = 1, - }, { - .name = "pcmuio96", - .num_asics = 2, - }, + .name = "pcmuio48", + .num_asics = 1, + }, { + .name = "pcmuio96", + .num_asics = 2, + }, }; struct pcmuio_asic { @@ -211,8 +211,7 @@ static unsigned int pcmuio_read(struct comedi_device *dev, */ static int pcmuio_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { int asic = pcmuio_subdevice_to_asic(s); int port = pcmuio_subdevice_to_port(s); @@ -246,8 +245,7 @@ static int pcmuio_dio_insn_bits(struct comedi_device *dev, static int pcmuio_dio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { int asic = pcmuio_subdevice_to_asic(s); int port = pcmuio_subdevice_to_port(s); @@ -459,7 +457,7 @@ static int pcmuio_cmd(struct comedi_device *dev, struct comedi_subdevice *s) /* Set up start of acquisition. */ if (cmd->start_src == TRIG_INT) s->async->inttrig = pcmuio_inttrig_start_intr; - else /* TRIG_NOW */ + else /* TRIG_NOW */ pcmuio_start_intr(dev, s); spin_unlock_irqrestore(&chip->spinlock, flags); @@ -468,8 +466,7 @@ static int pcmuio_cmd(struct comedi_device *dev, struct comedi_subdevice *s) } static int pcmuio_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_cmd *cmd) + struct comedi_subdevice *s, struct comedi_cmd *cmd) { int err = 0; @@ -504,7 +501,7 @@ static int pcmuio_cmdtest(struct comedi_device *dev, if (cmd->stop_src == TRIG_COUNT) err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); - else /* TRIG_NONE */ + else /* TRIG_NONE */ err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) @@ -570,24 +567,24 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it) for (i = 0; i < dev->n_subdevices; ++i) { s = &dev->subdevices[i]; - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 24; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = pcmuio_dio_insn_bits; - s->insn_config = pcmuio_dio_insn_config; + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 24; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = pcmuio_dio_insn_bits; + s->insn_config = pcmuio_dio_insn_config; /* subdevices 0 and 2 can support interrupts */ if ((i == 0 && dev->irq) || (i == 2 && devpriv->irq2)) { /* setup the interrupt subdevice */ dev->read_subdev = s; - s->subdev_flags |= SDF_CMD_READ | SDF_LSAMPL | - SDF_PACKED; - s->len_chanlist = s->n_chan; - s->cancel = pcmuio_cancel; - s->do_cmd = pcmuio_cmd; - s->do_cmdtest = pcmuio_cmdtest; + s->subdev_flags |= SDF_CMD_READ | SDF_LSAMPL | + SDF_PACKED; + s->len_chanlist = s->n_chan; + s->cancel = pcmuio_cancel; + s->do_cmd = pcmuio_cmd; + s->do_cmdtest = pcmuio_cmdtest; } } @@ -609,14 +606,15 @@ static void pcmuio_detach(struct comedi_device *dev) } static struct comedi_driver pcmuio_driver = { - .driver_name = "pcmuio", - .module = THIS_MODULE, - .attach = pcmuio_attach, - .detach = pcmuio_detach, - .board_name = &pcmuio_boards[0].name, - .offset = sizeof(struct pcmuio_board), - .num_names = ARRAY_SIZE(pcmuio_boards), + .driver_name = "pcmuio", + .module = THIS_MODULE, + .attach = pcmuio_attach, + .detach = pcmuio_detach, + .board_name = &pcmuio_boards[0].name, + .offset = sizeof(struct pcmuio_board), + .num_names = ARRAY_SIZE(pcmuio_boards), }; + module_comedi_driver(pcmuio_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/plx9052.h b/drivers/comedi/drivers/plx9052.h index e68a7afef025..7be9ab615bcc 100644 --- a/drivers/comedi/drivers/plx9052.h +++ b/drivers/comedi/drivers/plx9052.h @@ -55,9 +55,9 @@ #define PLX9052_CNTRL_PCI_R_NO_FLUSH BIT(16) /* read no flush mode */ #define PLX9052_CNTRL_PCI_R_NO_WRITE BIT(17) /* read no write mode */ #define PLX9052_CNTRL_PCI_W_RELEASE BIT(18) /* write release bus mode */ -#define PLX9052_CNTRL_RETRY_CLKS(x) (((x) & 0xf) << 19) /* retry clks */ +#define PLX9052_CNTRL_RETRY_CLKS(x) (((x) & 0xf) << 19) /* retry clks */ #define PLX9052_CNTRL_LOCK_ENAB BIT(23) /* slave LOCK# enable */ -#define PLX9052_CNTRL_EEPROM_MASK (0x1f << 24) /* EEPROM bits */ +#define PLX9052_CNTRL_EEPROM_MASK (0x1f << 24) /* EEPROM bits */ #define PLX9052_CNTRL_EEPROM_CLK BIT(24) /* EEPROM clock */ #define PLX9052_CNTRL_EEPROM_CS BIT(25) /* EEPROM chip select */ #define PLX9052_CNTRL_EEPROM_DOUT BIT(26) /* EEPROM write bit */ diff --git a/drivers/comedi/drivers/plx9080.h b/drivers/comedi/drivers/plx9080.h index aa0eda5a8093..3c21bb575919 100644 --- a/drivers/comedi/drivers/plx9080.h +++ b/drivers/comedi/drivers/plx9080.h @@ -55,12 +55,12 @@ struct plx_dma_desc { /* Local Address Space 1 Range Register */ #define PLX_REG_LAS1RR 0x00f0 -#define PLX_LASRR_IO BIT(0) /* Map to: 1=I/O, 0=Mem */ +#define PLX_LASRR_IO BIT(0) /* Map to: 1=I/O, 0=Mem */ #define PLX_LASRR_MLOC_ANY32 (BIT(1) * 0) /* Locate anywhere in 32 bit */ #define PLX_LASRR_MLOC_LT1MB (BIT(1) * 1) /* Locate in 1st meg */ #define PLX_LASRR_MLOC_ANY64 (BIT(1) * 2) /* Locate anywhere in 64 bit */ #define PLX_LASRR_MLOC_MASK GENMASK(2, 1) /* Memory location bits */ -#define PLX_LASRR_PREFETCH BIT(3) /* Memory is prefetchable */ +#define PLX_LASRR_PREFETCH BIT(3) /* Memory is prefetchable */ /* bits that specify range for memory space decode bits */ #define PLX_LASRR_MEM_MASK GENMASK(31, 4) /* bits that specify range for i/o space decode bits */ @@ -71,7 +71,7 @@ struct plx_dma_desc { /* Local Address Space 1 Local Base Address (Remap) Register */ #define PLX_REG_LAS1BA 0x00f4 -#define PLX_LASBA_EN BIT(0) /* Enable slave decode */ +#define PLX_LASBA_EN BIT(0) /* Enable slave decode */ /* bits that specify local base address for memory space */ #define PLX_LASBA_MEM_MASK GENMASK(31, 4) /* bits that specify local base address for i/o space */ @@ -441,7 +441,7 @@ struct plx_dma_desc { PLX_CNTRL_CCRDM_MASK | PLX_CNTRL_CCWDM_MASK) #define PLX_CNTRL_CC_NORMAL \ (PLX_CNTRL_CCRDMA_NORMAL | PLX_CNTRL_CCWDMA_NORMAL | \ - PLX_CNTRL_CCRDM_NORMAL | PLX_CNTRL_CCWDM_NORMAL) /* val after reset */ + PLX_CNTRL_CCRDM_NORMAL | PLX_CNTRL_CCWDM_NORMAL) /* val after reset */ /* PCI Permanent Configuration ID Register (hard-coded PLX vendor and device) */ #define PLX_REG_PCIHIDR 0x0070 @@ -617,7 +617,7 @@ struct plx_dma_desc { * %0 on success. * -%ETIMEDOUT if timed out waiting for abort to complete. */ -static inline int plx9080_abort_dma(void __iomem *iobase, unsigned int channel) +static inline int plx9080_abort_dma(void __iomem *iobase, unsigned int channel) { void __iomem *dma_cs_addr; u8 dma_status; diff --git a/drivers/comedi/drivers/quatech_daqp_cs.c b/drivers/comedi/drivers/quatech_daqp_cs.c index fe4408ebf6b3..9319a6707f6f 100644 --- a/drivers/comedi/drivers/quatech_daqp_cs.c +++ b/drivers/comedi/drivers/quatech_daqp_cs.c @@ -151,11 +151,11 @@ struct daqp_private { static const struct comedi_lrange range_daqp_ai = { 4, { - BIP_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(2.5), - BIP_RANGE(1.25) - } + BIP_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(2.5), + BIP_RANGE(1.25) + } }; static int daqp_clear_events(struct comedi_device *dev, int loops) @@ -175,8 +175,7 @@ static int daqp_clear_events(struct comedi_device *dev, int loops) return -EBUSY; } -static int daqp_ai_cancel(struct comedi_device *dev, - struct comedi_subdevice *s) +static int daqp_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) { struct daqp_private *devpriv = dev->private; @@ -259,8 +258,7 @@ static irqreturn_t daqp_interrupt(int irq, void *dev_id) } static void daqp_ai_set_one_scanlist_entry(struct comedi_device *dev, - unsigned int chanspec, - int start) + unsigned int chanspec, int start) { unsigned int chan = CR_CHAN(chanspec); unsigned int range = CR_RANGE(chanspec); @@ -281,8 +279,7 @@ static void daqp_ai_set_one_scanlist_entry(struct comedi_device *dev, static int daqp_ai_eos(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned int status; @@ -294,8 +291,7 @@ static int daqp_ai_eos(struct comedi_device *dev, static int daqp_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct daqp_private *devpriv = dev->private; int ret = 0; @@ -369,8 +365,7 @@ static void daqp_set_pacer(struct comedi_device *dev, unsigned int val) } static int daqp_ai_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_cmd *cmd) + struct comedi_subdevice *s, struct comedi_cmd *cmd) { struct daqp_private *devpriv = dev->private; int err = 0; @@ -435,7 +430,7 @@ static int daqp_ai_cmdtest(struct comedi_device *dev, if (cmd->stop_src == TRIG_COUNT) err |= comedi_check_trigger_arg_max(&cmd->stop_arg, 0x00ffffff); - else /* TRIG_NONE */ + else /* TRIG_NONE */ err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) @@ -573,7 +568,7 @@ static int daqp_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) unsigned long long nbytes; nsamples = (unsigned long long)cmd->stop_arg * - cmd->scan_end_arg; + cmd->scan_end_arg; nbytes = nsamples * comedi_bytes_per_sample(s); while (nbytes > DAQP_FIFO_SIZE * 3 / 4) nbytes /= 2; @@ -617,8 +612,7 @@ static int daqp_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) static int daqp_ao_empty(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned int status; @@ -630,8 +624,7 @@ static int daqp_ao_empty(struct comedi_device *dev, static int daqp_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct daqp_private *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -664,8 +657,7 @@ static int daqp_ao_insn_write(struct comedi_device *dev, static int daqp_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct daqp_private *devpriv = dev->private; @@ -679,8 +671,7 @@ static int daqp_di_insn_bits(struct comedi_device *dev, static int daqp_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct daqp_private *devpriv = dev->private; @@ -695,8 +686,7 @@ static int daqp_do_insn_bits(struct comedi_device *dev, return insn->n; } -static int daqp_auto_attach(struct comedi_device *dev, - unsigned long context) +static int daqp_auto_attach(struct comedi_device *dev, unsigned long context) { struct pcmcia_device *link = comedi_to_pcmcia_dev(dev); struct daqp_private *devpriv; @@ -723,28 +713,28 @@ static int daqp_auto_attach(struct comedi_device *dev, return ret; s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF; - s->n_chan = 8; - s->maxdata = 0xffff; - s->range_table = &range_daqp_ai; - s->insn_read = daqp_ai_insn_read; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF; + s->n_chan = 8; + s->maxdata = 0xffff; + s->range_table = &range_daqp_ai; + s->insn_read = daqp_ai_insn_read; if (dev->irq) { dev->read_subdev = s; - s->subdev_flags |= SDF_CMD_READ; - s->len_chanlist = 2048; - s->do_cmdtest = daqp_ai_cmdtest; - s->do_cmd = daqp_ai_cmd; - s->cancel = daqp_ai_cancel; + s->subdev_flags |= SDF_CMD_READ; + s->len_chanlist = 2048; + s->do_cmdtest = daqp_ai_cmdtest; + s->do_cmd = daqp_ai_cmd; + s->cancel = daqp_ai_cancel; } s = &dev->subdevices[1]; - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 2; - s->maxdata = 0x0fff; - s->range_table = &range_bipolar5; - s->insn_write = daqp_ao_insn_write; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 2; + s->maxdata = 0x0fff; + s->range_table = &range_bipolar5; + s->insn_write = daqp_ao_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) @@ -762,11 +752,11 @@ static int daqp_auto_attach(struct comedi_device *dev, * 3 DI3 External gain select, hi bit */ s = &dev->subdevices[2]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 4; - s->maxdata = 1; - s->insn_bits = daqp_di_insn_bits; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 4; + s->maxdata = 1; + s->insn_bits = daqp_di_insn_bits; /* * Digital Output subdevice @@ -776,20 +766,20 @@ static int daqp_auto_attach(struct comedi_device *dev, * work. */ s = &dev->subdevices[3]; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 4; - s->maxdata = 1; - s->insn_bits = daqp_do_insn_bits; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 4; + s->maxdata = 1; + s->insn_bits = daqp_do_insn_bits; return 0; } static struct comedi_driver driver_daqp = { - .driver_name = "quatech_daqp_cs", - .module = THIS_MODULE, - .auto_attach = daqp_auto_attach, - .detach = comedi_pcmcia_disable, + .driver_name = "quatech_daqp_cs", + .module = THIS_MODULE, + .auto_attach = daqp_auto_attach, + .detach = comedi_pcmcia_disable, }; static int daqp_cs_suspend(struct pcmcia_device *link) @@ -824,17 +814,19 @@ static const struct pcmcia_device_id daqp_cs_id_table[] = { PCMCIA_DEVICE_MANF_CARD(0x0137, 0x0027), PCMCIA_DEVICE_NULL }; + MODULE_DEVICE_TABLE(pcmcia, daqp_cs_id_table); static struct pcmcia_driver daqp_cs_driver = { - .name = "quatech_daqp_cs", - .owner = THIS_MODULE, - .id_table = daqp_cs_id_table, - .probe = daqp_cs_attach, - .remove = comedi_pcmcia_auto_unconfig, - .suspend = daqp_cs_suspend, - .resume = daqp_cs_resume, + .name = "quatech_daqp_cs", + .owner = THIS_MODULE, + .id_table = daqp_cs_id_table, + .probe = daqp_cs_attach, + .remove = comedi_pcmcia_auto_unconfig, + .suspend = daqp_cs_suspend, + .resume = daqp_cs_resume, }; + module_comedi_pcmcia_driver(driver_daqp, daqp_cs_driver); MODULE_DESCRIPTION("Comedi driver for Quatech DAQP PCMCIA data capture cards"); diff --git a/drivers/comedi/drivers/rtd520.c b/drivers/comedi/drivers/rtd520.c index 2d99a648b054..b3b5ea6d112a 100644 --- a/drivers/comedi/drivers/rtd520.c +++ b/drivers/comedi/drivers/rtd520.c @@ -251,71 +251,71 @@ */ static const struct comedi_lrange rtd_ai_7520_range = { 18, { - /* +-5V input range gain steps */ - BIP_RANGE(5.0), - BIP_RANGE(5.0 / 2), - BIP_RANGE(5.0 / 4), - BIP_RANGE(5.0 / 8), - BIP_RANGE(5.0 / 16), - BIP_RANGE(5.0 / 32), - /* +-10V input range gain steps */ - BIP_RANGE(10.0), - BIP_RANGE(10.0 / 2), - BIP_RANGE(10.0 / 4), - BIP_RANGE(10.0 / 8), - BIP_RANGE(10.0 / 16), - BIP_RANGE(10.0 / 32), - /* +10V input range gain steps */ - UNI_RANGE(10.0), - UNI_RANGE(10.0 / 2), - UNI_RANGE(10.0 / 4), - UNI_RANGE(10.0 / 8), - UNI_RANGE(10.0 / 16), - UNI_RANGE(10.0 / 32), - } + /* +-5V input range gain steps */ + BIP_RANGE(5.0), + BIP_RANGE(5.0 / 2), + BIP_RANGE(5.0 / 4), + BIP_RANGE(5.0 / 8), + BIP_RANGE(5.0 / 16), + BIP_RANGE(5.0 / 32), + /* +-10V input range gain steps */ + BIP_RANGE(10.0), + BIP_RANGE(10.0 / 2), + BIP_RANGE(10.0 / 4), + BIP_RANGE(10.0 / 8), + BIP_RANGE(10.0 / 16), + BIP_RANGE(10.0 / 32), + /* +10V input range gain steps */ + UNI_RANGE(10.0), + UNI_RANGE(10.0 / 2), + UNI_RANGE(10.0 / 4), + UNI_RANGE(10.0 / 8), + UNI_RANGE(10.0 / 16), + UNI_RANGE(10.0 / 32), + } }; /* PCI4520 has two more gains (6 more entries) */ static const struct comedi_lrange rtd_ai_4520_range = { 24, { - /* +-5V input range gain steps */ - BIP_RANGE(5.0), - BIP_RANGE(5.0 / 2), - BIP_RANGE(5.0 / 4), - BIP_RANGE(5.0 / 8), - BIP_RANGE(5.0 / 16), - BIP_RANGE(5.0 / 32), - BIP_RANGE(5.0 / 64), - BIP_RANGE(5.0 / 128), - /* +-10V input range gain steps */ - BIP_RANGE(10.0), - BIP_RANGE(10.0 / 2), - BIP_RANGE(10.0 / 4), - BIP_RANGE(10.0 / 8), - BIP_RANGE(10.0 / 16), - BIP_RANGE(10.0 / 32), - BIP_RANGE(10.0 / 64), - BIP_RANGE(10.0 / 128), - /* +10V input range gain steps */ - UNI_RANGE(10.0), - UNI_RANGE(10.0 / 2), - UNI_RANGE(10.0 / 4), - UNI_RANGE(10.0 / 8), - UNI_RANGE(10.0 / 16), - UNI_RANGE(10.0 / 32), - UNI_RANGE(10.0 / 64), - UNI_RANGE(10.0 / 128), - } + /* +-5V input range gain steps */ + BIP_RANGE(5.0), + BIP_RANGE(5.0 / 2), + BIP_RANGE(5.0 / 4), + BIP_RANGE(5.0 / 8), + BIP_RANGE(5.0 / 16), + BIP_RANGE(5.0 / 32), + BIP_RANGE(5.0 / 64), + BIP_RANGE(5.0 / 128), + /* +-10V input range gain steps */ + BIP_RANGE(10.0), + BIP_RANGE(10.0 / 2), + BIP_RANGE(10.0 / 4), + BIP_RANGE(10.0 / 8), + BIP_RANGE(10.0 / 16), + BIP_RANGE(10.0 / 32), + BIP_RANGE(10.0 / 64), + BIP_RANGE(10.0 / 128), + /* +10V input range gain steps */ + UNI_RANGE(10.0), + UNI_RANGE(10.0 / 2), + UNI_RANGE(10.0 / 4), + UNI_RANGE(10.0 / 8), + UNI_RANGE(10.0 / 16), + UNI_RANGE(10.0 / 32), + UNI_RANGE(10.0 / 64), + UNI_RANGE(10.0 / 128), + } }; /* Table order matches range values */ static const struct comedi_lrange rtd_ao_range = { 4, { - UNI_RANGE(5), - UNI_RANGE(10), - BIP_RANGE(5), - BIP_RANGE(10), - } + UNI_RANGE(5), + UNI_RANGE(10), + BIP_RANGE(5), + BIP_RANGE(10), + } }; enum rtd_boardid { @@ -332,17 +332,17 @@ struct rtd_boardinfo { static const struct rtd_boardinfo rtd520_boards[] = { [BOARD_DM7520] = { - .name = "DM7520", - .range_bip10 = 6, - .range_uni10 = 12, - .ai_range = &rtd_ai_7520_range, - }, + .name = "DM7520", + .range_bip10 = 6, + .range_uni10 = 12, + .ai_range = &rtd_ai_7520_range, + }, [BOARD_PCI4520] = { - .name = "PCI4520", - .range_bip10 = 8, - .range_uni10 = 16, - .ai_range = &rtd_ai_4520_range, - }, + .name = "PCI4520", + .range_bip10 = 8, + .range_uni10 = 16, + .ai_range = &rtd_ai_4520_range, + }, }; struct rtd_private { @@ -518,8 +518,7 @@ static int rtd520_probe_fifo_depth(struct comedi_device *dev) static int rtd_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned int status; @@ -794,7 +793,7 @@ static int rtd_ai_cmdtest(struct comedi_device *dev, if (cmd->stop_src == TRIG_COUNT) err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); - else /* TRIG_NONE */ + else /* TRIG_NONE */ err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) @@ -815,8 +814,9 @@ static int rtd_ai_cmdtest(struct comedi_device *dev, if (cmd->scan_begin_src == TRIG_TIMER) { arg = cmd->convert_arg * cmd->scan_end_arg; - err |= comedi_check_trigger_arg_min( - &cmd->scan_begin_arg, arg); + err |= + comedi_check_trigger_arg_min(&cmd->scan_begin_arg, + arg); } } @@ -992,8 +992,7 @@ static int rtd_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) static int rtd_ao_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int bit = (chan == 0) ? FS_DAC1_NOT_EMPTY : FS_DAC2_NOT_EMPTY; @@ -1007,8 +1006,7 @@ static int rtd_ao_eoc(struct comedi_device *dev, static int rtd_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct rtd_private *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -1046,8 +1044,7 @@ static int rtd_ao_insn_write(struct comedi_device *dev, static int rtd_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { if (comedi_dio_update_state(s, data)) writew(s->state & 0xff, dev->mmio + LAS0_DIO0); @@ -1059,8 +1056,7 @@ static int rtd_dio_insn_bits(struct comedi_device *dev, static int rtd_dio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { int ret; @@ -1086,8 +1082,7 @@ static int rtd_dio_insn_config(struct comedi_device *dev, static int rtd_counter_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct rtd_private *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -1204,8 +1199,7 @@ static void rtd_pci_latency_quirk(struct comedi_device *dev, } } -static int rtd_auto_attach(struct comedi_device *dev, - unsigned long context) +static int rtd_auto_attach(struct comedi_device *dev, unsigned long context) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); const struct rtd_boardinfo *board = NULL; @@ -1249,29 +1243,29 @@ static int rtd_auto_attach(struct comedi_device *dev, s = &dev->subdevices[0]; /* analog input subdevice */ - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_COMMON | SDF_DIFF; - s->n_chan = 16; - s->maxdata = 0x0fff; - s->range_table = board->ai_range; - s->len_chanlist = RTD_MAX_CHANLIST; - s->insn_read = rtd_ai_rinsn; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_COMMON | SDF_DIFF; + s->n_chan = 16; + s->maxdata = 0x0fff; + s->range_table = board->ai_range; + s->len_chanlist = RTD_MAX_CHANLIST; + s->insn_read = rtd_ai_rinsn; if (dev->irq) { dev->read_subdev = s; - s->subdev_flags |= SDF_CMD_READ; - s->do_cmd = rtd_ai_cmd; - s->do_cmdtest = rtd_ai_cmdtest; - s->cancel = rtd_ai_cancel; + s->subdev_flags |= SDF_CMD_READ; + s->do_cmd = rtd_ai_cmd; + s->do_cmdtest = rtd_ai_cmdtest; + s->cancel = rtd_ai_cancel; } s = &dev->subdevices[1]; /* analog output subdevice */ - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 2; - s->maxdata = 0x0fff; - s->range_table = &rtd_ao_range; - s->insn_write = rtd_ao_insn_write; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 2; + s->maxdata = 0x0fff; + s->range_table = &rtd_ao_range; + s->insn_write = rtd_ao_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) @@ -1279,14 +1273,14 @@ static int rtd_auto_attach(struct comedi_device *dev, s = &dev->subdevices[2]; /* digital i/o subdevice */ - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; /* we only support port 0 right now. Ignoring port 1 and user IO */ - s->n_chan = 8; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = rtd_dio_insn_bits; - s->insn_config = rtd_dio_insn_config; + s->n_chan = 8; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = rtd_dio_insn_bits; + s->insn_config = rtd_dio_insn_config; /* 8254 Timer/Counter subdevice */ s = &dev->subdevices[3]; @@ -1333,14 +1327,13 @@ static void rtd_detach(struct comedi_device *dev) } static struct comedi_driver rtd520_driver = { - .driver_name = "rtd520", - .module = THIS_MODULE, - .auto_attach = rtd_auto_attach, - .detach = rtd_detach, + .driver_name = "rtd520", + .module = THIS_MODULE, + .auto_attach = rtd_auto_attach, + .detach = rtd_detach, }; -static int rtd520_pci_probe(struct pci_dev *dev, - const struct pci_device_id *id) +static int rtd520_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) { return comedi_pci_auto_config(dev, &rtd520_driver, id->driver_data); } @@ -1350,14 +1343,16 @@ static const struct pci_device_id rtd520_pci_table[] = { { PCI_VDEVICE(RTD, 0x4520), BOARD_PCI4520 }, { 0 } }; + MODULE_DEVICE_TABLE(pci, rtd520_pci_table); static struct pci_driver rtd520_pci_driver = { - .name = "rtd520", - .id_table = rtd520_pci_table, - .probe = rtd520_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "rtd520", + .id_table = rtd520_pci_table, + .probe = rtd520_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(rtd520_driver, rtd520_pci_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/rti800.c b/drivers/comedi/drivers/rti800.c index 327fd93b8b12..a715f4ed4836 100644 --- a/drivers/comedi/drivers/rti800.c +++ b/drivers/comedi/drivers/rti800.c @@ -73,29 +73,29 @@ static const struct comedi_lrange range_rti800_ai_10_bipolar = { 4, { - BIP_RANGE(10), - BIP_RANGE(1), - BIP_RANGE(0.1), - BIP_RANGE(0.02) - } + BIP_RANGE(10), + BIP_RANGE(1), + BIP_RANGE(0.1), + BIP_RANGE(0.02) + } }; static const struct comedi_lrange range_rti800_ai_5_bipolar = { 4, { - BIP_RANGE(5), - BIP_RANGE(0.5), - BIP_RANGE(0.05), - BIP_RANGE(0.01) - } + BIP_RANGE(5), + BIP_RANGE(0.5), + BIP_RANGE(0.05), + BIP_RANGE(0.01) + } }; static const struct comedi_lrange range_rti800_ai_unipolar = { 4, { - UNI_RANGE(10), - UNI_RANGE(1), - UNI_RANGE(0.1), - UNI_RANGE(0.02) - } + UNI_RANGE(10), + UNI_RANGE(1), + UNI_RANGE(0.1), + UNI_RANGE(0.02) + } }; static const struct comedi_lrange *const rti800_ai_ranges[] = { @@ -116,11 +116,11 @@ struct rti800_board { static const struct rti800_board rti800_boardtypes[] = { { - .name = "rti800", - }, { - .name = "rti815", - .has_ao = 1, - }, + .name = "rti800", + }, { + .name = "rti815", + .has_ao = 1, + }, }; struct rti800_private { @@ -132,8 +132,7 @@ struct rti800_private { static int rti800_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned char status; @@ -149,8 +148,7 @@ static int rti800_ai_eoc(struct comedi_device *dev, static int rti800_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct rti800_private *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -172,8 +170,7 @@ static int rti800_ai_insn_read(struct comedi_device *dev, */ if (insn->n > 0) { int delay = (gain == 0) ? 10 : - (gain == 1) ? 20 : - (gain == 2) ? 40 : 80; + (gain == 1) ? 20 : (gain == 2) ? 40 : 80; udelay(delay); } @@ -202,8 +199,7 @@ static int rti800_ai_insn_read(struct comedi_device *dev, static int rti800_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct rti800_private *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -228,8 +224,7 @@ static int rti800_ao_insn_write(struct comedi_device *dev, static int rti800_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { data[1] = inb(dev->iobase + RTI800_DI); return insn->n; @@ -237,8 +232,7 @@ static int rti800_di_insn_bits(struct comedi_device *dev, static int rti800_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { if (comedi_dio_update_state(s, data)) { /* Outputs are inverted... */ @@ -281,57 +275,57 @@ static int rti800_attach(struct comedi_device *dev, struct comedi_devconfig *it) s = &dev->subdevices[0]; /* ai subdevice */ - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_GROUND; - s->n_chan = (it->options[2] ? 16 : 8); - s->insn_read = rti800_ai_insn_read; - s->maxdata = 0x0fff; - s->range_table = (it->options[3] < ARRAY_SIZE(rti800_ai_ranges)) - ? rti800_ai_ranges[it->options[3]] - : &range_unknown; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_GROUND; + s->n_chan = (it->options[2] ? 16 : 8); + s->insn_read = rti800_ai_insn_read; + s->maxdata = 0x0fff; + s->range_table = (it->options[3] < ARRAY_SIZE(rti800_ai_ranges)) + ? rti800_ai_ranges[it->options[3]] + : &range_unknown; s = &dev->subdevices[1]; if (board->has_ao) { /* ao subdevice (only on rti815) */ - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 2; - s->maxdata = 0x0fff; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 2; + s->maxdata = 0x0fff; s->range_table_list = devpriv->ao_range_type_list; devpriv->ao_range_type_list[0] = - (it->options[5] < ARRAY_SIZE(rti800_ao_ranges)) - ? rti800_ao_ranges[it->options[5]] - : &range_unknown; + (it->options[5] < ARRAY_SIZE(rti800_ao_ranges)) + ? rti800_ao_ranges[it->options[5]] + : &range_unknown; devpriv->ao_range_type_list[1] = - (it->options[7] < ARRAY_SIZE(rti800_ao_ranges)) - ? rti800_ao_ranges[it->options[7]] - : &range_unknown; - s->insn_write = rti800_ao_insn_write; + (it->options[7] < ARRAY_SIZE(rti800_ao_ranges)) + ? rti800_ao_ranges[it->options[7]] + : &range_unknown; + s->insn_write = rti800_ao_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) return ret; } else { - s->type = COMEDI_SUBD_UNUSED; + s->type = COMEDI_SUBD_UNUSED; } s = &dev->subdevices[2]; /* di */ - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 8; - s->insn_bits = rti800_di_insn_bits; - s->maxdata = 1; - s->range_table = &range_digital; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 8; + s->insn_bits = rti800_di_insn_bits; + s->maxdata = 1; + s->range_table = &range_digital; s = &dev->subdevices[3]; /* do */ - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 8; - s->insn_bits = rti800_do_insn_bits; - s->maxdata = 1; - s->range_table = &range_digital; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 8; + s->insn_bits = rti800_do_insn_bits; + s->maxdata = 1; + s->range_table = &range_digital; /* * There is also an Am9513 timer on these boards. This subdevice @@ -342,14 +336,15 @@ static int rti800_attach(struct comedi_device *dev, struct comedi_devconfig *it) } static struct comedi_driver rti800_driver = { - .driver_name = "rti800", - .module = THIS_MODULE, - .attach = rti800_attach, - .detach = comedi_legacy_detach, - .num_names = ARRAY_SIZE(rti800_boardtypes), - .board_name = &rti800_boardtypes[0].name, - .offset = sizeof(struct rti800_board), + .driver_name = "rti800", + .module = THIS_MODULE, + .attach = rti800_attach, + .detach = comedi_legacy_detach, + .num_names = ARRAY_SIZE(rti800_boardtypes), + .board_name = &rti800_boardtypes[0].name, + .offset = sizeof(struct rti800_board), }; + module_comedi_driver(rti800_driver); MODULE_DESCRIPTION("Comedi: RTI-800 Multifunction Analog/Digital board"); diff --git a/drivers/comedi/drivers/rti802.c b/drivers/comedi/drivers/rti802.c index 195e2b1ac4c1..42b9f831a1e4 100644 --- a/drivers/comedi/drivers/rti802.c +++ b/drivers/comedi/drivers/rti802.c @@ -40,8 +40,7 @@ struct rti802_private { static int rti802_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct rti802_private *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -86,11 +85,11 @@ static int rti802_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* Analog Output subdevice */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE; - s->maxdata = 0xfff; - s->n_chan = 8; - s->insn_write = rti802_ao_insn_write; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE; + s->maxdata = 0xfff; + s->n_chan = 8; + s->insn_write = rti802_ao_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) @@ -99,20 +98,21 @@ static int rti802_attach(struct comedi_device *dev, struct comedi_devconfig *it) s->range_table_list = devpriv->range_type_list; for (i = 0; i < 8; i++) { devpriv->dac_coding[i] = (it->options[3 + 2 * i]) - ? (dac_straight) : (dac_2comp); + ? (dac_straight) : (dac_2comp); devpriv->range_type_list[i] = (it->options[2 + 2 * i]) - ? &range_unipolar10 : &range_bipolar10; + ? &range_unipolar10 : &range_bipolar10; } return 0; } static struct comedi_driver rti802_driver = { - .driver_name = "rti802", - .module = THIS_MODULE, - .attach = rti802_attach, - .detach = comedi_legacy_detach, + .driver_name = "rti802", + .module = THIS_MODULE, + .attach = rti802_attach, + .detach = comedi_legacy_detach, }; + module_comedi_driver(rti802_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/s526.c b/drivers/comedi/drivers/s526.c index 085cf5b449e5..6f343576bda7 100644 --- a/drivers/comedi/drivers/s526.c +++ b/drivers/comedi/drivers/s526.c @@ -132,7 +132,7 @@ #define S526_GPCT_MODE_PR_SELECT_PR1 S526_GPCT_MODE_PR_SELECT(1) /* Control/Status - R = readable, W = writeable, C = write 1 to clear */ #define S526_GPCT_CTRL_REG(x) (0x18 + ((x) * 8)) -#define S526_GPCT_CTRL_EV_STATUS(x) ((x) << 0) /* RC */ +#define S526_GPCT_CTRL_EV_STATUS(x) ((x) << 0) /* RC */ #define S526_GPCT_CTRL_EV_STATUS_MASK S526_GPCT_EV_STATUS(0xf) #define S526_GPCT_CTRL_EV_STATUS_NONE S526_GPCT_EV_STATUS(0) /* these 4 bits can be OR'ed */ @@ -140,9 +140,9 @@ #define S526_GPCT_CTRL_EV_STATUS_ICAPN S526_GPCT_EV_STATUS(0x2) #define S526_GPCT_CTRL_EV_STATUS_ICAPP S526_GPCT_EV_STATUS(0x4) #define S526_GPCT_CTRL_EV_STATUS_RCAP S526_GPCT_EV_STATUS(0x8) -#define S526_GPCT_CTRL_COUT_STATUS BIT(4) /* R */ -#define S526_GPCT_CTRL_INDEX_STATUS BIT(5) /* R */ -#define S525_GPCT_CTRL_INTEN(x) ((x) << 6) /* W */ +#define S526_GPCT_CTRL_COUT_STATUS BIT(4) /* R */ +#define S526_GPCT_CTRL_INDEX_STATUS BIT(5) /* R */ +#define S525_GPCT_CTRL_INTEN(x) ((x) << 6) /* W */ #define S525_GPCT_CTRL_INTEN_MASK S526_GPCT_CTRL_INTEN(0xf) #define S525_GPCT_CTRL_INTEN_NONE S526_GPCT_CTRL_INTEN(0) /* these 4 bits can be OR'ed */ @@ -150,16 +150,16 @@ #define S525_GPCT_CTRL_INTEN_IXFALL S526_GPCT_CTRL_INTEN(0x2) #define S525_GPCT_CTRL_INTEN_IXRISE S526_GPCT_CTRL_INTEN(0x4) #define S525_GPCT_CTRL_INTEN_RO S526_GPCT_CTRL_INTEN(0x8) -#define S525_GPCT_CTRL_LATCH_SEL(x) ((x) << 10) /* W */ +#define S525_GPCT_CTRL_LATCH_SEL(x) ((x) << 10) /* W */ #define S525_GPCT_CTRL_LATCH_SEL_MASK S526_GPCT_CTRL_LATCH_SEL(0x7) #define S525_GPCT_CTRL_LATCH_SEL_NONE S526_GPCT_CTRL_LATCH_SEL(0) /* these 3 bits can be OR'ed */ #define S525_GPCT_CTRL_LATCH_SEL_IXFALL S526_GPCT_CTRL_LATCH_SEL(0x1) #define S525_GPCT_CTRL_LATCH_SEL_IXRISE S526_GPCT_CTRL_LATCH_SEL(0x2) #define S525_GPCT_CTRL_LATCH_SEL_ITIMER S526_GPCT_CTRL_LATCH_SEL(0x4) -#define S525_GPCT_CTRL_CT_ARM BIT(13) /* W */ -#define S525_GPCT_CTRL_CT_LOAD BIT(14) /* W */ -#define S526_GPCT_CTRL_CT_RESET BIT(15) /* W */ +#define S525_GPCT_CTRL_CT_ARM BIT(13) /* W */ +#define S525_GPCT_CTRL_CT_LOAD BIT(14) /* W */ +#define S526_GPCT_CTRL_CT_RESET BIT(15) /* W */ #define S526_EEPROM_DATA_REG 0x32 #define S526_EEPROM_CTRL_REG 0x34 #define S526_EEPROM_CTRL_ADDR(x) (((x) & 0x3f) << 3) @@ -180,8 +180,7 @@ static void s526_gpct_write(struct comedi_device *dev, outw(val & 0xffff, dev->iobase + S526_GPCT_LSB_REG(chan)); } -static unsigned int s526_gpct_read(struct comedi_device *dev, - unsigned int chan) +static unsigned int s526_gpct_read(struct comedi_device *dev, unsigned int chan) { unsigned int val; @@ -194,8 +193,7 @@ static unsigned int s526_gpct_read(struct comedi_device *dev, static int s526_gpct_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); int i; @@ -208,8 +206,7 @@ static int s526_gpct_rinsn(struct comedi_device *dev, static int s526_gpct_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct s526_private *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -379,8 +376,7 @@ static int s526_gpct_insn_config(struct comedi_device *dev, static int s526_gpct_winsn(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct s526_private *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -415,8 +411,7 @@ static int s526_gpct_winsn(struct comedi_device *dev, static int s526_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned int status; @@ -431,8 +426,7 @@ static int s526_eoc(struct comedi_device *dev, static int s526_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct s526_private *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -442,7 +436,7 @@ static int s526_ai_insn_read(struct comedi_device *dev, int i; ctrl = S526_AI_CTRL_CONV(chan) | S526_AI_CTRL_READ(chan) | - S526_AI_CTRL_START; + S526_AI_CTRL_START; if (ctrl != devpriv->ai_ctrl) { /* * The multiplexor needs to change, enable the 15us @@ -471,8 +465,7 @@ static int s526_ai_insn_read(struct comedi_device *dev, static int s526_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int ctrl = S526_AO_CTRL_CHAN(chan); @@ -500,8 +493,7 @@ static int s526_ao_insn_write(struct comedi_device *dev, static int s526_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { if (comedi_dio_update_state(s, data)) outw(s->state, dev->iobase + S526_DIO_CTRL_REG); @@ -513,8 +505,7 @@ static int s526_dio_insn_bits(struct comedi_device *dev, static int s526_dio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int mask; @@ -567,13 +558,13 @@ static int s526_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* General-Purpose Counter/Timer (GPCT) */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_COUNTER; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_LSAMPL; - s->n_chan = 4; - s->maxdata = 0x00ffffff; - s->insn_read = s526_gpct_rinsn; - s->insn_config = s526_gpct_insn_config; - s->insn_write = s526_gpct_winsn; + s->type = COMEDI_SUBD_COUNTER; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_LSAMPL; + s->n_chan = 4; + s->maxdata = 0x00ffffff; + s->insn_read = s526_gpct_rinsn; + s->insn_config = s526_gpct_insn_config; + s->insn_write = s526_gpct_winsn; /* * Analog Input subdevice @@ -582,22 +573,22 @@ static int s526_attach(struct comedi_device *dev, struct comedi_devconfig *it) * channel 9 is "reference 1" (0V) */ s = &dev->subdevices[1]; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_DIFF; - s->n_chan = 10; - s->maxdata = 0xffff; - s->range_table = &range_bipolar10; - s->len_chanlist = 16; - s->insn_read = s526_ai_insn_read; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_DIFF; + s->n_chan = 10; + s->maxdata = 0xffff; + s->range_table = &range_bipolar10; + s->len_chanlist = 16; + s->insn_read = s526_ai_insn_read; /* Analog Output subdevice */ s = &dev->subdevices[2]; - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 4; - s->maxdata = 0xffff; - s->range_table = &range_bipolar10; - s->insn_write = s526_ao_insn_write; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 4; + s->maxdata = 0xffff; + s->range_table = &range_bipolar10; + s->insn_write = s526_ao_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) @@ -605,23 +596,24 @@ static int s526_attach(struct comedi_device *dev, struct comedi_devconfig *it) /* Digital I/O subdevice */ s = &dev->subdevices[3]; - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 8; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = s526_dio_insn_bits; - s->insn_config = s526_dio_insn_config; + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 8; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = s526_dio_insn_bits; + s->insn_config = s526_dio_insn_config; return 0; } static struct comedi_driver s526_driver = { - .driver_name = "s526", - .module = THIS_MODULE, - .attach = s526_attach, - .detach = comedi_legacy_detach, + .driver_name = "s526", + .module = THIS_MODULE, + .attach = s526_attach, + .detach = comedi_legacy_detach, }; + module_comedi_driver(s526_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/s626.c b/drivers/comedi/drivers/s626.c index e7aba937d896..8757b0e9daab 100644 --- a/drivers/comedi/drivers/s626.c +++ b/drivers/comedi/drivers/s626.c @@ -134,9 +134,9 @@ static bool s626_mc_test(struct comedi_device *dev, static const struct comedi_lrange s626_range_table = { 2, { - BIP_RANGE(5), - BIP_RANGE(10) - } + BIP_RANGE(5), + BIP_RANGE(10) + } }; /* @@ -190,8 +190,7 @@ static u16 s626_debi_read(struct comedi_device *dev, u16 addr) /* * Write a value to a gate array register. */ -static void s626_debi_write(struct comedi_device *dev, u16 addr, - u16 wdata) +static void s626_debi_write(struct comedi_device *dev, u16 addr, u16 wdata) { /* Set up DEBI control register value in shadow RAM */ writel(S626_DEBI_CMD_WRWORD | addr, dev->mmio + S626_P_DEBICMD); @@ -277,8 +276,8 @@ static u8 s626_i2c_read(struct comedi_device *dev, u8 addr) */ if (s626_i2c_handshake(dev, S626_I2C_B2(S626_I2C_ATTRSTART, devpriv->i2c_adrs) | - S626_I2C_B1(S626_I2C_ATTRSTOP, addr) | - S626_I2C_B0(S626_I2C_ATTRNOP, 0))) + S626_I2C_B1(S626_I2C_ATTRSTOP, addr) | + S626_I2C_B0(S626_I2C_ATTRNOP, 0))) /* Abort function and declare error if handshake failed. */ return 0; @@ -290,8 +289,8 @@ static u8 s626_i2c_read(struct comedi_device *dev, u8 addr) */ if (s626_i2c_handshake(dev, S626_I2C_B2(S626_I2C_ATTRSTART, (devpriv->i2c_adrs | 1)) | - S626_I2C_B1(S626_I2C_ATTRSTOP, 0) | - S626_I2C_B0(S626_I2C_ATTRNOP, 0))) + S626_I2C_B1(S626_I2C_ATTRSTOP, 0) | + S626_I2C_B0(S626_I2C_ATTRNOP, 0))) /* Abort function and declare error if handshake failed. */ return 0; @@ -317,8 +316,7 @@ enum { static int s626_send_dac_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned int status; @@ -512,8 +510,7 @@ static int s626_send_dac(struct comedi_device *dev, u32 val) /* * Private helper function: Write setpoint to an application DAC channel. */ -static int s626_set_dac(struct comedi_device *dev, - u16 chan, int16_t dacdata) +static int s626_set_dac(struct comedi_device *dev, u16 chan, int16_t dacdata) { struct s626_private *devpriv = dev->private; u16 signmask; @@ -532,7 +529,7 @@ static int s626_set_dac(struct comedi_device *dev, } /* Limit DAC setpoint value to valid range. */ - if ((u16)dacdata > 0x1FFF) + if ((u16) dacdata > 0x1FFF) dacdata = 0x1FFF; /* @@ -574,10 +571,10 @@ static int s626_set_dac(struct comedi_device *dev, val |= 0x00004000; /* Address the two main dual-DAC devices * (TSL's chip select enables target device). */ - val |= ((u32)(chan & 1) << 15); /* Address the DAC channel - * within the device. - */ - val |= (u32)dacdata; /* Include DAC setpoint data. */ + val |= ((u32) (chan & 1) << 15); /* Address the DAC channel + * within the device. + */ + val |= (u32) dacdata; /* Include DAC setpoint data. */ return s626_send_dac(dev, val); } @@ -683,8 +680,7 @@ static void s626_preload(struct comedi_device *dev, /* * Reset a counter's index and overflow event capture flags. */ -static void s626_reset_cap_flags(struct comedi_device *dev, - unsigned int chan) +static void s626_reset_cap_flags(struct comedi_device *dev, unsigned int chan) { u16 set; @@ -704,8 +700,7 @@ static void s626_reset_cap_flags(struct comedi_device *dev, * ClkPol, ClkEnab, IndexSrc, IndexPol, LoadSrc. */ static void s626_set_mode_a(struct comedi_device *dev, - unsigned int chan, u16 setup, - u16 disable_int_src) + unsigned int chan, u16 setup, u16 disable_int_src) { struct s626_private *devpriv = dev->private; u16 cra; @@ -730,7 +725,7 @@ static void s626_set_mode_a(struct comedi_device *dev, /* Populate all mode-dependent attributes of CRA & CRB images. */ clkpol = S626_GET_STD_CLKPOL(setup); switch (S626_GET_STD_ENCMODE(setup)) { - case S626_ENCMODE_EXTENDER: /* Extender Mode: */ + case S626_ENCMODE_EXTENDER: /* Extender Mode: */ /* Force to Timer mode (Extender valid only for B counters). */ /* Fall through to case S626_ENCMODE_TIMER: */ case S626_ENCMODE_TIMER: /* Timer Mode: */ @@ -754,7 +749,7 @@ static void s626_set_mode_a(struct comedi_device *dev, break; } cra |= S626_SET_CRA_CNTSRC_A(cntsrc) | S626_SET_CRA_CLKPOL_A(clkpol) | - S626_SET_CRA_CLKMULT_A(clkmult); + S626_SET_CRA_CLKMULT_A(clkmult); /* * Force positive index polarity if IndxSrc is software-driven only, @@ -782,8 +777,7 @@ static void s626_set_mode_a(struct comedi_device *dev, } static void s626_set_mode_b(struct comedi_device *dev, - unsigned int chan, u16 setup, - u16 disable_int_src) + unsigned int chan, u16 setup, u16 disable_int_src) { struct s626_private *devpriv = dev->private; u16 cra; @@ -867,8 +861,7 @@ static void s626_set_mode_b(struct comedi_device *dev, } static void s626_set_mode(struct comedi_device *dev, - unsigned int chan, - u16 setup, u16 disable_int_src) + unsigned int chan, u16 setup, u16 disable_int_src) { if (chan < 3) s626_set_mode_a(dev, chan, setup, disable_int_src); @@ -981,8 +974,7 @@ static void s626_set_int_src(struct comedi_device *dev, /* * Generate an index pulse. */ -static void s626_pulse_index(struct comedi_device *dev, - unsigned int chan) +static void s626_pulse_index(struct comedi_device *dev, unsigned int chan) { if (chan < 3) { u16 cra; @@ -1196,7 +1188,7 @@ static bool s626_handle_eos_interrupt(struct comedi_device *dev) * first uint16_t in the buffer because it contains junk data * from the final ADC of the previous poll list scan. */ - u32 *readaddr = (u32 *)devpriv->ana_buf.logical_base + 1; + u32 *readaddr = (u32 *) devpriv->ana_buf.logical_base + 1; int i; /* get the data and hand it over to comedi */ @@ -1272,7 +1264,7 @@ static irqreturn_t s626_irq_handler(int irq, void *d) /* * This function builds the RPS program for hardware driven acquisition. */ -static void s626_reset_adc(struct comedi_device *dev, u8 *ppl) +static void s626_reset_adc(struct comedi_device *dev, u8 *ppl) { struct s626_private *devpriv = dev->private; struct comedi_subdevice *s = dev->read_subdev; @@ -1287,10 +1279,10 @@ static void s626_reset_adc(struct comedi_device *dev, u8 *ppl) s626_mc_disable(dev, S626_MC1_ERPS1, S626_P_MC1); /* Set starting logical address to write RPS commands. */ - rps = (u32 *)devpriv->rps_buf.logical_base; + rps = (u32 *) devpriv->rps_buf.logical_base; /* Initialize RPS instruction pointer */ - writel((u32)devpriv->rps_buf.physical_base, + writel((u32) devpriv->rps_buf.physical_base, dev->mmio + S626_P_RPSADDR1); /* Construct RPS program in rps_buf DMA buffer */ @@ -1372,9 +1364,9 @@ static void s626_reset_adc(struct comedi_device *dev, u8 *ppl) * flushes the RPS' instruction prefetch pipeline. */ jmp_adrs = - (u32)devpriv->rps_buf.physical_base + - (u32)((unsigned long)rps - - (unsigned long)devpriv->rps_buf.logical_base); + (u32) devpriv->rps_buf.physical_base + + (u32) ((unsigned long)rps - + (unsigned long)devpriv->rps_buf.logical_base); for (i = 0; i < (10 * S626_RPSCLK_PER_US / 2); i++) { jmp_adrs += 8; /* Repeat to implement time delay: */ /* Jump to next RPS instruction. */ @@ -1406,16 +1398,16 @@ static void s626_reset_adc(struct comedi_device *dev, u8 *ppl) /* Transfer ADC data from FB BUFFER 1 register to DMA buffer. */ *rps++ = S626_RPS_STREG | - (S626_BUGFIX_STREG(S626_P_FB_BUFFER1) >> 2); - *rps++ = (u32)devpriv->ana_buf.physical_base + - (devpriv->adc_items << 2); + (S626_BUGFIX_STREG(S626_P_FB_BUFFER1) >> 2); + *rps++ = (u32) devpriv->ana_buf.physical_base + + (devpriv->adc_items << 2); /* * If this slot's EndOfPollList flag is set, all channels have * now been processed. */ if (*ppl++ & S626_EOPL) { - devpriv->adc_items++; /* Adjust poll list item count. */ + devpriv->adc_items++; /* Adjust poll list item count. */ break; /* Exit poll list processing loop. */ } } @@ -1440,7 +1432,7 @@ static void s626_reset_adc(struct comedi_device *dev, u8 *ppl) *rps++ = S626_GPIO_BASE | S626_GPIO1_LO; *rps++ = S626_RPS_NOP; /* VERSION 2.03 CHANGE: STRETCH OUT ADC START PULSE. */ - *rps++ = S626_RPS_LDREG | (S626_P_GPIO >> 2); /* End ADC Start pulse. */ + *rps++ = S626_RPS_LDREG | (S626_P_GPIO >> 2); /* End ADC Start pulse. */ *rps++ = S626_GPIO_BASE | S626_GPIO1_HI; /* @@ -1451,8 +1443,8 @@ static void s626_reset_adc(struct comedi_device *dev, u8 *ppl) /* Transfer final ADC data from FB BUFFER 1 register to DMA buffer. */ *rps++ = S626_RPS_STREG | (S626_BUGFIX_STREG(S626_P_FB_BUFFER1) >> 2); - *rps++ = (u32)devpriv->ana_buf.physical_base + - (devpriv->adc_items << 2); + *rps++ = (u32) devpriv->ana_buf.physical_base + + (devpriv->adc_items << 2); /* Indicate ADC scan loop is finished. */ /* Signal ReadADC() that scan is done. */ @@ -1464,15 +1456,14 @@ static void s626_reset_adc(struct comedi_device *dev, u8 *ppl) /* Restart RPS program at its beginning. */ *rps++ = S626_RPS_JUMP; /* Branch to start of RPS program. */ - *rps++ = (u32)devpriv->rps_buf.physical_base; + *rps++ = (u32) devpriv->rps_buf.physical_base; /* End of RPS program build */ } static int s626_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned long context) + struct comedi_insn *insn, unsigned long context) { unsigned int status; @@ -1484,8 +1475,7 @@ static int s626_ai_eoc(struct comedi_device *dev, static int s626_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { u16 chan = CR_CHAN(insn->chanspec); u16 range = CR_RANGE(insn->chanspec); @@ -1584,7 +1574,7 @@ static int s626_ai_insn_read(struct comedi_device *dev, return n; } -static int s626_ai_load_polllist(u8 *ppl, struct comedi_cmd *cmd) +static int s626_ai_load_polllist(u8 *ppl, struct comedi_cmd *cmd) { int n; @@ -1601,8 +1591,7 @@ static int s626_ai_load_polllist(u8 *ppl, struct comedi_cmd *cmd) } static int s626_ai_inttrig(struct comedi_device *dev, - struct comedi_subdevice *s, - unsigned int trig_num) + struct comedi_subdevice *s, unsigned int trig_num) { struct comedi_cmd *cmd = &s->async->cmd; @@ -1651,18 +1640,18 @@ static void s626_timer_load(struct comedi_device *dev, unsigned int chan, int tick) { u16 setup = - /* Preload upon index. */ - S626_SET_STD_LOADSRC(S626_LOADSRC_INDX) | - /* Disable hardware index. */ - S626_SET_STD_INDXSRC(S626_INDXSRC_SOFT) | - /* Operating mode is Timer. */ - S626_SET_STD_ENCMODE(S626_ENCMODE_TIMER) | - /* Count direction is Down. */ - S626_SET_STD_CLKPOL(S626_CNTDIR_DOWN) | - /* Clock multiplier is 1x. */ - S626_SET_STD_CLKMULT(S626_CLKMULT_1X) | - /* Enabled by index */ - S626_SET_STD_CLKENAB(S626_CLKENAB_INDEX); + /* Preload upon index. */ + S626_SET_STD_LOADSRC(S626_LOADSRC_INDX) | + /* Disable hardware index. */ + S626_SET_STD_INDXSRC(S626_INDXSRC_SOFT) | + /* Operating mode is Timer. */ + S626_SET_STD_ENCMODE(S626_ENCMODE_TIMER) | + /* Count direction is Down. */ + S626_SET_STD_CLKPOL(S626_CNTDIR_DOWN) | + /* Clock multiplier is 1x. */ + S626_SET_STD_CLKMULT(S626_CLKMULT_1X) | + /* Enabled by index */ + S626_SET_STD_CLKENAB(S626_CLKENAB_INDEX); u16 value_latchsrc = S626_LATCHSRC_A_INDXA; /* uint16_t enab = S626_CLKENAB_ALWAYS; */ @@ -1870,7 +1859,7 @@ static int s626_ai_cmdtest(struct comedi_device *dev, if (cmd->stop_src == TRIG_COUNT) err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); - else /* TRIG_NONE */ + else /* TRIG_NONE */ err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) @@ -1891,8 +1880,9 @@ static int s626_ai_cmdtest(struct comedi_device *dev, if (cmd->scan_begin_src == TRIG_TIMER) { arg = cmd->convert_arg * cmd->scan_end_arg; - err |= comedi_check_trigger_arg_min( - &cmd->scan_begin_arg, arg); + err |= + comedi_check_trigger_arg_min(&cmd->scan_begin_arg, + arg); } } @@ -1919,14 +1909,13 @@ static int s626_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) static int s626_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); int i; for (i = 0; i < insn->n; i++) { - s16 dacdata = (s16)data[i]; + s16 dacdata = (s16) data[i]; int ret; dacdata -= (0x1fff); @@ -1971,8 +1960,7 @@ static void s626_dio_init(struct comedi_device *dev) static int s626_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned long group = (unsigned long)s->private; @@ -1986,8 +1974,7 @@ static int s626_dio_insn_bits(struct comedi_device *dev, static int s626_dio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned long group = (unsigned long)s->private; int ret; @@ -2016,18 +2003,18 @@ static int s626_enc_insn_config(struct comedi_device *dev, { unsigned int chan = CR_CHAN(insn->chanspec); u16 setup = - /* Preload upon index. */ - S626_SET_STD_LOADSRC(S626_LOADSRC_INDX) | - /* Disable hardware index. */ - S626_SET_STD_INDXSRC(S626_INDXSRC_SOFT) | - /* Operating mode is Counter. */ - S626_SET_STD_ENCMODE(S626_ENCMODE_COUNTER) | - /* Active high clock. */ - S626_SET_STD_CLKPOL(S626_CLKPOL_POS) | - /* Clock multiplier is 1x. */ - S626_SET_STD_CLKMULT(S626_CLKMULT_1X) | - /* Enabled by index */ - S626_SET_STD_CLKENAB(S626_CLKENAB_INDEX); + /* Preload upon index. */ + S626_SET_STD_LOADSRC(S626_LOADSRC_INDX) | + /* Disable hardware index. */ + S626_SET_STD_INDXSRC(S626_INDXSRC_SOFT) | + /* Operating mode is Counter. */ + S626_SET_STD_ENCMODE(S626_ENCMODE_COUNTER) | + /* Active high clock. */ + S626_SET_STD_CLKPOL(S626_CLKPOL_POS) | + /* Clock multiplier is 1x. */ + S626_SET_STD_CLKMULT(S626_CLKMULT_1X) | + /* Enabled by index */ + S626_SET_STD_CLKENAB(S626_CLKENAB_INDEX); /* uint16_t disable_int_src = true; */ /* uint32_t Preloadvalue; //Counter initial value */ u16 value_latchsrc = S626_LATCHSRC_AB_READ; @@ -2046,8 +2033,7 @@ static int s626_enc_insn_config(struct comedi_device *dev, static int s626_enc_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); u16 cntr_latch_reg = S626_LP_CNTR(chan); @@ -2099,18 +2085,18 @@ static void s626_counters_init(struct comedi_device *dev) { int chan; u16 setup = - /* Preload upon index. */ - S626_SET_STD_LOADSRC(S626_LOADSRC_INDX) | - /* Disable hardware index. */ - S626_SET_STD_INDXSRC(S626_INDXSRC_SOFT) | - /* Operating mode is counter. */ - S626_SET_STD_ENCMODE(S626_ENCMODE_COUNTER) | - /* Active high clock. */ - S626_SET_STD_CLKPOL(S626_CLKPOL_POS) | - /* Clock multiplier is 1x. */ - S626_SET_STD_CLKMULT(S626_CLKMULT_1X) | - /* Enabled by index */ - S626_SET_STD_CLKENAB(S626_CLKENAB_INDEX); + /* Preload upon index. */ + S626_SET_STD_LOADSRC(S626_LOADSRC_INDX) | + /* Disable hardware index. */ + S626_SET_STD_INDXSRC(S626_INDXSRC_SOFT) | + /* Operating mode is counter. */ + S626_SET_STD_ENCMODE(S626_ENCMODE_COUNTER) | + /* Active high clock. */ + S626_SET_STD_CLKPOL(S626_CLKPOL_POS) | + /* Clock multiplier is 1x. */ + S626_SET_STD_CLKMULT(S626_CLKMULT_1X) | + /* Enabled by index */ + S626_SET_STD_CLKENAB(S626_CLKENAB_INDEX); /* * Disable all counter interrupts and clear any captured counter events. @@ -2202,8 +2188,7 @@ static int s626_initialize(struct comedi_device *dev) * Issue an I2C ABORT command to halt any I2C * operation in progress and reset BUSY flag. */ - writel(S626_I2C_CLKSEL | S626_I2C_ABORT, - dev->mmio + S626_P_I2CSTAT); + writel(S626_I2C_CLKSEL | S626_I2C_ABORT, dev->mmio + S626_P_I2CSTAT); s626_mc_enable(dev, S626_MC2_UPLD_IIC, S626_P_MC2); ret = comedi_timeout(dev, NULL, NULL, s626_i2c_handshake_eoc, 0); if (ret) @@ -2237,8 +2222,7 @@ static int s626_initialize(struct comedi_device *dev) * in FB BUFFER1 register. */ writel(S626_RSD1 | S626_SIB_A1, dev->mmio + S626_P_TSL1); - writel(S626_RSD1 | S626_SIB_A1 | S626_EOS, - dev->mmio + S626_P_TSL1 + 4); + writel(S626_RSD1 | S626_SIB_A1 | S626_EOS, dev->mmio + S626_P_TSL1 + 4); /* Enable TSL1 slot list so that it executes all the time */ writel(S626_ACON1_ADCSTART, dev->mmio + S626_P_ACON1); @@ -2248,7 +2232,7 @@ static int s626_initialize(struct comedi_device *dev) */ /* Physical start of RPS program */ - writel((u32)devpriv->rps_buf.physical_base, + writel((u32) devpriv->rps_buf.physical_base, dev->mmio + S626_P_RPSADDR1); /* RPS program performs no explicit mem writes */ writel(0, dev->mmio + S626_P_RPSPAGE1); @@ -2298,7 +2282,7 @@ static int s626_initialize(struct comedi_device *dev) break; } } -#endif /* SAA7146 BUG WORKAROUND */ +#endif /* SAA7146 BUG WORKAROUND */ /* * Initialize the DAC interface @@ -2318,17 +2302,16 @@ static int s626_initialize(struct comedi_device *dev) * enabled. */ phys_buf = devpriv->ana_buf.physical_base + - (S626_DAC_WDMABUF_OS * sizeof(u32)); - writel((u32)phys_buf, dev->mmio + S626_P_BASEA2_OUT); - writel((u32)(phys_buf + sizeof(u32)), - dev->mmio + S626_P_PROTA2_OUT); + (S626_DAC_WDMABUF_OS * sizeof(u32)); + writel((u32) phys_buf, dev->mmio + S626_P_BASEA2_OUT); + writel((u32) (phys_buf + sizeof(u32)), dev->mmio + S626_P_PROTA2_OUT); /* * Cache Audio2's output DMA buffer logical address. This is * where DAC data is buffered for A2 output DMA transfers. */ - devpriv->dac_wbuf = (u32 *)devpriv->ana_buf.logical_base + - S626_DAC_WDMABUF_OS; + devpriv->dac_wbuf = (u32 *) devpriv->ana_buf.logical_base + + S626_DAC_WDMABUF_OS; /* * Audio2's output channels does not use paging. The @@ -2461,29 +2444,29 @@ static int s626_auto_attach(struct comedi_device *dev, s = &dev->subdevices[0]; /* analog input subdevice */ - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_DIFF; - s->n_chan = S626_ADC_CHANNELS; - s->maxdata = 0x3fff; - s->range_table = &s626_range_table; - s->len_chanlist = S626_ADC_CHANNELS; - s->insn_read = s626_ai_insn_read; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_DIFF; + s->n_chan = S626_ADC_CHANNELS; + s->maxdata = 0x3fff; + s->range_table = &s626_range_table; + s->len_chanlist = S626_ADC_CHANNELS; + s->insn_read = s626_ai_insn_read; if (dev->irq) { dev->read_subdev = s; - s->subdev_flags |= SDF_CMD_READ; - s->do_cmd = s626_ai_cmd; - s->do_cmdtest = s626_ai_cmdtest; - s->cancel = s626_ai_cancel; + s->subdev_flags |= SDF_CMD_READ; + s->do_cmd = s626_ai_cmd; + s->do_cmdtest = s626_ai_cmdtest; + s->cancel = s626_ai_cancel; } s = &dev->subdevices[1]; /* analog output subdevice */ - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE | SDF_READABLE; - s->n_chan = S626_DAC_CHANNELS; - s->maxdata = 0x3fff; - s->range_table = &range_bipolar10; - s->insn_write = s626_ao_insn_write; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE | SDF_READABLE; + s->n_chan = S626_DAC_CHANNELS; + s->maxdata = 0x3fff; + s->range_table = &range_bipolar10; + s->insn_write = s626_ao_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) @@ -2491,50 +2474,50 @@ static int s626_auto_attach(struct comedi_device *dev, s = &dev->subdevices[2]; /* digital I/O subdevice */ - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_WRITABLE | SDF_READABLE; - s->n_chan = 16; - s->maxdata = 1; - s->io_bits = 0xffff; - s->private = (void *)0; /* DIO group 0 */ - s->range_table = &range_digital; - s->insn_config = s626_dio_insn_config; - s->insn_bits = s626_dio_insn_bits; + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_WRITABLE | SDF_READABLE; + s->n_chan = 16; + s->maxdata = 1; + s->io_bits = 0xffff; + s->private = (void *)0; /* DIO group 0 */ + s->range_table = &range_digital; + s->insn_config = s626_dio_insn_config; + s->insn_bits = s626_dio_insn_bits; s = &dev->subdevices[3]; /* digital I/O subdevice */ - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_WRITABLE | SDF_READABLE; - s->n_chan = 16; - s->maxdata = 1; - s->io_bits = 0xffff; - s->private = (void *)1; /* DIO group 1 */ - s->range_table = &range_digital; - s->insn_config = s626_dio_insn_config; - s->insn_bits = s626_dio_insn_bits; + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_WRITABLE | SDF_READABLE; + s->n_chan = 16; + s->maxdata = 1; + s->io_bits = 0xffff; + s->private = (void *)1; /* DIO group 1 */ + s->range_table = &range_digital; + s->insn_config = s626_dio_insn_config; + s->insn_bits = s626_dio_insn_bits; s = &dev->subdevices[4]; /* digital I/O subdevice */ - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_WRITABLE | SDF_READABLE; - s->n_chan = 16; - s->maxdata = 1; - s->io_bits = 0xffff; - s->private = (void *)2; /* DIO group 2 */ - s->range_table = &range_digital; - s->insn_config = s626_dio_insn_config; - s->insn_bits = s626_dio_insn_bits; + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_WRITABLE | SDF_READABLE; + s->n_chan = 16; + s->maxdata = 1; + s->io_bits = 0xffff; + s->private = (void *)2; /* DIO group 2 */ + s->range_table = &range_digital; + s->insn_config = s626_dio_insn_config; + s->insn_bits = s626_dio_insn_bits; s = &dev->subdevices[5]; /* encoder (counter) subdevice */ - s->type = COMEDI_SUBD_COUNTER; - s->subdev_flags = SDF_WRITABLE | SDF_READABLE | SDF_LSAMPL; - s->n_chan = S626_ENCODER_CHANNELS; - s->maxdata = 0xffffff; - s->range_table = &range_unknown; - s->insn_config = s626_enc_insn_config; - s->insn_read = s626_enc_insn_read; - s->insn_write = s626_enc_insn_write; + s->type = COMEDI_SUBD_COUNTER; + s->subdev_flags = SDF_WRITABLE | SDF_READABLE | SDF_LSAMPL; + s->n_chan = S626_ENCODER_CHANNELS; + s->maxdata = 0xffffff; + s->range_table = &range_unknown; + s->insn_config = s626_enc_insn_config; + s->insn_read = s626_enc_insn_read; + s->insn_write = s626_enc_insn_write; return s626_initialize(dev); } @@ -2568,14 +2551,13 @@ static void s626_detach(struct comedi_device *dev) } static struct comedi_driver s626_driver = { - .driver_name = "s626", - .module = THIS_MODULE, - .auto_attach = s626_auto_attach, - .detach = s626_detach, + .driver_name = "s626", + .module = THIS_MODULE, + .auto_attach = s626_auto_attach, + .detach = s626_detach, }; -static int s626_pci_probe(struct pci_dev *dev, - const struct pci_device_id *id) +static int s626_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) { return comedi_pci_auto_config(dev, &s626_driver, id->driver_data); } @@ -2590,14 +2572,16 @@ static const struct pci_device_id s626_pci_table[] = { 0x6000, 0x0272) }, { 0 } }; + MODULE_DEVICE_TABLE(pci, s626_pci_table); static struct pci_driver s626_pci_driver = { - .name = "s626", - .id_table = s626_pci_table, - .probe = s626_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "s626", + .id_table = s626_pci_table, + .probe = s626_pci_probe, + .remove = comedi_pci_auto_unconfig, }; + module_comedi_pci_driver(s626_driver, s626_pci_driver); MODULE_AUTHOR("Gianluca Palli <gpalli@xxxxxxxxxxxxx>"); diff --git a/drivers/comedi/drivers/s626.h b/drivers/comedi/drivers/s626.h index 749252b1d26b..fa40c7a87ede 100644 --- a/drivers/comedi/drivers/s626.h +++ b/drivers/comedi/drivers/s626.h @@ -31,7 +31,7 @@ #define S626_INTEL 1 /* Intel bus type. */ #define S626_MOTOROLA 2 /* Motorola bus type. */ -#define S626_PLATFORM S626_INTEL /* *** SELECT PLATFORM TYPE *** */ +#define S626_PLATFORM S626_INTEL /* *** SELECT PLATFORM TYPE *** */ #define S626_RANGE_5V 0x10 /* +/-5V range */ #define S626_RANGE_10V 0x00 /* +/-10V range */ @@ -303,7 +303,7 @@ /* Bit masks for MISC2 register writes. */ #define S626_WRMISC2_WDCLEAR 0x8000 /* Reset watchdog timer to zero. */ -#define S626_WRMISC2_CHARGE_ENABLE 0x4000 /* Enable battery trickle charging. */ +#define S626_WRMISC2_CHARGE_ENABLE 0x4000 /* Enable battery trickle charging. */ /* Bit masks for MISC2 register that are the same for reads and writes. */ #define S626_MISC2_BATT_ENABLE 0x0008 /* Backup battery enable. */ @@ -416,20 +416,20 @@ #define S626_EOS 0x00000001 /* End of superframe. */ /* I2C configuration constants. */ -#define S626_I2C_CLKSEL 0x0400 /* - * I2C bit rate = - * PCIclk/480 = 68.75 KHz. - */ -#define S626_I2C_BITRATE 68.75 /* - * I2C bus data bit rate - * (determined by - * S626_I2C_CLKSEL) in KHz. - */ -#define S626_I2C_WRTIME 15.0 /* - * Worst case time, in msec, - * for EEPROM internal write - * op. - */ +#define S626_I2C_CLKSEL 0x0400 /* + * I2C bit rate = + * PCIclk/480 = 68.75 KHz. + */ +#define S626_I2C_BITRATE 68.75 /* + * I2C bus data bit rate + * (determined by + * S626_I2C_CLKSEL) in KHz. + */ +#define S626_I2C_WRTIME 15.0 /* + * Worst case time, in msec, + * for EEPROM internal write + * op. + */ /* I2C manifest constants. */ @@ -721,11 +721,11 @@ /* Bit field masks for CRB: */ #define S626_CRBMSK_INTRESETCMD S626_SET_CRB_INTRESETCMD(~0) /* (w) */ -#define S626_CRBMSK_CNTDIR_B S626_CRBMSK_INTRESETCMD /* (r) */ +#define S626_CRBMSK_CNTDIR_B S626_CRBMSK_INTRESETCMD /* (r) */ #define S626_CRBMSK_INTRESET_B S626_SET_CRB_INTRESET_B(~0) /* (w) */ -#define S626_CRBMSK_OVERDO_A S626_CRBMSK_INTRESET_B /* (r) */ +#define S626_CRBMSK_OVERDO_A S626_CRBMSK_INTRESET_B /* (r) */ #define S626_CRBMSK_INTRESET_A S626_SET_CRB_INTRESET_A(~0) /* (w) */ -#define S626_CRBMSK_OVERDO_B S626_CRBMSK_INTRESET_A /* (r) */ +#define S626_CRBMSK_OVERDO_B S626_CRBMSK_INTRESET_A /* (r) */ #define S626_CRBMSK_CLKENAB_A S626_SET_CRB_CLKENAB_A(~0) #define S626_CRBMSK_INTSRC_B S626_SET_CRB_INTSRC_B(~0) #define S626_CRBMSK_LATCHSRC S626_SET_CRB_LATCHSRC(~0) diff --git a/drivers/comedi/drivers/ssv_dnp.c b/drivers/comedi/drivers/ssv_dnp.c index 016d315aa584..483914cb3ee1 100644 --- a/drivers/comedi/drivers/ssv_dnp.c +++ b/drivers/comedi/drivers/ssv_dnp.c @@ -40,8 +40,7 @@ static int dnp_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int mask; unsigned int val; @@ -79,8 +78,7 @@ static int dnp_dio_insn_bits(struct comedi_device *dev, static int dnp_dio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int mask; @@ -91,13 +89,13 @@ static int dnp_dio_insn_config(struct comedi_device *dev, if (ret) return ret; - if (chan < 8) { /* Port A */ + if (chan < 8) { /* Port A */ mask = 1 << chan; outb(PAMR, CSCIR); - } else if (chan < 16) { /* Port B */ + } else if (chan < 16) { /* Port B */ mask = 1 << (chan - 8); outb(PBMR, CSCIR); - } else { /* Port C */ + } else { /* Port C */ /* * We have to pay attention with port C. * This is the meaning of PCMR: @@ -168,11 +166,12 @@ static void dnp_detach(struct comedi_device *dev) } static struct comedi_driver dnp_driver = { - .driver_name = "dnp-1486", - .module = THIS_MODULE, - .attach = dnp_attach, - .detach = dnp_detach, + .driver_name = "dnp-1486", + .module = THIS_MODULE, + .attach = dnp_attach, + .detach = dnp_detach, }; + module_comedi_driver(dnp_driver); MODULE_AUTHOR("Comedi https://www.comedi.org"); diff --git a/drivers/comedi/drivers/tests/comedi_example_test.c b/drivers/comedi/drivers/tests/comedi_example_test.c index 81d074bcdea5..1e2a813e6b2c 100644 --- a/drivers/comedi/drivers/tests/comedi_example_test.c +++ b/drivers/comedi/drivers/tests/comedi_example_test.c @@ -60,7 +60,9 @@ static int __init unittest_enter(void) return 0; } -static void __exit unittest_exit(void) { } +static void __exit unittest_exit(void) +{ +} module_init(unittest_enter); module_exit(unittest_exit); diff --git a/drivers/comedi/drivers/tests/ni_routes_test.c b/drivers/comedi/drivers/tests/ni_routes_test.c index 652362486ff6..5bf9374ece99 100644 --- a/drivers/comedi/drivers/tests/ni_routes_test.c +++ b/drivers/comedi/drivers/tests/ni_routes_test.c @@ -83,31 +83,43 @@ static const int no_val_dest = O(7), no_val_index = 4; static struct ni_device_routes DR = { .device = "testdev", - .routes = (struct ni_route_set[]){ - {.dest = O(0), .src = O9(/**/1, 2, 3, 4, 5, 6, 7, 8, 9)}, - {.dest = O(1), .src = O9(0, /**/2, 3, 4, 5, 6, 7, 8, 9)}, - /* ith route_set */ - {.dest = O(5), .src = O9(0, 1, 2, 3, 4,/**/ 6, 7, 8, 9)}, - {.dest = O(6), .src = O9(0, 1, 2, 3, 4, 5,/**/ 7, 8, 9)}, - /* next one will not have valid reg values */ - {.dest = O(7), .src = O9(0, 1, 2, 3, 4, 5, 6,/**/ 8, 9)}, - {.dest = O(9), .src = O9(0, 1, 2, 3, 4, 5, 6, 7, 8/**/)}, - - /* indirect routes done through muxes */ - {.dest = TRIGGER_LINE(0), .src = I1(rgout0_src0)}, - {.dest = TRIGGER_LINE(1), .src = I3(rgout0_src0, - brd3_src0, - brd3_src1)}, - {.dest = TRIGGER_LINE(2), .src = I3(rgout0_src1, - brd2_src0, - brd2_src1)}, - {.dest = TRIGGER_LINE(3), .src = I3(rgout0_src1, - brd1_src0, - brd1_src1)}, - {.dest = TRIGGER_LINE(4), .src = I2(brd0_src0, - brd0_src1)}, - {.dest = 0}, - }, + .routes = (struct ni_route_set[]) { + {.dest = O(0), .src = + O9(/**/ 1, 2, 3, 4, 5, 6, 7, 8, + 9)}, + {.dest = O(1), .src = + O9(0, /**/ 2, 3, 4, 5, 6, 7, 8, 9)}, + /* ith route_set */ + {.dest = O(5), .src = + O9(0, 1, 2, 3, 4, /**/ 6, 7, 8, 9)}, + {.dest = O(6), .src = + O9(0, 1, 2, 3, 4, 5, /**/ 7, 8, 9)}, + /* next one will not have valid reg values */ + {.dest = O(7), .src = + O9(0, 1, 2, 3, 4, 5, 6, /**/ 8, 9)}, + {.dest = O(9), .src = + O9(0, 1, 2, 3, 4, 5, 6, 7, 8 /**/)}, + + /* indirect routes done through muxes */ + {.dest = TRIGGER_LINE(0), .src = + I1(rgout0_src0)}, + {.dest = TRIGGER_LINE(1), .src = + I3(rgout0_src0, + brd3_src0, + brd3_src1)}, + {.dest = TRIGGER_LINE(2), .src = + I3(rgout0_src1, + brd2_src0, + brd2_src1)}, + {.dest = TRIGGER_LINE(3), .src = + I3(rgout0_src1, + brd1_src0, + brd1_src1)}, + {.dest = TRIGGER_LINE(4), .src = + I2(brd0_src0, + brd0_src1)}, + {.dest = 0}, + }, }; #undef I1 @@ -121,27 +133,27 @@ static struct ni_device_routes DR = { /* This table is indexed as RV[destination][source] */ static const u8 RV[NI_NUM_NAMES][NI_NUM_NAMES] = { - [0] = {RV9(/**/1, 2, 3, 4, 5, 6, 7, 8, 9)}, - [1] = {RV9(0,/**/ 2, 3, 4, 5, 6, 7, 8, 9)}, - [2] = {RV9(0, 1,/**/3, 4, 5, 6, 7, 8, 9)}, - [3] = {RV9(0, 1, 2,/**/4, 5, 6, 7, 8, 9)}, - [4] = {RV9(0, 1, 2, 3,/**/5, 6, 7, 8, 9)}, - [5] = {RV9(0, 1, 2, 3, 4,/**/6, 7, 8, 9)}, - [6] = {RV9(0, 1, 2, 3, 4, 5,/**/7, 8, 9)}, + [0] = { RV9(/**/ 1, 2, 3, 4, 5, 6, 7, 8, 9) }, + [1] = { RV9(0, /**/ 2, 3, 4, 5, 6, 7, 8, 9) }, + [2] = { RV9(0, 1, /**/ 3, 4, 5, 6, 7, 8, 9) }, + [3] = { RV9(0, 1, 2, /**/ 4, 5, 6, 7, 8, 9) }, + [4] = { RV9(0, 1, 2, 3, /**/ 5, 6, 7, 8, 9) }, + [5] = { RV9(0, 1, 2, 3, 4, /**/ 6, 7, 8, 9) }, + [6] = { RV9(0, 1, 2, 3, 4, 5, /**/ 7, 8, 9) }, /* [7] is intentionaly left absent to test invalid routes */ - [8] = {RV9(0, 1, 2, 3, 4, 5, 6, 7,/**/9)}, - [9] = {RV9(0, 1, 2, 3, 4, 5, 6, 7, 8/**/)}, + [8] = { RV9(0, 1, 2, 3, 4, 5, 6, 7, /**/ 9) }, + [9] = { RV9(0, 1, 2, 3, 4, 5, 6, 7, 8 /**/) }, /* some tests for needing extra muxes */ - [B(NI_RGOUT0)] = {[B(rgout0_src0)] = V(0), - [B(rgout0_src1)] = V(1)}, + [B(NI_RGOUT0)] = {[B(rgout0_src0)] = V(0), + [B(rgout0_src1)] = V(1) }, [B(NI_RTSI_BRD(0))] = {[B(brd0_src0)] = V(0), - [B(brd0_src1)] = V(1)}, + [B(brd0_src1)] = V(1) }, [B(NI_RTSI_BRD(1))] = {[B(brd1_src0)] = V(0), - [B(brd1_src1)] = V(1)}, + [B(brd1_src1)] = V(1) }, [B(NI_RTSI_BRD(2))] = {[B(brd2_src0)] = V(0), - [B(brd2_src1)] = V(1)}, + [B(brd2_src1)] = V(1) }, [B(NI_RTSI_BRD(3))] = {[B(brd3_src0)] = V(0), - [B(brd3_src1)] = V(1)}, + [B(brd3_src1)] = V(1) }, }; #undef RV9 @@ -245,7 +257,8 @@ static void test_ni_assign_device_routes(void) unittest(RVI(table, B(PXI_Star), B(NI_AI_SampleClock)) == V(17) && RVI(table, B(NI_10MHzRefClock), B(TRIGGER_LINE(0))) == 0 && RVI(table, B(NI_AI_ConvertClock), B(NI_PFI(0))) == 0 && - RVI(table, B(NI_AI_ConvertClock), B(NI_PFI(2))) == V(NI_PFI_OUTPUT_AI_CONVERT), + RVI(table, B(NI_AI_ConvertClock), + B(NI_PFI(2))) == V(NI_PFI_OUTPUT_AI_CONVERT), "pci-6070e finds e-series route_values table\n"); oldtable = table; @@ -289,8 +302,7 @@ static void test_ni_find_route_set(void) &DR.routes[no_val_index], "find no_val route_set in spite of missing values\n"); unittest(ni_find_route_set(DR.routes[DR.n_route_sets - 1].dest, &DR) == - &DR.routes[DR.n_route_sets - 1], - "find last route_set\n"); + &DR.routes[DR.n_route_sets - 1], "find last route_set\n"); } static void test_ni_route_set_has_source(void) @@ -372,24 +384,20 @@ static void test_ni_lookup_route_register(void) "lookup invalid destination\n"); unittest(ni_lookup_route_register(rgout0_src0, TRIGGER_LINE(0), T) == - -EINVAL, - "rgout0_src0: no direct lookup of indirect route\n"); + -EINVAL, "rgout0_src0: no direct lookup of indirect route\n"); unittest(ni_lookup_route_register(rgout0_src0, NI_RGOUT0, T) == 0, "rgout0_src0: lookup indirect route register\n"); unittest(ni_lookup_route_register(rgout0_src1, TRIGGER_LINE(2), T) == - -EINVAL, - "rgout0_src1: no direct lookup of indirect route\n"); + -EINVAL, "rgout0_src1: no direct lookup of indirect route\n"); unittest(ni_lookup_route_register(rgout0_src1, NI_RGOUT0, T) == 1, "rgout0_src1: lookup indirect route register\n"); unittest(ni_lookup_route_register(brd0_src0, TRIGGER_LINE(4), T) == - -EINVAL, - "brd0_src0: no direct lookup of indirect route\n"); + -EINVAL, "brd0_src0: no direct lookup of indirect route\n"); unittest(ni_lookup_route_register(brd0_src0, NI_RTSI_BRD(0), T) == 0, "brd0_src0: lookup indirect route register\n"); unittest(ni_lookup_route_register(brd0_src1, TRIGGER_LINE(4), T) == - -EINVAL, - "brd0_src1: no direct lookup of indirect route\n"); + -EINVAL, "brd0_src1: no direct lookup of indirect route\n"); unittest(ni_lookup_route_register(brd0_src1, NI_RTSI_BRD(0), T) == 1, "brd0_src1: lookup indirect route register\n"); } @@ -399,14 +407,11 @@ static void test_route_is_valid(void) const struct ni_route_tables *T = &private.routing_tables; init_pci_fake(); - unittest(!route_is_valid(O(0), O(0), T), - "check for bad route 0-->0\n"); - unittest(route_is_valid(O(0), O(1), T), - "validate first destination\n"); + unittest(!route_is_valid(O(0), O(0), T), "check for bad route 0-->0\n"); + unittest(route_is_valid(O(0), O(1), T), "validate first destination\n"); unittest(route_is_valid(O(5), O(6), T), "validate middle destination\n"); - unittest(route_is_valid(O(8), O(9), T), - "validate last destination\n"); + unittest(route_is_valid(O(8), O(9), T), "validate last destination\n"); } static void test_ni_is_cmd_dest(void) @@ -441,8 +446,7 @@ static void test_channel_is_rtsi(void) init_pci_fake(); unittest(channel_is_rtsi(TRIGGER_LINE(0)), "check First rtsi channel\n"); - unittest(channel_is_rtsi(TRIGGER_LINE(3)), - "check 3rd rtsi channel\n"); + unittest(channel_is_rtsi(TRIGGER_LINE(3)), "check 3rd rtsi channel\n"); unittest(channel_is_rtsi(TRIGGER_LINE(-1)), "check last rtsi channel\n"); unittest(!channel_is_rtsi(TRIGGER_LINE(-1) + 1), @@ -485,8 +489,7 @@ static void test_ni_find_route_source(void) "find first source\n"); unittest(ni_find_route_source(4, O(6), T) == O(4), "find middle source\n"); - unittest(ni_find_route_source(9, O(8), T) == O(9), - "find last source"); + unittest(ni_find_route_source(9, O(8), T) == O(9), "find last source"); unittest(ni_find_route_source(8, O(9), T) == O(8), "find invalid source (without checking device routes)\n"); } @@ -498,12 +501,9 @@ static void test_route_register_is_valid(void) init_pci_fake(); unittest(!route_register_is_valid(4, O(4), T), "check for bad source 4-->4\n"); - unittest(route_register_is_valid(0, O(1), T), - "find first source\n"); - unittest(route_register_is_valid(4, O(6), T), - "find middle source\n"); - unittest(route_register_is_valid(9, O(8), T), - "find last source"); + unittest(route_register_is_valid(0, O(1), T), "find first source\n"); + unittest(route_register_is_valid(4, O(6), T), "find middle source\n"); + unittest(route_register_is_valid(9, O(8), T), "find last source"); } static void test_ni_check_trigger_arg(void) @@ -599,7 +599,9 @@ static int __init ni_routes_unittest(void) return 0; } -static void __exit ni_routes_unittest_exit(void) { } +static void __exit ni_routes_unittest_exit(void) +{ +} module_init(ni_routes_unittest); module_exit(ni_routes_unittest_exit); diff --git a/drivers/comedi/drivers/tests/unittest.h b/drivers/comedi/drivers/tests/unittest.h index b0b34e058aad..858380c7bba9 100644 --- a/drivers/comedi/drivers/tests/unittest.h +++ b/drivers/comedi/drivers/tests/unittest.h @@ -48,12 +48,12 @@ typedef void (*unittest_fptr)(void); * @unit_tests: A null-terminated list of unit tests to execute. */ static inline void exec_unittests(const char *name, - const unittest_fptr *unit_tests) + const unittest_fptr *unit_tests) { pr_info("begin comedi:\"%s\" unittests\n", name); for (; (*unit_tests) != NULL; ++unit_tests) - (*unit_tests)(); + (*unit_tests) (); pr_info("end of comedi:\"%s\" unittests - %i passed, %i failed\n", name, unittest_results.passed, unittest_results.failed); diff --git a/drivers/comedi/drivers/usbdux.c b/drivers/comedi/drivers/usbdux.c index 0350f303d557..c1cfe7f70d1d 100644 --- a/drivers/comedi/drivers/usbdux.c +++ b/drivers/comedi/drivers/usbdux.c @@ -151,18 +151,18 @@ static const struct comedi_lrange range_usbdux_ai_range = { 4, { - BIP_RANGE(4.096), - BIP_RANGE(4.096 / 2), - UNI_RANGE(4.096), - UNI_RANGE(4.096 / 2) - } + BIP_RANGE(4.096), + BIP_RANGE(4.096 / 2), + UNI_RANGE(4.096), + UNI_RANGE(4.096 / 2) + } }; static const struct comedi_lrange range_usbdux_ao_range = { 2, { - BIP_RANGE(4.096), - UNI_RANGE(4.096) - } + BIP_RANGE(4.096), + UNI_RANGE(4.096) + } }; struct usbdux_private { @@ -237,8 +237,7 @@ static int usbdux_ai_cancel(struct comedi_device *dev, } static void usbduxsub_ai_handle_urb(struct comedi_device *dev, - struct comedi_subdevice *s, - struct urb *urb) + struct comedi_subdevice *s, struct urb *urb) { struct usbdux_private *devpriv = dev->private; struct comedi_async *async = s->async; @@ -365,8 +364,7 @@ static int usbdux_ao_cancel(struct comedi_device *dev, } static void usbduxsub_ao_handle_urb(struct comedi_device *dev, - struct comedi_subdevice *s, - struct urb *urb) + struct comedi_subdevice *s, struct urb *urb) { struct usbdux_private *devpriv = dev->private; struct comedi_async *async = s->async; @@ -476,8 +474,7 @@ static void usbduxsub_ao_isoc_irq(struct urb *urb) } static int usbdux_submit_urbs(struct comedi_device *dev, - struct urb **urbs, int num_urbs, - int input_urb) + struct urb **urbs, int num_urbs, int input_urb) { struct usb_device *usb = comedi_to_usb_dev(dev); struct usbdux_private *devpriv = dev->private; @@ -571,7 +568,7 @@ static int usbdux_ai_cmdtest(struct comedi_device *dev, if (cmd->stop_src == TRIG_COUNT) err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); - else /* TRIG_NONE */ + else /* TRIG_NONE */ err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) @@ -627,8 +624,7 @@ static int receive_dux_commands(struct comedi_device *dev, unsigned int command) } static int usbdux_ai_inttrig(struct comedi_device *dev, - struct comedi_subdevice *s, - unsigned int trig_num) + struct comedi_subdevice *s, unsigned int trig_num) { struct usbdux_private *devpriv = dev->private; struct comedi_cmd *cmd = &s->async->cmd; @@ -695,7 +691,7 @@ static int usbdux_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) devpriv->ai_interval *= 2; devpriv->ai_timer = cmd->scan_begin_arg / - (125000 * devpriv->ai_interval); + (125000 * devpriv->ai_interval); } else { /* interval always 1ms */ devpriv->ai_interval = 1; @@ -735,8 +731,7 @@ static int usbdux_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) /* Mode 0 is used to get a single conversion on demand */ static int usbdux_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct usbdux_private *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -780,8 +775,7 @@ static int usbdux_ai_insn_read(struct comedi_device *dev, static int usbdux_ao_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct usbdux_private *devpriv = dev->private; int ret; @@ -795,12 +789,11 @@ static int usbdux_ao_insn_read(struct comedi_device *dev, static int usbdux_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct usbdux_private *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); - __le16 *p = (__le16 *)&devpriv->dux_commands[2]; + __le16 *p = (__le16 *) &devpriv->dux_commands[2]; int ret = -EBUSY; int i; @@ -834,8 +827,7 @@ static int usbdux_ao_insn_write(struct comedi_device *dev, } static int usbdux_ao_inttrig(struct comedi_device *dev, - struct comedi_subdevice *s, - unsigned int trig_num) + struct comedi_subdevice *s, unsigned int trig_num) { struct usbdux_private *devpriv = dev->private; struct comedi_cmd *cmd = &s->async->cmd; @@ -935,7 +927,7 @@ static int usbdux_ao_cmdtest(struct comedi_device *dev, if (cmd->stop_src == TRIG_COUNT) err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); - else /* TRIG_NONE */ + else /* TRIG_NONE */ err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) @@ -999,8 +991,7 @@ static int usbdux_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s) static int usbdux_dio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { int ret; @@ -1017,8 +1008,7 @@ static int usbdux_dio_insn_config(struct comedi_device *dev, static int usbdux_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct usbdux_private *devpriv = dev->private; int ret; @@ -1052,8 +1042,7 @@ static int usbdux_dio_insn_bits(struct comedi_device *dev, static int usbdux_counter_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct usbdux_private *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -1081,12 +1070,11 @@ static int usbdux_counter_read(struct comedi_device *dev, static int usbdux_counter_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct usbdux_private *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); - __le16 *p = (__le16 *)&devpriv->dux_commands[2]; + __le16 *p = (__le16 *) &devpriv->dux_commands[2]; int ret = 0; int i; @@ -1214,16 +1202,13 @@ static int usbduxsub_submit_pwm_urbs(struct comedi_device *dev) /* in case of a resubmission after an unlink... */ usb_fill_bulk_urb(urb, usb, usb_sndbulkpipe(usb, 4), urb->transfer_buffer, - devpriv->pwm_buf_sz, - usbduxsub_pwm_irq, - dev); + devpriv->pwm_buf_sz, usbduxsub_pwm_irq, dev); return usb_submit_urb(urb, GFP_ATOMIC); } static int usbdux_pwm_period(struct comedi_device *dev, - struct comedi_subdevice *s, - unsigned int period) + struct comedi_subdevice *s, unsigned int period) { struct usbdux_private *devpriv = dev->private; int fx2delay; @@ -1274,8 +1259,7 @@ static int usbdux_pwm_start(struct comedi_device *dev, static void usbdux_pwm_pattern(struct comedi_device *dev, struct comedi_subdevice *s, unsigned int chan, - unsigned int value, - unsigned int sign) + unsigned int value, unsigned int sign) { struct usbdux_private *devpriv = dev->private; char pwm_mask = (1 << chan); /* DIO bit for the PWM data */ @@ -1300,8 +1284,7 @@ static void usbdux_pwm_pattern(struct comedi_device *dev, static int usbdux_pwm_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); @@ -1323,8 +1306,7 @@ static int usbdux_pwm_write(struct comedi_device *dev, static int usbdux_pwm_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct usbdux_private *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -1363,7 +1345,7 @@ static int usbdux_pwm_config(struct comedi_device *dev, } static int usbdux_firmware_upload(struct comedi_device *dev, - const u8 *data, size_t size, + const u8 *data, size_t size, unsigned long context) { struct usb_device *usb = comedi_to_usb_dev(dev); @@ -1393,13 +1375,11 @@ static int usbdux_firmware_upload(struct comedi_device *dev, } /* stop the current firmware on the device */ - *tmp = 1; /* 7f92 to one */ + *tmp = 1; /* 7f92 to one */ ret = usb_control_msg(usb, usb_sndctrlpipe(usb, 0), USBDUX_FIRMWARE_CMD, VENDOR_DIR_OUT, - USBDUX_CPU_CS, 0x0000, - tmp, 1, - BULK_TIMEOUT); + USBDUX_CPU_CS, 0x0000, tmp, 1, BULK_TIMEOUT); if (ret < 0) { dev_err(dev->class_dev, "can not stop firmware\n"); goto done; @@ -1409,22 +1389,18 @@ static int usbdux_firmware_upload(struct comedi_device *dev, ret = usb_control_msg(usb, usb_sndctrlpipe(usb, 0), USBDUX_FIRMWARE_CMD, VENDOR_DIR_OUT, - 0, 0x0000, - buf, size, - BULK_TIMEOUT); + 0, 0x0000, buf, size, BULK_TIMEOUT); if (ret < 0) { dev_err(dev->class_dev, "firmware upload failed\n"); goto done; } /* start the new firmware on the device */ - *tmp = 0; /* 7f92 to zero */ + *tmp = 0; /* 7f92 to zero */ ret = usb_control_msg(usb, usb_sndctrlpipe(usb, 0), USBDUX_FIRMWARE_CMD, VENDOR_DIR_OUT, - USBDUX_CPU_CS, 0x0000, - tmp, 1, - BULK_TIMEOUT); + USBDUX_CPU_CS, 0x0000, tmp, 1, BULK_TIMEOUT); if (ret < 0) dev_err(dev->class_dev, "can not start firmware\n"); @@ -1508,8 +1484,7 @@ static int usbdux_alloc_usb_buffers(struct comedi_device *dev) devpriv->pwm_urb = urb; /* max bulk ep size in high speed */ - urb->transfer_buffer = kzalloc(devpriv->pwm_buf_sz, - GFP_KERNEL); + urb->transfer_buffer = kzalloc(devpriv->pwm_buf_sz, GFP_KERNEL); if (!urb->transfer_buffer) return -ENOMEM; } @@ -1605,31 +1580,31 @@ static int usbdux_auto_attach(struct comedi_device *dev, /* Analog Input subdevice */ s = &dev->subdevices[0]; dev->read_subdev = s; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_CMD_READ; - s->n_chan = 8; - s->maxdata = 0x0fff; - s->len_chanlist = 8; - s->range_table = &range_usbdux_ai_range; - s->insn_read = usbdux_ai_insn_read; - s->do_cmdtest = usbdux_ai_cmdtest; - s->do_cmd = usbdux_ai_cmd; - s->cancel = usbdux_ai_cancel; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_CMD_READ; + s->n_chan = 8; + s->maxdata = 0x0fff; + s->len_chanlist = 8; + s->range_table = &range_usbdux_ai_range; + s->insn_read = usbdux_ai_insn_read; + s->do_cmdtest = usbdux_ai_cmdtest; + s->do_cmd = usbdux_ai_cmd; + s->cancel = usbdux_ai_cancel; /* Analog Output subdevice */ s = &dev->subdevices[1]; dev->write_subdev = s; - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_CMD_WRITE; - s->n_chan = 4; - s->maxdata = 0x0fff; - s->len_chanlist = s->n_chan; - s->range_table = &range_usbdux_ao_range; - s->do_cmdtest = usbdux_ao_cmdtest; - s->do_cmd = usbdux_ao_cmd; - s->cancel = usbdux_ao_cancel; - s->insn_read = usbdux_ao_insn_read; - s->insn_write = usbdux_ao_insn_write; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_CMD_WRITE; + s->n_chan = 4; + s->maxdata = 0x0fff; + s->len_chanlist = s->n_chan; + s->range_table = &range_usbdux_ao_range; + s->do_cmdtest = usbdux_ao_cmdtest; + s->do_cmd = usbdux_ao_cmd; + s->cancel = usbdux_ao_cancel; + s->insn_read = usbdux_ao_insn_read; + s->insn_write = usbdux_ao_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) @@ -1637,33 +1612,33 @@ static int usbdux_auto_attach(struct comedi_device *dev, /* Digital I/O subdevice */ s = &dev->subdevices[2]; - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 8; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = usbdux_dio_insn_bits; - s->insn_config = usbdux_dio_insn_config; + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 8; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = usbdux_dio_insn_bits; + s->insn_config = usbdux_dio_insn_config; /* Counter subdevice */ s = &dev->subdevices[3]; - s->type = COMEDI_SUBD_COUNTER; - s->subdev_flags = SDF_WRITABLE | SDF_READABLE; - s->n_chan = 4; - s->maxdata = 0xffff; - s->insn_read = usbdux_counter_read; - s->insn_write = usbdux_counter_write; - s->insn_config = usbdux_counter_config; + s->type = COMEDI_SUBD_COUNTER; + s->subdev_flags = SDF_WRITABLE | SDF_READABLE; + s->n_chan = 4; + s->maxdata = 0xffff; + s->insn_read = usbdux_counter_read; + s->insn_write = usbdux_counter_write; + s->insn_config = usbdux_counter_config; if (devpriv->high_speed) { /* PWM subdevice */ s = &dev->subdevices[4]; - s->type = COMEDI_SUBD_PWM; - s->subdev_flags = SDF_WRITABLE | SDF_PWM_HBRIDGE; - s->n_chan = 8; - s->maxdata = devpriv->pwm_buf_sz; - s->insn_write = usbdux_pwm_write; - s->insn_config = usbdux_pwm_config; + s->type = COMEDI_SUBD_PWM; + s->subdev_flags = SDF_WRITABLE | SDF_PWM_HBRIDGE; + s->n_chan = 8; + s->maxdata = devpriv->pwm_buf_sz; + s->insn_write = usbdux_pwm_write; + s->insn_config = usbdux_pwm_config; usbdux_pwm_period(dev, s, PWM_DEFAULT_PERIOD); } @@ -1696,10 +1671,10 @@ static void usbdux_detach(struct comedi_device *dev) } static struct comedi_driver usbdux_driver = { - .driver_name = "usbdux", - .module = THIS_MODULE, - .auto_attach = usbdux_auto_attach, - .detach = usbdux_detach, + .driver_name = "usbdux", + .module = THIS_MODULE, + .auto_attach = usbdux_auto_attach, + .detach = usbdux_detach, }; static int usbdux_usb_probe(struct usb_interface *intf, @@ -1713,14 +1688,16 @@ static const struct usb_device_id usbdux_usb_table[] = { { USB_DEVICE(0x13d8, 0x0002) }, { } }; + MODULE_DEVICE_TABLE(usb, usbdux_usb_table); static struct usb_driver usbdux_usb_driver = { - .name = "usbdux", - .probe = usbdux_usb_probe, - .disconnect = comedi_usb_auto_unconfig, - .id_table = usbdux_usb_table, + .name = "usbdux", + .probe = usbdux_usb_probe, + .disconnect = comedi_usb_auto_unconfig, + .id_table = usbdux_usb_table, }; + module_comedi_usb_driver(usbdux_driver, usbdux_usb_driver); MODULE_AUTHOR("Bernd Porr, BerndPorr@xxxxxxx"); diff --git a/drivers/comedi/drivers/usbduxfast.c b/drivers/comedi/drivers/usbduxfast.c index 4af012968cb6..7e14b831459d 100644 --- a/drivers/comedi/drivers/usbduxfast.c +++ b/drivers/comedi/drivers/usbduxfast.c @@ -135,9 +135,9 @@ */ static const struct comedi_lrange range_usbduxfast_ai_range = { 2, { - BIP_RANGE(0.75), - BIP_RANGE(0.5) - } + BIP_RANGE(0.75), + BIP_RANGE(0.5) + } }; /* @@ -171,8 +171,7 @@ static int usbduxfast_send_cmd(struct comedi_device *dev, int cmd_type) devpriv->duxbuf[0] = cmd_type; ret = usb_bulk_msg(usb, usb_sndbulkpipe(usb, CHANNELLISTEP), - devpriv->duxbuf, SIZEOFDUXBUF, - &nsent, 10000); + devpriv->duxbuf, SIZEOFDUXBUF, &nsent, 10000); if (ret < 0) dev_err(dev->class_dev, "could not transmit command to the usb-device, err=%d\n", @@ -324,7 +323,8 @@ static int usbduxfast_ai_check_chanlist(struct comedi_device *dev, int i; if (cmd->chanlist_len > 3 && cmd->chanlist_len != 16) { - dev_err(dev->class_dev, "unsupported combination of channels\n"); + dev_err(dev->class_dev, + "unsupported combination of channels\n"); return -EINVAL; } @@ -395,12 +395,12 @@ static int usbduxfast_ai_cmdtest(struct comedi_device *dev, /* * Validate the conversion timing: * for 1 channel the timing in 30MHz "steps" is: - * steps <= MAX_SAMPLING_PERIOD + * steps <= MAX_SAMPLING_PERIOD * for all other chanlist_len it is: - * MIN_SAMPLING_PERIOD <= steps <= MAX_SAMPLING_PERIOD + * MIN_SAMPLING_PERIOD <= steps <= MAX_SAMPLING_PERIOD */ steps = (cmd->convert_arg * 30) / 1000; - if (cmd->chanlist_len != 1) + if (cmd->chanlist_len != 1) err2 |= comedi_check_trigger_arg_min(&steps, MIN_SAMPLING_PERIOD); else @@ -414,7 +414,7 @@ static int usbduxfast_ai_cmdtest(struct comedi_device *dev, if (cmd->stop_src == TRIG_COUNT) err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); - else /* TRIG_NONE */ + else /* TRIG_NONE */ err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) @@ -562,8 +562,7 @@ static int usbduxfast_ai_cmd(struct comedi_device *dev, /* branch back to state 1 */ /* deceision state w data */ /* doesn't matter */ - usbduxfast_cmd_data(dev, 3, - 0x09, 0x03, rngmask, 0xff); + usbduxfast_cmd_data(dev, 3, 0x09, 0x03, rngmask, 0xff); } break; @@ -595,7 +594,7 @@ static int usbduxfast_ai_cmd(struct comedi_device *dev, 0x00, 0xfe & rngmask, 0x00); /* and the second part */ - usbduxfast_cmd_data(dev, 2, steps_tmp - steps_tmp / 2, + usbduxfast_cmd_data(dev, 2, steps_tmp - steps_tmp / 2, 0x00, rngmask, 0x00); /* data */ @@ -661,8 +660,7 @@ static int usbduxfast_ai_cmd(struct comedi_device *dev, /* commit data to the FIFO and do the first part of the delay */ /* data */ - usbduxfast_cmd_data(dev, 4, steps_tmp / 2, - 0x02, rngmask, 0x00); + usbduxfast_cmd_data(dev, 4, steps_tmp / 2, 0x02, rngmask, 0x00); if (CR_RANGE(cmd->chanlist[0]) > 0) rngmask = 0xff - 0x04; @@ -744,7 +742,7 @@ static int usbduxfast_ai_cmd(struct comedi_device *dev, goto cmd_exit; } s->async->inttrig = NULL; - } else { /* TRIG_INT */ + } else { /* TRIG_INT */ s->async->inttrig = usbduxfast_ai_inttrig; } @@ -759,8 +757,7 @@ static int usbduxfast_ai_cmd(struct comedi_device *dev, */ static int usbduxfast_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct usb_device *usb = comedi_to_usb_dev(dev); struct usbduxfast_private *devpriv = dev->private; @@ -828,7 +825,7 @@ static int usbduxfast_ai_insn_read(struct comedi_device *dev, return -EINVAL; } for (j = chan; (j < n) && (i < insn->n); j = j + 16) { - data[i] = ((u16 *)(devpriv->inbuf))[j]; + data[i] = ((u16 *) (devpriv->inbuf))[j]; i++; } } @@ -839,7 +836,7 @@ static int usbduxfast_ai_insn_read(struct comedi_device *dev, } static int usbduxfast_upload_firmware(struct comedi_device *dev, - const u8 *data, size_t size, + const u8 *data, size_t size, unsigned long context) { struct usb_device *usb = comedi_to_usb_dev(dev); @@ -868,13 +865,11 @@ static int usbduxfast_upload_firmware(struct comedi_device *dev, } /* stop the current firmware on the device */ - *tmp = 1; /* 7f92 to one */ + *tmp = 1; /* 7f92 to one */ ret = usb_control_msg(usb, usb_sndctrlpipe(usb, 0), USBDUXFASTSUB_FIRMWARE, VENDOR_DIR_OUT, - USBDUXFASTSUB_CPUCS, 0x0000, - tmp, 1, - EZTIMEOUT); + USBDUXFASTSUB_CPUCS, 0x0000, tmp, 1, EZTIMEOUT); if (ret < 0) { dev_err(dev->class_dev, "can not stop firmware\n"); goto done; @@ -883,23 +878,18 @@ static int usbduxfast_upload_firmware(struct comedi_device *dev, /* upload the new firmware to the device */ ret = usb_control_msg(usb, usb_sndctrlpipe(usb, 0), USBDUXFASTSUB_FIRMWARE, - VENDOR_DIR_OUT, - 0, 0x0000, - buf, size, - EZTIMEOUT); + VENDOR_DIR_OUT, 0, 0x0000, buf, size, EZTIMEOUT); if (ret < 0) { dev_err(dev->class_dev, "firmware upload failed\n"); goto done; } /* start the new firmware on the device */ - *tmp = 0; /* 7f92 to zero */ + *tmp = 0; /* 7f92 to zero */ ret = usb_control_msg(usb, usb_sndctrlpipe(usb, 0), USBDUXFASTSUB_FIRMWARE, VENDOR_DIR_OUT, - USBDUXFASTSUB_CPUCS, 0x0000, - tmp, 1, - EZTIMEOUT); + USBDUXFASTSUB_CPUCS, 0x0000, tmp, 1, EZTIMEOUT); if (ret < 0) dev_err(dev->class_dev, "can not start firmware\n"); @@ -963,16 +953,16 @@ static int usbduxfast_auto_attach(struct comedi_device *dev, /* Analog Input subdevice */ s = &dev->subdevices[0]; dev->read_subdev = s; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_CMD_READ; - s->n_chan = 16; - s->maxdata = 0x1000; /* 12-bit + 1 overflow bit */ - s->range_table = &range_usbduxfast_ai_range; - s->insn_read = usbduxfast_ai_insn_read; - s->len_chanlist = s->n_chan; - s->do_cmdtest = usbduxfast_ai_cmdtest; - s->do_cmd = usbduxfast_ai_cmd; - s->cancel = usbduxfast_ai_cancel; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_CMD_READ; + s->n_chan = 16; + s->maxdata = 0x1000; /* 12-bit + 1 overflow bit */ + s->range_table = &range_usbduxfast_ai_range; + s->insn_read = usbduxfast_ai_insn_read; + s->len_chanlist = s->n_chan; + s->do_cmdtest = usbduxfast_ai_cmdtest; + s->do_cmd = usbduxfast_ai_cmd; + s->cancel = usbduxfast_ai_cancel; return 0; } @@ -1005,10 +995,10 @@ static void usbduxfast_detach(struct comedi_device *dev) } static struct comedi_driver usbduxfast_driver = { - .driver_name = "usbduxfast", - .module = THIS_MODULE, - .auto_attach = usbduxfast_auto_attach, - .detach = usbduxfast_detach, + .driver_name = "usbduxfast", + .module = THIS_MODULE, + .auto_attach = usbduxfast_auto_attach, + .detach = usbduxfast_detach, }; static int usbduxfast_usb_probe(struct usb_interface *intf, @@ -1023,14 +1013,16 @@ static const struct usb_device_id usbduxfast_usb_table[] = { { USB_DEVICE(0x13d8, 0x0011) }, /* real ID */ { } }; + MODULE_DEVICE_TABLE(usb, usbduxfast_usb_table); static struct usb_driver usbduxfast_usb_driver = { - .name = "usbduxfast", - .probe = usbduxfast_usb_probe, - .disconnect = comedi_usb_auto_unconfig, - .id_table = usbduxfast_usb_table, + .name = "usbduxfast", + .probe = usbduxfast_usb_probe, + .disconnect = comedi_usb_auto_unconfig, + .id_table = usbduxfast_usb_table, }; + module_comedi_usb_driver(usbduxfast_driver, usbduxfast_usb_driver); MODULE_AUTHOR("Bernd Porr, BerndPorr@xxxxxxx"); diff --git a/drivers/comedi/drivers/usbduxsigma.c b/drivers/comedi/drivers/usbduxsigma.c index 54d7605e909f..6ffbe33f760c 100644 --- a/drivers/comedi/drivers/usbduxsigma.c +++ b/drivers/comedi/drivers/usbduxsigma.c @@ -124,8 +124,8 @@ static const struct comedi_lrange usbduxsigma_ai_range = { 1, { - BIP_RANGE(2.5 * 0x800000 / 0x780000 / 2.0) - } + BIP_RANGE(2.5 * 0x800000 / 0x780000 / 2.0) + } }; struct usbduxsigma_private { @@ -220,7 +220,7 @@ static void usbduxsigma_ai_handle_urb(struct comedi_device *dev, */ for (i = 0; i < cmd->chanlist_len; i++) { val = be32_to_cpu(devpriv->in_buf[i + 1]); - val &= 0x00ffffff; /* strip status byte */ + val &= 0x00ffffff; /* strip status byte */ val = comedi_offset_munge(s, val); if (!comedi_buf_write_samples(s, &val, 1)) return; @@ -521,7 +521,7 @@ static int usbduxsigma_ai_cmdtest(struct comedi_device *dev, if (cmd->stop_src == TRIG_COUNT) err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); - else /* TRIG_NONE */ + else /* TRIG_NONE */ err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) @@ -542,8 +542,7 @@ static int usbduxsigma_ai_cmdtest(struct comedi_device *dev, * creates the ADC command for the MAX1271 * range is the range value from comedi */ -static void create_adc_command(unsigned int chan, - u8 *muxsg0, u8 *muxsg1) +static void create_adc_command(unsigned int chan, u8 *muxsg0, u8 *muxsg1) { if (chan < 8) (*muxsg0) = (*muxsg0) | (1 << chan); @@ -648,16 +647,16 @@ static int usbduxsigma_ai_cmd(struct comedi_device *dev, } for (i = 0; i < len; i++) { - unsigned int chan = CR_CHAN(cmd->chanlist[i]); + unsigned int chan = CR_CHAN(cmd->chanlist[i]); create_adc_command(chan, &muxsg0, &muxsg1); } devpriv->dux_commands[1] = devpriv->ai_interval; - devpriv->dux_commands[2] = len; /* num channels per time step */ - devpriv->dux_commands[3] = 0x12; /* CONFIG0 */ - devpriv->dux_commands[4] = 0x03; /* CONFIG1: 23kHz sample, delay 0us */ - devpriv->dux_commands[5] = 0x00; /* CONFIG3: diff. channels off */ + devpriv->dux_commands[2] = len; /* num channels per time step */ + devpriv->dux_commands[3] = 0x12; /* CONFIG0 */ + devpriv->dux_commands[4] = 0x03; /* CONFIG1: 23kHz sample, delay 0us */ + devpriv->dux_commands[5] = 0x00; /* CONFIG3: diff. channels off */ devpriv->dux_commands[6] = muxsg0; devpriv->dux_commands[7] = muxsg1; devpriv->dux_commands[8] = sysred; @@ -681,7 +680,7 @@ static int usbduxsigma_ai_cmd(struct comedi_device *dev, return ret; } s->async->inttrig = NULL; - } else { /* TRIG_INT */ + } else { /* TRIG_INT */ s->async->inttrig = usbduxsigma_ai_inttrig; } @@ -712,9 +711,9 @@ static int usbduxsigma_ai_insn_read(struct comedi_device *dev, create_adc_command(chan, &muxsg0, &muxsg1); /* Mode 0 is used to get a single conversion on demand */ - devpriv->dux_commands[1] = 0x16; /* CONFIG0: chopper on */ - devpriv->dux_commands[2] = 0x80; /* CONFIG1: 2kHz sampling rate */ - devpriv->dux_commands[3] = 0x00; /* CONFIG3: diff. channels off */ + devpriv->dux_commands[1] = 0x16; /* CONFIG0: chopper on */ + devpriv->dux_commands[2] = 0x80; /* CONFIG1: 2kHz sampling rate */ + devpriv->dux_commands[3] = 0x00; /* CONFIG3: diff. channels off */ devpriv->dux_commands[4] = muxsg0; devpriv->dux_commands[5] = muxsg1; devpriv->dux_commands[6] = sysred; @@ -737,7 +736,7 @@ static int usbduxsigma_ai_insn_read(struct comedi_device *dev, /* 32 bits big endian from the A/D converter */ val = be32_to_cpu(get_unaligned((__be32 - *)(devpriv->insn_buf + 1))); + *) (devpriv->insn_buf + 1))); val &= 0x00ffffff; /* strip status byte */ data[i] = comedi_offset_munge(s, val); } @@ -778,7 +777,7 @@ static int usbduxsigma_ao_insn_write(struct comedi_device *dev, } for (i = 0; i < insn->n; i++) { - devpriv->dux_commands[1] = 1; /* num channels */ + devpriv->dux_commands[1] = 1; /* num channels */ devpriv->dux_commands[2] = data[i]; /* value */ devpriv->dux_commands[3] = chan; /* channel number */ ret = usbbuxsigma_send_cmd(dev, USBDUXSIGMA_DA_CMD); @@ -872,7 +871,7 @@ static int usbduxsigma_ao_cmdtest(struct comedi_device *dev, if (cmd->stop_src == TRIG_COUNT) err |= comedi_check_trigger_arg_min(&cmd->stop_arg, 1); - else /* TRIG_NONE */ + else /* TRIG_NONE */ err |= comedi_check_trigger_arg_is(&cmd->stop_arg, 0); if (err) @@ -919,7 +918,7 @@ static int usbduxsigma_ao_cmd(struct comedi_device *dev, return ret; } s->async->inttrig = NULL; - } else { /* TRIG_INT */ + } else { /* TRIG_INT */ s->async->inttrig = usbduxsigma_ao_inttrig; } @@ -974,8 +973,7 @@ static int usbduxsigma_dio_insn_bits(struct comedi_device *dev, goto done; s->state = devpriv->insn_buf[1] | - (devpriv->insn_buf[2] << 8) | - (devpriv->insn_buf[3] << 16); + (devpriv->insn_buf[2] << 8) | (devpriv->insn_buf[3] << 16); data[1] = s->state; ret = insn->n; @@ -1117,8 +1115,7 @@ static int usbduxsigma_pwm_start(struct comedi_device *dev, static void usbduxsigma_pwm_pattern(struct comedi_device *dev, struct comedi_subdevice *s, unsigned int chan, - unsigned int value, - unsigned int sign) + unsigned int value, unsigned int sign) { struct usbduxsigma_private *devpriv = dev->private; char pwm_mask = (1 << chan); /* DIO bit for the PWM data */ @@ -1143,8 +1140,7 @@ static void usbduxsigma_pwm_pattern(struct comedi_device *dev, static int usbduxsigma_pwm_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); @@ -1166,8 +1162,7 @@ static int usbduxsigma_pwm_write(struct comedi_device *dev, static int usbduxsigma_pwm_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct usbduxsigma_private *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -1216,28 +1211,28 @@ static int usbduxsigma_getstatusinfo(struct comedi_device *dev, int chan) switch (chan) { default: case 0: - sysred = 0; /* ADC zero */ + sysred = 0; /* ADC zero */ break; case 1: - sysred = 1; /* ADC offset */ + sysred = 1; /* ADC offset */ break; case 2: - sysred = 4; /* VCC */ + sysred = 4; /* VCC */ break; case 3: - sysred = 8; /* temperature */ + sysred = 8; /* temperature */ break; case 4: - sysred = 16; /* gain */ + sysred = 16; /* gain */ break; case 5: - sysred = 32; /* ref */ + sysred = 32; /* ref */ break; } - devpriv->dux_commands[1] = 0x12; /* CONFIG0 */ - devpriv->dux_commands[2] = 0x80; /* CONFIG1: 2kHz sampling rate */ - devpriv->dux_commands[3] = 0x00; /* CONFIG3: diff. channels off */ + devpriv->dux_commands[1] = 0x12; /* CONFIG0 */ + devpriv->dux_commands[2] = 0x80; /* CONFIG1: 2kHz sampling rate */ + devpriv->dux_commands[3] = 0x00; /* CONFIG3: diff. channels off */ devpriv->dux_commands[4] = 0; devpriv->dux_commands[5] = 0; devpriv->dux_commands[6] = sysred; @@ -1250,14 +1245,14 @@ static int usbduxsigma_getstatusinfo(struct comedi_device *dev, int chan) return ret; /* 32 bits big endian from the A/D converter */ - val = be32_to_cpu(get_unaligned((__be32 *)(devpriv->insn_buf + 1))); + val = be32_to_cpu(get_unaligned((__be32 *) (devpriv->insn_buf + 1))); val &= 0x00ffffff; /* strip status byte */ return (int)comedi_offset_munge(s, val); } static int usbduxsigma_firmware_upload(struct comedi_device *dev, - const u8 *data, size_t size, + const u8 *data, size_t size, unsigned long context) { struct usb_device *usb = comedi_to_usb_dev(dev); @@ -1286,13 +1281,11 @@ static int usbduxsigma_firmware_upload(struct comedi_device *dev, } /* stop the current firmware on the device */ - *tmp = 1; /* 7f92 to one */ + *tmp = 1; /* 7f92 to one */ ret = usb_control_msg(usb, usb_sndctrlpipe(usb, 0), USBDUXSUB_FIRMWARE, VENDOR_DIR_OUT, - USBDUXSUB_CPUCS, 0x0000, - tmp, 1, - BULK_TIMEOUT); + USBDUXSUB_CPUCS, 0x0000, tmp, 1, BULK_TIMEOUT); if (ret < 0) { dev_err(dev->class_dev, "can not stop firmware\n"); goto done; @@ -1302,22 +1295,18 @@ static int usbduxsigma_firmware_upload(struct comedi_device *dev, ret = usb_control_msg(usb, usb_sndctrlpipe(usb, 0), USBDUXSUB_FIRMWARE, VENDOR_DIR_OUT, - 0, 0x0000, - buf, size, - BULK_TIMEOUT); + 0, 0x0000, buf, size, BULK_TIMEOUT); if (ret < 0) { dev_err(dev->class_dev, "firmware upload failed\n"); goto done; } /* start the new firmware on the device */ - *tmp = 0; /* 7f92 to zero */ + *tmp = 0; /* 7f92 to zero */ ret = usb_control_msg(usb, usb_sndctrlpipe(usb, 0), USBDUXSUB_FIRMWARE, VENDOR_DIR_OUT, - USBDUXSUB_CPUCS, 0x0000, - tmp, 1, - BULK_TIMEOUT); + USBDUXSUB_CPUCS, 0x0000, tmp, 1, BULK_TIMEOUT); if (ret < 0) dev_err(dev->class_dev, "can not start firmware\n"); @@ -1394,8 +1383,7 @@ static int usbduxsigma_alloc_usb_buffers(struct comedi_device *dev) return -ENOMEM; devpriv->pwm_urb = urb; - urb->transfer_buffer = kzalloc(devpriv->pwm_buf_sz, - GFP_KERNEL); + urb->transfer_buffer = kzalloc(devpriv->pwm_buf_sz, GFP_KERNEL); if (!urb->transfer_buffer) return -ENOMEM; } @@ -1492,31 +1480,31 @@ static int usbduxsigma_auto_attach(struct comedi_device *dev, /* Analog Input subdevice */ s = &dev->subdevices[0]; dev->read_subdev = s; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_CMD_READ | SDF_LSAMPL; - s->n_chan = NUMCHANNELS; - s->len_chanlist = NUMCHANNELS; - s->maxdata = 0x00ffffff; - s->range_table = &usbduxsigma_ai_range; - s->insn_read = usbduxsigma_ai_insn_read; - s->do_cmdtest = usbduxsigma_ai_cmdtest; - s->do_cmd = usbduxsigma_ai_cmd; - s->cancel = usbduxsigma_ai_cancel; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_CMD_READ | SDF_LSAMPL; + s->n_chan = NUMCHANNELS; + s->len_chanlist = NUMCHANNELS; + s->maxdata = 0x00ffffff; + s->range_table = &usbduxsigma_ai_range; + s->insn_read = usbduxsigma_ai_insn_read; + s->do_cmdtest = usbduxsigma_ai_cmdtest; + s->do_cmd = usbduxsigma_ai_cmd; + s->cancel = usbduxsigma_ai_cancel; /* Analog Output subdevice */ s = &dev->subdevices[1]; dev->write_subdev = s; - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_CMD_WRITE; - s->n_chan = 4; - s->len_chanlist = s->n_chan; - s->maxdata = 0x00ff; - s->range_table = &range_unipolar2_5; - s->insn_write = usbduxsigma_ao_insn_write; - s->insn_read = usbduxsigma_ao_insn_read; - s->do_cmdtest = usbduxsigma_ao_cmdtest; - s->do_cmd = usbduxsigma_ao_cmd; - s->cancel = usbduxsigma_ao_cancel; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE | SDF_GROUND | SDF_CMD_WRITE; + s->n_chan = 4; + s->len_chanlist = s->n_chan; + s->maxdata = 0x00ff; + s->range_table = &range_unipolar2_5; + s->insn_write = usbduxsigma_ao_insn_write; + s->insn_read = usbduxsigma_ao_insn_read; + s->do_cmdtest = usbduxsigma_ao_cmdtest; + s->do_cmd = usbduxsigma_ao_cmd; + s->cancel = usbduxsigma_ao_cancel; ret = comedi_alloc_subdev_readback(s); if (ret) @@ -1524,23 +1512,23 @@ static int usbduxsigma_auto_attach(struct comedi_device *dev, /* Digital I/O subdevice */ s = &dev->subdevices[2]; - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = 24; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = usbduxsigma_dio_insn_bits; - s->insn_config = usbduxsigma_dio_insn_config; + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = 24; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = usbduxsigma_dio_insn_bits; + s->insn_config = usbduxsigma_dio_insn_config; if (devpriv->high_speed) { /* Timer / pwm subdevice */ s = &dev->subdevices[3]; - s->type = COMEDI_SUBD_PWM; - s->subdev_flags = SDF_WRITABLE | SDF_PWM_HBRIDGE; - s->n_chan = 8; - s->maxdata = devpriv->pwm_buf_sz; - s->insn_write = usbduxsigma_pwm_write; - s->insn_config = usbduxsigma_pwm_config; + s->type = COMEDI_SUBD_PWM; + s->subdev_flags = SDF_WRITABLE | SDF_PWM_HBRIDGE; + s->n_chan = 8; + s->maxdata = devpriv->pwm_buf_sz; + s->insn_write = usbduxsigma_pwm_write; + s->insn_config = usbduxsigma_pwm_config; usbduxsigma_pwm_period(dev, s, PWM_DEFAULT_PERIOD); } @@ -1582,10 +1570,10 @@ static void usbduxsigma_detach(struct comedi_device *dev) } static struct comedi_driver usbduxsigma_driver = { - .driver_name = "usbduxsigma", - .module = THIS_MODULE, - .auto_attach = usbduxsigma_auto_attach, - .detach = usbduxsigma_detach, + .driver_name = "usbduxsigma", + .module = THIS_MODULE, + .auto_attach = usbduxsigma_auto_attach, + .detach = usbduxsigma_detach, }; static int usbduxsigma_usb_probe(struct usb_interface *intf, @@ -1600,14 +1588,16 @@ static const struct usb_device_id usbduxsigma_usb_table[] = { { USB_DEVICE(0x13d8, 0x0022) }, { } }; + MODULE_DEVICE_TABLE(usb, usbduxsigma_usb_table); static struct usb_driver usbduxsigma_usb_driver = { - .name = "usbduxsigma", - .probe = usbduxsigma_usb_probe, - .disconnect = comedi_usb_auto_unconfig, - .id_table = usbduxsigma_usb_table, + .name = "usbduxsigma", + .probe = usbduxsigma_usb_probe, + .disconnect = comedi_usb_auto_unconfig, + .id_table = usbduxsigma_usb_table, }; + module_comedi_usb_driver(usbduxsigma_driver, usbduxsigma_usb_driver); MODULE_AUTHOR("Bernd Porr, mail@xxxxxxxxxxxxxxx"); diff --git a/drivers/comedi/drivers/vmk80xx.c b/drivers/comedi/drivers/vmk80xx.c index 9f920819cd74..631360570052 100644 --- a/drivers/comedi/drivers/vmk80xx.c +++ b/drivers/comedi/drivers/vmk80xx.c @@ -97,9 +97,9 @@ enum vmk80xx_model { static const struct comedi_lrange vmk8061_range = { 2, { - UNI_RANGE(5), - UNI_RANGE(10) - } + UNI_RANGE(5), + UNI_RANGE(10) + } }; struct vmk80xx_board { @@ -117,27 +117,27 @@ struct vmk80xx_board { static const struct vmk80xx_board vmk80xx_boardinfo[] = { [DEVICE_VMK8055] = { - .name = "K8055 (VM110)", - .model = VMK8055_MODEL, - .range = &range_unipolar5, - .ai_nchans = 2, - .ai_maxdata = 0x00ff, - .ao_nchans = 2, - .di_nchans = 6, - .cnt_maxdata = 0xffff, - }, + .name = "K8055 (VM110)", + .model = VMK8055_MODEL, + .range = &range_unipolar5, + .ai_nchans = 2, + .ai_maxdata = 0x00ff, + .ao_nchans = 2, + .di_nchans = 6, + .cnt_maxdata = 0xffff, + }, [DEVICE_VMK8061] = { - .name = "K8061 (VM140)", - .model = VMK8061_MODEL, - .range = &vmk8061_range, - .ai_nchans = 8, - .ai_maxdata = 0x03ff, - .ao_nchans = 8, - .di_nchans = 8, - .cnt_maxdata = 0, /* unknown, device is not writeable */ - .pwm_nchans = 1, - .pwm_maxdata = 0x03ff, - }, + .name = "K8061 (VM140)", + .model = VMK8061_MODEL, + .range = &vmk8061_range, + .ai_nchans = 8, + .ai_maxdata = 0x03ff, + .ao_nchans = 8, + .di_nchans = 8, + .cnt_maxdata = 0, /* unknown, device is not writeable */ + .pwm_nchans = 1, + .pwm_maxdata = 0x03ff, + }, }; struct vmk80xx_private { @@ -190,8 +190,7 @@ static int vmk80xx_read_packet(struct comedi_device *dev) ep = devpriv->ep_rx; pipe = usb_rcvintpipe(usb, ep->bEndpointAddress); return usb_interrupt_msg(usb, pipe, devpriv->usb_rx_buf, - usb_endpoint_maxp(ep), NULL, - HZ * 10); + usb_endpoint_maxp(ep), NULL, HZ * 10); } static int vmk80xx_write_packet(struct comedi_device *dev, int cmd) @@ -211,8 +210,7 @@ static int vmk80xx_write_packet(struct comedi_device *dev, int cmd) ep = devpriv->ep_tx; pipe = usb_sndintpipe(usb, ep->bEndpointAddress); return usb_interrupt_msg(usb, pipe, devpriv->usb_tx_buf, - usb_endpoint_maxp(ep), NULL, - HZ * 10); + usb_endpoint_maxp(ep), NULL, HZ * 10); } static int vmk80xx_reset_device(struct comedi_device *dev) @@ -232,8 +230,7 @@ static int vmk80xx_reset_device(struct comedi_device *dev) static int vmk80xx_ai_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct vmk80xx_private *devpriv = dev->private; int chan; @@ -280,8 +277,7 @@ static int vmk80xx_ai_insn_read(struct comedi_device *dev, static int vmk80xx_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct vmk80xx_private *devpriv = dev->private; int chan; @@ -321,8 +317,7 @@ static int vmk80xx_ao_insn_write(struct comedi_device *dev, static int vmk80xx_ao_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct vmk80xx_private *devpriv = dev->private; int chan; @@ -350,8 +345,7 @@ static int vmk80xx_ao_insn_read(struct comedi_device *dev, static int vmk80xx_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct vmk80xx_private *devpriv = dev->private; unsigned char *rx_buf; @@ -374,8 +368,8 @@ static int vmk80xx_di_insn_bits(struct comedi_device *dev, if (!retval) { if (devpriv->model == VMK8055_MODEL) data[1] = (((rx_buf[reg] >> 4) & 0x03) | - ((rx_buf[reg] << 2) & 0x04) | - ((rx_buf[reg] >> 3) & 0x18)); + ((rx_buf[reg] << 2) & 0x04) | + ((rx_buf[reg] >> 3) & 0x18)); else data[1] = rx_buf[reg]; @@ -389,8 +383,7 @@ static int vmk80xx_di_insn_bits(struct comedi_device *dev, static int vmk80xx_do_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct vmk80xx_private *devpriv = dev->private; unsigned char *rx_buf = devpriv->usb_rx_buf; @@ -401,7 +394,7 @@ static int vmk80xx_do_insn_bits(struct comedi_device *dev, if (devpriv->model == VMK8061_MODEL) { reg = VMK8061_DO_REG; cmd = VMK8061_CMD_DO; - } else { /* VMK8055_MODEL */ + } else { /* VMK8055_MODEL */ reg = VMK8055_DO_REG; cmd = VMK8055_CMD_WRT_AD; } @@ -433,8 +426,7 @@ static int vmk80xx_do_insn_bits(struct comedi_device *dev, static int vmk80xx_cnt_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct vmk80xx_private *devpriv = dev->private; int chan; @@ -465,7 +457,7 @@ static int vmk80xx_cnt_insn_read(struct comedi_device *dev, if (devpriv->model == VMK8055_MODEL) data[n] = devpriv->usb_rx_buf[reg[0]]; - else /* VMK8061_MODEL */ + else /* VMK8061_MODEL */ data[n] = devpriv->usb_rx_buf[reg[0] * (chan + 1) + 1] + 256 * devpriv->usb_rx_buf[reg[1] * 2 + 2]; } @@ -477,8 +469,7 @@ static int vmk80xx_cnt_insn_read(struct comedi_device *dev, static int vmk80xx_cnt_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct vmk80xx_private *devpriv = dev->private; unsigned int chan = CR_CHAN(insn->chanspec); @@ -514,8 +505,7 @@ static int vmk80xx_cnt_insn_config(struct comedi_device *dev, static int vmk80xx_cnt_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct vmk80xx_private *devpriv = dev->private; unsigned long debtime; @@ -558,8 +548,7 @@ static int vmk80xx_cnt_insn_write(struct comedi_device *dev, static int vmk80xx_pwm_insn_read(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct vmk80xx_private *devpriv = dev->private; unsigned char *tx_buf; @@ -591,8 +580,7 @@ static int vmk80xx_pwm_insn_read(struct comedi_device *dev, static int vmk80xx_pwm_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct vmk80xx_private *devpriv = dev->private; unsigned char *tx_buf; @@ -667,7 +655,8 @@ static int vmk80xx_find_usb_endpoints(struct comedi_device *dev) if (!devpriv->ep_rx || !devpriv->ep_tx) return -ENODEV; - if (!usb_endpoint_maxp(devpriv->ep_rx) || !usb_endpoint_maxp(devpriv->ep_tx)) + if (!usb_endpoint_maxp(devpriv->ep_rx) + || !usb_endpoint_maxp(devpriv->ep_tx)) return -EINVAL; return 0; @@ -713,66 +702,66 @@ static int vmk80xx_init_subdevices(struct comedi_device *dev) /* Analog input subdevice */ s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_GROUND; - s->n_chan = board->ai_nchans; - s->maxdata = board->ai_maxdata; - s->range_table = board->range; - s->insn_read = vmk80xx_ai_insn_read; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_GROUND; + s->n_chan = board->ai_nchans; + s->maxdata = board->ai_maxdata; + s->range_table = board->range; + s->insn_read = vmk80xx_ai_insn_read; /* Analog output subdevice */ s = &dev->subdevices[1]; - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE | SDF_GROUND; - s->n_chan = board->ao_nchans; - s->maxdata = 0x00ff; - s->range_table = board->range; - s->insn_write = vmk80xx_ao_insn_write; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE | SDF_GROUND; + s->n_chan = board->ao_nchans; + s->maxdata = 0x00ff; + s->range_table = board->range; + s->insn_write = vmk80xx_ao_insn_write; if (devpriv->model == VMK8061_MODEL) { - s->subdev_flags |= SDF_READABLE; - s->insn_read = vmk80xx_ao_insn_read; + s->subdev_flags |= SDF_READABLE; + s->insn_read = vmk80xx_ao_insn_read; } /* Digital input subdevice */ s = &dev->subdevices[2]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = board->di_nchans; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = vmk80xx_di_insn_bits; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = board->di_nchans; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = vmk80xx_di_insn_bits; /* Digital output subdevice */ s = &dev->subdevices[3]; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 8; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = vmk80xx_do_insn_bits; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 8; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = vmk80xx_do_insn_bits; /* Counter subdevice */ s = &dev->subdevices[4]; - s->type = COMEDI_SUBD_COUNTER; - s->subdev_flags = SDF_READABLE; - s->n_chan = 2; - s->maxdata = board->cnt_maxdata; - s->insn_read = vmk80xx_cnt_insn_read; - s->insn_config = vmk80xx_cnt_insn_config; + s->type = COMEDI_SUBD_COUNTER; + s->subdev_flags = SDF_READABLE; + s->n_chan = 2; + s->maxdata = board->cnt_maxdata; + s->insn_read = vmk80xx_cnt_insn_read; + s->insn_config = vmk80xx_cnt_insn_config; if (devpriv->model == VMK8055_MODEL) { - s->subdev_flags |= SDF_WRITABLE; - s->insn_write = vmk80xx_cnt_insn_write; + s->subdev_flags |= SDF_WRITABLE; + s->insn_write = vmk80xx_cnt_insn_write; } /* PWM subdevice */ if (devpriv->model == VMK8061_MODEL) { s = &dev->subdevices[5]; - s->type = COMEDI_SUBD_PWM; - s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = board->pwm_nchans; - s->maxdata = board->pwm_maxdata; - s->insn_read = vmk80xx_pwm_insn_read; - s->insn_write = vmk80xx_pwm_insn_write; + s->type = COMEDI_SUBD_PWM; + s->subdev_flags = SDF_READABLE | SDF_WRITABLE; + s->n_chan = board->pwm_nchans; + s->maxdata = board->pwm_maxdata; + s->insn_read = vmk80xx_pwm_insn_read; + s->insn_write = vmk80xx_pwm_insn_write; } up(&devpriv->limit_sem); @@ -780,8 +769,7 @@ static int vmk80xx_init_subdevices(struct comedi_device *dev) return 0; } -static int vmk80xx_auto_attach(struct comedi_device *dev, - unsigned long context) +static int vmk80xx_auto_attach(struct comedi_device *dev, unsigned long context) { struct usb_interface *intf = comedi_to_usb_interface(dev); const struct vmk80xx_board *board = NULL; @@ -838,10 +826,10 @@ static void vmk80xx_detach(struct comedi_device *dev) } static struct comedi_driver vmk80xx_driver = { - .module = THIS_MODULE, - .driver_name = "vmk80xx", - .auto_attach = vmk80xx_auto_attach, - .detach = vmk80xx_detach, + .module = THIS_MODULE, + .driver_name = "vmk80xx", + .auto_attach = vmk80xx_auto_attach, + .detach = vmk80xx_detach, }; static int vmk80xx_usb_probe(struct usb_interface *intf, @@ -851,28 +839,30 @@ static int vmk80xx_usb_probe(struct usb_interface *intf, } static const struct usb_device_id vmk80xx_usb_id_table[] = { - { USB_DEVICE(0x10cf, 0x5500), .driver_info = DEVICE_VMK8055 }, - { USB_DEVICE(0x10cf, 0x5501), .driver_info = DEVICE_VMK8055 }, - { USB_DEVICE(0x10cf, 0x5502), .driver_info = DEVICE_VMK8055 }, - { USB_DEVICE(0x10cf, 0x5503), .driver_info = DEVICE_VMK8055 }, - { USB_DEVICE(0x10cf, 0x8061), .driver_info = DEVICE_VMK8061 }, - { USB_DEVICE(0x10cf, 0x8062), .driver_info = DEVICE_VMK8061 }, - { USB_DEVICE(0x10cf, 0x8063), .driver_info = DEVICE_VMK8061 }, - { USB_DEVICE(0x10cf, 0x8064), .driver_info = DEVICE_VMK8061 }, - { USB_DEVICE(0x10cf, 0x8065), .driver_info = DEVICE_VMK8061 }, - { USB_DEVICE(0x10cf, 0x8066), .driver_info = DEVICE_VMK8061 }, - { USB_DEVICE(0x10cf, 0x8067), .driver_info = DEVICE_VMK8061 }, - { USB_DEVICE(0x10cf, 0x8068), .driver_info = DEVICE_VMK8061 }, + { USB_DEVICE(0x10cf, 0x5500), .driver_info = DEVICE_VMK8055 }, + { USB_DEVICE(0x10cf, 0x5501), .driver_info = DEVICE_VMK8055 }, + { USB_DEVICE(0x10cf, 0x5502), .driver_info = DEVICE_VMK8055 }, + { USB_DEVICE(0x10cf, 0x5503), .driver_info = DEVICE_VMK8055 }, + { USB_DEVICE(0x10cf, 0x8061), .driver_info = DEVICE_VMK8061 }, + { USB_DEVICE(0x10cf, 0x8062), .driver_info = DEVICE_VMK8061 }, + { USB_DEVICE(0x10cf, 0x8063), .driver_info = DEVICE_VMK8061 }, + { USB_DEVICE(0x10cf, 0x8064), .driver_info = DEVICE_VMK8061 }, + { USB_DEVICE(0x10cf, 0x8065), .driver_info = DEVICE_VMK8061 }, + { USB_DEVICE(0x10cf, 0x8066), .driver_info = DEVICE_VMK8061 }, + { USB_DEVICE(0x10cf, 0x8067), .driver_info = DEVICE_VMK8061 }, + { USB_DEVICE(0x10cf, 0x8068), .driver_info = DEVICE_VMK8061 }, { } }; + MODULE_DEVICE_TABLE(usb, vmk80xx_usb_id_table); static struct usb_driver vmk80xx_usb_driver = { - .name = "vmk80xx", - .id_table = vmk80xx_usb_id_table, - .probe = vmk80xx_usb_probe, - .disconnect = comedi_usb_auto_unconfig, + .name = "vmk80xx", + .id_table = vmk80xx_usb_id_table, + .probe = vmk80xx_usb_probe, + .disconnect = comedi_usb_auto_unconfig, }; + module_comedi_usb_driver(vmk80xx_driver, vmk80xx_usb_driver); MODULE_AUTHOR("Manuel Gebele <forensixs@xxxxxx>"); diff --git a/drivers/comedi/drivers/z8536.h b/drivers/comedi/drivers/z8536.h index 3ef5f9e79b89..d85c374bc45f 100644 --- a/drivers/comedi/drivers/z8536.h +++ b/drivers/comedi/drivers/z8536.h @@ -25,11 +25,11 @@ #define Z8536_CFG_CTRL_PCE_CT3E BIT(4) /* Port C & C/T 3 Enable */ #define Z8536_CFG_CTRL_PLC BIT(3) /* Port A/B Link Control */ #define Z8536_CFG_CTRL_PAE BIT(2) /* Port A Enable */ -#define Z8536_CFG_CTRL_LC(x) (((x) & 0x3) << 0) /* Link Control */ -#define Z8536_CFG_CTRL_LC_INDEP Z8536_CFG_CTRL_LC(0)/* Independent */ -#define Z8536_CFG_CTRL_LC_GATE Z8536_CFG_CTRL_LC(1)/* 1 Gates 2 */ -#define Z8536_CFG_CTRL_LC_TRIG Z8536_CFG_CTRL_LC(2)/* 1 Triggers 2 */ -#define Z8536_CFG_CTRL_LC_CLK Z8536_CFG_CTRL_LC(3)/* 1 Clocks 2 */ +#define Z8536_CFG_CTRL_LC(x) (((x) & 0x3) << 0) /* Link Control */ +#define Z8536_CFG_CTRL_LC_INDEP Z8536_CFG_CTRL_LC(0) /* Independent */ +#define Z8536_CFG_CTRL_LC_GATE Z8536_CFG_CTRL_LC(1) /* 1 Gates 2 */ +#define Z8536_CFG_CTRL_LC_TRIG Z8536_CFG_CTRL_LC(2) /* 1 Triggers 2 */ +#define Z8536_CFG_CTRL_LC_CLK Z8536_CFG_CTRL_LC(3) /* 1 Clocks 2 */ #define Z8536_CFG_CTRL_LC_MASK Z8536_CFG_CTRL_LC(3) /* Interrupt Vector registers */ @@ -108,30 +108,30 @@ #define Z8536_CT_MODE_ETE BIT(4) /* External Trigger Enable */ #define Z8536_CT_MODE_EGE BIT(3) /* External Gate Enable */ #define Z8536_CT_MODE_REB BIT(2) /* Retrigger Enable Bit */ -#define Z8536_CT_MODE_DCS(x) (((x) & 0x3) << 0) /* Duty Cycle */ -#define Z8536_CT_MODE_DCS_PULSE Z8536_CT_MODE_DCS(0) /* Pulse */ -#define Z8536_CT_MODE_DCS_ONESHOT Z8536_CT_MODE_DCS(1) /* One-Shot */ -#define Z8536_CT_MODE_DCS_SQRWAVE Z8536_CT_MODE_DCS(2) /* Square Wave */ -#define Z8536_CT_MODE_DCS_DO_NOT_USE Z8536_CT_MODE_DCS(3) /* Do Not Use */ +#define Z8536_CT_MODE_DCS(x) (((x) & 0x3) << 0) /* Duty Cycle */ +#define Z8536_CT_MODE_DCS_PULSE Z8536_CT_MODE_DCS(0) /* Pulse */ +#define Z8536_CT_MODE_DCS_ONESHOT Z8536_CT_MODE_DCS(1) /* One-Shot */ +#define Z8536_CT_MODE_DCS_SQRWAVE Z8536_CT_MODE_DCS(2) /* Square Wave */ +#define Z8536_CT_MODE_DCS_DO_NOT_USE Z8536_CT_MODE_DCS(3) /* Do Not Use */ #define Z8536_CT_MODE_DCS_MASK Z8536_CT_MODE_DCS(3) /* Port A/B Mode Specification registers */ #define Z8536_PA_MODE_REG 0x20 #define Z8536_PB_MODE_REG 0x28 #define Z8536_PAB_MODE_PTS(x) (((x) & 0x3) << 6) /* Port type */ -#define Z8536_PAB_MODE_PTS_BIT Z8536_PAB_MODE_PTS(0 << 6)/* Bit */ -#define Z8536_PAB_MODE_PTS_INPUT Z8536_PAB_MODE_PTS(1 << 6)/* Input */ -#define Z8536_PAB_MODE_PTS_OUTPUT Z8536_PAB_MODE_PTS(2 << 6)/* Output */ -#define Z8536_PAB_MODE_PTS_BIDIR Z8536_PAB_MODE_PTS(3 << 6)/* Bidir */ +#define Z8536_PAB_MODE_PTS_BIT Z8536_PAB_MODE_PTS(0 << 6) /* Bit */ +#define Z8536_PAB_MODE_PTS_INPUT Z8536_PAB_MODE_PTS(1 << 6) /* Input */ +#define Z8536_PAB_MODE_PTS_OUTPUT Z8536_PAB_MODE_PTS(2 << 6) /* Output */ +#define Z8536_PAB_MODE_PTS_BIDIR Z8536_PAB_MODE_PTS(3 << 6) /* Bidir */ #define Z8536_PAB_MODE_PTS_MASK Z8536_PAB_MODE_PTS(3 << 6) #define Z8536_PAB_MODE_ITB BIT(5) /* Interrupt on Two Bytes */ #define Z8536_PAB_MODE_SB BIT(4) /* Single Buffered mode */ #define Z8536_PAB_MODE_IMO BIT(3) /* Interrupt on Match Only */ -#define Z8536_PAB_MODE_PMS(x) (((x) & 0x3) << 1) /* Pattern Mode */ -#define Z8536_PAB_MODE_PMS_DISABLE Z8536_PAB_MODE_PMS(0)/* Disabled */ -#define Z8536_PAB_MODE_PMS_AND Z8536_PAB_MODE_PMS(1)/* "AND" */ -#define Z8536_PAB_MODE_PMS_OR Z8536_PAB_MODE_PMS(2)/* "OR" */ -#define Z8536_PAB_MODE_PMS_OR_PEV Z8536_PAB_MODE_PMS(3)/* "OR-Priority" */ +#define Z8536_PAB_MODE_PMS(x) (((x) & 0x3) << 1) /* Pattern Mode */ +#define Z8536_PAB_MODE_PMS_DISABLE Z8536_PAB_MODE_PMS(0) /* Disabled */ +#define Z8536_PAB_MODE_PMS_AND Z8536_PAB_MODE_PMS(1) /* "AND" */ +#define Z8536_PAB_MODE_PMS_OR Z8536_PAB_MODE_PMS(2) /* "OR" */ +#define Z8536_PAB_MODE_PMS_OR_PEV Z8536_PAB_MODE_PMS(3) /* "OR-Priority" */ #define Z8536_PAB_MODE_PMS_MASK Z8536_PAB_MODE_PMS(3) #define Z8536_PAB_MODE_LPM BIT(0) /* Latch on Pattern Match */ #define Z8536_PAB_MODE_DTE BIT(0) /* Deskew Timer Enabled */ @@ -139,22 +139,22 @@ /* Port A/B Handshake Specification registers */ #define Z8536_PA_HANDSHAKE_REG 0x21 #define Z8536_PB_HANDSHAKE_REG 0x29 -#define Z8536_PAB_HANDSHAKE_HST(x) (((x) & 0x3) << 6) /* Handshake Type */ -#define Z8536_PAB_HANDSHAKE_HST_INTER Z8536_PAB_HANDSHAKE_HST(0)/*Interlock*/ -#define Z8536_PAB_HANDSHAKE_HST_STROBED Z8536_PAB_HANDSHAKE_HST(1)/* Strobed */ -#define Z8536_PAB_HANDSHAKE_HST_PULSED Z8536_PAB_HANDSHAKE_HST(2)/* Pulsed */ -#define Z8536_PAB_HANDSHAKE_HST_3WIRE Z8536_PAB_HANDSHAKE_HST(3)/* 3-Wire */ +#define Z8536_PAB_HANDSHAKE_HST(x) (((x) & 0x3) << 6) /* Handshake Type */ +#define Z8536_PAB_HANDSHAKE_HST_INTER Z8536_PAB_HANDSHAKE_HST(0) /*Interlock */ +#define Z8536_PAB_HANDSHAKE_HST_STROBED Z8536_PAB_HANDSHAKE_HST(1) /* Strobed */ +#define Z8536_PAB_HANDSHAKE_HST_PULSED Z8536_PAB_HANDSHAKE_HST(2) /* Pulsed */ +#define Z8536_PAB_HANDSHAKE_HST_3WIRE Z8536_PAB_HANDSHAKE_HST(3) /* 3-Wire */ #define Z8536_PAB_HANDSHAKE_HST_MASK Z8536_PAB_HANDSHAKE_HST(3) #define Z8536_PAB_HANDSHAKE_RWS(x) (((x) & 0x7) << 3) /* Req/Wait */ -#define Z8536_PAB_HANDSHAKE_RWS_DISABLE Z8536_PAB_HANDSHAKE_RWS(0)/* Disabled */ -#define Z8536_PAB_HANDSHAKE_RWS_OUTWAIT Z8536_PAB_HANDSHAKE_RWS(1)/* Out Wait */ -#define Z8536_PAB_HANDSHAKE_RWS_INWAIT Z8536_PAB_HANDSHAKE_RWS(3)/* In Wait */ -#define Z8536_PAB_HANDSHAKE_RWS_SPREQ Z8536_PAB_HANDSHAKE_RWS(4)/* Special */ -#define Z8536_PAB_HANDSHAKE_RWS_OUTREQ Z8536_PAB_HANDSHAKE_RWS(5)/* Out Req */ -#define Z8536_PAB_HANDSHAKE_RWS_INREQ Z8536_PAB_HANDSHAKE_RWS(7)/* In Req */ +#define Z8536_PAB_HANDSHAKE_RWS_DISABLE Z8536_PAB_HANDSHAKE_RWS(0) /* Disabled */ +#define Z8536_PAB_HANDSHAKE_RWS_OUTWAIT Z8536_PAB_HANDSHAKE_RWS(1) /* Out Wait */ +#define Z8536_PAB_HANDSHAKE_RWS_INWAIT Z8536_PAB_HANDSHAKE_RWS(3) /* In Wait */ +#define Z8536_PAB_HANDSHAKE_RWS_SPREQ Z8536_PAB_HANDSHAKE_RWS(4) /* Special */ +#define Z8536_PAB_HANDSHAKE_RWS_OUTREQ Z8536_PAB_HANDSHAKE_RWS(5) /* Out Req */ +#define Z8536_PAB_HANDSHAKE_RWS_INREQ Z8536_PAB_HANDSHAKE_RWS(7) /* In Req */ #define Z8536_PAB_HANDSHAKE_RWS_MASK Z8536_PAB_HANDSHAKE_RWS(7) -#define Z8536_PAB_HANDSHAKE_DESKEW(x) ((x) << 0)/* Deskew Time */ -#define Z8536_PAB_HANDSHAKE_DESKEW_MASK (3 << 0)/* Deskew Time mask */ +#define Z8536_PAB_HANDSHAKE_DESKEW(x) ((x) << 0) /* Deskew Time */ +#define Z8536_PAB_HANDSHAKE_DESKEW_MASK (3 << 0) /* Deskew Time mask */ /* * Port A/B/C Data Path Polarity registers @@ -207,4 +207,4 @@ #define Z8536_PA_PM_REG 0x27 #define Z8536_PB_PM_REG 0x2f -#endif /* _Z8536_H */ +#endif /* _Z8536_H */ diff --git a/drivers/comedi/kcomedilib/kcomedilib_main.c b/drivers/comedi/kcomedilib/kcomedilib_main.c index df9bba1b69ed..e434ba881952 100644 --- a/drivers/comedi/kcomedilib/kcomedilib_main.c +++ b/drivers/comedi/kcomedilib/kcomedilib_main.c @@ -54,6 +54,7 @@ struct comedi_device *comedi_open(const char *filename) return retval; } + EXPORT_SYMBOL_GPL(comedi_open); int comedi_close(struct comedi_device *dev) @@ -61,11 +62,11 @@ int comedi_close(struct comedi_device *dev) comedi_dev_put(dev); return 0; } + EXPORT_SYMBOL_GPL(comedi_close); static int comedi_do_insn(struct comedi_device *dev, - struct comedi_insn *insn, - unsigned int *data) + struct comedi_insn *insn, unsigned int *data) { struct comedi_subdevice *s; int ret; @@ -145,6 +146,7 @@ int comedi_dio_get_config(struct comedi_device *dev, unsigned int subdev, *io = data[1]; return ret; } + EXPORT_SYMBOL_GPL(comedi_dio_get_config); int comedi_dio_config(struct comedi_device *dev, unsigned int subdev, @@ -160,6 +162,7 @@ int comedi_dio_config(struct comedi_device *dev, unsigned int subdev, return comedi_do_insn(dev, &insn, &io); } + EXPORT_SYMBOL_GPL(comedi_dio_config); int comedi_dio_bitfield2(struct comedi_device *dev, unsigned int subdev, @@ -205,6 +208,7 @@ int comedi_dio_bitfield2(struct comedi_device *dev, unsigned int subdev, *bits = data[1] >> shift; return ret; } + EXPORT_SYMBOL_GPL(comedi_dio_bitfield2); int comedi_find_subdevice_by_type(struct comedi_device *dev, int type, @@ -225,6 +229,7 @@ int comedi_find_subdevice_by_type(struct comedi_device *dev, int type, up_read(&dev->attach_lock); return ret; } + EXPORT_SYMBOL_GPL(comedi_find_subdevice_by_type); int comedi_get_n_channels(struct comedi_device *dev, unsigned int subdevice) @@ -240,6 +245,7 @@ int comedi_get_n_channels(struct comedi_device *dev, unsigned int subdevice) return n; } + EXPORT_SYMBOL_GPL(comedi_get_n_channels); static int __init kcomedilib_module_init(void) diff --git a/drivers/comedi/range.c b/drivers/comedi/range.c index a4e6fe0fb729..ec33724d6576 100644 --- a/drivers/comedi/range.c +++ b/drivers/comedi/range.c @@ -11,25 +11,35 @@ #include "comedidev.h" #include "comedi_internal.h" -const struct comedi_lrange range_bipolar10 = { 1, {BIP_RANGE(10)} }; +const struct comedi_lrange range_bipolar10 = { 1, { BIP_RANGE(10) } }; + EXPORT_SYMBOL_GPL(range_bipolar10); -const struct comedi_lrange range_bipolar5 = { 1, {BIP_RANGE(5)} }; +const struct comedi_lrange range_bipolar5 = { 1, { BIP_RANGE(5) } }; + EXPORT_SYMBOL_GPL(range_bipolar5); -const struct comedi_lrange range_bipolar2_5 = { 1, {BIP_RANGE(2.5)} }; +const struct comedi_lrange range_bipolar2_5 = { 1, { BIP_RANGE(2.5) } }; + EXPORT_SYMBOL_GPL(range_bipolar2_5); -const struct comedi_lrange range_unipolar10 = { 1, {UNI_RANGE(10)} }; +const struct comedi_lrange range_unipolar10 = { 1, { UNI_RANGE(10) } }; + EXPORT_SYMBOL_GPL(range_unipolar10); -const struct comedi_lrange range_unipolar5 = { 1, {UNI_RANGE(5)} }; +const struct comedi_lrange range_unipolar5 = { 1, { UNI_RANGE(5) } }; + EXPORT_SYMBOL_GPL(range_unipolar5); -const struct comedi_lrange range_unipolar2_5 = { 1, {UNI_RANGE(2.5)} }; +const struct comedi_lrange range_unipolar2_5 = { 1, { UNI_RANGE(2.5) } }; + EXPORT_SYMBOL_GPL(range_unipolar2_5); -const struct comedi_lrange range_0_20mA = { 1, {RANGE_mA(0, 20)} }; +const struct comedi_lrange range_0_20mA = { 1, { RANGE_mA(0, 20) } }; + EXPORT_SYMBOL_GPL(range_0_20mA); -const struct comedi_lrange range_4_20mA = { 1, {RANGE_mA(4, 20)} }; +const struct comedi_lrange range_4_20mA = { 1, { RANGE_mA(4, 20) } }; + EXPORT_SYMBOL_GPL(range_4_20mA); -const struct comedi_lrange range_0_32mA = { 1, {RANGE_mA(0, 32)} }; +const struct comedi_lrange range_0_32mA = { 1, { RANGE_mA(0, 32) } }; + EXPORT_SYMBOL_GPL(range_0_32mA); -const struct comedi_lrange range_unknown = { 1, {{0, 1000000, UNIT_none} } }; +const struct comedi_lrange range_unknown = { 1, { { 0, 1000000, UNIT_none} } }; + EXPORT_SYMBOL_GPL(range_unknown); /* @@ -45,8 +55,7 @@ EXPORT_SYMBOL_GPL(range_unknown); * writes: * array of comedi_krange structures to rangeinfo->range_ptr pointer */ -int do_rangeinfo_ioctl(struct comedi_device *dev, - struct comedi_rangeinfo *it) +int do_rangeinfo_ioctl(struct comedi_device *dev, struct comedi_rangeinfo *it) { int subd, chan; const struct comedi_lrange *lr; @@ -118,8 +127,7 @@ int comedi_check_chanlist(struct comedi_subdevice *s, int n, range_len = s->range_table_list[chan]->length; else range_len = 0; - if (chan >= s->n_chan || - CR_RANGE(chanspec) >= range_len) { + if (chan >= s->n_chan || CR_RANGE(chanspec) >= range_len) { dev_warn(dev->class_dev, "bad chanlist[%d]=0x%08x chan=%d range length=%d\n", i, chanspec, chan, range_len); @@ -128,4 +136,5 @@ int comedi_check_chanlist(struct comedi_subdevice *s, int n, } return 0; } + EXPORT_SYMBOL_GPL(comedi_check_chanlist); -- 2.25.1 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel