aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Boyd <sboyd@codeaurora.org>2015-02-02 17:11:25 -0500
committerStephen Boyd <sboyd@codeaurora.org>2015-03-12 15:18:53 -0400
commitb61c43c09f5e2b9bf8f340034c5ef1db8c64efa5 (patch)
treeb0aae827b8dd71fc4c268b49e0a43af906f2cfb6
parentdfc202ead3123988793ac1160849676000b77ee4 (diff)
clk: clk_set_parent() with current parent shouldn't fail
If a driver calls clk_set_parent(clk, parent) and parent is the current parent of clk we shouldn't fail in any case. Unfortunately if clk is a read-only mux we return -ENOSYS because we think we can't change the parent, except for in this special case where we don't actually need to change the parent at all. Return 0 in such a situation. Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Acked-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Michael Turquette <mturquette@linaro.org>
-rw-r--r--drivers/clk/clk.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 42064cec2364..3e10cdff284b 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -2055,16 +2055,18 @@ static int clk_core_set_parent(struct clk_core *clk, struct clk_core *parent)
2055 if (!clk) 2055 if (!clk)
2056 return 0; 2056 return 0;
2057 2057
2058 /* verify ops for for multi-parent clks */
2059 if ((clk->num_parents > 1) && (!clk->ops->set_parent))
2060 return -ENOSYS;
2061
2062 /* prevent racing with updates to the clock topology */ 2058 /* prevent racing with updates to the clock topology */
2063 clk_prepare_lock(); 2059 clk_prepare_lock();
2064 2060
2065 if (clk->parent == parent) 2061 if (clk->parent == parent)
2066 goto out; 2062 goto out;
2067 2063
2064 /* verify ops for for multi-parent clks */
2065 if ((clk->num_parents > 1) && (!clk->ops->set_parent)) {
2066 ret = -ENOSYS;
2067 goto out;
2068 }
2069
2068 /* check that we are allowed to re-parent if the clock is in use */ 2070 /* check that we are allowed to re-parent if the clock is in use */
2069 if ((clk->flags & CLK_SET_PARENT_GATE) && clk->prepare_count) { 2071 if ((clk->flags & CLK_SET_PARENT_GATE) && clk->prepare_count) {
2070 ret = -EBUSY; 2072 ret = -EBUSY;