Skip to content

Commit

Permalink
powercap/drivers/dtpm: Fix __udivdi3 and __aeabi_uldivmod unresolved …
Browse files Browse the repository at this point in the history
…symbols

32-bit architectures do not support u64 divisions, 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
unresolved references to symbols.

Fix this by using the compatible macros:

DIV64_U64_ROUND_CLOSEST and DIV_ROUND_CLOSEST_ULL.

Fixes: a20d0ef ("powercap/drivers/dtpm: Add API for dynamic thermal power management")
Reported-by: kernel test robot <[email protected]>
Signed-off-by: Daniel Lezcano <[email protected]>
Signed-off-by: Rafael J. Wysocki <[email protected]>
  • Loading branch information
dlezcano authored and rafaeljw committed Dec 30, 2020
1 parent 0e8f68d commit 8f50db4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/powercap/dtpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

__dtpm_rebalance_weight(child);
}
Expand Down Expand Up @@ -272,7 +272,7 @@ static int __set_power_limit_uw(struct dtpm *dtpm, int cid, u64 power_limit)
} else if (power_limit == dtpm->power_min) {
power = child->power_min;
} else {
power = DIV_ROUND_CLOSEST(
power = DIV_ROUND_CLOSEST_ULL(
power_limit * child->weight, 1024);
}

Expand Down

0 comments on commit 8f50db4

Please sign in to comment.