Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754951AbdLOHmO (ORCPT ); Fri, 15 Dec 2017 02:42:14 -0500 Received: from mga06.intel.com ([134.134.136.31]:56944 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753694AbdLOHfi (ORCPT ); Fri, 15 Dec 2017 02:35:38 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,403,1508828400"; d="scan'208";a="158949306" From: Sagar Arun Kamble To: linux-kernel@vger.kernel.org Cc: Sagar Arun Kamble , Richard Cochran , Tariq Toukan , netdev@vger.kernel.org, linux-rdma@vger.kernel.org Subject: [PATCH 11/27] net/mlx4: Use timecounter_initialize interface Date: Fri, 15 Dec 2017 13:08:26 +0530 Message-Id: <1513323522-15021-12-git-send-email-sagar.a.kamble@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1513323522-15021-1-git-send-email-sagar.a.kamble@intel.com> References: <1513323522-15021-1-git-send-email-sagar.a.kamble@intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2054 Lines: 54 With new interface timecounter_initialize we can initialize timecounter fields and underlying cyclecounter together. Update mlx4 timecounter init with this new function. Signed-off-by: Sagar Arun Kamble Cc: Richard Cochran Cc: Tariq Toukan Cc: netdev@vger.kernel.org Cc: linux-rdma@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- drivers/net/ethernet/mellanox/mlx4/en_clock.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx4/en_clock.c b/drivers/net/ethernet/mellanox/mlx4/en_clock.c index 35987b5..dd736cc 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_clock.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_clock.c @@ -264,6 +264,7 @@ void mlx4_en_init_timestamp(struct mlx4_en_dev *mdev) { struct mlx4_dev *dev = mdev->dev; unsigned long flags; + u32 mult, shift; /* mlx4_en_init_timestamp is called for each netdev. * mdev->ptp_clock is common for all ports, skip initialization if @@ -274,17 +275,17 @@ void mlx4_en_init_timestamp(struct mlx4_en_dev *mdev) seqlock_init(&mdev->clock_lock); - memset(&mdev->clock.cc, 0, sizeof(mdev->clock.cc)); - mdev->clock.cc.read = mlx4_en_read_clock; - mdev->clock.cc.mask = CLOCKSOURCE_MASK(48); - mdev->clock.cc.shift = freq_to_shift(dev->caps.hca_core_clock); - mdev->clock.cc.mult = - clocksource_khz2mult(1000 * dev->caps.hca_core_clock, - mdev->clock.cc.shift); + shift = freq_to_shift(dev->caps.hca_core_clock); + mult = clocksource_khz2mult(1000 * dev->caps.hca_core_clock, shift); mdev->nominal_c_mult = mdev->clock.cc.mult; write_seqlock_irqsave(&mdev->clock_lock, flags); - timecounter_init(&mdev->clock, ktime_to_ns(ktime_get_real())); + timecounter_initialize(&mdev->clock, + mlx4_en_read_clock, + CLOCKSOURCE_MASK(48), + mult, + shift, + ktime_to_ns(ktime_get_real())); write_sequnlock_irqrestore(&mdev->clock_lock, flags); /* Configure the PHC */ -- 1.9.1