msm: clock: Clean up handoff function return values
The intended interpretation of handoff function return value was for 1 or
true to indicate that a handoff of a running clock had been successfully
performed, and 0 or false to indicate that it had not (either because the
clock was off or the rate was invalid).
Some handoff functions added later, however, used the value of 0 to mean
something else: that the handoff of some state was successful, but the
enabled/disabled state of the clock was not checked.
The vague definitions for the return codes of these functions make
it difficult to understand their intended behaviour. Address this by
using an enum of return codes so that their intentions are obvious.
Also update the functions that did not check enabled/disabled state
to do so and return meaningful values.
Change-Id: Iebf4c9e4b358379f7f048a720888b299dc9ee8e5
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
diff --git a/arch/arm/mach-msm/clock-8960.c b/arch/arm/mach-msm/clock-8960.c
index 417b388..02706e0 100644
--- a/arch/arm/mach-msm/clock-8960.c
+++ b/arch/arm/mach-msm/clock-8960.c
@@ -2866,16 +2866,22 @@
return -ENXIO;
}
-static int pix_rdi_clk_handoff(struct clk *c)
+static enum handoff pix_rdi_clk_handoff(struct clk *c)
{
u32 reg;
struct pix_rdi_clk *clk = to_pix_rdi_clk(c);
+ enum handoff ret;
+
+ ret = branch_handoff(&clk->b, &clk->c);
+ if (ret == HANDOFF_DISABLED_CLK)
+ return ret;
reg = readl_relaxed(clk->s_reg);
clk->cur_rate = reg & clk->s_mask ? 1 : 0;
reg = readl_relaxed(clk->s2_reg);
clk->cur_rate = reg & clk->s2_mask ? 2 : clk->cur_rate;
- return 0;
+
+ return HANDOFF_ENABLED_CLK;
}
static struct clk_ops clk_ops_pix_rdi_8960 = {