summaryrefslogtreecommitdiffstats
path: root/drivers/base/regmap/internal.h
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2013-05-24 10:29:22 +0200
committerMark Brown <broonie@opensource.wolfsonmicro.com>2013-05-25 11:16:02 -0400
commit92ab1aab59c61b3e05200b9aa0e05ab770059142 (patch)
tree53c798ac04a0ffabcdca31f33e69420fe864f1e7 /drivers/base/regmap/internal.h
parent81485f5220770c381ac076573642ac44f13723af (diff)
downloadop-kernel-dev-92ab1aab59c61b3e05200b9aa0e05ab770059142.zip
op-kernel-dev-92ab1aab59c61b3e05200b9aa0e05ab770059142.tar.gz
regmap: Make regmap-mmio usable from atomic contexts
regmap-mmio uses a spinlock with spin_lock() and spin_unlock() for locking. To be able to use the regmap API from different contexts (atomic vs non-atomic), without the risk of race conditions, we need to use spin_lock_irqsave() and spin_lock_irqrestore() instead. A new field, the spinlock_flags field, is added to regmap struct to store the flags between regmap_{,un}lock_spinlock(). The spinlock_flags field itself is also protected by the spinlock. Thanks to Stephen Warren for the suggestion of this particular solution. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Reviewed-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/base/regmap/internal.h')
-rw-r--r--drivers/base/regmap/internal.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/base/regmap/internal.h b/drivers/base/regmap/internal.h
index b33a4ff..ae23d83 100644
--- a/drivers/base/regmap/internal.h
+++ b/drivers/base/regmap/internal.h
@@ -52,6 +52,7 @@ struct regmap_async {
struct regmap {
struct mutex mutex;
spinlock_t spinlock;
+ unsigned long spinlock_flags;
regmap_lock lock;
regmap_unlock unlock;
void *lock_arg; /* This is passed to lock/unlock functions */
OpenPOWER on IntegriCloud