summaryrefslogtreecommitdiff
path: root/drivers/clk/clk.c
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@st.com>2012-04-11 14:33:42 +0400
committerMike Turquette <mturquette@linaro.org>2012-05-02 05:13:38 +0400
commit0e1c03017549a9df513622b3f15ff38eb8d35a62 (patch)
treef2fc7de20e598493916a27fbb7b6ba8104850a2f /drivers/clk/clk.c
parent0197b3ea0f66cd2a11417f58fe1812858ea77908 (diff)
downloadlinux-0e1c03017549a9df513622b3f15ff38eb8d35a62.tar.xz
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. Signed-off-by: Viresh Kumar <viresh.kumar@st.com> Signed-off-by: Mike Turquette <mturquette@linaro.org>
Diffstat (limited to 'drivers/clk/clk.c')
-rw-r--r--drivers/clk/clk.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index c81803b9ba35..8149764f8438 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -900,6 +900,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) {