[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1583185843-20707-2-git-send-email-jolly.shah@xilinx.com>
Date: Mon, 2 Mar 2020 13:50:40 -0800
From: Jolly Shah <jolly.shah@...inx.com>
To: olof@...om.net, mturquette@...libre.com, sboyd@...nel.org,
michal.simek@...inx.com, arm@...nel.org, linux-clk@...r.kernel.org
Cc: rajanv@...inx.com, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, Rajan Vaja <rajan.vaja@...inx.com>,
Jolly Shah <jolly.shah@...inx.com>
Subject: [PATCH v2 1/4] drivers: clk: zynqmp: Limit bestdiv with maxdiv
From: Rajan Vaja <rajan.vaja@...inx.com>
Clock divider value should not be greater than maximum divider value.
So use minimum of best divider or maximum divider value.
Signed-off-by: Rajan Vaja <rajan.vaja@...inx.com>
Signed-off-by: Jolly Shah <jolly.shah@...inx.com>
---
drivers/clk/zynqmp/divider.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/clk/zynqmp/divider.c b/drivers/clk/zynqmp/divider.c
index 973cdf0..7d2cb61 100644
--- a/drivers/clk/zynqmp/divider.c
+++ b/drivers/clk/zynqmp/divider.c
@@ -198,6 +198,8 @@ static long zynqmp_clk_divider_round_rate(struct clk_hw *hw,
if ((clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) && divider->is_frac)
bestdiv = rate % *prate ? 1 : bestdiv;
+
+ bestdiv = min_t(u32, bestdiv, divider->max_div);
*prate = rate * bestdiv;
return rate;
--
2.7.4
Powered by blists - more mailing lists