* [PATCH] clk: rockchip: validity should be checked prior to clock rate change
@ 2016-11-08 9:10 ` Elaine Zhang
0 siblings, 0 replies; 5+ messages in thread
From: Elaine Zhang @ 2016-11-08 9:10 UTC (permalink / raw)
To: heiko, mturquette, sboyd, xf, rocky.hao
Cc: huangtao, xxx, jay.xu, linux-clk, linux-rockchip, linux-kernel,
Elaine Zhang
If validity is not checked prior to clock rate change, clk_set_rate(
cpu_clk, unsupported_rate) will return success, but the real clock rate
change operation is prohibited in post clock change event. Alough post
clock change event will report error due to unsupported clock rate is
set, but this error message is ignored by clock framework.
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
Signed-off-by: Rocky Hao <rocky.hao@rock-chips.com>
---
drivers/clk/rockchip/clk-cpu.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/clk/rockchip/clk-cpu.c b/drivers/clk/rockchip/clk-cpu.c
index 05b3d73bfefa..c4b0cc83fa87 100644
--- a/drivers/clk/rockchip/clk-cpu.c
+++ b/drivers/clk/rockchip/clk-cpu.c
@@ -125,8 +125,17 @@ static int rockchip_cpuclk_pre_rate_change(struct rockchip_cpuclk *cpuclk,
{
const struct rockchip_cpuclk_reg_data *reg_data = cpuclk->reg_data;
unsigned long alt_prate, alt_div;
+ const struct rockchip_cpuclk_rate_table *rate;
unsigned long flags;
+ /* check validity of the new rate */
+ rate = rockchip_get_cpuclk_settings(cpuclk, ndata->new_rate);
+ if (!rate) {
+ pr_err("%s: Invalid rate : %lu for cpuclk\n",
+ __func__, ndata->new_rate);
+ return -EINVAL;
+ }
+
alt_prate = clk_get_rate(cpuclk->alt_parent);
spin_lock_irqsave(cpuclk->lock, flags);
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] clk: rockchip: validity should be checked prior to clock rate change
@ 2016-11-08 9:10 ` Elaine Zhang
0 siblings, 0 replies; 5+ messages in thread
From: Elaine Zhang @ 2016-11-08 9:10 UTC (permalink / raw)
To: heiko-4mtYJXux2i+zQB+pC5nmwQ, mturquette-rdvid1DuHRBWk0Htik3J/w,
sboyd-sgV2jX0FEOL9JmXXK+q4OQ, xf-TNX95d0MmH7DzftRWevZcw,
rocky.hao-TNX95d0MmH7DzftRWevZcw
Cc: huangtao-TNX95d0MmH7DzftRWevZcw, xxx-TNX95d0MmH7DzftRWevZcw,
Elaine Zhang, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
jay.xu-TNX95d0MmH7DzftRWevZcw, linux-clk-u79uwXL29TY76Z2rM5mHXA
If validity is not checked prior to clock rate change, clk_set_rate(
cpu_clk, unsupported_rate) will return success, but the real clock rate
change operation is prohibited in post clock change event. Alough post
clock change event will report error due to unsupported clock rate is
set, but this error message is ignored by clock framework.
Signed-off-by: Elaine Zhang <zhangqing-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
Signed-off-by: Rocky Hao <rocky.hao-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
---
drivers/clk/rockchip/clk-cpu.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/clk/rockchip/clk-cpu.c b/drivers/clk/rockchip/clk-cpu.c
index 05b3d73bfefa..c4b0cc83fa87 100644
--- a/drivers/clk/rockchip/clk-cpu.c
+++ b/drivers/clk/rockchip/clk-cpu.c
@@ -125,8 +125,17 @@ static int rockchip_cpuclk_pre_rate_change(struct rockchip_cpuclk *cpuclk,
{
const struct rockchip_cpuclk_reg_data *reg_data = cpuclk->reg_data;
unsigned long alt_prate, alt_div;
+ const struct rockchip_cpuclk_rate_table *rate;
unsigned long flags;
+ /* check validity of the new rate */
+ rate = rockchip_get_cpuclk_settings(cpuclk, ndata->new_rate);
+ if (!rate) {
+ pr_err("%s: Invalid rate : %lu for cpuclk\n",
+ __func__, ndata->new_rate);
+ return -EINVAL;
+ }
+
alt_prate = clk_get_rate(cpuclk->alt_parent);
spin_lock_irqsave(cpuclk->lock, flags);
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] clk: rockchip: validity should be checked prior to clock rate change
@ 2016-11-08 13:26 ` Heiko Stübner
0 siblings, 0 replies; 5+ messages in thread
From: Heiko Stübner @ 2016-11-08 13:26 UTC (permalink / raw)
To: Elaine Zhang
Cc: mturquette, sboyd, xf, rocky.hao, huangtao, xxx, jay.xu,
linux-clk, linux-rockchip, linux-kernel
Hi Elaine,
Am Dienstag, 8. November 2016, 17:10:14 schrieb Elaine Zhang:
> If validity is not checked prior to clock rate change, clk_set_rate(
> cpu_clk, unsupported_rate) will return success, but the real clock rate
> change operation is prohibited in post clock change event. Alough post
> clock change event will report error due to unsupported clock rate is
> set, but this error message is ignored by clock framework.
>
> Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
> Signed-off-by: Rocky Hao <rocky.hao@rock-chips.com>
looks good and thanks for catching this. Just a bureaucracy-question regarding
the Signed-off-by lines, before I can apply the patch as I don't really know
how Rocky fits into the picture.
I.e. was he the original patch author (the we should change the from) or a
reviewer/tester for the fixed issue?
Thanks
Heiko
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] clk: rockchip: validity should be checked prior to clock rate change
@ 2016-11-08 13:26 ` Heiko Stübner
0 siblings, 0 replies; 5+ messages in thread
From: Heiko Stübner @ 2016-11-08 13:26 UTC (permalink / raw)
To: Elaine Zhang
Cc: huangtao-TNX95d0MmH7DzftRWevZcw, xf-TNX95d0MmH7DzftRWevZcw,
mturquette-rdvid1DuHRBWk0Htik3J/w, sboyd-sgV2jX0FEOL9JmXXK+q4OQ,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-clk-u79uwXL29TY76Z2rM5mHXA,
linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
rocky.hao-TNX95d0MmH7DzftRWevZcw, jay.xu-TNX95d0MmH7DzftRWevZcw,
xxx-TNX95d0MmH7DzftRWevZcw
Hi Elaine,
Am Dienstag, 8. November 2016, 17:10:14 schrieb Elaine Zhang:
> If validity is not checked prior to clock rate change, clk_set_rate(
> cpu_clk, unsupported_rate) will return success, but the real clock rate
> change operation is prohibited in post clock change event. Alough post
> clock change event will report error due to unsupported clock rate is
> set, but this error message is ignored by clock framework.
>
> Signed-off-by: Elaine Zhang <zhangqing-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
> Signed-off-by: Rocky Hao <rocky.hao-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
looks good and thanks for catching this. Just a bureaucracy-question regarding
the Signed-off-by lines, before I can apply the patch as I don't really know
how Rocky fits into the picture.
I.e. was he the original patch author (the we should change the from) or a
reviewer/tester for the fixed issue?
Thanks
Heiko
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] clk: rockchip: validity should be checked prior to clock rate change
2016-11-08 9:10 ` Elaine Zhang
(?)
(?)
@ 2016-11-14 16:41 ` Heiko Stuebner
-1 siblings, 0 replies; 5+ messages in thread
From: Heiko Stuebner @ 2016-11-14 16:41 UTC (permalink / raw)
To: Elaine Zhang
Cc: mturquette, sboyd, xf, rocky.hao, huangtao, xxx, jay.xu,
linux-clk, linux-rockchip, linux-kernel
Am Dienstag, 8. November 2016, 17:10:14 CET schrieb Elaine Zhang:
> If validity is not checked prior to clock rate change, clk_set_rate(
> cpu_clk, unsupported_rate) will return success, but the real clock rate
> change operation is prohibited in post clock change event. Alough post
> clock change event will report error due to unsupported clock rate is
> set, but this error message is ignored by clock framework.
>
> Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
> Signed-off-by: Rocky Hao <rocky.hao@rock-chips.com>
after Elaine clarified that the line mentioning Rocky was actually a tested-by,
applied to my clock branch
Thanks
Heiko
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-11-14 16:41 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-08 9:10 [PATCH] clk: rockchip: validity should be checked prior to clock rate change Elaine Zhang
2016-11-08 9:10 ` Elaine Zhang
2016-11-08 13:26 ` Heiko Stübner
2016-11-08 13:26 ` Heiko Stübner
2016-11-14 16:41 ` Heiko Stuebner
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.