Commit 350f66d5 authored by Richard Cochran's avatar Richard Cochran Committed by David S. Miller

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: default avatarRichard Cochran <richardcochran@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent bdf36d94
...@@ -290,7 +290,6 @@ static int igb_ptp_gettime_82576(struct ptp_clock_info *ptp, ...@@ -290,7 +290,6 @@ static int igb_ptp_gettime_82576(struct ptp_clock_info *ptp,
ptp_caps); ptp_caps);
unsigned long flags; unsigned long flags;
u64 ns; u64 ns;
u32 remainder;
spin_lock_irqsave(&igb->tmreg_lock, flags); spin_lock_irqsave(&igb->tmreg_lock, flags);
...@@ -298,8 +297,7 @@ static int igb_ptp_gettime_82576(struct ptp_clock_info *ptp, ...@@ -298,8 +297,7 @@ static int igb_ptp_gettime_82576(struct ptp_clock_info *ptp,
spin_unlock_irqrestore(&igb->tmreg_lock, flags); spin_unlock_irqrestore(&igb->tmreg_lock, flags);
ts->tv_sec = div_u64_rem(ns, 1000000000, &remainder); *ts = ns_to_timespec64(ns);
ts->tv_nsec = remainder;
return 0; return 0;
} }
...@@ -328,8 +326,7 @@ static int igb_ptp_settime_82576(struct ptp_clock_info *ptp, ...@@ -328,8 +326,7 @@ static int igb_ptp_settime_82576(struct ptp_clock_info *ptp,
unsigned long flags; unsigned long flags;
u64 ns; u64 ns;
ns = ts->tv_sec * 1000000000ULL; ns = timespec64_to_ns(ts);
ns += ts->tv_nsec;
spin_lock_irqsave(&igb->tmreg_lock, flags); spin_lock_irqsave(&igb->tmreg_lock, flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment