The (*do_cmdtest) validates the cmd->convert_src as (TRIG_TIMER | TRIG_EXT | TRIG_NOW). Only the TRIG_TIMER source validates the cmd->convert_arg using the i8253_cascade_ns_to_timer() helper. The (*do_cmd) operation should only program the pacer when the convert_src indicates that the pacer is used. It should also not be modifying the cmd paramters.
Check the convert_src in das16_cmd_exec() before programming the pacer. Remove the unnecessary i8253_cascade_ns_to_timer() in das16_set_pacer() and change the return type to void. Signed-off-by: H Hartley Sweeten <hswee...@visionengravers.com> Cc: Ian Abbott <abbo...@mev.co.uk> Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org> --- drivers/staging/comedi/drivers/das16.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/staging/comedi/drivers/das16.c b/drivers/staging/comedi/drivers/das16.c index 626eb21..7d891b9 100644 --- a/drivers/staging/comedi/drivers/das16.c +++ b/drivers/staging/comedi/drivers/das16.c @@ -628,22 +628,15 @@ static int das16_cmd_test(struct comedi_device *dev, struct comedi_subdevice *s, return 0; } -static unsigned int das16_set_pacer(struct comedi_device *dev, unsigned int ns, - unsigned int flags) +static void das16_set_pacer(struct comedi_device *dev) { struct das16_private_struct *devpriv = dev->private; unsigned long timer_base = dev->iobase + DAS16_TIMER_BASE_REG; - i8253_cascade_ns_to_timer(devpriv->clockbase, - &devpriv->divisor1, &devpriv->divisor2, - &ns, flags); - i8254_set_mode(timer_base, 0, 1, I8254_MODE2 | I8254_BINARY); i8254_set_mode(timer_base, 0, 2, I8254_MODE2 | I8254_BINARY); i8254_write(timer_base, 0, 1, devpriv->divisor1); i8254_write(timer_base, 0, 2, devpriv->divisor2); - - return ns; } static int das16_cmd_exec(struct comedi_device *dev, struct comedi_subdevice *s) @@ -684,7 +677,8 @@ static int das16_cmd_exec(struct comedi_device *dev, struct comedi_subdevice *s) } /* set counter mode and counts */ - cmd->convert_arg = das16_set_pacer(dev, cmd->convert_arg, cmd->flags); + if (cmd->convert_src == TRIG_TIMER) + das16_set_pacer(dev); /* enable counters */ byte = 0; -- 2.0.3 _______________________________________________ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel