aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwspinlock
diff options
context:
space:
mode:
authorChristina Warren <cawarren@ti.com>2011-08-10 16:55:24 -0500
committerZiyann <jaraidaniel@gmail.com>2014-10-01 12:55:45 +0200
commit61e24dbadc61d2612703a879ac2e04229fa15e58 (patch)
tree5c4bb2b6ca75f9eb3607beca0b82c3ac60ed499e /drivers/hwspinlock
parent44bccf860052ed78c3c9c1e4aa6fbce8b58470eb (diff)
downloadkernel_samsung_tuna-61e24dbadc61d2612703a879ac2e04229fa15e58.tar.gz
kernel_samsung_tuna-61e24dbadc61d2612703a879ac2e04229fa15e58.tar.bz2
kernel_samsung_tuna-61e24dbadc61d2612703a879ac2e04229fa15e58.zip
drivers: hwspinlock: use mutex instead of spinlock
We cannot call functions which sleep when we hold a software spinlock. To avoid the warnings, we use a mutex instead. The mutex is initialized when we register the hwspinlock. Change-Id: Ifa331eb431552b29e1e6aafbb5a3469018909e9c Signed-off-by: Christina Warren <cawarren@ti.com> Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Diffstat (limited to 'drivers/hwspinlock')
-rw-r--r--drivers/hwspinlock/hwspinlock_core.c7
-rw-r--r--drivers/hwspinlock/hwspinlock_internal.h1
2 files changed, 5 insertions, 3 deletions
diff --git a/drivers/hwspinlock/hwspinlock_core.c b/drivers/hwspinlock/hwspinlock_core.c
index 12f7c8300c7..3908e776ac6 100644
--- a/drivers/hwspinlock/hwspinlock_core.c
+++ b/drivers/hwspinlock/hwspinlock_core.c
@@ -110,7 +110,7 @@ int __hwspin_trylock(struct hwspinlock *hwlock, int mode, unsigned long *flags)
else if (mode == HWLOCK_IRQ)
ret = spin_trylock_irq(&hwlock->lock);
else
- ret = spin_trylock(&hwlock->lock);
+ ret = mutex_trylock(&hwlock->slock);
/* is lock already taken by another context on the local cpu ? */
if (!ret)
@@ -126,7 +126,7 @@ int __hwspin_trylock(struct hwspinlock *hwlock, int mode, unsigned long *flags)
else if (mode == HWLOCK_IRQ)
spin_unlock_irq(&hwlock->lock);
else
- spin_unlock(&hwlock->lock);
+ mutex_unlock(&hwlock->slock);
return -EBUSY;
}
@@ -253,7 +253,7 @@ void __hwspin_unlock(struct hwspinlock *hwlock, int mode, unsigned long *flags)
else if (mode == HWLOCK_IRQ)
spin_unlock_irq(&hwlock->lock);
else
- spin_unlock(&hwlock->lock);
+ mutex_unlock(&hwlock->slock);
}
EXPORT_SYMBOL_GPL(__hwspin_unlock);
@@ -280,6 +280,7 @@ int hwspin_lock_register(struct hwspinlock *hwlock)
}
spin_lock_init(&hwlock->lock);
+ mutex_init(&hwlock->slock);
mutex_lock(&hwspinlock_tree_lock);
diff --git a/drivers/hwspinlock/hwspinlock_internal.h b/drivers/hwspinlock/hwspinlock_internal.h
index 69935e6b93e..605b206e00d 100644
--- a/drivers/hwspinlock/hwspinlock_internal.h
+++ b/drivers/hwspinlock/hwspinlock_internal.h
@@ -55,6 +55,7 @@ struct hwspinlock {
const struct hwspinlock_ops *ops;
int id;
spinlock_t lock;
+ struct mutex slock;
struct module *owner;
};