Skip to contentSkip to conversation

arm32 build failure after 992aa864dca068554802a65a467a2640985cc213

PATCH Nathan Chancellor 2 participants 2 messages Jun 18, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi all,

A 32-bit ARM allyesconfig fails to link after commit 992aa864dca0 ("mlxsw: spectrum_ptp: Add implementation for physical hardware clock operations") because of 64-bit division:

arm-linux-gnueabi-ld:
drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.o: in function `mlxsw_sp1_ptp_phc_settime':
spectrum_ptp.c:(.text+0x39c): undefined reference to `__aeabi_uldivmod'

The following diff fixes it but I have no idea if it is proper or not (hence reaching out before sending it, in case one of you has a more proper idea).

Cheers,
Nathan

---

drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c +1 -1
index 2a9bbc90225e..65686f0b6834 100644
@@ -87,7 +87,7 @@ mlxsw_sp1_ptp_phc_settime(struct mlxsw_sp_ptp_clock *clock, u64 nsec)
        u32 next_sec;
        int err;
 
-       next_sec = nsec / NSEC_PER_SEC + 1;
+       next_sec = (u32)div64_u64(nsec, NSEC_PER_SEC + 1);
        next_sec_in_nsec = next_sec * NSEC_PER_SEC;
 
        spin_lock(&clock->lock);
#1 lore raw
Quoted 27 lines · Nathan Chancellor

Hi all,

A 32-bit ARM allyesconfig fails to link after commit 992aa864dca0 ("mlxsw: spectrum_ptp: Add implementation for physical hardware clock operations") because of 64-bit division:

arm-linux-gnueabi-ld:
drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.o: in function `mlxsw_sp1_ptp_phc_settime':
spectrum_ptp.c:(.text+0x39c): undefined reference to `__aeabi_uldivmod'

The following diff fixes it but I have no idea if it is proper or not (hence reaching out before sending it, in case one of you has a more proper idea).

Cheers,
Nathan

---

drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c +0 -0
index 2a9bbc90225e..65686f0b6834 100644

drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c mlxsw_sp1_ptp_phc_settime(struct mlxsw_sp_ptp_clock *clock, u64 nsec) · line 93

Quoted 8 lines
drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c +1 -1
@@ -87,7 +87,7 @@ mlxsw_sp1_ptp_phc_settime(struct mlxsw_sp_ptp_clock *clock, u64 nsec)
        u32 next_sec;
        int err;
 
-       next_sec = nsec / NSEC_PER_SEC + 1;
+       next_sec = (u32)div64_u64(nsec, NSEC_PER_SEC + 1);
        next_sec_in_nsec = next_sec * NSEC_PER_SEC;
 
        spin_lock(&clock->lock);

Thanks for the report. I will send a fix.