lkml.org 
[lkml]   [2021]   [Jan]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] powercap/drivers/dtpm: Fix __udivdi3 and __aeabi_uldivmod unresolved symbols
Hi Daniel,

On Wed, Dec 30, 2020 at 4:39 PM Daniel Lezcano
<daniel.lezcano@linaro.org> wrote:
> 32 bits architectures do not support u64 division, so the macro
> DIV_ROUND_CLOSEST is not adequate as the compiler will replace the
> call to an unexisting function for the platform, leading to an
> unresolved symbols.
>
> Fix this by using the compatible macros:
>
> DIV64_U64_ROUND_CLOSEST and DIV_ROUND_CLOSEST_ULL.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>

Thanks for your patch!

> --- a/drivers/powercap/dtpm.c
> +++ b/drivers/powercap/dtpm.c
> @@ -99,8 +99,8 @@ static void __dtpm_rebalance_weight(struct dtpm *dtpm)
> pr_debug("Setting weight '%d' for '%s'\n",
> child->weight, child->zone.name);
>
> - child->weight = DIV_ROUND_CLOSEST(child->power_max * 1024,
> - dtpm->power_max);
> + child->weight = DIV64_U64_ROUND_CLOSEST(
> + child->power_max * 1024, dtpm->power_max);

Note that 64-by-64 divisions are expensive on 32-bit platforms.

Does dtpm.power_max need to be u64?
The (lack of) documentation for the dtpm structure does not say what is
being stored there.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

\
 
 \ /
  Last update: 2021-01-04 09:20    [W:0.482 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site