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: 12753910 X-Patchwork-Delegate: kieran@bingham.xyz 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D119C433EF for ; Mon, 21 Feb 2022 16:26:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380261AbiBUQ1P (ORCPT ); Mon, 21 Feb 2022 11:27:15 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:53622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380573AbiBUQ1D (ORCPT ); Mon, 21 Feb 2022 11:27:03 -0500 Received: from baptiste.telenet-ops.be (baptiste.telenet-ops.be [IPv6:2a02:1800:120:4::f00:13]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A743227B29 for ; Mon, 21 Feb 2022 08:26:20 -0800 (PST) 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 Cc: dri-devel@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org, Geert Uytterhoeven 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 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org "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;