Skip to contentSkip to conversation

clk: clk_calc_new_rates() required for parent only if CLK_SET_RATE_PARENT is set

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

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clk: clk_calc_new_rates() required for parent only if CLK_SET_RATE_PARENT is set

We need to call clk_calc_new_rates() for parent clock only when we have CLK_SET_RATE_PARENT flag set for clock.

This patch fixes it.

---
 drivers/clk/clk.c |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)
drivers/clk/clk.c +7 -8
index 2f58455..56e32a1 100644
@@ -780,15 +780,14 @@ static struct clk *clk_calc_new_rates(struct clk *clk, unsigned long rate)
 		goto out;
 	}
 
-	if (clk->flags & CLK_SET_RATE_PARENT)
-		new_rate = clk->ops->round_rate(clk->hw, rate, &best_parent_rate);
-	else
-		new_rate = clk->ops->round_rate(clk->hw, rate, NULL);
-
-	if (best_parent_rate != clk->parent->rate) {
-		top = clk_calc_new_rates(clk->parent, best_parent_rate);
+	if (clk->flags & CLK_SET_RATE_PARENT) {
+		new_rate = clk->ops->round_rate(clk->hw, rate,
+				&best_parent_rate);
 
-		goto out;
+		if (best_parent_rate != clk->parent->rate)
+			top = clk_calc_new_rates(clk->parent, best_parent_rate);
+	} else {
+		new_rate = clk->ops->round_rate(clk->hw, rate, NULL);
 	}
 
 out:
Signature · 1 line
1.7.9
#1 lore raw

PATCH 1/1 clk: clk_calc_new_rates() required for parent only if CLK_SET_RATE_PARENT is set

Quoted 6 lines · Viresh Kumar

We need to call clk_calc_new_rates() for parent clock only when we have CLK_SET_RATE_PARENT flag set for clock.

This patch fixes it.

I see no functional change in this patch. With or without this patch we only call clk_calc_new_rates() when the parent rate actually changed. The code is easier to read with this patch and may be slightly more efficient, so:

Quoted 40 lines
---
 drivers/clk/clk.c |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)
drivers/clk/clk.c +7 -8
index 2f58455..56e32a1 100644
@@ -780,15 +780,14 @@ static struct clk *clk_calc_new_rates(struct clk *clk, unsigned long rate)
 		goto out;
 	}
 
-	if (clk->flags & CLK_SET_RATE_PARENT)
-		new_rate = clk->ops->round_rate(clk->hw, rate, &best_parent_rate);
-	else
-		new_rate = clk->ops->round_rate(clk->hw, rate, NULL);
-
-	if (best_parent_rate != clk->parent->rate) {
-		top = clk_calc_new_rates(clk->parent, best_parent_rate);
+	if (clk->flags & CLK_SET_RATE_PARENT) {
+		new_rate = clk->ops->round_rate(clk->hw, rate,
+				&best_parent_rate);
 
-		goto out;
+		if (best_parent_rate != clk->parent->rate)
+			top = clk_calc_new_rates(clk->parent, best_parent_rate);
+	} else {
+		new_rate = clk->ops->round_rate(clk->hw, rate, NULL);
 	}
 
 out:
Signature · 7 lines
1.7.9


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#2 lore raw

PATCH 1/1 clk: clk_calc_new_rates() required for parent only if CLK_SET_RATE_PARENT is set

Quoted 6 lines · Sascha Hauer

I see no functional change in this patch. With or without this patch we only call clk_calc_new_rates() when the parent rate actually changed. The code is easier to read with this patch and may be slightly more efficient, so:

Thanks Sascha. :)
Actually i am doing SPEAr clock stuff and i have to look at already implemented clock source files. when i feel something can be rearranged in a better way (atleast according to me :) ), i patch it.

They wouldn't be tested as i don't have SPEAr stuff ready. Will mention this untested thing in patch next time.

You may see some more of these in coming time.

Signature · 1 line
viresh