From: Richard Cochran Date: Tue, 31 Mar 2015 21:08:14 +0000 (+0200) Subject: ptp: mlx4: use helpers for converting ns to timespec. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f75419c81edf8e5c287cefd6e9a419b6e3c1300a;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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: Richard Cochran Signed-off-by: David S. Miller --- diff --git a/drivers/net/ethernet/mellanox/mlx4/en_clock.c b/drivers/net/ethernet/mellanox/mlx4/en_clock.c index 666e7bdeb4f1..8a083d73efdb 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_clock.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_clock.c @@ -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; }