Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f75419c8 authored by Richard Cochran's avatar Richard Cochran Committed by David S. Miller
Browse files

ptp: mlx4: 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>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 350f66d5
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -170,15 +170,13 @@ static int mlx4_en_phc_gettime(struct ptp_clock_info *ptp,
	struct mlx4_en_dev *mdev = container_of(ptp, struct mlx4_en_dev,
						ptp_clock_info);
	unsigned long flags;
	u32 remainder;
	u64 ns;

	write_lock_irqsave(&mdev->clock_lock, flags);
	ns = timecounter_read(&mdev->clock);
	write_unlock_irqrestore(&mdev->clock_lock, flags);

	ts->tv_sec = div_u64_rem(ns, NSEC_PER_SEC, &remainder);
	ts->tv_nsec = remainder;
	*ts = ns_to_timespec64(ns);

	return 0;
}