Skip to contentSkip to conversation

drivers/clk/clk-npcm8xx.c:70:1-7: WARNING: do_div() does a 64-by-32 division, please consider using div64_ul instead. (fwd)

PATCH New Julia Lawall 1 participant 1 message Aug 15, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 63/93 drivers/clk/clk-npcm8xx.c:70:1-7: WARNING: do_div() does a 64-by-32 division, please consider using div64_ul instead. (fwd)

---------- Forwarded message ----------
Date: Tue, 15 Aug 2023 04:14:32 +0800
From: kernel test robot <[email protected]>
To: [email protected]
Cc: [email protected], Julia Lawall <[email protected]>
Subject: [shenki:dev-6.5 63/93] drivers/clk/clk-npcm8xx.c:70:1-7: WARNING:
do_div() does a 64-by-32 division, please consider using div64_ul instead.

BCC: [email protected]
CC: [email protected]
TO: Joel Stanley <[email protected]>

tree:   https://github.com/shenki/linux dev-6.5
head:   e874a83263bd783e23411cf6ab12622ac36362f5
commit: 3ee0ccee782341bcffbaf9afbe476e2bc8ad0cfb [63/93] clk: npcm8xx: add clock controller

:::::: branch date: 4 days ago
:::::: commit date: 4 days ago
config: riscv-randconfig-r053-20230815 (https://download.01.org/0day-ci/archive/20230815/[email protected]/config)
compiler: riscv64-linux-gcc (GCC) 12.3.0
reproduce: (https://download.01.org/0day-ci/archive/20230815/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags

| Reported-by: kernel test robot <[email protected]>
| Reported-by: Julia Lawall <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

cocci warnings: (new ones prefixed by >>)

Quoted 1 line
Quoted 1 line

drivers/clk/clk-npcm8xx.c:70:1-7: WARNING: do_div() does a 64-by-32 division, please consider using div64_ul instead.

vim +70 drivers/clk/clk-npcm8xx.c

3ee0ccee782341 Tomer Maimon 2022-10-02  48
3ee0ccee782341 Tomer Maimon 2022-10-02  49  static unsigned long npcm8xx_clk_pll_recalc_rate(struct clk_hw *hw,
3ee0ccee782341 Tomer Maimon 2022-10-02  50  						 unsigned long parent_rate)
3ee0ccee782341 Tomer Maimon 2022-10-02  51  {
3ee0ccee782341 Tomer Maimon 2022-10-02  52  	struct npcm8xx_clk_pll *pll = to_npcm8xx_clk_pll(hw);
3ee0ccee782341 Tomer Maimon 2022-10-02  53  	unsigned long fbdv, indv, otdv1, otdv2;
3ee0ccee782341 Tomer Maimon 2022-10-02  54  	unsigned int val;
3ee0ccee782341 Tomer Maimon 2022-10-02  55  	u64 ret;
3ee0ccee782341 Tomer Maimon 2022-10-02  56
3ee0ccee782341 Tomer Maimon 2022-10-02  57  	if (parent_rate == 0) {
3ee0ccee782341 Tomer Maimon 2022-10-02  58  		pr_debug("%s: parent rate is zero\n", __func__);
3ee0ccee782341 Tomer Maimon 2022-10-02  59  		return 0;
3ee0ccee782341 Tomer Maimon 2022-10-02  60  	}
3ee0ccee782341 Tomer Maimon 2022-10-02  61
3ee0ccee782341 Tomer Maimon 2022-10-02  62  	val = readl_relaxed(pll->pllcon + pll->pll.reg);
3ee0ccee782341 Tomer Maimon 2022-10-02  63
3ee0ccee782341 Tomer Maimon 2022-10-02  64  	indv = FIELD_GET(PLLCON_INDV, val);
3ee0ccee782341 Tomer Maimon 2022-10-02  65  	fbdv = FIELD_GET(PLLCON_FBDV, val);
3ee0ccee782341 Tomer Maimon 2022-10-02  66  	otdv1 = FIELD_GET(PLLCON_OTDV1, val);
3ee0ccee782341 Tomer Maimon 2022-10-02  67  	otdv2 = FIELD_GET(PLLCON_OTDV2, val);
3ee0ccee782341 Tomer Maimon 2022-10-02  68
3ee0ccee782341 Tomer Maimon 2022-10-02  69  	ret = (u64)parent_rate * fbdv;
3ee0ccee782341 Tomer Maimon 2022-10-02 @70  	do_div(ret, indv * otdv1 * otdv2);
3ee0ccee782341 Tomer Maimon 2022-10-02  71
3ee0ccee782341 Tomer Maimon 2022-10-02  72  	return ret;
3ee0ccee782341 Tomer Maimon 2022-10-02  73  }
3ee0ccee782341 Tomer Maimon 2022-10-02  74
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki