[PATCH] regmap: don't use spinlocks with REGCACHE_{RBTREE,COMPRESSED}

From: Andrew Bresticker
Date: Wed Feb 26 2014 - 22:59:09 EST


Both REGCACHE_RBTREE and REGCACHE_COMPRESSED make GFP_KERNEL allocations
with the regmap lock held. If we're initializing a regmap which would
normally use a spinlock (e.g. MMIO), fall back to using a mutex if one
of these caching types is to be used.

Signed-off-by: Andrew Bresticker <abrestic@xxxxxxxxxxxx>
---
drivers/base/regmap/regmap.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 2b4e72f..fb618d2 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -438,8 +438,9 @@ struct regmap *regmap_init(struct device *dev,
map->unlock = config->unlock;
map->lock_arg = config->lock_arg;
} else {
- if ((bus && bus->fast_io) ||
- config->fast_io) {
+ if (((bus && bus->fast_io) || config->fast_io) &&
+ config->cache_type != REGCACHE_RBTREE &&
+ config->cache_type != REGCACHE_COMPRESSED) {
spin_lock_init(&map->spinlock);
map->lock = regmap_lock_spinlock;
map->unlock = regmap_unlock_spinlock;
--
1.9.0.rc1.175.g0b1dcb5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/