Commit c72c4c6e authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: me4000: return void from ai_round_cmd_args()

This function always succeeds. Change the return type to void and
remove the unnecessary error check in me4000_ai_do_cmd().

Move the function call in me4000_ai_do_cmd_test() from before Step 1
to Step 3 where the arguments are validated. There is no reason to
get the values if the previous steps fail.

Rename the function so it has namespace associated with the driver.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 55fb972e
...@@ -580,11 +580,12 @@ static int me4000_ai_check_chanlist(struct comedi_device *dev, ...@@ -580,11 +580,12 @@ static int me4000_ai_check_chanlist(struct comedi_device *dev,
return 0; return 0;
} }
static int ai_round_cmd_args(struct comedi_device *dev, static void me4000_ai_round_cmd_args(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_subdevice *s,
struct comedi_cmd *cmd, struct comedi_cmd *cmd,
unsigned int *init_ticks, unsigned int *init_ticks,
unsigned int *scan_ticks, unsigned int *chan_ticks) unsigned int *scan_ticks,
unsigned int *chan_ticks)
{ {
int rest; int rest;
...@@ -630,8 +631,6 @@ static int ai_round_cmd_args(struct comedi_device *dev, ...@@ -630,8 +631,6 @@ static int ai_round_cmd_args(struct comedi_device *dev,
(*chan_ticks)++; (*chan_ticks)++;
} }
} }
return 0;
} }
static void ai_write_timer(struct comedi_device *dev, static void ai_write_timer(struct comedi_device *dev,
...@@ -757,10 +756,8 @@ static int me4000_ai_do_cmd(struct comedi_device *dev, ...@@ -757,10 +756,8 @@ static int me4000_ai_do_cmd(struct comedi_device *dev,
return err; return err;
/* Round the timer arguments */ /* Round the timer arguments */
err = ai_round_cmd_args(dev, me4000_ai_round_cmd_args(dev, s, cmd,
s, cmd, &init_ticks, &scan_ticks, &chan_ticks); &init_ticks, &scan_ticks, &chan_ticks);
if (err)
return err;
/* Prepare the AI for acquisition */ /* Prepare the AI for acquisition */
err = ai_prepare(dev, s, cmd, init_ticks, scan_ticks, chan_ticks); err = ai_prepare(dev, s, cmd, init_ticks, scan_ticks, chan_ticks);
...@@ -782,9 +779,6 @@ static int me4000_ai_do_cmd_test(struct comedi_device *dev, ...@@ -782,9 +779,6 @@ static int me4000_ai_do_cmd_test(struct comedi_device *dev,
unsigned int scan_ticks; unsigned int scan_ticks;
int err = 0; int err = 0;
/* Round the timer arguments */
ai_round_cmd_args(dev, s, cmd, &init_ticks, &scan_ticks, &chan_ticks);
/* Step 1 : check if triggers are trivially valid */ /* Step 1 : check if triggers are trivially valid */
err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_EXT); err |= comedi_check_trigger_src(&cmd->start_src, TRIG_NOW | TRIG_EXT);
...@@ -842,6 +836,11 @@ static int me4000_ai_do_cmd_test(struct comedi_device *dev, ...@@ -842,6 +836,11 @@ static int me4000_ai_do_cmd_test(struct comedi_device *dev,
cmd->chanlist_len = 1; cmd->chanlist_len = 1;
err |= -EINVAL; err |= -EINVAL;
} }
/* Round the timer arguments */
me4000_ai_round_cmd_args(dev, s, cmd,
&init_ticks, &scan_ticks, &chan_ticks);
if (init_ticks < 66) { if (init_ticks < 66) {
cmd->start_arg = 2000; cmd->start_arg = 2000;
err |= -EINVAL; err |= -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment