staging: comedi: dt282x: avoid calculating the timer divisor multiple times
A common timer is used for analog input and output async commands. The (*do_cmdtest) for both subdevices calculates the divisor as part of Step 4 when validating the trigger arguments. The divisor is calculated again in the (*do_cmd) for both subdevices in order to set the timer. The comedi core only calls the (*do_cmd) is called after a successful (*do_cmdtest). Save the divisor from the (*do_cmdtest) in the private data and use that value in the (*do_cmd). The extra check of the cmd->convert_arg in dt282x_ai_cmd() is not necessary. The convert_arg was already checked in the (*do_cmdtest), and it's not used in the (*do_cmd). Tidy up dt282x_ns_to_timer(), the parameters are all unsigned int's and the mask of the 'flags' can be moved here to simplify the callers. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Showing
Please register or sign in to comment