Commit 661e2180 authored by Stephen Boyd's avatar Stephen Boyd

clk: basic-type: Silence warnings about lock imbalances

The basic clock types use conditional locking for the register
accessor spinlocks. Add __acquire() and __release() markings in
the right locations so that sparse isn't tripped up on the
conditional locking.

drivers/clk/clk-mux.c:68:12: warning: context imbalance in 'clk_mux_set_parent' - different lock contexts for basic block
drivers/clk/clk-divider.c:379:12: warning: context imbalance in 'clk_divider_set_rate' - different lock contexts for basic block
drivers/clk/clk-gate.c:71:9: warning: context imbalance in 'clk_gate_endisable' - different lock contexts for basic block
drivers/clk/clk-fractional-divider.c:36:9: warning: context imbalance in 'clk_fd_recalc_rate' - different lock contexts for basic block
drivers/clk/clk-fractional-divider.c:68:12: warning: context imbalance in 'clk_fd_set_rate' - different lock contexts for basic block

Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarStephen Boyd <sboyd@codeaurora.org>
parent 169f05e8
...@@ -395,6 +395,8 @@ static int clk_divider_set_rate(struct clk_hw *hw, unsigned long rate, ...@@ -395,6 +395,8 @@ static int clk_divider_set_rate(struct clk_hw *hw, unsigned long rate,
if (divider->lock) if (divider->lock)
spin_lock_irqsave(divider->lock, flags); spin_lock_irqsave(divider->lock, flags);
else
__acquire(divider->lock);
if (divider->flags & CLK_DIVIDER_HIWORD_MASK) { if (divider->flags & CLK_DIVIDER_HIWORD_MASK) {
val = div_mask(divider->width) << (divider->shift + 16); val = div_mask(divider->width) << (divider->shift + 16);
...@@ -407,6 +409,8 @@ static int clk_divider_set_rate(struct clk_hw *hw, unsigned long rate, ...@@ -407,6 +409,8 @@ static int clk_divider_set_rate(struct clk_hw *hw, unsigned long rate,
if (divider->lock) if (divider->lock)
spin_unlock_irqrestore(divider->lock, flags); spin_unlock_irqrestore(divider->lock, flags);
else
__release(divider->lock);
return 0; return 0;
} }
......
...@@ -27,11 +27,15 @@ static unsigned long clk_fd_recalc_rate(struct clk_hw *hw, ...@@ -27,11 +27,15 @@ static unsigned long clk_fd_recalc_rate(struct clk_hw *hw,
if (fd->lock) if (fd->lock)
spin_lock_irqsave(fd->lock, flags); spin_lock_irqsave(fd->lock, flags);
else
__acquire(fd->lock);
val = clk_readl(fd->reg); val = clk_readl(fd->reg);
if (fd->lock) if (fd->lock)
spin_unlock_irqrestore(fd->lock, flags); spin_unlock_irqrestore(fd->lock, flags);
else
__release(fd->lock);
m = (val & fd->mmask) >> fd->mshift; m = (val & fd->mmask) >> fd->mshift;
n = (val & fd->nmask) >> fd->nshift; n = (val & fd->nmask) >> fd->nshift;
...@@ -80,6 +84,8 @@ static int clk_fd_set_rate(struct clk_hw *hw, unsigned long rate, ...@@ -80,6 +84,8 @@ static int clk_fd_set_rate(struct clk_hw *hw, unsigned long rate,
if (fd->lock) if (fd->lock)
spin_lock_irqsave(fd->lock, flags); spin_lock_irqsave(fd->lock, flags);
else
__acquire(fd->lock);
val = clk_readl(fd->reg); val = clk_readl(fd->reg);
val &= ~(fd->mmask | fd->nmask); val &= ~(fd->mmask | fd->nmask);
...@@ -88,6 +94,8 @@ static int clk_fd_set_rate(struct clk_hw *hw, unsigned long rate, ...@@ -88,6 +94,8 @@ static int clk_fd_set_rate(struct clk_hw *hw, unsigned long rate,
if (fd->lock) if (fd->lock)
spin_unlock_irqrestore(fd->lock, flags); spin_unlock_irqrestore(fd->lock, flags);
else
__release(fd->lock);
return 0; return 0;
} }
......
...@@ -52,6 +52,8 @@ static void clk_gate_endisable(struct clk_hw *hw, int enable) ...@@ -52,6 +52,8 @@ static void clk_gate_endisable(struct clk_hw *hw, int enable)
if (gate->lock) if (gate->lock)
spin_lock_irqsave(gate->lock, flags); spin_lock_irqsave(gate->lock, flags);
else
__acquire(gate->lock);
if (gate->flags & CLK_GATE_HIWORD_MASK) { if (gate->flags & CLK_GATE_HIWORD_MASK) {
reg = BIT(gate->bit_idx + 16); reg = BIT(gate->bit_idx + 16);
...@@ -70,6 +72,8 @@ static void clk_gate_endisable(struct clk_hw *hw, int enable) ...@@ -70,6 +72,8 @@ static void clk_gate_endisable(struct clk_hw *hw, int enable)
if (gate->lock) if (gate->lock)
spin_unlock_irqrestore(gate->lock, flags); spin_unlock_irqrestore(gate->lock, flags);
else
__release(gate->lock);
} }
static int clk_gate_enable(struct clk_hw *hw) static int clk_gate_enable(struct clk_hw *hw)
......
...@@ -84,6 +84,8 @@ static int clk_mux_set_parent(struct clk_hw *hw, u8 index) ...@@ -84,6 +84,8 @@ static int clk_mux_set_parent(struct clk_hw *hw, u8 index)
if (mux->lock) if (mux->lock)
spin_lock_irqsave(mux->lock, flags); spin_lock_irqsave(mux->lock, flags);
else
__acquire(mux->lock);
if (mux->flags & CLK_MUX_HIWORD_MASK) { if (mux->flags & CLK_MUX_HIWORD_MASK) {
val = mux->mask << (mux->shift + 16); val = mux->mask << (mux->shift + 16);
...@@ -96,6 +98,8 @@ static int clk_mux_set_parent(struct clk_hw *hw, u8 index) ...@@ -96,6 +98,8 @@ static int clk_mux_set_parent(struct clk_hw *hw, u8 index)
if (mux->lock) if (mux->lock)
spin_unlock_irqrestore(mux->lock, flags); spin_unlock_irqrestore(mux->lock, flags);
else
__release(mux->lock);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment