Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1440259 > unrolled thread
| Started by | <jiada_wang@mentor.com> |
|---|---|
| First post | 2016-07-11 07:40 +0200 |
| Last post | 2016-07-14 07:20 +0200 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
[RFC PATCH v2] clk: move check of CLK_SET_RATE_GATE flag to clk_propagate_rate_change() <jiada_wang@mentor.com> - 2016-07-11 07:40 +0200
Re: [RFC PATCH v2] clk: move check of CLK_SET_RATE_GATE flag to clk_propagate_rate_change() Michael Turquette <mturquette@baylibre.com> - 2016-07-13 00:40 +0200
Re: [RFC PATCH v2] clk: move check of CLK_SET_RATE_GATE flag to clk_propagate_rate_change() Jiada Wang <jiada_wang@mentor.com> - 2016-07-14 07:20 +0200
| From | <jiada_wang@mentor.com> |
|---|---|
| Date | 2016-07-11 07:40 +0200 |
| Subject | [RFC PATCH v2] clk: move check of CLK_SET_RATE_GATE flag to clk_propagate_rate_change() |
| Message-ID | <rTC6J-2Oh-11@gated-at.bofh.it> |
From: Jiada Wang <jiada_wang@mentor.com>
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 offsprings,
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 | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 820a939..2f930c8 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -1437,6 +1437,9 @@ static struct clk_core *clk_propagate_rate_change(struct clk_core *core,
if (core->rate == core->new_rate)
return NULL;
+ if ((core->flags & CLK_SET_RATE_GATE) && core->prepare_count)
+ return core;
+
if (core->notifier_count) {
ret = __clk_notify(core, event, core->rate, core->new_rate);
if (ret & NOTIFY_STOP_MASK)
@@ -1571,9 +1574,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)
--
1.7.9.5
[toc] | [next] | [standalone]
| From | Michael Turquette <mturquette@baylibre.com> |
|---|---|
| Date | 2016-07-13 00:40 +0200 |
| Subject | Re: [RFC PATCH v2] clk: move check of CLK_SET_RATE_GATE flag to clk_propagate_rate_change() |
| Message-ID | <rUevn-2IR-1@gated-at.bofh.it> |
| In reply to | #1440259 |
Quoting jiada_wang@mentor.com (2016-07-10 22:33:28)
> From: Jiada Wang <jiada_wang@mentor.com>
>
> 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 offsprings,
> 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>
> ---
What's different in version 2? It's tradition to put a little version
changelog here, below the "---" line and above the "diff --git a/..."
line.
Regards,
Mike
> drivers/clk/clk.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index 820a939..2f930c8 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -1437,6 +1437,9 @@ static struct clk_core *clk_propagate_rate_change(struct clk_core *core,
> if (core->rate == core->new_rate)
> return NULL;
>
> + if ((core->flags & CLK_SET_RATE_GATE) && core->prepare_count)
> + return core;
> +
> if (core->notifier_count) {
> ret = __clk_notify(core, event, core->rate, core->new_rate);
> if (ret & NOTIFY_STOP_MASK)
> @@ -1571,9 +1574,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)
> --
> 1.7.9.5
>
>
[toc] | [prev] | [next] | [standalone]
| From | Jiada Wang <jiada_wang@mentor.com> |
|---|---|
| Date | 2016-07-14 07:20 +0200 |
| Message-ID | <rUHe1-5dl-9@gated-at.bofh.it> |
| In reply to | #1441811 |
Hello Michael
On 07/13/2016 07:29 AM, Michael Turquette wrote:
> Quoting jiada_wang@mentor.com (2016-07-10 22:33:28)
>> From: Jiada Wang <jiada_wang@mentor.com>
>>
>> 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 offsprings,
>> 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>
>> ---
>
> What's different in version 2? It's tradition to put a little version
> changelog here, below the "---" line and above the "diff --git a/..."
> line.
>
version 2 resolves the following kernel warning
"
drivers/clk/clk.c: In function 'clk_propagate_rate_change':
>> drivers/clk/clk.c:1441:3: warning: return makes pointer from integer
without a cast
return -EBUSY;
^
"
I forgot to add a changelog in v2 patch, sorry for the confusion caused.
Thanks,
Jiada
> Regards,
> Mike
>
>> drivers/clk/clk.c | 6 +++---
>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
>> index 820a939..2f930c8 100644
>> --- a/drivers/clk/clk.c
>> +++ b/drivers/clk/clk.c
>> @@ -1437,6 +1437,9 @@ static struct clk_core *clk_propagate_rate_change(struct clk_core *core,
>> if (core->rate == core->new_rate)
>> return NULL;
>>
>> + if ((core->flags & CLK_SET_RATE_GATE) && core->prepare_count)
>> + return core;
>> +
>> if (core->notifier_count) {
>> ret = __clk_notify(core, event, core->rate, core->new_rate);
>> if (ret & NOTIFY_STOP_MASK)
>> @@ -1571,9 +1574,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)
>> --
>> 1.7.9.5
>>
>>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web