From patchwork Mon Feb 21 16:26:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 12753919 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7D170C433EF for ; Mon, 21 Feb 2022 16:31:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CF51210E656; Mon, 21 Feb 2022 16:31:24 +0000 (UTC) X-Greylist: delayed 301 seconds by postgrey-1.36 at gabe; Mon, 21 Feb 2022 16:31:23 UTC Received: from baptiste.telenet-ops.be (baptiste.telenet-ops.be [IPv6:2a02:1800:120:4::f00:13]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5EA5810E656 for ; Mon, 21 Feb 2022 16:31:23 +0000 (UTC) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed40:49dc:a1b5:3fe0:3d2b]) by baptiste.telenet-ops.be with bizsmtp id xsSJ260083YJRAw01sSJq1; Mon, 21 Feb 2022 17:26:18 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1nMBVx-001TiT-Ov; Mon, 21 Feb 2022 17:26:17 +0100 Received: from geert by rox.of.borg with local (Exim 4.93) (envelope-from ) id 1nMBVx-006G2O-19; Mon, 21 Feb 2022 17:26:17 +0100 From: Geert Uytterhoeven To: Laurent Pinchart , Kieran Bingham , David Airlie , Daniel Vetter Subject: [PATCH] drm: rcar-du: Simplify division/shift logic Date: Mon, 21 Feb 2022 17:26:15 +0100 Message-Id: X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-renesas-soc@vger.kernel.org, Geert Uytterhoeven , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" "a / (1 << b)" == "a >> b". No change in generated code. Signed-off-by: Geert Uytterhoeven --- drivers/gpu/drm/rcar-du/rcar_lvds.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_lvds.c b/drivers/gpu/drm/rcar-du/rcar_lvds.c index 72a272cfc11ee129..30afc1d3482a9670 100644 --- a/drivers/gpu/drm/rcar-du/rcar_lvds.c +++ b/drivers/gpu/drm/rcar-du/rcar_lvds.c @@ -229,7 +229,7 @@ static void rcar_lvds_d3_e3_pll_calc(struct rcar_lvds *lvds, struct clk *clk, * the PLL, followed by a an optional fixed /7 * divider. */ - fout = fvco / (1 << e) / div7; + fout = (fvco >> e) / div7; div = max(1UL, DIV_ROUND_CLOSEST(fout, target)); diff = abs(fout / div - target); @@ -249,7 +249,7 @@ static void rcar_lvds_d3_e3_pll_calc(struct rcar_lvds *lvds, struct clk *clk, } done: - output = fin * pll->pll_n / pll->pll_m / (1 << pll->pll_e) + output = (fin * pll->pll_n / pll->pll_m >> pll->pll_e) / div7 / pll->div; error = (long)(output - target) * 10000 / (long)target;