summaryrefslogtreecommitdiff
path: root/drivers/pwm
diff options
context:
space:
mode:
authorLaxman Dewangan <ldewangan@nvidia.com>2017-04-07 15:03:59 +0530
committerThierry Reding <thierry.reding@gmail.com>2017-04-12 16:08:00 +0200
commit90241fb9b55a36edd9dafb8de679f66836e84369 (patch)
tree147363c619b3f62554eed269fa374f0f5c41e2a4 /drivers/pwm
parentcaf065f8fd583b43a3f95d84c8a0a0d07597963b (diff)
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.c3
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;