diff options
author | Richard Cochran <richardcochran@gmail.com> | 2015-03-31 17:08:12 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-03-31 17:19:19 -0400 |
commit | 350f66d58a62e63ef3163450f68ed4b2a0ab507b (patch) | |
tree | 7995902748712d1e9e58dfa4afa4d0cf15d536cc | |
parent | bdf36d947134baced573594118ff575f5c6cb77b (diff) |
ptp: igb: 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>
-rw-r--r-- | drivers/net/ethernet/intel/igb/igb_ptp.c | 7 |
1 files changed, 2 insertions, 5 deletions
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 | ||