Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755139AbdLOHlX (ORCPT ); Fri, 15 Dec 2017 02:41:23 -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 S1753922AbdLOHfm (ORCPT ); Fri, 15 Dec 2017 02:35:42 -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="158949327" From: Sagar Arun Kamble To: linux-kernel@vger.kernel.org Cc: Sagar Arun Kamble , Richard Cochran , Saeed Mahameed , Matan Barak , Leon Romanovsky , Eugenia Emantayev , Eitan Rabin , Feras Daoud , Miroslav Lichvar , netdev@vger.kernel.org, linux-rdma@vger.kernel.org Subject: [PATCH 12/27] net/mlx5: Use timecounter_initialize interface Date: Fri, 15 Dec 2017 13:08:27 +0530 Message-Id: <1513323522-15021-13-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: 2118 Lines: 59 With new interface timecounter_initialize we can initialize timecounter fields and underlying cyclecounter together. Update mlx5 timecounter init with this new function. Signed-off-by: Sagar Arun Kamble Cc: Richard Cochran Cc: Saeed Mahameed Cc: Matan Barak Cc: Leon Romanovsky Cc: Eugenia Emantayev Cc: Eitan Rabin Cc: Feras Daoud Cc: Sagar Arun Kamble Cc: Miroslav Lichvar Cc: netdev@vger.kernel.org Cc: linux-rdma@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c index 8cb6838..071f78a 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c @@ -458,6 +458,7 @@ void mlx5_init_clock(struct mlx5_core_dev *mdev) u64 ns; u64 frac = 0; u32 dev_freq; + u32 mult, shift; dev_freq = MLX5_CAP_GEN(mdev, device_frequency_khz); if (!dev_freq) { @@ -465,13 +466,16 @@ void mlx5_init_clock(struct mlx5_core_dev *mdev) return; } rwlock_init(&clock->lock); - cc->read = read_internal_timer; - cc->shift = MLX5_CYCLES_SHIFT; - cc->mult = clocksource_khz2mult(dev_freq, cc->shift); - clock->nominal_c_mult = cc->mult; - cc->mask = CLOCKSOURCE_MASK(41); - - timecounter_init(&clock->tc, ktime_to_ns(ktime_get_real())); + shift = MLX5_CYCLES_SHIFT; + mult = clocksource_khz2mult(dev_freq, shift); + clock->nominal_c_mult = mult; + + timecounter_initialize(&clock->tc, + read_internal_timer, + CLOCKSOURCE_MASK(41), + mult, + shift, + ktime_to_ns(ktime_get_real())); /* Calculate period in seconds to call the overflow watchdog - to make * sure counter is checked at least once every wrap around. -- 1.9.1