diff options
author | Laxman Dewangan <ldewangan@nvidia.com> | 2017-04-07 15:03:59 +0530 |
---|---|---|
committer | Thierry Reding <thierry.reding@gmail.com> | 2017-04-12 16:08:00 +0200 |
commit | 90241fb9b55a36edd9dafb8de679f66836e84369 (patch) | |
tree | 147363c619b3f62554eed269fa374f0f5c41e2a4 /drivers/pwm | |
parent | caf065f8fd583b43a3f95d84c8a0a0d07597963b (diff) | |
download | linux-90241fb9b55a36edd9dafb8de679f66836e84369.tar.gz linux-90241fb9b55a36edd9dafb8de679f66836e84369.tar.bz2 linux-90241fb9b55a36edd9dafb8de679f66836e84369.zip |
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>
Diffstat (limited to 'drivers/pwm')
-rw-r--r-- | drivers/pwm/pwm-tegra.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/pwm/pwm-tegra.c b/drivers/pwm/pwm-tegra.c index e4647840cd6e..0a688dabd670 100644 --- a/drivers/pwm/pwm-tegra.c +++ b/drivers/pwm/pwm-tegra.c @@ -85,8 +85,7 @@ static int tegra_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, * nearest integer during division. */ c *= (1 << PWM_DUTY_WIDTH); - c += period_ns / 2; - do_div(c, period_ns); + c = DIV_ROUND_CLOSEST_ULL(c, period_ns); val = (u32)c << PWM_DUTY_SHIFT; |