pwm: tegra: Use DIV_ROUND_CLOSEST_ULL() instead of local implementation

Use macro DIV_ROUND_CLOSEST_ULL() for 64-bit division to closest one
instead of implementing the same locally. This increase readability.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
This commit is contained in:
Laxman Dewangan 2017-04-07 15:03:59 +05:30 committed by Thierry Reding
parent caf065f8fd
commit 90241fb9b5
1 changed files with 1 additions and 2 deletions

View File

@ -85,8 +85,7 @@ static int tegra_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
* nearest integer during division. * nearest integer during division.
*/ */
c *= (1 << PWM_DUTY_WIDTH); c *= (1 << PWM_DUTY_WIDTH);
c += period_ns / 2; c = DIV_ROUND_CLOSEST_ULL(c, period_ns);
do_div(c, period_ns);
val = (u32)c << PWM_DUTY_SHIFT; val = (u32)c << PWM_DUTY_SHIFT;