aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Boyd <sboyd@codeaurora.org>2015-02-02 17:09:43 -0500
committerStephen Boyd <sboyd@codeaurora.org>2015-03-12 15:18:49 -0400
commit08b9575660cd6d654c05314fc41d2209f2d8bdfb (patch)
treea988748bd661eae7462e202d20674e4be3014323
parent6b54783620bcfaff37ad41e957d29c326211cc18 (diff)
clk: Missing set_phase op is an error
If a clock's clk_ops doesn't have the set_phase op set we should return an error from clk_set_phase(). This way clock consumers know that when they tried to set a phase it didn't work, as opposed to the current behavior where the return value is 0 meaning success. Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Michael Turquette <mturquette@linaro.org>
-rw-r--r--drivers/clk/clk.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index b0313cb4369c..0b3f39c03785 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -2123,10 +2123,10 @@ EXPORT_SYMBOL_GPL(clk_set_parent);
2123 */ 2123 */
2124int clk_set_phase(struct clk *clk, int degrees) 2124int clk_set_phase(struct clk *clk, int degrees)
2125{ 2125{
2126 int ret = 0; 2126 int ret = -EINVAL;
2127 2127
2128 if (!clk) 2128 if (!clk)
2129 goto out; 2129 return 0;
2130 2130
2131 /* sanity check degrees */ 2131 /* sanity check degrees */
2132 degrees %= 360; 2132 degrees %= 360;
@@ -2135,18 +2135,14 @@ int clk_set_phase(struct clk *clk, int degrees)
2135 2135
2136 clk_prepare_lock(); 2136 clk_prepare_lock();
2137 2137
2138 if (!clk->core->ops->set_phase) 2138 if (clk->core->ops->set_phase)
2139 goto out_unlock; 2139 ret = clk->core->ops->set_phase(clk->core->hw, degrees);
2140
2141 ret = clk->core->ops->set_phase(clk->core->hw, degrees);
2142 2140
2143 if (!ret) 2141 if (!ret)
2144 clk->core->phase = degrees; 2142 clk->core->phase = degrees;
2145 2143
2146out_unlock:
2147 clk_prepare_unlock(); 2144 clk_prepare_unlock();
2148 2145
2149out:
2150 return ret; 2146 return ret;
2151} 2147}
2152EXPORT_SYMBOL_GPL(clk_set_phase); 2148EXPORT_SYMBOL_GPL(clk_set_phase);