Skip to content

Commit

Permalink
pwm: rcar: Simplify multiplication/shift logic
Browse files Browse the repository at this point in the history
- Remove the superfluous cast; the multiplication will yield a 64-bit
    result due to the "100ULL" anyway,
  - "a * (1 << b)" == "a << b".

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
  • Loading branch information
Geert Uytterhoeven authored and Thierry Reding committed Feb 24, 2022
1 parent f486673 commit ed14d36
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/pwm/pwm-rcar.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ static int rcar_pwm_set_counter(struct rcar_pwm_chip *rp, int div, int duty_ns,
unsigned long clk_rate = clk_get_rate(rp->clk);
u32 cyc, ph;

one_cycle = (unsigned long long)NSEC_PER_SEC * 100ULL * (1 << div);
one_cycle = NSEC_PER_SEC * 100ULL << div;
do_div(one_cycle, clk_rate);

tmp = period_ns * 100ULL;
Expand Down

0 comments on commit ed14d36

Please sign in to comment.