mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] regmap: don't use spinlocks with REGCACHE_{RBTREE,COMPRESSED}
@ 2014-02-27  3:50 Andrew Bresticker
  2014-02-27 11:37 ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Bresticker @ 2014-02-27  3:50 UTC (permalink / raw)
  To: Mark Brown; +Cc: Greg Kroah-Hartman, linux-kernel, Andrew Bresticker

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@chromium.org>
---
 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-02-28  3:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-27  3:50 [PATCH] regmap: don't use spinlocks with REGCACHE_{RBTREE,COMPRESSED} Andrew Bresticker
2014-02-27 11:37 ` Mark Brown
2014-02-28  2:32   ` Andrew Bresticker
2014-02-28  3:39     ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®