diff options
-rw-r--r-- | drivers/net/ethernet/adi/bfin_mac.c | 8 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 7 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/tg3.c | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/freescale/fec_ptp.c | 7 | ||||
-rw-r--r-- | drivers/net/ethernet/freescale/gianfar_ptp.c | 8 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/e1000e/ptp.c | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/igb/igb_ptp.c | 7 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c | 7 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/en_clock.c | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/ti/cpts.c | 7 |
11 files changed, 20 insertions, 47 deletions
diff --git a/drivers/net/ethernet/adi/bfin_mac.c b/drivers/net/ethernet/adi/bfin_mac.c index 0c37aefaaea0..096531a73124 100644 --- a/drivers/net/ethernet/adi/bfin_mac.c +++ b/drivers/net/ethernet/adi/bfin_mac.c | |||
@@ -986,7 +986,6 @@ static int bfin_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta) | |||
986 | static int bfin_ptp_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts) | 986 | static int bfin_ptp_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts) |
987 | { | 987 | { |
988 | u64 ns; | 988 | u64 ns; |
989 | u32 remainder; | ||
990 | unsigned long flags; | 989 | unsigned long flags; |
991 | struct bfin_mac_local *lp = | 990 | struct bfin_mac_local *lp = |
992 | container_of(ptp, struct bfin_mac_local, caps); | 991 | container_of(ptp, struct bfin_mac_local, caps); |
@@ -997,8 +996,8 @@ static int bfin_ptp_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts) | |||
997 | 996 | ||
998 | spin_unlock_irqrestore(&lp->phc_lock, flags); | 997 | spin_unlock_irqrestore(&lp->phc_lock, flags); |
999 | 998 | ||
1000 | ts->tv_sec = div_u64_rem(ns, 1000000000, &remainder); | 999 | *ts = ns_to_timespec64(ns); |
1001 | ts->tv_nsec = remainder; | 1000 | |
1002 | return 0; | 1001 | return 0; |
1003 | } | 1002 | } |
1004 | 1003 | ||
@@ -1010,8 +1009,7 @@ static int bfin_ptp_settime(struct ptp_clock_info *ptp, | |||
1010 | struct bfin_mac_local *lp = | 1009 | struct bfin_mac_local *lp = |
1011 | container_of(ptp, struct bfin_mac_local, caps); | 1010 | container_of(ptp, struct bfin_mac_local, caps); |
1012 | 1011 | ||
1013 | ns = ts->tv_sec * 1000000000ULL; | 1012 | ns = timespec64_to_ns(ts); |
1014 | ns += ts->tv_nsec; | ||
1015 | 1013 | ||
1016 | spin_lock_irqsave(&lp->phc_lock, flags); | 1014 | spin_lock_irqsave(&lp->phc_lock, flags); |
1017 | 1015 | ||
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index f0466a028145..177cb0e722e7 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
@@ -13290,14 +13290,12 @@ static int bnx2x_ptp_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts) | |||
13290 | { | 13290 | { |
13291 | struct bnx2x *bp = container_of(ptp, struct bnx2x, ptp_clock_info); | 13291 | struct bnx2x *bp = container_of(ptp, struct bnx2x, ptp_clock_info); |
13292 | u64 ns; | 13292 | u64 ns; |
13293 | u32 remainder; | ||
13294 | 13293 | ||
13295 | ns = timecounter_read(&bp->timecounter); | 13294 | ns = timecounter_read(&bp->timecounter); |
13296 | 13295 | ||
13297 | DP(BNX2X_MSG_PTP, "PTP gettime called, ns = %llu\n", ns); | 13296 | DP(BNX2X_MSG_PTP, "PTP gettime called, ns = %llu\n", ns); |
13298 | 13297 | ||
13299 | ts->tv_sec = div_u64_rem(ns, 1000000000ULL, &remainder); | 13298 | *ts = ns_to_timespec64(ns); |
13300 | ts->tv_nsec = remainder; | ||
13301 | 13299 | ||
13302 | return 0; | 13300 | return 0; |
13303 | } | 13301 | } |
@@ -13308,8 +13306,7 @@ static int bnx2x_ptp_settime(struct ptp_clock_info *ptp, | |||
13308 | struct bnx2x *bp = container_of(ptp, struct bnx2x, ptp_clock_info); | 13306 | struct bnx2x *bp = container_of(ptp, struct bnx2x, ptp_clock_info); |
13309 | u64 ns; | 13307 | u64 ns; |
13310 | 13308 | ||
13311 | ns = ts->tv_sec * 1000000000ULL; | 13309 | ns = timespec64_to_ns(ts); |
13312 | ns += ts->tv_nsec; | ||
13313 | 13310 | ||
13314 | DP(BNX2X_MSG_PTP, "PTP settime called, ns = %llu\n", ns); | 13311 | DP(BNX2X_MSG_PTP, "PTP settime called, ns = %llu\n", ns); |
13315 | 13312 | ||
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index d02d19bd34e0..1270b189a9a2 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
@@ -6220,7 +6220,6 @@ static int tg3_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta) | |||
6220 | static int tg3_ptp_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts) | 6220 | static int tg3_ptp_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts) |
6221 | { | 6221 | { |
6222 | u64 ns; | 6222 | u64 ns; |
6223 | u32 remainder; | ||
6224 | struct tg3 *tp = container_of(ptp, struct tg3, ptp_info); | 6223 | struct tg3 *tp = container_of(ptp, struct tg3, ptp_info); |
6225 | 6224 | ||
6226 | tg3_full_lock(tp, 0); | 6225 | tg3_full_lock(tp, 0); |
@@ -6228,8 +6227,7 @@ static int tg3_ptp_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts) | |||
6228 | ns += tp->ptp_adjust; | 6227 | ns += tp->ptp_adjust; |
6229 | tg3_full_unlock(tp); | 6228 | tg3_full_unlock(tp); |
6230 | 6229 | ||
6231 | ts->tv_sec = div_u64_rem(ns, 1000000000, &remainder); | 6230 | *ts = ns_to_timespec64(ns); |
6232 | ts->tv_nsec = remainder; | ||
6233 | 6231 | ||
6234 | return 0; | 6232 | return 0; |
6235 | } | 6233 | } |
diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c index b833993d2e19..a583d89b13c4 100644 --- a/drivers/net/ethernet/freescale/fec_ptp.c +++ b/drivers/net/ethernet/freescale/fec_ptp.c | |||
@@ -395,15 +395,13 @@ static int fec_ptp_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts) | |||
395 | struct fec_enet_private *adapter = | 395 | struct fec_enet_private *adapter = |
396 | container_of(ptp, struct fec_enet_private, ptp_caps); | 396 | container_of(ptp, struct fec_enet_private, ptp_caps); |
397 | u64 ns; | 397 | u64 ns; |
398 | u32 remainder; | ||
399 | unsigned long flags; | 398 | unsigned long flags; |
400 | 399 | ||
401 | spin_lock_irqsave(&adapter->tmreg_lock, flags); | 400 | spin_lock_irqsave(&adapter->tmreg_lock, flags); |
402 | ns = timecounter_read(&adapter->tc); | 401 | ns = timecounter_read(&adapter->tc); |
403 | spin_unlock_irqrestore(&adapter->tmreg_lock, flags); | 402 | spin_unlock_irqrestore(&adapter->tmreg_lock, flags); |
404 | 403 | ||
405 | ts->tv_sec = div_u64_rem(ns, 1000000000ULL, &remainder); | 404 | *ts = ns_to_timespec64(ns); |
406 | ts->tv_nsec = remainder; | ||
407 | 405 | ||
408 | return 0; | 406 | return 0; |
409 | } | 407 | } |
@@ -433,8 +431,7 @@ static int fec_ptp_settime(struct ptp_clock_info *ptp, | |||
433 | return -EINVAL; | 431 | return -EINVAL; |
434 | } | 432 | } |
435 | 433 | ||
436 | ns = ts->tv_sec * 1000000000ULL; | 434 | ns = timespec64_to_ns(ts); |
437 | ns += ts->tv_nsec; | ||
438 | /* Get the timer value based on timestamp. | 435 | /* Get the timer value based on timestamp. |
439 | * Update the counter with the masked value. | 436 | * Update the counter with the masked value. |
440 | */ | 437 | */ |
diff --git a/drivers/net/ethernet/freescale/gianfar_ptp.c b/drivers/net/ethernet/freescale/gianfar_ptp.c index 04265a7275e5..8e3cd77aa347 100644 --- a/drivers/net/ethernet/freescale/gianfar_ptp.c +++ b/drivers/net/ethernet/freescale/gianfar_ptp.c | |||
@@ -326,7 +326,6 @@ static int ptp_gianfar_gettime(struct ptp_clock_info *ptp, | |||
326 | struct timespec64 *ts) | 326 | struct timespec64 *ts) |
327 | { | 327 | { |
328 | u64 ns; | 328 | u64 ns; |
329 | u32 remainder; | ||
330 | unsigned long flags; | 329 | unsigned long flags; |
331 | struct etsects *etsects = container_of(ptp, struct etsects, caps); | 330 | struct etsects *etsects = container_of(ptp, struct etsects, caps); |
332 | 331 | ||
@@ -336,8 +335,8 @@ static int ptp_gianfar_gettime(struct ptp_clock_info *ptp, | |||
336 | 335 | ||
337 | spin_unlock_irqrestore(&etsects->lock, flags); | 336 | spin_unlock_irqrestore(&etsects->lock, flags); |
338 | 337 | ||
339 | ts->tv_sec = div_u64_rem(ns, 1000000000, &remainder); | 338 | *ts = ns_to_timespec64(ns); |
340 | ts->tv_nsec = remainder; | 339 | |
341 | return 0; | 340 | return 0; |
342 | } | 341 | } |
343 | 342 | ||
@@ -348,8 +347,7 @@ static int ptp_gianfar_settime(struct ptp_clock_info *ptp, | |||
348 | unsigned long flags; | 347 | unsigned long flags; |
349 | struct etsects *etsects = container_of(ptp, struct etsects, caps); | 348 | struct etsects *etsects = container_of(ptp, struct etsects, caps); |
350 | 349 | ||
351 | ns = ts->tv_sec * 1000000000ULL; | 350 | ns = timespec64_to_ns(ts); |
352 | ns += ts->tv_nsec; | ||
353 | 351 | ||
354 | spin_lock_irqsave(&etsects->lock, flags); | 352 | spin_lock_irqsave(&etsects->lock, flags); |
355 | 353 | ||
diff --git a/drivers/net/ethernet/intel/e1000e/ptp.c b/drivers/net/ethernet/intel/e1000e/ptp.c index 6fedc2c327dd..8d7b21dc7e19 100644 --- a/drivers/net/ethernet/intel/e1000e/ptp.c +++ b/drivers/net/ethernet/intel/e1000e/ptp.c | |||
@@ -111,15 +111,13 @@ static int e1000e_phc_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts) | |||
111 | struct e1000_adapter *adapter = container_of(ptp, struct e1000_adapter, | 111 | struct e1000_adapter *adapter = container_of(ptp, struct e1000_adapter, |
112 | ptp_clock_info); | 112 | ptp_clock_info); |
113 | unsigned long flags; | 113 | unsigned long flags; |
114 | u32 remainder; | ||
115 | u64 ns; | 114 | u64 ns; |
116 | 115 | ||
117 | spin_lock_irqsave(&adapter->systim_lock, flags); | 116 | spin_lock_irqsave(&adapter->systim_lock, flags); |
118 | ns = timecounter_read(&adapter->tc); | 117 | ns = timecounter_read(&adapter->tc); |
119 | spin_unlock_irqrestore(&adapter->systim_lock, flags); | 118 | spin_unlock_irqrestore(&adapter->systim_lock, flags); |
120 | 119 | ||
121 | ts->tv_sec = div_u64_rem(ns, NSEC_PER_SEC, &remainder); | 120 | *ts = ns_to_timespec64(ns); |
122 | ts->tv_nsec = remainder; | ||
123 | 121 | ||
124 | return 0; | 122 | return 0; |
125 | } | 123 | } |
diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c index c4894fb5c1d2..e3b9b63ad010 100644 --- a/drivers/net/ethernet/intel/igb/igb_ptp.c +++ b/drivers/net/ethernet/intel/igb/igb_ptp.c | |||
@@ -290,7 +290,6 @@ static int igb_ptp_gettime_82576(struct ptp_clock_info *ptp, | |||
290 | ptp_caps); | 290 | ptp_caps); |
291 | unsigned long flags; | 291 | unsigned long flags; |
292 | u64 ns; | 292 | u64 ns; |
293 | u32 remainder; | ||
294 | 293 | ||
295 | spin_lock_irqsave(&igb->tmreg_lock, flags); | 294 | spin_lock_irqsave(&igb->tmreg_lock, flags); |
296 | 295 | ||
@@ -298,8 +297,7 @@ static int igb_ptp_gettime_82576(struct ptp_clock_info *ptp, | |||
298 | 297 | ||
299 | spin_unlock_irqrestore(&igb->tmreg_lock, flags); | 298 | spin_unlock_irqrestore(&igb->tmreg_lock, flags); |
300 | 299 | ||
301 | ts->tv_sec = div_u64_rem(ns, 1000000000, &remainder); | 300 | *ts = ns_to_timespec64(ns); |
302 | ts->tv_nsec = remainder; | ||
303 | 301 | ||
304 | return 0; | 302 | return 0; |
305 | } | 303 | } |
@@ -328,8 +326,7 @@ static int igb_ptp_settime_82576(struct ptp_clock_info *ptp, | |||
328 | unsigned long flags; | 326 | unsigned long flags; |
329 | u64 ns; | 327 | u64 ns; |
330 | 328 | ||
331 | ns = ts->tv_sec * 1000000000ULL; | 329 | ns = timespec64_to_ns(ts); |
332 | ns += ts->tv_nsec; | ||
333 | 330 | ||
334 | spin_lock_irqsave(&igb->tmreg_lock, flags); | 331 | spin_lock_irqsave(&igb->tmreg_lock, flags); |
335 | 332 | ||
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c index 75b9e938728d..e5ba04025e2b 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c | |||
@@ -284,15 +284,13 @@ static int ixgbe_ptp_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts) | |||
284 | struct ixgbe_adapter *adapter = | 284 | struct ixgbe_adapter *adapter = |
285 | container_of(ptp, struct ixgbe_adapter, ptp_caps); | 285 | container_of(ptp, struct ixgbe_adapter, ptp_caps); |
286 | u64 ns; | 286 | u64 ns; |
287 | u32 remainder; | ||
288 | unsigned long flags; | 287 | unsigned long flags; |
289 | 288 | ||
290 | spin_lock_irqsave(&adapter->tmreg_lock, flags); | 289 | spin_lock_irqsave(&adapter->tmreg_lock, flags); |
291 | ns = timecounter_read(&adapter->tc); | 290 | ns = timecounter_read(&adapter->tc); |
292 | spin_unlock_irqrestore(&adapter->tmreg_lock, flags); | 291 | spin_unlock_irqrestore(&adapter->tmreg_lock, flags); |
293 | 292 | ||
294 | ts->tv_sec = div_u64_rem(ns, 1000000000ULL, &remainder); | 293 | *ts = ns_to_timespec64(ns); |
295 | ts->tv_nsec = remainder; | ||
296 | 294 | ||
297 | return 0; | 295 | return 0; |
298 | } | 296 | } |
@@ -313,8 +311,7 @@ static int ixgbe_ptp_settime(struct ptp_clock_info *ptp, | |||
313 | u64 ns; | 311 | u64 ns; |
314 | unsigned long flags; | 312 | unsigned long flags; |
315 | 313 | ||
316 | ns = ts->tv_sec * 1000000000ULL; | 314 | ns = timespec64_to_ns(ts); |
317 | ns += ts->tv_nsec; | ||
318 | 315 | ||
319 | /* reset the timecounter */ | 316 | /* reset the timecounter */ |
320 | spin_lock_irqsave(&adapter->tmreg_lock, flags); | 317 | spin_lock_irqsave(&adapter->tmreg_lock, flags); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_clock.c b/drivers/net/ethernet/mellanox/mlx4/en_clock.c index 666e7bdeb4f1..8a083d73efdb 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_clock.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_clock.c | |||
@@ -170,15 +170,13 @@ static int mlx4_en_phc_gettime(struct ptp_clock_info *ptp, | |||
170 | struct mlx4_en_dev *mdev = container_of(ptp, struct mlx4_en_dev, | 170 | struct mlx4_en_dev *mdev = container_of(ptp, struct mlx4_en_dev, |
171 | ptp_clock_info); | 171 | ptp_clock_info); |
172 | unsigned long flags; | 172 | unsigned long flags; |
173 | u32 remainder; | ||
174 | u64 ns; | 173 | u64 ns; |
175 | 174 | ||
176 | write_lock_irqsave(&mdev->clock_lock, flags); | 175 | write_lock_irqsave(&mdev->clock_lock, flags); |
177 | ns = timecounter_read(&mdev->clock); | 176 | ns = timecounter_read(&mdev->clock); |
178 | write_unlock_irqrestore(&mdev->clock_lock, flags); | 177 | write_unlock_irqrestore(&mdev->clock_lock, flags); |
179 | 178 | ||
180 | ts->tv_sec = div_u64_rem(ns, NSEC_PER_SEC, &remainder); | 179 | *ts = ns_to_timespec64(ns); |
181 | ts->tv_nsec = remainder; | ||
182 | 180 | ||
183 | return 0; | 181 | return 0; |
184 | } | 182 | } |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c index 172f3188361e..170a18b61281 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c | |||
@@ -111,7 +111,6 @@ static int stmmac_get_time(struct ptp_clock_info *ptp, struct timespec64 *ts) | |||
111 | container_of(ptp, struct stmmac_priv, ptp_clock_ops); | 111 | container_of(ptp, struct stmmac_priv, ptp_clock_ops); |
112 | unsigned long flags; | 112 | unsigned long flags; |
113 | u64 ns; | 113 | u64 ns; |
114 | u32 reminder; | ||
115 | 114 | ||
116 | spin_lock_irqsave(&priv->ptp_lock, flags); | 115 | spin_lock_irqsave(&priv->ptp_lock, flags); |
117 | 116 | ||
@@ -119,8 +118,7 @@ static int stmmac_get_time(struct ptp_clock_info *ptp, struct timespec64 *ts) | |||
119 | 118 | ||
120 | spin_unlock_irqrestore(&priv->ptp_lock, flags); | 119 | spin_unlock_irqrestore(&priv->ptp_lock, flags); |
121 | 120 | ||
122 | ts->tv_sec = div_u64_rem(ns, 1000000000ULL, &reminder); | 121 | *ts = ns_to_timespec64(ns); |
123 | ts->tv_nsec = reminder; | ||
124 | 122 | ||
125 | return 0; | 123 | return 0; |
126 | } | 124 | } |
diff --git a/drivers/net/ethernet/ti/cpts.c b/drivers/net/ethernet/ti/cpts.c index 074b6369da66..85a55b4ff8c0 100644 --- a/drivers/net/ethernet/ti/cpts.c +++ b/drivers/net/ethernet/ti/cpts.c | |||
@@ -170,7 +170,6 @@ static int cpts_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta) | |||
170 | static int cpts_ptp_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts) | 170 | static int cpts_ptp_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts) |
171 | { | 171 | { |
172 | u64 ns; | 172 | u64 ns; |
173 | u32 remainder; | ||
174 | unsigned long flags; | 173 | unsigned long flags; |
175 | struct cpts *cpts = container_of(ptp, struct cpts, info); | 174 | struct cpts *cpts = container_of(ptp, struct cpts, info); |
176 | 175 | ||
@@ -178,8 +177,7 @@ static int cpts_ptp_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts) | |||
178 | ns = timecounter_read(&cpts->tc); | 177 | ns = timecounter_read(&cpts->tc); |
179 | spin_unlock_irqrestore(&cpts->lock, flags); | 178 | spin_unlock_irqrestore(&cpts->lock, flags); |
180 | 179 | ||
181 | ts->tv_sec = div_u64_rem(ns, 1000000000, &remainder); | 180 | *ts = ns_to_timespec64(ns); |
182 | ts->tv_nsec = remainder; | ||
183 | 181 | ||
184 | return 0; | 182 | return 0; |
185 | } | 183 | } |
@@ -191,8 +189,7 @@ static int cpts_ptp_settime(struct ptp_clock_info *ptp, | |||
191 | unsigned long flags; | 189 | unsigned long flags; |
192 | struct cpts *cpts = container_of(ptp, struct cpts, info); | 190 | struct cpts *cpts = container_of(ptp, struct cpts, info); |
193 | 191 | ||
194 | ns = ts->tv_sec * 1000000000ULL; | 192 | ns = timespec64_to_ns(ts); |
195 | ns += ts->tv_nsec; | ||
196 | 193 | ||
197 | spin_lock_irqsave(&cpts->lock, flags); | 194 | spin_lock_irqsave(&cpts->lock, flags); |
198 | timecounter_init(&cpts->tc, &cpts->cc, ns); | 195 | timecounter_init(&cpts->tc, &cpts->cc, ns); |