summaryrefslogtreecommitdiffstats
path: root/drivers/clk/clk.c
diff options
context:
space:
mode:
authorStephen Boyd2015-07-24 21:24:48 +0200
committerStephen Boyd2015-07-28 20:59:30 +0200
commita57aa18539f8b232065f574f438edb646c6b9d9b (patch)
tree5feec1e76d3d6b8ac034c3bfe034a28b94fc335d /drivers/clk/clk.c
parentclk: basic-type: Silence warnings about lock imbalances (diff)
downloadkernel-qcow2-linux-a57aa18539f8b232065f574f438edb646c6b9d9b.tar.gz
kernel-qcow2-linux-a57aa18539f8b232065f574f438edb646c6b9d9b.tar.xz
kernel-qcow2-linux-a57aa18539f8b232065f574f438edb646c6b9d9b.zip
clk: Silence warnings about lock imbalances
The recursive spinlock implementation trips up sparse and it complains that these functions have lock imbalances. That isn't really true though, so add some __acquires() and __releases() information so that sparse is quiet. drivers/clk/clk.c:116:22: warning: context imbalance in 'clk_enable_lock' - wrong count at exit drivers/clk/clk.c:141:9: warning: context imbalance in 'clk_enable_unlock' - unexpected unlock Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Diffstat (limited to 'drivers/clk/clk.c')
-rw-r--r--drivers/clk/clk.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 819ffa6db83d..898052ee0efa 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -114,12 +114,14 @@ static void clk_prepare_unlock(void)
}
static unsigned long clk_enable_lock(void)
+ __acquires(enable_lock)
{
unsigned long flags;
if (!spin_trylock_irqsave(&enable_lock, flags)) {
if (enable_owner == current) {
enable_refcnt++;
+ __acquire(enable_lock);
return flags;
}
spin_lock_irqsave(&enable_lock, flags);
@@ -132,12 +134,15 @@ static unsigned long clk_enable_lock(void)
}
static void clk_enable_unlock(unsigned long flags)
+ __releases(enable_lock)
{
WARN_ON_ONCE(enable_owner != current);
WARN_ON_ONCE(enable_refcnt == 0);
- if (--enable_refcnt)
+ if (--enable_refcnt) {
+ __release(enable_lock);
return;
+ }
enable_owner = NULL;
spin_unlock_irqrestore(&enable_lock, flags);
}