From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932533AbeARSrG (ORCPT ); Thu, 18 Jan 2018 13:47:06 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:40484 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755003AbeARSpk (ORCPT ); Thu, 18 Jan 2018 13:45:40 -0500 X-Google-Smtp-Source: ACJfBouGa3m/s2Edd9cIZTZ0iR7INFcMVxAKRuT12IGGZ4uATakjq5YdL2TVMUdHZj1gm13qFWkD2w== From: Jerome Brunet To: Neil Armstrong Cc: Jerome Brunet , Kevin Hilman , Carlo Caione , Michael Turquette , Stephen Boyd , linux-amlogic@lists.infradead.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/9] clk: meson: use frac parameter width instead of a constant Date: Thu, 18 Jan 2018 19:45:27 +0100 Message-Id: <20180118184532.6856-5-jbrunet@baylibre.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180118184532.6856-1-jbrunet@baylibre.com> References: <20180118184532.6856-1-jbrunet@baylibre.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use the fractional part width in the calculation instead of 12, which happens to e the witdh right now. This is safer in case the field width ever change in the future Signed-off-by: Jerome Brunet --- drivers/clk/meson/clk-pll.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/meson/clk-pll.c b/drivers/clk/meson/clk-pll.c index fa4cec13d6e8..d9efe725b7ad 100644 --- a/drivers/clk/meson/clk-pll.c +++ b/drivers/clk/meson/clk-pll.c @@ -80,7 +80,7 @@ static unsigned long meson_clk_pll_recalc_rate(struct clk_hw *hw, reg = readl(pll->base + p->reg_off); frac = PARM_GET(p->width, p->shift, reg); - rate += (u64)parent_rate * frac >> 12; + rate += (u64)parent_rate * frac >> p->width; rate *= 2; } -- 2.14.3