]> Git Repo - linux.git/commitdiff
soc: qcom: stats: fix 64-bit division
authorArnd Bergmann <[email protected]>
Wed, 6 Dec 2023 12:37:06 +0000 (13:37 +0100)
committerBjorn Andersson <[email protected]>
Thu, 7 Dec 2023 15:21:51 +0000 (07:21 -0800)
Unguarded 64-bit division is not allowed on 32-bit kernels because this
is very slow. The result of trying anyway is a link failure:

arm-linux-gnueabi-ld: drivers/soc/qcom/qcom_stats.o: in function `qcom_ddr_stats_show':
qcom_stats.c:(.text+0x334): undefined reference to `__aeabi_uldivmod'

As this function is only used for debugging and not performance critical,
rewrite it to use div_u64() instead. ARCH_TIMER_FREQ is a multiple of
MSEC_PER_SEC anyway, so there is no loss in precisison.

Fixes: e84e61bdb97c ("soc: qcom: stats: Add DDR sleep stats")
Signed-off-by: Arnd Bergmann <[email protected]>
Reviewed-by: Uwe Kleine-König <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Bjorn Andersson <[email protected]>
drivers/soc/qcom/qcom_stats.c

index 4763d62a8cb0f1c1503817d4459076b281843f8a..5ec8a754b22b8b0903e94cad95c036aedb044f87 100644 (file)
@@ -221,7 +221,7 @@ static int qcom_ddr_stats_show(struct seq_file *s, void *unused)
 
        for (i = 0; i < ddr.entry_count; i++) {
                /* Convert the period to ms */
-               entry[i].dur = mult_frac(MSEC_PER_SEC, entry[i].dur, ARCH_TIMER_FREQ);
+               entry[i].dur = div_u64(entry[i].dur, ARCH_TIMER_FREQ / MSEC_PER_SEC);
        }
 
        for (i = 0; i < ddr.entry_count; i++)
This page took 0.06408 seconds and 4 git commands to generate.