From: Quanyang Wang <[email protected]>

64-bit division "(u64 A) / (u32 B)" will break linking on ARCH arm:

arm-linux-gnueabihf-ld: drivers/clk/si5324drv.o: in function `si5324_find_n2ls':
si5324drv.c:(.text+0xb94): undefined reference to `__aeabi_uldivmod'

Fix this by using do_div.

Signed-off-by: Quanyang Wang <[email protected]>
---
 drivers/clk/si5324drv.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/si5324drv.c b/drivers/clk/si5324drv.c
index 5c064a329e735..622ec6efd610d 100644
--- a/drivers/clk/si5324drv.c
+++ b/drivers/clk/si5324drv.c
@@ -151,12 +151,13 @@ static int si5324_find_n2ls(struct si5324_settingst 
*settings)
                                SI5324_FIN_FOUT_SHIFT)) {
                        pr_debug("Fout frequency out of range.\n");
                } else {
+                       u64 divident = fosc_actual >> SI5324_FIN_FOUT_SHIFT;
+
                        pr_debug("Found solution: fout = %dHz delta = %dHz.\n",
                                 (u32)(fout_actual >> SI5324_FIN_FOUT_SHIFT),
                                 (u32)(delta_fout >> SI5324_FIN_FOUT_SHIFT));
                        pr_debug("fosc = %dkHz f3 = %dHz.\n",
-                                (u32)((fosc_actual >> SI5324_FIN_FOUT_SHIFT) /
-                                      1000),
+                                (u32)(do_div(divident, 1000)),
                                 (u32)(f3_actual >> SI5324_FIN_FOUT_SHIFT));
 
                        if (((u64)abs(delta_fout)) <
-- 
2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#10103): 
https://lists.yoctoproject.org/g/linux-yocto/message/10103
Mute This Topic: https://lists.yoctoproject.org/mt/84148462/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to