* [PATCH net-next] mlxsw: spectrum_ptp: Fix compilation on 32-bit ARM
@ 2019-06-18 12:45 Shalom Toledo
2019-06-18 15:56 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Shalom Toledo @ 2019-06-18 12:45 UTC (permalink / raw)
To: netdev; +Cc: davem, Jiri Pirko, Ido Schimmel, mlxsw, natechancellor
Compilation on 32-bit ARM fails 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'
Fix by using div_u64().
Fixes: 992aa864dca0 ("mlxsw: spectrum_ptp: Add implementation for physical hardware clock operations")
Signed-off-by: Shalom Toledo <shalomt@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Reported-by: Nathan Chancellor <natechancellor@gmail.com>
---
drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c
index 2a9bbc90225e..bb6c0cb25771 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c
@@ -81,13 +81,12 @@ static int
mlxsw_sp1_ptp_phc_settime(struct mlxsw_sp_ptp_clock *clock, u64 nsec)
{
struct mlxsw_core *mlxsw_core = clock->core;
+ u64 next_sec, next_sec_in_nsec, cycles;
char mtutc_pl[MLXSW_REG_MTUTC_LEN];
char mtpps_pl[MLXSW_REG_MTPPS_LEN];
- u64 next_sec_in_nsec, cycles;
- u32 next_sec;
int err;
- next_sec = nsec / NSEC_PER_SEC + 1;
+ next_sec = div_u64(nsec, NSEC_PER_SEC) + 1;
next_sec_in_nsec = next_sec * NSEC_PER_SEC;
spin_lock(&clock->lock);
--
2.20.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] mlxsw: spectrum_ptp: Fix compilation on 32-bit ARM
2019-06-18 12:45 [PATCH net-next] mlxsw: spectrum_ptp: Fix compilation on 32-bit ARM Shalom Toledo
@ 2019-06-18 15:56 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-06-18 15:56 UTC (permalink / raw)
To: shalomt; +Cc: netdev, jiri, idosch, mlxsw, natechancellor
From: Shalom Toledo <shalomt@mellanox.com>
Date: Tue, 18 Jun 2019 12:45:35 +0000
> Compilation on 32-bit ARM fails 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'
>
> Fix by using div_u64().
>
> Fixes: 992aa864dca0 ("mlxsw: spectrum_ptp: Add implementation for physical hardware clock operations")
> Signed-off-by: Shalom Toledo <shalomt@mellanox.com>
> Reviewed-by: Ido Schimmel <idosch@mellanox.com>
> Reported-by: Nathan Chancellor <natechancellor@gmail.com>
Applied, thank you.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-06-18 15:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-18 12:45 [PATCH net-next] mlxsw: spectrum_ptp: Fix compilation on 32-bit ARM Shalom Toledo
2019-06-18 15:56 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).