msm: clock: Move lateinit clock handoff code out of SKIP_AUTO_OFF check
The clock handoff feature is separate from auto-off and should not
be influenced by the SKIP_AUTO_OFF flag. Fix this so that
clk_disable_unprepare() is called for handed-off clocks at lateinit
even if that flag is set.
Change-Id: Iee617e53f46846eec0ba74a61a4d7efb80a8ba6a
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
diff --git a/arch/arm/mach-msm/clock.c b/arch/arm/mach-msm/clock.c
index cbb86a7..4073a8d 100644
--- a/arch/arm/mach-msm/clock.c
+++ b/arch/arm/mach-msm/clock.c
@@ -442,24 +442,24 @@
bool handoff = false;
clock_debug_add(clk);
+ spin_lock_irqsave(&clk->lock, flags);
if (!(clk->flags & CLKFLAG_SKIP_AUTO_OFF)) {
- spin_lock_irqsave(&clk->lock, flags);
if (!clk->count && clk->ops->auto_off) {
count++;
clk->ops->auto_off(clk);
}
- if (clk->flags & CLKFLAG_HANDOFF_RATE) {
- clk->flags &= ~CLKFLAG_HANDOFF_RATE;
- handoff = true;
- }
- spin_unlock_irqrestore(&clk->lock, flags);
- /*
- * Calling this outside the lock is safe since
- * it doesn't need to be atomic with the flag change.
- */
- if (handoff)
- clk_disable_unprepare(clk);
}
+ if (clk->flags & CLKFLAG_HANDOFF_RATE) {
+ clk->flags &= ~CLKFLAG_HANDOFF_RATE;
+ handoff = true;
+ }
+ spin_unlock_irqrestore(&clk->lock, flags);
+ /*
+ * Calling this outside the lock is safe since
+ * it doesn't need to be atomic with the flag change.
+ */
+ if (handoff)
+ clk_disable_unprepare(clk);
}
pr_info("clock_late_init() disabled %d unused clocks\n", count);
if (clk_init_data->late_init)