Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 90241fb9 authored by Laxman Dewangan's avatar Laxman Dewangan Committed by Thierry Reding
Browse files

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: default avatarLaxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: default avatarThierry Reding <thierry.reding@gmail.com>
parent caf065f8
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -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;