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

ptp: e1000e: use helpers for converting ns to timespec.

This patch changes the driver to use ns_to_timespec64() instead of
open coding the same logic.

Compile tested only.
Signed-off-by: default avatarRichard Cochran <richardcochran@gmail.com>
Acked-by: default avatarJacob Keller <jacob.e.keller@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3359e7c2
......@@ -111,15 +111,13 @@ static int e1000e_phc_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts)
struct e1000_adapter *adapter = container_of(ptp, struct e1000_adapter,
ptp_clock_info);
unsigned long flags;
u32 remainder;
u64 ns;
spin_lock_irqsave(&adapter->systim_lock, flags);
ns = timecounter_read(&adapter->tc);
spin_unlock_irqrestore(&adapter->systim_lock, flags);
ts->tv_sec = div_u64_rem(ns, NSEC_PER_SEC, &remainder);
ts->tv_nsec = remainder;
*ts = ns_to_timespec64(ns);
return 0;
}
......
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