Skip to content

Commit de7aeb5

Browse files
tobluxbebarino
authored andcommitted
clk: hisilicon: Remove unnecessary local variable
The local u64 variable refdiv_val has the same value as the local u32 variable val and can be removed. Remove it and use val directly as the divisor to also remove the following Coccinelle/coccicheck warning reported by do_div.cocci: WARNING: do_div() does a 64-by-32 division, please consider using div64_u64 instead Use the preferred div_u64() function instead of the do_div() macro. Signed-off-by: Thorsten Blum <[email protected]> Link: https://lore.kernel.org/r/[email protected] Acked-by: Uwe Kleine-König <[email protected]> Signed-off-by: Stephen Boyd <[email protected]>
1 parent ec562c9 commit de7aeb5

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

drivers/clk/hisilicon/clk-hi3559a.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ static unsigned long clk_pll_recalc_rate(struct clk_hw *hw,
407407
unsigned long parent_rate)
408408
{
409409
struct hi3559av100_clk_pll *clk = to_pll_clk(hw);
410-
u64 frac_val, fbdiv_val, refdiv_val;
410+
u64 frac_val, fbdiv_val;
411411
u32 postdiv1_val, postdiv2_val;
412412
u32 val;
413413
u64 tmp, rate;
@@ -435,14 +435,13 @@ static unsigned long clk_pll_recalc_rate(struct clk_hw *hw,
435435
val = readl_relaxed(clk->ctrl_reg2);
436436
val = val >> clk->refdiv_shift;
437437
val &= ((1 << clk->refdiv_width) - 1);
438-
refdiv_val = val;
439438

440439
/* rate = 24000000 * (fbdiv + frac / (1<<24) ) / refdiv */
441440
rate = 0;
442441
tmp = 24000000 * fbdiv_val + (24000000 * frac_val) / (1 << 24);
443442
rate += tmp;
444-
do_div(rate, refdiv_val);
445-
do_div(rate, postdiv1_val * postdiv2_val);
443+
rate = div_u64(rate, val);
444+
rate = div_u64(rate, postdiv1_val * postdiv2_val);
446445

447446
return rate;
448447
}

0 commit comments

Comments
 (0)