The `chanlist` member of `struct comedi_cmd` is used by the `COMEDI_CMD` and `COMEDI_CMDTEST` ioctls where it points to a channel list in user memory (but it may be `NULL` for the `COMEDI_CMDTEST` ioctl). It is also used by the low-level drivers, where it points to a copy of the channel list in kernel memory. I want to avoid mixing kernel and user pointers. The low-level comedi drivers that support asynchronous comedi commands have a `do_cmdtest()` handler which is called during processing of the `COMEDI_CMD` and `COMEDI_CMDTEST` ioctls. The `do_cmdtest()` handler takes a pointer to the kernel copy of the `struct comedi_cmd` and the `chanlist` member of the `struct comedi_cmd` currently points to a copy of the channel list in kernel memory (but it may be NULL for the `COMEDI_CMDTEST` ioctl). To help avoid using the `chanlist` member of the `struct comedi_cmd` type as both a user memory pointer and a kernel memory pointer depending on context, add an explicit `chanlist` parameter to the `do_cmdtest()` handlers in the low-level comedi drivers to point to the kernel copy of the channel list. Change those handlers to use that parameter to access the channel list instead of using the struct member. Keep the kernel copy of the `struct comedi_cmd` clean of pointers to user memory by setting its `chanlist` member to NULL. Signed-off-by: Ian Abbott <abbotti@xxxxxxxxx> --- v2: Set the `chanlist` member of `struct comedi_cmd` to `NULL` before calling the the `do_cmdtest()` handler in the low-level driver. Change order of patch sequence. --- drivers/staging/comedi/comedi_fops.c | 10 ++--- drivers/staging/comedi/comedidev.h | 2 +- drivers/staging/comedi/drivers/8255.c | 3 +- .../staging/comedi/drivers/addi-data/addi_common.h | 2 +- .../comedi/drivers/addi-data/hwdrv_apci3120.c | 31 ++++++++------- .../comedi/drivers/addi-data/hwdrv_apci3120.h | 6 ++- .../comedi/drivers/addi-data/hwdrv_apci3200.c | 44 +++++++++++----------- .../comedi/drivers/addi-data/hwdrv_apci3200.h | 6 ++- drivers/staging/comedi/drivers/adl_pci9111.c | 15 ++++---- drivers/staging/comedi/drivers/adl_pci9118.c | 10 +++-- drivers/staging/comedi/drivers/adv_pci1710.c | 10 ++--- drivers/staging/comedi/drivers/amplc_dio200.c | 3 +- drivers/staging/comedi/drivers/amplc_pc236.c | 3 +- drivers/staging/comedi/drivers/amplc_pci224.c | 10 ++--- drivers/staging/comedi/drivers/amplc_pci230.c | 34 +++++++++-------- drivers/staging/comedi/drivers/cb_das16_cs.c | 3 +- drivers/staging/comedi/drivers/cb_pcidas.c | 22 ++++++----- drivers/staging/comedi/drivers/cb_pcidas64.c | 25 ++++++------ drivers/staging/comedi/drivers/cb_pcidda.c | 3 +- drivers/staging/comedi/drivers/comedi_parport.c | 3 +- drivers/staging/comedi/drivers/comedi_test.c | 3 +- drivers/staging/comedi/drivers/das16.c | 12 +++--- drivers/staging/comedi/drivers/das16m1.c | 7 ++-- drivers/staging/comedi/drivers/das1800.c | 9 +++-- drivers/staging/comedi/drivers/das800.c | 16 ++++---- drivers/staging/comedi/drivers/dmm32at.c | 13 ++++--- drivers/staging/comedi/drivers/dt2814.c | 3 +- drivers/staging/comedi/drivers/dt282x.c | 6 ++- drivers/staging/comedi/drivers/dt3000.c | 3 +- drivers/staging/comedi/drivers/gsc_hpdi.c | 12 +++--- drivers/staging/comedi/drivers/me4000.c | 22 ++++++----- drivers/staging/comedi/drivers/me_daq.c | 3 +- drivers/staging/comedi/drivers/ni_6527.c | 3 +- drivers/staging/comedi/drivers/ni_65xx.c | 3 +- drivers/staging/comedi/drivers/ni_660x.c | 5 ++- drivers/staging/comedi/drivers/ni_at_a2150.c | 15 ++++---- drivers/staging/comedi/drivers/ni_atmio16d.c | 3 +- drivers/staging/comedi/drivers/ni_labpc.c | 43 +++++++++++---------- drivers/staging/comedi/drivers/ni_mio_common.c | 20 ++++++---- drivers/staging/comedi/drivers/ni_pcidio.c | 6 ++- drivers/staging/comedi/drivers/ni_tio.h | 3 +- drivers/staging/comedi/drivers/ni_tiocmd.c | 3 +- drivers/staging/comedi/drivers/pcl711.c | 3 +- drivers/staging/comedi/drivers/pcl812.c | 3 +- drivers/staging/comedi/drivers/pcl816.c | 21 ++++++----- drivers/staging/comedi/drivers/pcl818.c | 20 +++++----- drivers/staging/comedi/drivers/pcm_common.c | 3 +- drivers/staging/comedi/drivers/pcm_common.h | 3 +- drivers/staging/comedi/drivers/pcmmio.c | 4 +- drivers/staging/comedi/drivers/pcmuio.c | 4 +- drivers/staging/comedi/drivers/quatech_daqp_cs.c | 3 +- drivers/staging/comedi/drivers/rtd520.c | 3 +- drivers/staging/comedi/drivers/s626.c | 3 +- drivers/staging/comedi/drivers/skel.c | 6 ++- drivers/staging/comedi/drivers/usbdux.c | 6 ++- drivers/staging/comedi/drivers/usbduxfast.c | 3 +- drivers/staging/comedi/drivers/usbduxsigma.c | 6 ++- 57 files changed, 307 insertions(+), 242 deletions(-) diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index c2a32cf..a649551 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -1222,7 +1222,7 @@ static int do_cmd_ioctl(struct comedi_device *dev, goto cleanup; } - ret = s->do_cmdtest(dev, s, &async->cmd); + ret = s->do_cmdtest(dev, s, &async->cmd, async->cmd.chanlist); if (async->cmd.flags & TRIG_BOGUS || ret) { DPRINTK("test returned %d\n", ret); @@ -1322,7 +1322,7 @@ static int do_cmdtest_ioctl(struct comedi_device *dev, } /* load channel/gain list */ - if (cmd.chanlist) { + if (user_chanlist) { chanlist = kmalloc(cmd.chanlist_len * sizeof(int), GFP_KERNEL); if (!chanlist) { @@ -1344,15 +1344,13 @@ static int do_cmdtest_ioctl(struct comedi_device *dev, DPRINTK("bad chanlist\n"); goto cleanup; } - - cmd.chanlist = chanlist; } - ret = s->do_cmdtest(dev, s, &cmd); + cmd.chanlist = NULL; + ret = s->do_cmdtest(dev, s, &cmd, chanlist); /* restore chanlist pointer before copying back */ cmd.chanlist = (unsigned int __force *)user_chanlist; - if (copy_to_user(arg, &cmd, sizeof(struct comedi_cmd))) { DPRINTK("bad cmd address\n"); ret = -EFAULT; diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index cb67a5c..4501cda 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -104,7 +104,7 @@ struct comedi_subdevice { int (*do_cmd) (struct comedi_device *, struct comedi_subdevice *); int (*do_cmdtest) (struct comedi_device *, struct comedi_subdevice *, - struct comedi_cmd *); + struct comedi_cmd *, const unsigned int *); int (*poll) (struct comedi_device *, struct comedi_subdevice *); int (*cancel) (struct comedi_device *, struct comedi_subdevice *); /* int (*do_lock)(struct comedi_device *, struct comedi_subdevice *); */ diff --git a/drivers/staging/comedi/drivers/8255.c b/drivers/staging/comedi/drivers/8255.c index e2506dd..5c69627 100644 --- a/drivers/staging/comedi/drivers/8255.c +++ b/drivers/staging/comedi/drivers/8255.c @@ -226,7 +226,8 @@ static int subdev_8255_insn_config(struct comedi_device *dev, static int subdev_8255_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd) + struct comedi_cmd *cmd, + const unsigned int *chanlist) { int err = 0; unsigned int tmp; diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.h b/drivers/staging/comedi/drivers/addi-data/addi_common.h index b7bbb71..155184d 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_common.h +++ b/drivers/staging/comedi/drivers/addi-data/addi_common.h @@ -108,7 +108,7 @@ struct addi_board { int (*ai_bits)(struct comedi_device *, struct comedi_subdevice *, struct comedi_insn *, unsigned int *); int (*ai_cmdtest)(struct comedi_device *, struct comedi_subdevice *, - struct comedi_cmd *); + struct comedi_cmd *, const unsigned int *); int (*ai_cmd)(struct comedi_device *, struct comedi_subdevice *); int (*ai_cancel)(struct comedi_device *, struct comedi_subdevice *); diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c index d61fce0..ab1be36 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c @@ -458,25 +458,30 @@ int i_APCI3120_StopCyclicAcquisition(struct comedi_device *dev, struct comedi_su /* +----------------------------------------------------------------------------+ -| Function name :int i_APCI3120_CommandTestAnalogInput(struct comedi_device *dev| -| ,struct comedi_subdevice *s,struct comedi_cmd *cmd) | -| | +| Function name : int i_APCI3120_CommandTestAnalogInput( | +| struct comedi_device *dev,struct comedi_subdevice *s | +| ,struct comedi_cmd *cmd,unsigned int *chanlist) | +| | +----------------------------------------------------------------------------+ -| Task : Test validity for a command for cyclic anlog input | -| acquisition | -| | +| Task : Test validity for a command for cyclic anlog input | +| acquisition | +| | +----------------------------------------------------------------------------+ -| Input Parameters : struct comedi_device *dev | -| struct comedi_subdevice *s | -| struct comedi_cmd *cmd | +| Input Parameters : struct comedi_device *dev | +| struct comedi_subdevice *s | +| struct comedi_cmd *cmd | +| const unsigned int *chanlist | +| | +----------------------------------------------------------------------------+ -| Return Value :0 | -| | +| Return Value : 0 | +| | +----------------------------------------------------------------------------+ */ -int i_APCI3120_CommandTestAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd) +int i_APCI3120_CommandTestAnalogInput(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_cmd *cmd, + const unsigned int *chanlist) { int err = 0; int tmp; /* divisor1,divisor2; */ diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.h b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.h index 50eb0a0..5c2f128 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.h +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.h @@ -242,8 +242,10 @@ int i_APCI3120_InsnConfigAnalogInput(struct comedi_device *dev, struct comedi_su struct comedi_insn *insn, unsigned int *data); int i_APCI3120_InsnReadAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); -int i_APCI3120_CommandTestAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd); +int i_APCI3120_CommandTestAnalogInput(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_cmd *cmd, + const unsigned int *chanlist); int i_APCI3120_CommandAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s); /* int i_APCI3120_CancelAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s); */ int i_APCI3120_StopCyclicAcquisition(struct comedi_device *dev, struct comedi_subdevice *s); diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c index f6f5092..5d6e3b0 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c @@ -2533,30 +2533,30 @@ int i_APCI3200_InsnWriteReleaseAnalogInput(struct comedi_device *dev, /* +----------------------------------------------------------------------------+ - | Function name :int i_APCI3200_CommandTestAnalogInput(struct comedi_device *dev| - | ,struct comedi_subdevice *s,struct comedi_cmd *cmd) | - | | + | Function name : int i_APCI3200_CommandTestAnalogInput( | + | struct comedi_device *dev,struct comedi_subdevice *s, | + | struct comedi_cmd *cmd, unsigned int *chanlist) | + | | +----------------------------------------------------------------------------+ - | Task : Test validity for a command for cyclic anlog input | - | acquisition | - | | + | Task : Test validity for a command for cyclic anlog input | + | acquisition | + | | +----------------------------------------------------------------------------+ - | Input Parameters : struct comedi_device *dev | - | struct comedi_subdevice *s | - | struct comedi_cmd *cmd | - | | - | - | | - | | - | | + | Input Parameters : struct comedi_device *dev | + | struct comedi_subdevice *s | + | struct comedi_cmd *cmd | + | const unsigned int *chanlist | + | | +----------------------------------------------------------------------------+ - | Return Value :0 | - | | + | Return Value : 0 | + | | +----------------------------------------------------------------------------+ */ -int i_APCI3200_CommandTestAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd) +int i_APCI3200_CommandTestAnalogInput(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_cmd *cmd, + const unsigned int *chanlist) { int err = 0; @@ -2638,10 +2638,10 @@ int i_APCI3200_CommandTestAnalogInput(struct comedi_device *dev, struct comedi_s i_APCI3200_Reset(dev); return 2; } - /* i_FirstChannel=cmd->chanlist[0]; */ - s_BoardInfos[dev->minor].i_FirstChannel = cmd->chanlist[0]; - /* i_LastChannel=cmd->chanlist[1]; */ - s_BoardInfos[dev->minor].i_LastChannel = cmd->chanlist[1]; + /* i_FirstChannel=chanlist[0]; */ + s_BoardInfos[dev->minor].i_FirstChannel = chanlist[0]; + /* i_LastChannel=chanlist[1]; */ + s_BoardInfos[dev->minor].i_LastChannel = chanlist[1]; if (cmd->convert_src == TRIG_TIMER) { ui_ConvertTime = cmd->convert_arg & 0xFFFF; diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.h b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.h index 812a9c4..f641081 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.h +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.h @@ -170,8 +170,10 @@ int i_APCI3200_InsnBits_AnalogInput_Test(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data); int i_APCI3200_StopCyclicAcquisition(struct comedi_device *dev, struct comedi_subdevice *s); int i_APCI3200_InterruptHandleEos(struct comedi_device *dev); -int i_APCI3200_CommandTestAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd); +int i_APCI3200_CommandTestAnalogInput(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_cmd *cmd, + const unsigned int *chanlist); int i_APCI3200_CommandAnalogInput(struct comedi_device *dev, struct comedi_subdevice *s); int i_APCI3200_ReadDigitalInput(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); diff --git a/drivers/staging/comedi/drivers/adl_pci9111.c b/drivers/staging/comedi/drivers/adl_pci9111.c index 91efaa4..fce0dc9 100644 --- a/drivers/staging/comedi/drivers/adl_pci9111.c +++ b/drivers/staging/comedi/drivers/adl_pci9111.c @@ -324,7 +324,8 @@ static int pci9111_ai_cancel(struct comedi_device *dev, static int pci9111_ai_do_cmd_test(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd) + struct comedi_cmd *cmd, + const unsigned int *chanlist) { struct pci9111_private_data *dev_private = dev->private; int tmp; @@ -460,25 +461,25 @@ static int pci9111_ai_do_cmd_test(struct comedi_device *dev, /* Step 5 : check channel list */ - if (cmd->chanlist) { + if (chanlist) { - range = CR_RANGE(cmd->chanlist[0]); - reference = CR_AREF(cmd->chanlist[0]); + range = CR_RANGE(chanlist[0]); + reference = CR_AREF(chanlist[0]); if (cmd->chanlist_len > 1) { for (i = 0; i < cmd->chanlist_len; i++) { - if (CR_CHAN(cmd->chanlist[i]) != i) { + if (CR_CHAN(chanlist[i]) != i) { comedi_error(dev, "entries in chanlist must be consecutive " "channels,counting upwards from 0\n"); error++; } - if (CR_RANGE(cmd->chanlist[i]) != range) { + if (CR_RANGE(chanlist[i]) != range) { comedi_error(dev, "entries in chanlist must all have the same gain\n"); error++; } - if (CR_AREF(cmd->chanlist[i]) != reference) { + if (CR_AREF(chanlist[i]) != reference) { comedi_error(dev, "entries in chanlist must all have the same reference\n"); error++; diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c index f7b254d..c674a18 100644 --- a/drivers/staging/comedi/drivers/adl_pci9118.c +++ b/drivers/staging/comedi/drivers/adl_pci9118.c @@ -346,7 +346,8 @@ struct pci9118_private { static int check_channel_list(struct comedi_device *dev, struct comedi_subdevice *s, int n_chan, - unsigned int *chanlist, int frontadd, int backadd) + const unsigned int *chanlist, int frontadd, + int backadd) { const struct boardtype *this_board = comedi_board(dev); struct pci9118_private *devpriv = dev->private; @@ -1093,7 +1094,8 @@ static int pci9118_ai_inttrig(struct comedi_device *dev, static int pci9118_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd) + struct comedi_cmd *cmd, + const unsigned int *chanlist) { const struct boardtype *this_board = comedi_board(dev); struct pci9118_private *devpriv = dev->private; @@ -1325,9 +1327,9 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev, if (err) return 4; - if (cmd->chanlist) + if (chanlist) if (!check_channel_list(dev, s, cmd->chanlist_len, - cmd->chanlist, 0, 0)) + chanlist, 0, 0)) return 5; /* incorrect channels list */ return 0; diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index 0fd021062..37e558d 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -341,7 +341,7 @@ static const unsigned int muxonechan[] = { */ static int check_channel_list(struct comedi_device *dev, struct comedi_subdevice *s, - unsigned int *chanlist, unsigned int n_chan) + const unsigned int *chanlist, unsigned int n_chan) { unsigned int chansegment[32]; unsigned int i, nowmustbechan, seglen, segpos; @@ -1038,7 +1038,8 @@ static int pci171x_ai_docmd_and_mode(int mode, struct comedi_device *dev, */ static int pci171x_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd) + struct comedi_cmd *cmd, + const unsigned int *chanlist) { const struct boardtype *this_board = comedi_board(dev); struct pci1710_private *devpriv = dev->private; @@ -1129,9 +1130,8 @@ static int pci171x_ai_cmdtest(struct comedi_device *dev, /* step 5: complain about special chanlist considerations */ - if (cmd->chanlist) { - if (!check_channel_list(dev, s, cmd->chanlist, - cmd->chanlist_len)) + if (chanlist) { + if (!check_channel_list(dev, s, chanlist, cmd->chanlist_len)) return 5; /* incorrect channels list */ } diff --git a/drivers/staging/comedi/drivers/amplc_dio200.c b/drivers/staging/comedi/drivers/amplc_dio200.c index b7cfc13a..cb0fe2d 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200.c +++ b/drivers/staging/comedi/drivers/amplc_dio200.c @@ -768,7 +768,8 @@ static int dio200_subdev_intr_cancel(struct comedi_device *dev, */ static int dio200_subdev_intr_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_cmd *cmd) + struct comedi_subdevice *s, struct comedi_cmd *cmd, + const unsigned int *chanlist) { int err = 0; unsigned int tmp; diff --git a/drivers/staging/comedi/drivers/amplc_pc236.c b/drivers/staging/comedi/drivers/amplc_pc236.c index a957cd8..f4648ed 100644 --- a/drivers/staging/comedi/drivers/amplc_pc236.c +++ b/drivers/staging/comedi/drivers/amplc_pc236.c @@ -310,7 +310,8 @@ static int pc236_intr_insn(struct comedi_device *dev, */ static int pc236_intr_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd) + struct comedi_cmd *cmd, + const unsigned int *chanlist) { int err = 0; int tmp; diff --git a/drivers/staging/comedi/drivers/amplc_pci224.c b/drivers/staging/comedi/drivers/amplc_pci224.c index 365f911..338316d 100644 --- a/drivers/staging/comedi/drivers/amplc_pci224.c +++ b/drivers/staging/comedi/drivers/amplc_pci224.c @@ -714,7 +714,7 @@ pci224_ao_inttrig_start(struct comedi_device *dev, struct comedi_subdevice *s, */ static int pci224_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd) + struct comedi_cmd *cmd, const unsigned int *chanlist) { struct pci224_private *devpriv = dev->private; int err = 0; @@ -933,7 +933,7 @@ pci224_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, /* Step 5: check channel list. */ - if (cmd->chanlist && (cmd->chanlist_len > 0)) { + if (chanlist && (cmd->chanlist_len > 0)) { unsigned int range; enum { range_err = 1, dupchan_err = 2, }; unsigned errors; @@ -946,16 +946,16 @@ pci224_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, * * Check the list has no duplicate channels. */ - range = CR_RANGE(cmd->chanlist[0]); + range = CR_RANGE(chanlist[0]); errors = 0; tmp = 0; for (n = 0; n < cmd->chanlist_len; n++) { - ch = CR_CHAN(cmd->chanlist[n]); + ch = CR_CHAN(chanlist[n]); if (tmp & (1U << ch)) errors |= dupchan_err; tmp |= (1U << ch); - if (CR_RANGE(cmd->chanlist[n]) != range) + if (CR_RANGE(chanlist[n]) != range) errors |= range_err; } diff --git a/drivers/staging/comedi/drivers/amplc_pci230.c b/drivers/staging/comedi/drivers/amplc_pci230.c index 4c9f131..301367a 100644 --- a/drivers/staging/comedi/drivers/amplc_pci230.c +++ b/drivers/staging/comedi/drivers/amplc_pci230.c @@ -951,7 +951,8 @@ static int pci230_ao_rinsn(struct comedi_device *dev, } static int pci230_ao_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_cmd *cmd) + struct comedi_subdevice *s, struct comedi_cmd *cmd, + const unsigned int *chanlist) { const struct pci230_board *thisboard = comedi_board(dev); struct pci230_private *devpriv = dev->private; @@ -1117,7 +1118,7 @@ static int pci230_ao_cmdtest(struct comedi_device *dev, /* Step 5: check channel list if it exists. */ - if (cmd->chanlist && cmd->chanlist_len > 0) { + if (chanlist && cmd->chanlist_len > 0) { enum { seq_err = (1 << 0), range_err = (1 << 1) @@ -1127,12 +1128,12 @@ static int pci230_ao_cmdtest(struct comedi_device *dev, unsigned int chan, prev_chan; unsigned int range, first_range; - prev_chan = CR_CHAN(cmd->chanlist[0]); - first_range = CR_RANGE(cmd->chanlist[0]); + prev_chan = CR_CHAN(chanlist[0]); + first_range = CR_RANGE(chanlist[0]); errors = 0; for (n = 1; n < cmd->chanlist_len; n++) { - chan = CR_CHAN(cmd->chanlist[n]); - range = CR_RANGE(cmd->chanlist[n]); + chan = CR_CHAN(chanlist[n]); + range = CR_RANGE(chanlist[n]); /* Channel numbers must strictly increase. */ if (chan < prev_chan) errors |= seq_err; @@ -1603,7 +1604,8 @@ static int pci230_ai_check_scan_period(struct comedi_cmd *cmd) } static int pci230_ai_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_cmd *cmd) + struct comedi_subdevice *s, struct comedi_cmd *cmd, + const unsigned int *chanlist) { const struct pci230_board *thisboard = comedi_board(dev); struct pci230_private *devpriv = dev->private; @@ -1705,9 +1707,9 @@ static int pci230_ai_cmdtest(struct comedi_device *dev, if (devpriv->hwver == 0) { /* PCI230 or PCI260. Max speed depends whether * single-ended or pseudo-differential. */ - if (cmd->chanlist && (cmd->chanlist_len > 0)) { + if (chanlist && (cmd->chanlist_len > 0)) { /* Peek analogue reference of first channel. */ - if (CR_AREF(cmd->chanlist[0]) == AREF_DIFF) + if (CR_AREF(chanlist[0]) == AREF_DIFF) max_speed_ai = MAX_SPEED_AI_DIFF; else max_speed_ai = MAX_SPEED_AI_SE; @@ -1846,7 +1848,7 @@ static int pci230_ai_cmdtest(struct comedi_device *dev, /* Step 5: check channel list if it exists. */ - if (cmd->chanlist && cmd->chanlist_len > 0) { + if (chanlist && cmd->chanlist_len > 0) { enum { seq_err = 1 << 0, rangepair_err = 1 << 1, @@ -1867,9 +1869,9 @@ static int pci230_ai_cmdtest(struct comedi_device *dev, errors = 0; prev_chan = prev_aref = prev_range = prev_polarity = 0; for (n = 0; n < cmd->chanlist_len; n++) { - chan = CR_CHAN(cmd->chanlist[n]); - range = CR_RANGE(cmd->chanlist[n]); - aref = CR_AREF(cmd->chanlist[n]); + chan = CR_CHAN(chanlist[n]); + range = CR_RANGE(chanlist[n]); + aref = CR_AREF(chanlist[n]); polarity = pci230_ai_bipolar[range]; /* Only the first half of the channels are available if * differential. (These are remapped in software. In @@ -1886,8 +1888,8 @@ static int pci230_ai_cmdtest(struct comedi_device *dev, subseq_len = n; } if ((subseq_len > 0) - && (cmd->chanlist[n] != - cmd->chanlist[n % subseq_len])) { + && (chanlist[n] != + chanlist[n % subseq_len])) { errors |= seq_err; } /* Channels must have same AREF. */ @@ -1936,7 +1938,7 @@ static int pci230_ai_cmdtest(struct comedi_device *dev, * does, and we can't tell them apart! */ if ((subseq_len > 1) - && (CR_CHAN(cmd->chanlist[0]) != 0)) { + && (CR_CHAN(chanlist[0]) != 0)) { errors |= buggy_chan0_err; } } diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c index a3d53ba..3599ec7 100644 --- a/drivers/staging/comedi/drivers/cb_das16_cs.c +++ b/drivers/staging/comedi/drivers/cb_das16_cs.c @@ -164,7 +164,8 @@ static int das16cs_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) static int das16cs_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd) + struct comedi_cmd *cmd, + const unsigned int *chanlist) { int err = 0; int tmp; diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index 4dd87c2..ff505952 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -795,7 +795,8 @@ static int trimpot_read_insn(struct comedi_device *dev, static int cb_pcidas_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd) + struct comedi_cmd *cmd, + const unsigned int *chanlist) { const struct cb_pcidas_board *thisboard = comedi_board(dev); struct cb_pcidas_private *devpriv = dev->private; @@ -940,17 +941,17 @@ static int cb_pcidas_ai_cmdtest(struct comedi_device *dev, return 4; /* check channel/gain list against card's limitations */ - if (cmd->chanlist) { - gain = CR_RANGE(cmd->chanlist[0]); - start_chan = CR_CHAN(cmd->chanlist[0]); + if (chanlist) { + gain = CR_RANGE(chanlist[0]); + start_chan = CR_CHAN(chanlist[0]); for (i = 1; i < cmd->chanlist_len; i++) { - if (CR_CHAN(cmd->chanlist[i]) != + if (CR_CHAN(chanlist[i]) != (start_chan + i) % s->n_chan) { comedi_error(dev, "entries in chanlist must be consecutive channels, counting upwards\n"); err++; } - if (CR_RANGE(cmd->chanlist[i]) != gain) { + if (CR_RANGE(chanlist[i]) != gain) { comedi_error(dev, "entries in chanlist must all have the same gain\n"); err++; @@ -1072,7 +1073,8 @@ static int cb_pcidas_ai_cmd(struct comedi_device *dev, static int cb_pcidas_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd) + struct comedi_cmd *cmd, + const unsigned int *chanlist) { const struct cb_pcidas_board *thisboard = comedi_board(dev); struct cb_pcidas_private *devpriv = dev->private; @@ -1166,9 +1168,9 @@ static int cb_pcidas_ao_cmdtest(struct comedi_device *dev, return 4; /* check channel/gain list against card's limitations */ - if (cmd->chanlist && cmd->chanlist_len > 1) { - if (CR_CHAN(cmd->chanlist[0]) != 0 || - CR_CHAN(cmd->chanlist[1]) != 1) { + if (chanlist && cmd->chanlist_len > 1) { + if (CR_CHAN(chanlist[0]) != 0 || + CR_CHAN(chanlist[1]) != 1) { comedi_error(dev, "channels must be ordered channel 0, channel 1 in chanlist\n"); err++; diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c index 7168883..75c51f0 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas64.c +++ b/drivers/staging/comedi/drivers/cb_pcidas64.c @@ -1110,12 +1110,12 @@ static int ao_readback_insn(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data); static int ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s); static int ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd); + struct comedi_cmd *cmd, const unsigned int *chanlist); static int ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s); static int ao_inttrig(struct comedi_device *dev, struct comedi_subdevice *subdev, unsigned int trig_num); static int ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd); + struct comedi_cmd *cmd, const unsigned int *chanlist); static irqreturn_t handle_interrupt(int irq, void *d); static int ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s); static int ao_cancel(struct comedi_device *dev, struct comedi_subdevice *s); @@ -2105,7 +2105,7 @@ static int ai_config_insn(struct comedi_device *dev, struct comedi_subdevice *s, } static int ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd) + struct comedi_cmd *cmd, const unsigned int *chanlist) { int err = 0; int tmp; @@ -2253,10 +2253,10 @@ static int ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, return 4; /* make sure user is doesn't change analog reference mid chanlist */ - if (cmd->chanlist) { - aref = CR_AREF(cmd->chanlist[0]); + if (chanlist) { + aref = CR_AREF(chanlist[0]); for (i = 1; i < cmd->chanlist_len; i++) { - if (aref != CR_AREF(cmd->chanlist[i])) { + if (aref != CR_AREF(chanlist[i])) { comedi_error(dev, "all elements in chanlist must use the same analog reference"); err++; @@ -2265,10 +2265,9 @@ static int ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, } /* check 4020 chanlist */ if (board(dev)->layout == LAYOUT_4020) { - unsigned int first_channel = CR_CHAN(cmd->chanlist[0]); + unsigned int first_channel = CR_CHAN(chanlist[0]); for (i = 1; i < cmd->chanlist_len; i++) { - if (CR_CHAN(cmd->chanlist[i]) != - first_channel + i) { + if (CR_CHAN(chanlist[i]) != first_channel + i) { comedi_error(dev, "chanlist must use consecutive channels"); err++; @@ -3463,7 +3462,7 @@ static int ao_inttrig(struct comedi_device *dev, struct comedi_subdevice *s, } static int ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd) + struct comedi_cmd *cmd, const unsigned int *chanlist) { int err = 0; int tmp; @@ -3559,10 +3558,10 @@ static int ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, if (err) return 4; - if (cmd->chanlist) { - unsigned int first_channel = CR_CHAN(cmd->chanlist[0]); + if (chanlist) { + unsigned int first_channel = CR_CHAN(chanlist[0]); for (i = 1; i < cmd->chanlist_len; i++) { - if (CR_CHAN(cmd->chanlist[i]) != first_channel + i) { + if (CR_CHAN(chanlist[i]) != first_channel + i) { comedi_error(dev, "chanlist must use consecutive channels"); err++; diff --git a/drivers/staging/comedi/drivers/cb_pcidda.c b/drivers/staging/comedi/drivers/cb_pcidda.c index ad9f3a3..667b54b2 100644 --- a/drivers/staging/comedi/drivers/cb_pcidda.c +++ b/drivers/staging/comedi/drivers/cb_pcidda.c @@ -242,7 +242,8 @@ static int cb_pcidda_ai_cmd(struct comedi_device *dev, #if 0 static int cb_pcidda_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd) + struct comedi_cmd *cmd, + const unsigned int *chanlist) { int err = 0; int tmp; diff --git a/drivers/staging/comedi/drivers/comedi_parport.c b/drivers/staging/comedi/drivers/comedi_parport.c index c9e40a9..02f0f0b 100644 --- a/drivers/staging/comedi/drivers/comedi_parport.c +++ b/drivers/staging/comedi/drivers/comedi_parport.c @@ -173,7 +173,8 @@ static int parport_intr_insn(struct comedi_device *dev, static int parport_intr_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd) + struct comedi_cmd *cmd, + const unsigned int *chanlist) { int err = 0; int tmp; diff --git a/drivers/staging/comedi/drivers/comedi_test.c b/drivers/staging/comedi/drivers/comedi_test.c index b0f0ec5..cb5fc87 100644 --- a/drivers/staging/comedi/drivers/comedi_test.c +++ b/drivers/staging/comedi/drivers/comedi_test.c @@ -226,7 +226,8 @@ static void waveform_ai_interrupt(unsigned long arg) static int waveform_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd) + struct comedi_cmd *cmd, + const unsigned int *chanlist) { int err = 0; int tmp; diff --git a/drivers/staging/comedi/drivers/das16.c b/drivers/staging/comedi/drivers/das16.c index 744376a..b0bfacf 100644 --- a/drivers/staging/comedi/drivers/das16.c +++ b/drivers/staging/comedi/drivers/das16.c @@ -395,7 +395,7 @@ struct das16_private_struct { #define devpriv ((struct das16_private_struct *)(dev->private)) static int das16_cmd_test(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd) + struct comedi_cmd *cmd, const unsigned int *chanlist) { const struct das16_board *board = comedi_board(dev); int err = 0, tmp; @@ -530,11 +530,11 @@ static int das16_cmd_test(struct comedi_device *dev, struct comedi_subdevice *s, return 4; /* check channel/gain list against card's limitations */ - if (cmd->chanlist) { - gain = CR_RANGE(cmd->chanlist[0]); - start_chan = CR_CHAN(cmd->chanlist[0]); + if (chanlist) { + gain = CR_RANGE(chanlist[0]); + start_chan = CR_CHAN(chanlist[0]); for (i = 1; i < cmd->chanlist_len; i++) { - if (CR_CHAN(cmd->chanlist[i]) != + if (CR_CHAN(chanlist[i]) != (start_chan + i) % s->n_chan) { comedi_error(dev, "entries in chanlist must be " @@ -542,7 +542,7 @@ static int das16_cmd_test(struct comedi_device *dev, struct comedi_subdevice *s, "counting upwards\n"); err++; } - if (CR_RANGE(cmd->chanlist[i]) != gain) { + if (CR_RANGE(chanlist[i]) != gain) { comedi_error(dev, "entries in chanlist must all " "have the same gain\n"); diff --git a/drivers/staging/comedi/drivers/das16m1.c b/drivers/staging/comedi/drivers/das16m1.c index 7f0668f..abb9600 100644 --- a/drivers/staging/comedi/drivers/das16m1.c +++ b/drivers/staging/comedi/drivers/das16m1.c @@ -165,7 +165,8 @@ static void munge_sample_array(short *array, unsigned int num_elements) } static int das16m1_cmd_test(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_cmd *cmd) + struct comedi_subdevice *s, struct comedi_cmd *cmd, + const unsigned int *chanlist) { const struct das16m1_board *board = comedi_board(dev); unsigned int err = 0, tmp, i; @@ -267,10 +268,10 @@ static int das16m1_cmd_test(struct comedi_device *dev, return 4; /* check chanlist against board's peculiarities */ - if (cmd->chanlist && cmd->chanlist_len > 1) { + if (chanlist && cmd->chanlist_len > 1) { for (i = 0; i < cmd->chanlist_len; i++) { /* even/odd channels must go into even/odd queue addresses */ - if ((i % 2) != (CR_CHAN(cmd->chanlist[i]) % 2)) { + if ((i % 2) != (CR_CHAN(chanlist[i]) % 2)) { comedi_error(dev, "bad chanlist:\n" " even/odd channels must go have even/odd chanlist indices"); err++; diff --git a/drivers/staging/comedi/drivers/das1800.c b/drivers/staging/comedi/drivers/das1800.c index 711d4e2..99aad86 100644 --- a/drivers/staging/comedi/drivers/das1800.c +++ b/drivers/staging/comedi/drivers/das1800.c @@ -781,7 +781,8 @@ static unsigned int burst_convert_arg(unsigned int convert_arg, int round_mode) /* test analog input cmd */ static int das1800_ai_do_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd) + struct comedi_cmd *cmd, + const unsigned int *chanlist) { int err = 0; int tmp; @@ -939,10 +940,10 @@ static int das1800_ai_do_cmdtest(struct comedi_device *dev, return 4; /* make sure user is not trying to mix unipolar and bipolar ranges */ - if (cmd->chanlist) { - unipolar = CR_RANGE(cmd->chanlist[0]) & UNIPOLAR; + if (chanlist) { + unipolar = CR_RANGE(chanlist[0]) & UNIPOLAR; for (i = 1; i < cmd->chanlist_len; i++) { - if (unipolar != (CR_RANGE(cmd->chanlist[i]) & UNIPOLAR)) { + if (unipolar != (CR_RANGE(chanlist[i]) & UNIPOLAR)) { comedi_error(dev, "unipolar and bipolar ranges cannot be mixed in the chanlist"); err++; diff --git a/drivers/staging/comedi/drivers/das800.c b/drivers/staging/comedi/drivers/das800.c index 8e89101..273602f 100644 --- a/drivers/staging/comedi/drivers/das800.c +++ b/drivers/staging/comedi/drivers/das800.c @@ -263,7 +263,8 @@ static void enable_das800(struct comedi_device *dev); static void disable_das800(struct comedi_device *dev); static int das800_ai_do_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd); + struct comedi_cmd *cmd, + const unsigned int *chanlist); static int das800_ai_do_cmd(struct comedi_device *dev, struct comedi_subdevice *s); static int das800_ai_rinsn(struct comedi_device *dev, @@ -602,7 +603,8 @@ static void disable_das800(struct comedi_device *dev) static int das800_ai_do_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd) + struct comedi_cmd *cmd, + const unsigned int *chanlist) { int err = 0; int tmp; @@ -703,17 +705,17 @@ static int das800_ai_do_cmdtest(struct comedi_device *dev, return 4; /* check channel/gain list against card's limitations */ - if (cmd->chanlist) { - gain = CR_RANGE(cmd->chanlist[0]); - startChan = CR_CHAN(cmd->chanlist[0]); + if (chanlist) { + gain = CR_RANGE(chanlist[0]); + startChan = CR_CHAN(chanlist[0]); for (i = 1; i < cmd->chanlist_len; i++) { - if (CR_CHAN(cmd->chanlist[i]) != + if (CR_CHAN(chanlist[i]) != (startChan + i) % N_CHAN_AI) { comedi_error(dev, "entries in chanlist must be consecutive channels, counting upwards\n"); err++; } - if (CR_RANGE(cmd->chanlist[i]) != gain) { + if (CR_RANGE(chanlist[i]) != gain) { comedi_error(dev, "entries in chanlist must all have the same gain\n"); err++; diff --git a/drivers/staging/comedi/drivers/dmm32at.c b/drivers/staging/comedi/drivers/dmm32at.c index 0703ca5..0add8c3 100644 --- a/drivers/staging/comedi/drivers/dmm32at.c +++ b/drivers/staging/comedi/drivers/dmm32at.c @@ -252,7 +252,8 @@ static int dmm32at_ns_to_timer(unsigned int *ns, int round) static int dmm32at_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd) + struct comedi_cmd *cmd, + const unsigned int *chanlist) { int err = 0; int tmp; @@ -403,17 +404,17 @@ static int dmm32at_ai_cmdtest(struct comedi_device *dev, /* step 5 check the channel list, the channel list for this board must be consecutive and gains must be the same */ - if (cmd->chanlist) { - gain = CR_RANGE(cmd->chanlist[0]); - start_chan = CR_CHAN(cmd->chanlist[0]); + if (chanlist) { + gain = CR_RANGE(chanlist[0]); + start_chan = CR_CHAN(chanlist[0]); for (i = 1; i < cmd->chanlist_len; i++) { - if (CR_CHAN(cmd->chanlist[i]) != + if (CR_CHAN(chanlist[i]) != (start_chan + i) % s->n_chan) { comedi_error(dev, "entries in chanlist must be consecutive channels, counting upwards\n"); err++; } - if (CR_RANGE(cmd->chanlist[i]) != gain) { + if (CR_RANGE(chanlist[i]) != gain) { comedi_error(dev, "entries in chanlist must all have the same gain\n"); err++; diff --git a/drivers/staging/comedi/drivers/dt2814.c b/drivers/staging/comedi/drivers/dt2814.c index ce5d837..41d04d1 100644 --- a/drivers/staging/comedi/drivers/dt2814.c +++ b/drivers/staging/comedi/drivers/dt2814.c @@ -124,7 +124,8 @@ static int dt2814_ns_to_timer(unsigned int *ns, unsigned int flags) } static int dt2814_ai_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_cmd *cmd) + struct comedi_subdevice *s, struct comedi_cmd *cmd, + const unsigned int *chanlist) { int err = 0; int tmp; diff --git a/drivers/staging/comedi/drivers/dt282x.c b/drivers/staging/comedi/drivers/dt282x.c index b7c43c8..c66a158 100644 --- a/drivers/staging/comedi/drivers/dt282x.c +++ b/drivers/staging/comedi/drivers/dt282x.c @@ -576,7 +576,8 @@ 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 unsigned int *chanlist) { const struct dt282x_board *board = comedi_board(dev); int err = 0; @@ -857,7 +858,8 @@ 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, + const unsigned int *chanlist) { int err = 0; int tmp; diff --git a/drivers/staging/comedi/drivers/dt3000.c b/drivers/staging/comedi/drivers/dt3000.c index 3a940a2..3338bf6 100644 --- a/drivers/staging/comedi/drivers/dt3000.c +++ b/drivers/staging/comedi/drivers/dt3000.c @@ -403,7 +403,8 @@ static void dt3k_ai_empty_fifo(struct comedi_device *dev, } static int dt3k_ai_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_cmd *cmd) + struct comedi_subdevice *s, struct comedi_cmd *cmd, + const unsigned int *chanlist) { int err = 0; int tmp; diff --git a/drivers/staging/comedi/drivers/gsc_hpdi.c b/drivers/staging/comedi/drivers/gsc_hpdi.c index 5d3fa71..83d46d1 100644 --- a/drivers/staging/comedi/drivers/gsc_hpdi.c +++ b/drivers/staging/comedi/drivers/gsc_hpdi.c @@ -55,7 +55,7 @@ support could be added to this driver. static void abort_dma(struct comedi_device *dev, unsigned int channel); static int hpdi_cmd(struct comedi_device *dev, struct comedi_subdevice *s); static int hpdi_cmd_test(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd); + struct comedi_cmd *cmd, const unsigned int *chanlist); static int hpdi_cancel(struct comedi_device *dev, struct comedi_subdevice *s); static irqreturn_t handle_interrupt(int irq, void *d); static int dio_config_block_size(struct comedi_device *dev, unsigned int *data); @@ -720,7 +720,7 @@ static int dio_config_block_size(struct comedi_device *dev, unsigned int *data) } static int di_cmd_test(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd) + struct comedi_cmd *cmd, const unsigned int *chanlist) { int err = 0; int tmp; @@ -802,11 +802,11 @@ static int di_cmd_test(struct comedi_device *dev, struct comedi_subdevice *s, if (err) return 4; - if (!cmd->chanlist) + if (!chanlist) return 0; for (i = 1; i < cmd->chanlist_len; i++) { - if (CR_CHAN(cmd->chanlist[i]) != i) { + if (CR_CHAN(chanlist[i]) != i) { /* XXX could support 8 or 16 channels */ comedi_error(dev, "chanlist must be ch 0 to 31 in order"); @@ -822,12 +822,12 @@ static int di_cmd_test(struct comedi_device *dev, struct comedi_subdevice *s, } static int hpdi_cmd_test(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd) + struct comedi_cmd *cmd, const unsigned int *chanlist) { if (priv(dev)->dio_config_output) return -EINVAL; else - return di_cmd_test(dev, s, cmd); + return di_cmd_test(dev, s, cmd, chanlist); } static inline void hpdi_writel(struct comedi_device *dev, uint32_t bits, diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index d7c5146..6efe5e4 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -621,7 +621,8 @@ static int me4000_ai_cancel(struct comedi_device *dev, } static int ai_check_chanlist(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_cmd *cmd) + struct comedi_subdevice *s, struct comedi_cmd *cmd, + const unsigned int *chanlist) { const struct me4000_board *thisboard = comedi_board(dev); int aref; @@ -640,15 +641,15 @@ static int ai_check_chanlist(struct comedi_device *dev, } /* Check the pointer */ - if (!cmd->chanlist) { + if (!chanlist) { dev_err(dev->class_dev, "NULL pointer to channel list\n"); return -EFAULT; } /* Check whether aref is equal for all entries */ - aref = CR_AREF(cmd->chanlist[0]); + aref = CR_AREF(chanlist[0]); for (i = 0; i < cmd->chanlist_len; i++) { - if (CR_AREF(cmd->chanlist[i]) != aref) { + if (CR_AREF(chanlist[i]) != aref) { dev_err(dev->class_dev, "Mode is not equal for all entries\n"); return -EINVAL; @@ -658,7 +659,7 @@ static int ai_check_chanlist(struct comedi_device *dev, /* Check whether channels are available for this ending */ if (aref == SDF_DIFF) { for (i = 0; i < cmd->chanlist_len; i++) { - if (CR_CHAN(cmd->chanlist[i]) >= + if (CR_CHAN(chanlist[i]) >= thisboard->ai_diff_nchan) { dev_err(dev->class_dev, "Channel number to high\n"); @@ -667,7 +668,7 @@ static int ai_check_chanlist(struct comedi_device *dev, } } else { for (i = 0; i < cmd->chanlist_len; i++) { - if (CR_CHAN(cmd->chanlist[i]) >= thisboard->ai_nchan) { + if (CR_CHAN(chanlist[i]) >= thisboard->ai_nchan) { dev_err(dev->class_dev, "Channel number to high\n"); return -EINVAL; @@ -678,8 +679,8 @@ static int ai_check_chanlist(struct comedi_device *dev, /* Check if bipolar is set for all entries when in differential mode */ if (aref == SDF_DIFF) { for (i = 0; i < cmd->chanlist_len; i++) { - if (CR_RANGE(cmd->chanlist[i]) != 1 && - CR_RANGE(cmd->chanlist[i]) != 2) { + if (CR_RANGE(chanlist[i]) != 1 && + CR_RANGE(chanlist[i]) != 2) { dev_err(dev->class_dev, "Bipolar is not selected in differential mode\n"); return -EINVAL; @@ -909,7 +910,8 @@ static int me4000_ai_do_cmd(struct comedi_device *dev, */ static int me4000_ai_do_cmd_test(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd) + struct comedi_cmd *cmd, + const unsigned int *chanlist) { unsigned int init_ticks; @@ -1191,7 +1193,7 @@ static int me4000_ai_do_cmd_test(struct comedi_device *dev, /* * Stage 5. Check the channel list. */ - if (ai_check_chanlist(dev, s, cmd)) + if (ai_check_chanlist(dev, s, cmd, chanlist)) return 5; return 0; diff --git a/drivers/staging/comedi/drivers/me_daq.c b/drivers/staging/comedi/drivers/me_daq.c index 2ce0b14..d94603d 100644 --- a/drivers/staging/comedi/drivers/me_daq.c +++ b/drivers/staging/comedi/drivers/me_daq.c @@ -418,7 +418,8 @@ static int me_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) /* Test analog input command */ static int me_ai_do_cmd_test(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_cmd *cmd) + struct comedi_subdevice *s, struct comedi_cmd *cmd, + const unsigned int *chanlist) { return 0; } diff --git a/drivers/staging/comedi/drivers/ni_6527.c b/drivers/staging/comedi/drivers/ni_6527.c index 8125d50..a43f34a 100644 --- a/drivers/staging/comedi/drivers/ni_6527.c +++ b/drivers/staging/comedi/drivers/ni_6527.c @@ -221,7 +221,8 @@ static irqreturn_t ni6527_interrupt(int irq, void *d) static int ni6527_intr_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd) + struct comedi_cmd *cmd, + const unsigned int *chanlist) { int err = 0; int tmp; diff --git a/drivers/staging/comedi/drivers/ni_65xx.c b/drivers/staging/comedi/drivers/ni_65xx.c index aab2b06..68416fe 100644 --- a/drivers/staging/comedi/drivers/ni_65xx.c +++ b/drivers/staging/comedi/drivers/ni_65xx.c @@ -483,7 +483,8 @@ static irqreturn_t ni_65xx_interrupt(int irq, void *d) static int ni_65xx_intr_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd) + struct comedi_cmd *cmd, + const unsigned int *chanlist) { int err = 0; int tmp; diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c index df2f3b0..fb6c5ca 100644 --- a/drivers/staging/comedi/drivers/ni_660x.c +++ b/drivers/staging/comedi/drivers/ni_660x.c @@ -901,11 +901,12 @@ static int ni_660x_cmd(struct comedi_device *dev, struct comedi_subdevice *s) } static int ni_660x_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_cmd *cmd) + struct comedi_subdevice *s, struct comedi_cmd *cmd, + const unsigned int *chanlist) { struct ni_gpct *counter = subdev_to_counter(s); - return ni_tio_cmdtest(counter, cmd); + return ni_tio_cmdtest(counter, cmd, chanlist); } static int ni_660x_cancel(struct comedi_device *dev, struct comedi_subdevice *s) diff --git a/drivers/staging/comedi/drivers/ni_at_a2150.c b/drivers/staging/comedi/drivers/ni_at_a2150.c index 5895d4d..9445f4b 100644 --- a/drivers/staging/comedi/drivers/ni_at_a2150.c +++ b/drivers/staging/comedi/drivers/ni_at_a2150.c @@ -314,7 +314,8 @@ static int a2150_cancel(struct comedi_device *dev, struct comedi_subdevice *s) } static int a2150_ai_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_cmd *cmd) + struct comedi_subdevice *s, struct comedi_cmd *cmd, + const unsigned int *chanlist) { int err = 0; int tmp; @@ -412,16 +413,16 @@ static int a2150_ai_cmdtest(struct comedi_device *dev, return 4; /* check channel/gain list against card's limitations */ - if (cmd->chanlist) { - startChan = CR_CHAN(cmd->chanlist[0]); + if (chanlist) { + startChan = CR_CHAN(chanlist[0]); for (i = 1; i < cmd->chanlist_len; i++) { - if (CR_CHAN(cmd->chanlist[i]) != (startChan + i)) { + if (CR_CHAN(chanlist[i]) != (startChan + i)) { comedi_error(dev, "entries in chanlist must be consecutive channels, counting upwards\n"); err++; } } - if (cmd->chanlist_len == 2 && CR_CHAN(cmd->chanlist[0]) == 1) { + if (cmd->chanlist_len == 2 && CR_CHAN(chanlist[0]) == 1) { comedi_error(dev, "length 2 chanlist must be channels 0,1 or channels 2,3"); err++; @@ -431,8 +432,8 @@ static int a2150_ai_cmdtest(struct comedi_device *dev, "chanlist must have 1,2 or 4 channels"); err++; } - if (CR_AREF(cmd->chanlist[0]) != CR_AREF(cmd->chanlist[1]) || - CR_AREF(cmd->chanlist[2]) != CR_AREF(cmd->chanlist[3])) { + if (CR_AREF(chanlist[0]) != CR_AREF(chanlist[1]) || + CR_AREF(chanlist[2]) != CR_AREF(chanlist[3])) { comedi_error(dev, "channels 0/1 and 2/3 must have the same analog reference"); err++; diff --git a/drivers/staging/comedi/drivers/ni_atmio16d.c b/drivers/staging/comedi/drivers/ni_atmio16d.c index 4108cbf..e7d5759 100644 --- a/drivers/staging/comedi/drivers/ni_atmio16d.c +++ b/drivers/staging/comedi/drivers/ni_atmio16d.c @@ -244,7 +244,8 @@ static irqreturn_t atmio16d_interrupt(int irq, void *d) static int atmio16d_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd) + struct comedi_cmd *cmd, + const unsigned int *chanlist) { int err = 0, tmp; diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c index d534e63..78decfc 100644 --- a/drivers/staging/comedi/drivers/ni_labpc.c +++ b/drivers/staging/comedi/drivers/ni_labpc.c @@ -222,7 +222,8 @@ static void handle_isa_dma(struct comedi_device *dev); #endif static void labpc_drain_dregs(struct comedi_device *dev); static int labpc_ai_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_cmd *cmd); + struct comedi_subdevice *s, struct comedi_cmd *cmd, + const unsigned int *chanlist); static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s); static int labpc_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); @@ -817,22 +818,23 @@ static int labpc_cancel(struct comedi_device *dev, struct comedi_subdevice *s) return 0; } -static enum scan_mode labpc_ai_scan_mode(const struct comedi_cmd *cmd) +static enum scan_mode labpc_ai_scan_mode(const struct comedi_cmd *cmd, + const unsigned int *chanlist) { if (cmd->chanlist_len == 1) return MODE_SINGLE_CHAN; /* chanlist may be NULL during cmdtest. */ - if (cmd->chanlist == NULL) + if (chanlist == NULL) return MODE_MULT_CHAN_UP; - if (CR_CHAN(cmd->chanlist[0]) == CR_CHAN(cmd->chanlist[1])) + if (CR_CHAN(chanlist[0]) == CR_CHAN(chanlist[1])) return MODE_SINGLE_CHAN_INTERVAL; - if (CR_CHAN(cmd->chanlist[0]) < CR_CHAN(cmd->chanlist[1])) + if (CR_CHAN(chanlist[0]) < CR_CHAN(chanlist[1])) return MODE_MULT_CHAN_UP; - if (CR_CHAN(cmd->chanlist[0]) > CR_CHAN(cmd->chanlist[1])) + if (CR_CHAN(chanlist[0]) > CR_CHAN(chanlist[1])) return MODE_MULT_CHAN_DOWN; pr_err("ni_labpc: bug! cannot determine AI scan mode\n"); @@ -841,11 +843,12 @@ static enum scan_mode labpc_ai_scan_mode(const struct comedi_cmd *cmd) static int labpc_ai_chanlist_invalid(const struct comedi_device *dev, const struct comedi_cmd *cmd, + const unsigned int *chanlist, enum scan_mode mode) { int channel, range, aref, i; - if (cmd->chanlist == NULL) + if (chanlist == NULL) return 0; if (mode == MODE_SINGLE_CHAN) @@ -859,30 +862,29 @@ static int labpc_ai_chanlist_invalid(const struct comedi_device *dev, } } - channel = CR_CHAN(cmd->chanlist[0]); - range = CR_RANGE(cmd->chanlist[0]); - aref = CR_AREF(cmd->chanlist[0]); + channel = CR_CHAN(chanlist[0]); + range = CR_RANGE(chanlist[0]); + aref = CR_AREF(chanlist[0]); for (i = 0; i < cmd->chanlist_len; i++) { switch (mode) { case MODE_SINGLE_CHAN_INTERVAL: - if (CR_CHAN(cmd->chanlist[i]) != channel) { + if (CR_CHAN(chanlist[i]) != channel) { comedi_error(dev, "channel scanning order specified in chanlist is not supported by hardware.\n"); return 1; } break; case MODE_MULT_CHAN_UP: - if (CR_CHAN(cmd->chanlist[i]) != i) { + if (CR_CHAN(chanlist[i]) != i) { comedi_error(dev, "channel scanning order specified in chanlist is not supported by hardware.\n"); return 1; } break; case MODE_MULT_CHAN_DOWN: - if (CR_CHAN(cmd->chanlist[i]) != - cmd->chanlist_len - i - 1) { + if (CR_CHAN(chanlist[i]) != cmd->chanlist_len - i - 1) { comedi_error(dev, "channel scanning order specified in chanlist is not supported by hardware.\n"); return 1; @@ -895,13 +897,13 @@ static int labpc_ai_chanlist_invalid(const struct comedi_device *dev, break; } - if (CR_RANGE(cmd->chanlist[i]) != range) { + if (CR_RANGE(chanlist[i]) != range) { comedi_error(dev, "entries in chanlist must all have the same range\n"); return 1; } - if (CR_AREF(cmd->chanlist[i]) != aref) { + if (CR_AREF(chanlist[i]) != aref) { comedi_error(dev, "entries in chanlist must all have the same reference\n"); return 1; @@ -975,7 +977,8 @@ static void labpc_set_ai_scan_period(struct comedi_cmd *cmd, } static int labpc_ai_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_cmd *cmd) + struct comedi_subdevice *s, struct comedi_cmd *cmd, + const unsigned int *chanlist) { int err = 0; int tmp, tmp2; @@ -1102,7 +1105,7 @@ static int labpc_ai_cmdtest(struct comedi_device *dev, tmp = cmd->convert_arg; tmp2 = cmd->scan_begin_arg; - mode = labpc_ai_scan_mode(cmd); + mode = labpc_ai_scan_mode(cmd, chanlist); labpc_adc_timing(dev, cmd, mode); if (tmp != cmd->convert_arg || tmp2 != cmd->scan_begin_arg) err++; @@ -1110,7 +1113,7 @@ static int labpc_ai_cmdtest(struct comedi_device *dev, if (err) return 4; - if (labpc_ai_chanlist_invalid(dev, cmd, mode)) + if (labpc_ai_chanlist_invalid(dev, cmd, chanlist, mode)) return 5; return 0; @@ -1192,7 +1195,7 @@ static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) } else xfer = fifo_not_empty_transfer; devpriv->current_transfer = xfer; - mode = labpc_ai_scan_mode(cmd); + mode = labpc_ai_scan_mode(cmd, cmd->chanlist); /* setup command6 register for 1200 boards */ if (thisboard->register_layout == labpc_1200_layout) { diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 87995da..54a2164 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -220,7 +220,8 @@ static int ni_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); static int ni_cdio_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_cmd *cmd); + struct comedi_subdevice *s, struct comedi_cmd *cmd, + const unsigned int *chanlist); 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); @@ -317,7 +318,8 @@ static int ni_gpct_insn_config(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data); static int ni_gpct_cmd(struct comedi_device *dev, struct comedi_subdevice *s); static int ni_gpct_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_cmd *cmd); + struct comedi_subdevice *s, struct comedi_cmd *cmd, + const unsigned int *chanlist); static int ni_gpct_cancel(struct comedi_device *dev, struct comedi_subdevice *s); static void handle_gpct_interrupt(struct comedi_device *dev, @@ -2162,7 +2164,7 @@ static unsigned ni_min_ai_scan_period_ns(struct comedi_device *dev, } static int ni_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd) + struct comedi_cmd *cmd, const unsigned int *chanlist) { int err = 0; int tmp; @@ -3353,7 +3355,7 @@ static int ni_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s) } static int ni_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd) + struct comedi_cmd *cmd, const unsigned int *chanlist) { int err = 0; int tmp; @@ -3641,7 +3643,8 @@ static int ni_m_series_dio_insn_bits(struct comedi_device *dev, } static int ni_cdio_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_cmd *cmd) + struct comedi_subdevice *s, struct comedi_cmd *cmd, + const unsigned int *chanlist) { int err = 0; int tmp; @@ -3739,7 +3742,7 @@ static int ni_cdio_cmdtest(struct comedi_device *dev, /* step 5: check chanlist */ for (i = 0; i < cmd->chanlist_len; ++i) { - if (cmd->chanlist[i] != i) + if (chanlist[i] != i) err = 1; } @@ -5247,12 +5250,13 @@ static int ni_gpct_cmd(struct comedi_device *dev, struct comedi_subdevice *s) } static int ni_gpct_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_cmd *cmd) + struct comedi_subdevice *s, struct comedi_cmd *cmd, + const unsigned int *chanlist) { #ifdef PCIDMA struct ni_gpct *counter = s->private; - return ni_tio_cmdtest(counter, cmd); + return ni_tio_cmdtest(counter, cmd, chanlist); #else return -ENOTSUPP; #endif diff --git a/drivers/staging/comedi/drivers/ni_pcidio.c b/drivers/staging/comedi/drivers/ni_pcidio.c index 6a70e26..cf8856a 100644 --- a/drivers/staging/comedi/drivers/ni_pcidio.c +++ b/drivers/staging/comedi/drivers/ni_pcidio.c @@ -313,7 +313,8 @@ struct nidio96_private { static int ni_pcidio_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd); + struct comedi_cmd *cmd, + const unsigned int *chanlist); static int ni_pcidio_cmd(struct comedi_device *dev, struct comedi_subdevice *s); static int ni_pcidio_inttrig(struct comedi_device *dev, struct comedi_subdevice *s, unsigned int trignum); @@ -678,7 +679,8 @@ static int ni_pcidio_insn_bits(struct comedi_device *dev, } static int ni_pcidio_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_cmd *cmd) + struct comedi_subdevice *s, struct comedi_cmd *cmd, + const unsigned int *chanlist) { int err = 0; int tmp; diff --git a/drivers/staging/comedi/drivers/ni_tio.h b/drivers/staging/comedi/drivers/ni_tio.h index b058820..6c59d52 100644 --- a/drivers/staging/comedi/drivers/ni_tio.h +++ b/drivers/staging/comedi/drivers/ni_tio.h @@ -155,7 +155,8 @@ extern int ni_tio_insn_config(struct ni_gpct *counter, extern int ni_tio_winsn(struct ni_gpct *counter, struct comedi_insn *insn, unsigned int *data); extern int ni_tio_cmd(struct ni_gpct *counter, struct comedi_async *async); -extern int ni_tio_cmdtest(struct ni_gpct *counter, struct comedi_cmd *cmd); +extern int ni_tio_cmdtest(struct ni_gpct *counter, struct comedi_cmd *cmd, + const unsigned int *chanlist); extern int ni_tio_cancel(struct ni_gpct *counter); extern void ni_tio_handle_interrupt(struct ni_gpct *counter, struct comedi_subdevice *s); diff --git a/drivers/staging/comedi/drivers/ni_tiocmd.c b/drivers/staging/comedi/drivers/ni_tiocmd.c index a961158..fb2f726 100644 --- a/drivers/staging/comedi/drivers/ni_tiocmd.c +++ b/drivers/staging/comedi/drivers/ni_tiocmd.c @@ -234,7 +234,8 @@ int ni_tio_cmd(struct ni_gpct *counter, struct comedi_async *async) } EXPORT_SYMBOL_GPL(ni_tio_cmd); -int ni_tio_cmdtest(struct ni_gpct *counter, struct comedi_cmd *cmd) +int ni_tio_cmdtest(struct ni_gpct *counter, struct comedi_cmd *cmd, + const unsigned int *chanlist) { int err = 0; int tmp; diff --git a/drivers/staging/comedi/drivers/pcl711.c b/drivers/staging/comedi/drivers/pcl711.c index ef77b15..4acf5db 100644 --- a/drivers/staging/comedi/drivers/pcl711.c +++ b/drivers/staging/comedi/drivers/pcl711.c @@ -261,7 +261,8 @@ ok: } static int pcl711_ai_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_cmd *cmd) + struct comedi_subdevice *s, struct comedi_cmd *cmd, + const unsigned int *chanlist) { int tmp; int err = 0; diff --git a/drivers/staging/comedi/drivers/pcl812.c b/drivers/staging/comedi/drivers/pcl812.c index d196343..44a0ad2 100644 --- a/drivers/staging/comedi/drivers/pcl812.c +++ b/drivers/staging/comedi/drivers/pcl812.c @@ -529,7 +529,8 @@ static int pcl812_do_insn_bits(struct comedi_device *dev, ============================================================================== */ static int pcl812_ai_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_cmd *cmd) + struct comedi_subdevice *s, struct comedi_cmd *cmd, + const unsigned int *chanlist) { const struct pcl812_board *board = comedi_board(dev); int err = 0; diff --git a/drivers/staging/comedi/drivers/pcl816.c b/drivers/staging/comedi/drivers/pcl816.c index f65fd66..af0cb088 100644 --- a/drivers/staging/comedi/drivers/pcl816.c +++ b/drivers/staging/comedi/drivers/pcl816.c @@ -179,10 +179,12 @@ struct pcl816_private { */ static int check_channel_list(struct comedi_device *dev, struct comedi_subdevice *s, - unsigned int *chanlist, unsigned int chanlen); + const unsigned int *chanlist, + unsigned int chanlen); static void setup_channel_list(struct comedi_device *dev, struct comedi_subdevice *s, - unsigned int *chanlist, unsigned int seglen); + const unsigned int *chanlist, + unsigned int seglen); static int pcl816_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s); static void start_pacer(struct comedi_device *dev, int mode, @@ -193,7 +195,8 @@ static int set_rtc_irq_bit(unsigned char bit); static int pcl816_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd); + struct comedi_cmd *cmd, + const unsigned int *chanlist); static int pcl816_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s); /* @@ -448,7 +451,8 @@ static void pcl816_cmdtest_out(int e, struct comedi_cmd *cmd) ============================================================================== */ static int pcl816_ai_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_cmd *cmd) + struct comedi_subdevice *s, struct comedi_cmd *cmd, + const unsigned int *chanlist) { const struct pcl816_board *board = comedi_board(dev); int err = 0; @@ -566,9 +570,8 @@ static int pcl816_ai_cmdtest(struct comedi_device *dev, /* step 5: complain about special chanlist considerations */ - if (cmd->chanlist) { - if (!check_channel_list(dev, s, cmd->chanlist, - cmd->chanlist_len)) + if (chanlist) { + if (!check_channel_list(dev, s, chanlist, cmd->chanlist_len)) return 5; /* incorrect channels list */ } @@ -879,7 +882,7 @@ start_pacer(struct comedi_device *dev, int mode, unsigned int divisor1, */ static int check_channel_list(struct comedi_device *dev, - struct comedi_subdevice *s, unsigned int *chanlist, + struct comedi_subdevice *s, const unsigned int *chanlist, unsigned int chanlen) { unsigned int chansegment[16]; @@ -953,7 +956,7 @@ check_channel_list(struct comedi_device *dev, */ static void setup_channel_list(struct comedi_device *dev, - struct comedi_subdevice *s, unsigned int *chanlist, + struct comedi_subdevice *s, const unsigned int *chanlist, unsigned int seglen) { unsigned int i; diff --git a/drivers/staging/comedi/drivers/pcl818.c b/drivers/staging/comedi/drivers/pcl818.c index 023a27d..7d63fbd 100644 --- a/drivers/staging/comedi/drivers/pcl818.c +++ b/drivers/staging/comedi/drivers/pcl818.c @@ -332,11 +332,12 @@ static const unsigned int muxonechan[] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0 */ static void setup_channel_list(struct comedi_device *dev, struct comedi_subdevice *s, - unsigned int *chanlist, unsigned int n_chan, - unsigned int seglen); + const unsigned int *chanlist, + unsigned int n_chan, unsigned int seglen); static int check_channel_list(struct comedi_device *dev, struct comedi_subdevice *s, - unsigned int *chanlist, unsigned int n_chan); + const unsigned int *chanlist, + unsigned int n_chan); static int pcl818_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s); @@ -1157,7 +1158,7 @@ static void start_pacer(struct comedi_device *dev, int mode, */ static int check_channel_list(struct comedi_device *dev, struct comedi_subdevice *s, - unsigned int *chanlist, unsigned int n_chan) + const unsigned int *chanlist, unsigned int n_chan) { unsigned int chansegment[16]; unsigned int i, nowmustbechan, seglen, segpos; @@ -1218,8 +1219,8 @@ static int check_channel_list(struct comedi_device *dev, static void setup_channel_list(struct comedi_device *dev, struct comedi_subdevice *s, - unsigned int *chanlist, unsigned int n_chan, - unsigned int seglen) + const unsigned int *chanlist, + unsigned int n_chan, unsigned int seglen) { int i; @@ -1255,7 +1256,7 @@ static int check_single_ended(unsigned int port) ============================================================================== */ static int ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd) + struct comedi_cmd *cmd, const unsigned int *chanlist) { const struct pcl818_board *board = comedi_board(dev); int err = 0; @@ -1363,9 +1364,8 @@ static int ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, /* step 5: complain about special chanlist considerations */ - if (cmd->chanlist) { - if (!check_channel_list(dev, s, cmd->chanlist, - cmd->chanlist_len)) + if (chanlist) { + if (!check_channel_list(dev, s, chanlist, cmd->chanlist_len)) return 5; /* incorrect channels list */ } diff --git a/drivers/staging/comedi/drivers/pcm_common.c b/drivers/staging/comedi/drivers/pcm_common.c index 474af7b..ced0f3c 100644 --- a/drivers/staging/comedi/drivers/pcm_common.c +++ b/drivers/staging/comedi/drivers/pcm_common.c @@ -6,7 +6,8 @@ * the PCM drivers. */ int comedi_pcm_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_cmd *cmd) + struct comedi_subdevice *s, struct comedi_cmd *cmd, + const unsigned int *chanlist) { int err = 0; unsigned int tmp; diff --git a/drivers/staging/comedi/drivers/pcm_common.h b/drivers/staging/comedi/drivers/pcm_common.h index cd4840c..cd928cd 100644 --- a/drivers/staging/comedi/drivers/pcm_common.h +++ b/drivers/staging/comedi/drivers/pcm_common.h @@ -3,6 +3,7 @@ extern int comedi_pcm_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd); + struct comedi_cmd *cmd, + const unsigned int *chanlist); #endif diff --git a/drivers/staging/comedi/drivers/pcmmio.c b/drivers/staging/comedi/drivers/pcmmio.c index a10bf0a..2ab9cfc 100644 --- a/drivers/staging/comedi/drivers/pcmmio.c +++ b/drivers/staging/comedi/drivers/pcmmio.c @@ -834,9 +834,9 @@ 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_cmd *cmd, const unsigned int *chanlist) { - return comedi_pcm_cmdtest(dev, s, cmd); + return comedi_pcm_cmdtest(dev, s, cmd, chanlist); } static int adc_wait_ready(unsigned long iobase) diff --git a/drivers/staging/comedi/drivers/pcmuio.c b/drivers/staging/comedi/drivers/pcmuio.c index 0e32119..8a1f3ba 100644 --- a/drivers/staging/comedi/drivers/pcmuio.c +++ b/drivers/staging/comedi/drivers/pcmuio.c @@ -740,9 +740,9 @@ 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_cmd *cmd, const unsigned int *chanlist) { - return comedi_pcm_cmdtest(dev, s, cmd); + return comedi_pcm_cmdtest(dev, s, cmd, chanlist); } static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it) diff --git a/drivers/staging/comedi/drivers/quatech_daqp_cs.c b/drivers/staging/comedi/drivers/quatech_daqp_cs.c index e95a4eb..56337fb 100644 --- a/drivers/staging/comedi/drivers/quatech_daqp_cs.c +++ b/drivers/staging/comedi/drivers/quatech_daqp_cs.c @@ -451,7 +451,8 @@ static int daqp_ns_to_timer(unsigned int *ns, int round) */ 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, + const unsigned int *chanlist) { int err = 0; int tmp; diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index d0e4844..b5ae518 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -971,7 +971,8 @@ static int rtd_ai_poll(struct comedi_device *dev, struct comedi_subdevice *s) */ static int rtd_ai_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_cmd *cmd) + struct comedi_subdevice *s, struct comedi_cmd *cmd, + const unsigned int *chanlist) { int err = 0; int tmp; diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c index f90578e..8258edf8 100644 --- a/drivers/staging/comedi/drivers/s626.c +++ b/drivers/staging/comedi/drivers/s626.c @@ -1543,7 +1543,8 @@ static int s626_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) } static int s626_ai_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_cmd *cmd) + struct comedi_subdevice *s, struct comedi_cmd *cmd, + const unsigned int *chanlist) { int err = 0; int tmp; diff --git a/drivers/staging/comedi/drivers/skel.c b/drivers/staging/comedi/drivers/skel.c index eb70bac..44f3719 100644 --- a/drivers/staging/comedi/drivers/skel.c +++ b/drivers/staging/comedi/drivers/skel.c @@ -198,7 +198,8 @@ static int skel_dio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data); static int skel_ai_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_cmd *cmd); + struct comedi_subdevice *s, struct comedi_cmd *cmd, + const unsigned int *chanlist); static int skel_ns_to_timer(unsigned int *ns, int round); /* @@ -350,7 +351,8 @@ static int skel_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, } static int skel_ai_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_cmd *cmd) + struct comedi_subdevice *s, struct comedi_cmd *cmd, + const unsigned int *chanlist) { int err = 0; int tmp; diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c index bc5fc5c..2861803 100644 --- a/drivers/staging/comedi/drivers/usbdux.c +++ b/drivers/staging/comedi/drivers/usbdux.c @@ -927,7 +927,8 @@ static int usbduxsub_submit_OutURBs(struct usbduxsub *usbduxsub) } static int usbdux_ai_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_cmd *cmd) + struct comedi_subdevice *s, struct comedi_cmd *cmd, + const unsigned int *chanlist) { int err = 0, tmp, i; unsigned int tmpTimer; @@ -1486,7 +1487,8 @@ static int usbdux_ao_inttrig(struct comedi_device *dev, } static int usbdux_ao_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_cmd *cmd) + struct comedi_subdevice *s, struct comedi_cmd *cmd, + const unsigned int *chanlist) { int err = 0, tmp; struct usbduxsub *this_usbduxsub = dev->private; diff --git a/drivers/staging/comedi/drivers/usbduxfast.c b/drivers/staging/comedi/drivers/usbduxfast.c index 0f6c139..aa7253d 100644 --- a/drivers/staging/comedi/drivers/usbduxfast.c +++ b/drivers/staging/comedi/drivers/usbduxfast.c @@ -547,7 +547,8 @@ static int usbduxfastsub_submit_InURBs(struct usbduxfastsub_s *udfs) static int usbduxfast_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd) + struct comedi_cmd *cmd, + const unsigned int *chanlist) { int err = 0, stop_mask = 0; long int steps, tmp; diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c index b4ab83f..42391f8 100644 --- a/drivers/staging/comedi/drivers/usbduxsigma.c +++ b/drivers/staging/comedi/drivers/usbduxsigma.c @@ -895,7 +895,8 @@ static int chanToInterval(int nChannels) static int usbdux_ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd) + struct comedi_cmd *cmd, + const unsigned int *chanlist) { int err = 0, tmp, i; unsigned int tmpTimer; @@ -1556,7 +1557,8 @@ out: static int usbdux_ao_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_cmd *cmd) + struct comedi_cmd *cmd, + const unsigned int *chanlist) { int err = 0, tmp; struct usbduxsub *this_usbduxsub = dev->private; -- 1.7.12 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/devel