public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] regmap: Don't lock in regmap_reinit_cache()
@ 2012-07-27 13:54 Dimitris Papastamos
  2012-08-01 13:54 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Dimitris Papastamos @ 2012-07-27 13:54 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-kernel, patches

When bus->fast_io is set, the locking here is done with spinlocks.
This is currently true for the regmap-mmio bus implementation.

While holding a spinlock we can't go to sleep, various operations
like removing the debugfs entries or re-initializing the cache will
sleep, therefore, shift the locking up to the user.

Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
---
 V2, removed the change id that was automatically.

 drivers/base/regmap/regmap.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index c241ae2..52069d2 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -659,13 +659,12 @@ EXPORT_SYMBOL_GPL(devm_regmap_init);
  * new cache.  This can be used to restore the cache to defaults or to
  * update the cache configuration to reflect runtime discovery of the
  * hardware.
+ *
+ * No explicit locking is done here, the user needs to ensure that
+ * this function will not race with other calls to regmap.
  */
 int regmap_reinit_cache(struct regmap *map, const struct regmap_config *config)
 {
-	int ret;
-
-	map->lock(map);
-
 	regcache_exit(map);
 	regmap_debugfs_exit(map);
 
@@ -681,11 +680,7 @@ int regmap_reinit_cache(struct regmap *map, const struct regmap_config *config)
 	map->cache_bypass = false;
 	map->cache_only = false;
 
-	ret = regcache_init(map, config);
-
-	map->unlock(map);
-
-	return ret;
+	return regcache_init(map, config);
 }
 EXPORT_SYMBOL_GPL(regmap_reinit_cache);
 
-- 
1.7.11.3


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

* Re: [PATCH v2] regmap: Don't lock in regmap_reinit_cache()
  2012-07-27 13:54 [PATCH v2] regmap: Don't lock in regmap_reinit_cache() Dimitris Papastamos
@ 2012-08-01 13:54 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2012-08-01 13:54 UTC (permalink / raw)
  To: Dimitris Papastamos; +Cc: linux-kernel, patches

On Fri, Jul 27, 2012 at 02:54:15PM +0100, Dimitris Papastamos wrote:
> When bus->fast_io is set, the locking here is done with spinlocks.
> This is currently true for the regmap-mmio bus implementation.

Applied, thanks.

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

end of thread, other threads:[~2012-08-01 13:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-27 13:54 [PATCH v2] regmap: Don't lock in regmap_reinit_cache() Dimitris Papastamos
2012-08-01 13:54 ` Mark Brown

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