From a207c12f62e8b53e1e1600ca384b13a39a9feed2 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 18 Jul 2014 17:01:16 -0700 Subject: staging: comedi: drivers: cleanup cmd->flags use Most of the comedi drivers that support async commands have some sort of timer to control the acquisition timing. For these drivers, Step 4 of the (*do_cmdtest) operations calls a ns_to_timer() function that converts the desired ns time of the command into a value used to set the timer. These ns_to_timer() functions also typically pass the cmd->flags in order to determine the desired rounding mode. Some of the drivers mask the cmd->flags with TRIG_ROUND_MASK when calling the ns_to_timer() functions. Move all the masking into the ns_to_timer() functions and just pass the cmd->flags directly. The cmd->flags member is an unsigned int, change the parameter type in the the ns_to_timer() functions to match. For aesthetics, rename the parameter in all the ns_to_timer() functions to 'flags'. Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_pcidio.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging/comedi/drivers/ni_pcidio.c') diff --git a/drivers/staging/comedi/drivers/ni_pcidio.c b/drivers/staging/comedi/drivers/ni_pcidio.c index 7bc4b9f127f3..cb161d815444 100644 --- a/drivers/staging/comedi/drivers/ni_pcidio.c +++ b/drivers/staging/comedi/drivers/ni_pcidio.c @@ -303,7 +303,7 @@ static int ni_pcidio_cmdtest(struct comedi_device *dev, 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); -static int ni_pcidio_ns_to_timer(int *nanosec, int round_mode); +static int ni_pcidio_ns_to_timer(int *nanosec, unsigned int flags); static int setup_mite_dma(struct comedi_device *dev, struct comedi_subdevice *s); @@ -596,7 +596,7 @@ static int ni_pcidio_cmdtest(struct comedi_device *dev, if (cmd->scan_begin_src == TRIG_TIMER) { arg = cmd->scan_begin_arg; - ni_pcidio_ns_to_timer(&arg, cmd->flags & TRIG_ROUND_MASK); + ni_pcidio_ns_to_timer(&arg, cmd->flags); err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, arg); } @@ -606,13 +606,13 @@ static int ni_pcidio_cmdtest(struct comedi_device *dev, return 0; } -static int ni_pcidio_ns_to_timer(int *nanosec, int round_mode) +static int ni_pcidio_ns_to_timer(int *nanosec, unsigned int flags) { int divider, base; base = TIMER_BASE; - switch (round_mode) { + switch (flags & TRIG_ROUND_MASK) { case TRIG_ROUND_NEAREST: default: divider = (*nanosec + base / 2) / base; -- cgit v1.2.3