aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/freescale
diff options
context:
space:
mode:
authorRichard Cochran <richardcochran@gmail.com>2015-03-31 17:08:09 -0400
committerDavid S. Miller <davem@davemloft.net>2015-03-31 17:19:19 -0400
commit6630514fcee9987a06e991956a1e8eaa2a421a70 (patch)
tree7caa6a3d16049557e8f8f3b5266cecac5ff712b9 /drivers/net/ethernet/freescale
parent7a20efb07437f8716977401c5bd183c3d192ff12 (diff)
ptp: fec: use helpers for converting ns to timespec.
This patch changes the driver to use ns_to_timespec64() and timespec64_to_ns() instead of open coding the same logic. Compile tested only. Signed-off-by: Richard Cochran <richardcochran@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/freescale')
-rw-r--r--drivers/net/ethernet/freescale/fec_ptp.c7
1 files changed, 2 insertions, 5 deletions
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 */