mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3] clk: move check of CLK_SET_RATE_GATE flag to clk_propagate_rate_change()
@ 2016-08-23  8:10 Jiada Wang
  2016-08-23  8:10 ` [PATCH] " Jiada Wang
  0 siblings, 1 reply; 2+ messages in thread
From: Jiada Wang @ 2016-08-23  8:10 UTC (permalink / raw)
  To: mturquette, sboyd, linux-clk
  Cc: linux-kernel, joshua_frkuska, vladimir_zapolskiy, jiada_wang

v3:
- updated commit message
- only check CLK_SET_RATE_GATE flag in case of 'PRE_RATE_CHANGE' event
- continue propagate rate change, even when there is error in clk_propagate_rate_change()

v2:
- changed to return clk_core *core, instead of NULL

Jiada Wang (1):
  clk: move check of CLK_SET_RATE_GATE flag to
    clk_propagate_rate_change()

 drivers/clk/clk.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

-- 
2.4.5

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] clk: move check of CLK_SET_RATE_GATE flag to clk_propagate_rate_change()
  2016-08-23  8:10 [PATCH v3] clk: move check of CLK_SET_RATE_GATE flag to clk_propagate_rate_change() Jiada Wang
@ 2016-08-23  8:10 ` Jiada Wang
  0 siblings, 0 replies; 2+ messages in thread
From: Jiada Wang @ 2016-08-23  8:10 UTC (permalink / raw)
  To: mturquette, sboyd, linux-clk
  Cc: linux-kernel, joshua_frkuska, vladimir_zapolskiy, jiada_wang

Previously CLK_SET_RATE_GATE flag is only checked in clk_set_rate()
which only ensures the clock being called by clk_set_rate() won't
change rate when it has been prepared if CLK_SET_RATE_GATE flag is set.
But a clk_set_rate() request may propagate rate change to these clocks
from the requested clock's topmost parent clock to all its children,
when any one of these clocks has CLK_SET_RATE_GATE flag set
and it has been prepared, the clk_set_rate() request should fail.

This patch moves check of CLK_SET_RATE_GATE flag to
clk_propagate_rate_change() to ensure all affected clocks will
be checked if their rate will be changed after clk_set_rate().

Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
---
 drivers/clk/clk.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 820a939..021c740 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -1437,6 +1437,13 @@ static struct clk_core *clk_propagate_rate_change(struct clk_core *core,
 	if (core->rate == core->new_rate)
 		return NULL;
 
+	if ((event == PRE_RATE_CHANGE) &&
+	    (core->flags & CLK_SET_RATE_GATE) && core->prepare_count) {
+		pr_err("%s: %s not gated but wants to change rate\n",
+			__func__, core->name);
+		fail_clk = core;
+	}
+
 	if (core->notifier_count) {
 		ret = __clk_notify(core, event, core->rate, core->new_rate);
 		if (ret & NOTIFY_STOP_MASK)
@@ -1571,9 +1578,6 @@ static int clk_core_set_rate_nolock(struct clk_core *core,
 	if (rate == clk_core_get_rate_nolock(core))
 		return 0;
 
-	if ((core->flags & CLK_SET_RATE_GATE) && core->prepare_count)
-		return -EBUSY;
-
 	/* calculate new rates and get the topmost changed clock */
 	top = clk_calc_new_rates(core, rate);
 	if (!top)
-- 
2.4.5

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-08-23  8:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-23  8:10 [PATCH v3] clk: move check of CLK_SET_RATE_GATE flag to clk_propagate_rate_change() Jiada Wang
2016-08-23  8:10 ` [PATCH] " Jiada Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®