[PATCH] clk: fix clk_round_rate() behaviour

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Right now this function returns the current rate of the clock in the
case when the round_rate() is not given in the clock's ops. This breaks
clk_set_rate(), which calls clk_round_rate() to check if the resulting
frequency would be the same as the one that is already set.
Make it so that clk_round_rate() returns the frequency that was given as
argument in this case.

Signed-off-by: Denis Orlov <denorl2009@xxxxxxxxx>
---
 drivers/clk/clk.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 52e309e877..7492717d3c 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -139,16 +139,16 @@ long clk_round_rate(struct clk *clk, unsigned long rate)
 	if (IS_ERR(clk))
 		return 0;
 
+	if (!clk->ops->round_rate)
+		return rate;
+
 	parent = clk_get_parent(clk);
 	if (parent)
 		parent_rate = clk_get_rate(parent);
 
 	hw = clk_to_clk_hw(clk);
 
-	if (clk->ops->round_rate)
-		return clk->ops->round_rate(hw, rate, &parent_rate);
-
-	return clk_get_rate(clk);
+	return clk->ops->round_rate(hw, rate, &parent_rate);
 }
 
 long clk_hw_round_rate(struct clk_hw *hw, unsigned long rate)
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux