diff options
author | Dimitris Papastamos <dp@opensource.wolfsonmicro.com> | 2012-07-27 09:54:15 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-08-04 06:07:57 -0400 |
commit | 4d879514e73f3e6b27617d9898c83c9939462dda (patch) | |
tree | 06bf8f994fb2ccefb68fa8aba07897c7d87fdc47 | |
parent | 0d7614f09c1ebdbaa1599a5aba7593f147bf96ee (diff) |
regmap: Don't lock in regmap_reinit_cache()
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>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r-- | drivers/base/regmap/regmap.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index c241ae2f2f10..52069d29ff12 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c | |||
@@ -659,13 +659,12 @@ EXPORT_SYMBOL_GPL(devm_regmap_init); | |||
659 | * new cache. This can be used to restore the cache to defaults or to | 659 | * new cache. This can be used to restore the cache to defaults or to |
660 | * update the cache configuration to reflect runtime discovery of the | 660 | * update the cache configuration to reflect runtime discovery of the |
661 | * hardware. | 661 | * hardware. |
662 | * | ||
663 | * No explicit locking is done here, the user needs to ensure that | ||
664 | * this function will not race with other calls to regmap. | ||
662 | */ | 665 | */ |
663 | int regmap_reinit_cache(struct regmap *map, const struct regmap_config *config) | 666 | int regmap_reinit_cache(struct regmap *map, const struct regmap_config *config) |
664 | { | 667 | { |
665 | int ret; | ||
666 | |||
667 | map->lock(map); | ||
668 | |||
669 | regcache_exit(map); | 668 | regcache_exit(map); |
670 | regmap_debugfs_exit(map); | 669 | regmap_debugfs_exit(map); |
671 | 670 | ||
@@ -681,11 +680,7 @@ int regmap_reinit_cache(struct regmap *map, const struct regmap_config *config) | |||
681 | map->cache_bypass = false; | 680 | map->cache_bypass = false; |
682 | map->cache_only = false; | 681 | map->cache_only = false; |
683 | 682 | ||
684 | ret = regcache_init(map, config); | 683 | return regcache_init(map, config); |
685 | |||
686 | map->unlock(map); | ||
687 | |||
688 | return ret; | ||
689 | } | 684 | } |
690 | EXPORT_SYMBOL_GPL(regmap_reinit_cache); | 685 | EXPORT_SYMBOL_GPL(regmap_reinit_cache); |
691 | 686 | ||