Skip to contentSkip to conversation

clk: clk_set_rate() must fail if CLK_SET_RATE_GATE is set and clk is enabled

PATCH New Viresh Kumar 2 participants 2 messages Apr 11, 2012 – May 2, 2012 Common clk

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clk: clk_set_rate() must fail if CLK_SET_RATE_GATE is set and clk is enabled

This is well documented but isn't implemented. clk_set_rate() must check if flags have CLK_SET_RATE_GATE bit set and is enabled too.

Untested patch.

---
 drivers/clk/clk.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/clk/clk.c +5 -0
index 9d11c19..65dc35d 100644
@@ -905,6 +905,11 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
 	if (rate == clk->rate)
 		goto out;
 
+	if ((clk->flags & CLK_SET_RATE_GATE) && __clk_is_enabled(clk)) {
+		ret = -EBUSY;
+		goto out;
+	}
+
 	/* calculate new rates and get the topmost changed clock */
 	top = clk_calc_new_rates(clk, rate);
 	if (!top) {
Signature · 1 line
1.7.9
#1 lore raw

PATCH 1/1 clk: clk_set_rate() must fail if CLK_SET_RATE_GATE is set and clk is enabled

Quoted 6 lines · Viresh Kumar

This is well documented but isn't implemented. clk_set_rate() must check if flags have CLK_SET_RATE_GATE bit set and is enabled too.

Untested patch.

Tested and pulled into clk-next.

Thanks,
Mike

Quoted 23 lines
---
 drivers/clk/clk.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/clk/clk.c +5 -0
index 9d11c19..65dc35d 100644
@@ -905,6 +905,11 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
 	if (rate == clk->rate)
 		goto out;
 
+	if ((clk->flags & CLK_SET_RATE_GATE) && __clk_is_enabled(clk)) {
+		ret = -EBUSY;
+		goto out;
+	}
+
 	/* calculate new rates and get the topmost changed clock */
 	top = clk_calc_new_rates(clk, rate);
 	if (!top) {
Signature · 1 line
1.7.9