Skip to content

Commit 0704fae

Browse files
richardcochrandavem330
authored andcommitted
ptp: ixgbe: 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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6630514 commit 0704fae

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -284,15 +284,13 @@ static int ixgbe_ptp_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts)
284284
struct ixgbe_adapter *adapter =
285285
container_of(ptp, struct ixgbe_adapter, ptp_caps);
286286
u64 ns;
287-
u32 remainder;
288287
unsigned long flags;
289288

290289
spin_lock_irqsave(&adapter->tmreg_lock, flags);
291290
ns = timecounter_read(&adapter->tc);
292291
spin_unlock_irqrestore(&adapter->tmreg_lock, flags);
293292

294-
ts->tv_sec = div_u64_rem(ns, 1000000000ULL, &remainder);
295-
ts->tv_nsec = remainder;
293+
*ts = ns_to_timespec64(ns);
296294

297295
return 0;
298296
}
@@ -313,8 +311,7 @@ static int ixgbe_ptp_settime(struct ptp_clock_info *ptp,
313311
u64 ns;
314312
unsigned long flags;
315313

316-
ns = ts->tv_sec * 1000000000ULL;
317-
ns += ts->tv_nsec;
314+
ns = timespec64_to_ns(ts);
318315

319316
/* reset the timecounter */
320317
spin_lock_irqsave(&adapter->tmreg_lock, flags);

0 commit comments

Comments
 (0)