[PATCH] drm: rcar-du: Simplify division/shift logic
Geert Uytterhoeven
geert+renesas at glider.be
Mon Feb 21 16:26:15 UTC 2022
"a / (1 << b)" == "a >> b".
No change in generated code.
Signed-off-by: Geert Uytterhoeven <geert+renesas at glider.be>
---
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;
--
2.25.1
More information about the dri-devel
mailing list