With new interface timecounter_initialize we can initialize timecounter
fields and underlying cyclecounter together. Update fec ethernet
timecounter init with this new function.

Signed-off-by: Sagar Arun Kamble <sagar.a.kam...@intel.com>
Cc: Richard Cochran <richardcoch...@gmail.com>
Cc: Fugang Duan <fugang.d...@nxp.com>
Cc: net...@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/net/ethernet/freescale/fec_ptp.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fec_ptp.c 
b/drivers/net/ethernet/freescale/fec_ptp.c
index b1261d1..1ba7216 100644
--- a/drivers/net/ethernet/freescale/fec_ptp.c
+++ b/drivers/net/ethernet/freescale/fec_ptp.c
@@ -278,14 +278,13 @@ void fec_ptp_start_cyclecounter(struct net_device *ndev)
        writel(FEC_T_CTRL_ENABLE | FEC_T_CTRL_PERIOD_RST,
                fep->hwp + FEC_ATIME_CTRL);
 
-       memset(&fep->tc.cc, 0, sizeof(fep->tc.cc));
-       fep->tc.cc.read = fec_ptp_read;
-       fep->tc.cc.mask = CLOCKSOURCE_MASK(31);
-       fep->tc.cc.shift = 31;
-       fep->tc.cc.mult = FEC_CC_MULT;
-
-       /* reset the ns time counter */
-       timecounter_init(&fep->tc, ktime_to_ns(ktime_get_real()));
+       /* Initialize the ns time counter */
+       timecounter_initialize(&fep->tc,
+                              fec_ptp_read,
+                              CLOCKSOURCE_MASK(31),
+                              FEC_CC_MULT,
+                              31,
+                              ktime_to_ns(ktime_get_real()));
 
        spin_unlock_irqrestore(&fep->tmreg_lock, flags);
 }
-- 
1.9.1

Reply via email to