]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
regmap: Hold the regmap lock when allocating and freeing the cache
authorMark Brown <broonie@kernel.org>
Thu, 22 Aug 2024 19:13:36 +0000 (20:13 +0100)
committerMark Brown <broonie@kernel.org>
Fri, 23 Aug 2024 10:03:11 +0000 (11:03 +0100)
For the benefit of the maple tree's lockdep checking hold the lock while
creating and exiting the cache.

Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://patch.msgid.link/20240822-b4-regmap-maple-nolock-v1-2-d5e6dbae3396@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/base/regmap/regcache.c
drivers/base/regmap/regmap.c

index 7ec1ec60533508562caf1ec1ab80a2416a8cdd74..d3659ba3cc1122f55c53c1acd568010cb4d78f4d 100644 (file)
@@ -195,7 +195,9 @@ int regcache_init(struct regmap *map, const struct regmap_config *config)
        if (map->cache_ops->init) {
                dev_dbg(map->dev, "Initializing %s cache\n",
                        map->cache_ops->name);
+               map->lock(map->lock_arg);
                ret = map->cache_ops->init(map);
+               map->unlock(map->lock_arg);
                if (ret)
                        goto err_free;
        }
@@ -223,7 +225,9 @@ void regcache_exit(struct regmap *map)
        if (map->cache_ops->exit) {
                dev_dbg(map->dev, "Destroying %s cache\n",
                        map->cache_ops->name);
+               map->lock(map->lock_arg);
                map->cache_ops->exit(map);
+               map->unlock(map->lock_arg);
        }
 }
 
index bfc6bc1eb3a4a9245a1d7167aeae4a07750553a4..9ed842d17642b54b7de05676cc659e94c828e2ee 100644 (file)
@@ -1445,6 +1445,7 @@ void regmap_exit(struct regmap *map)
        struct regmap_async *async;
 
        regcache_exit(map);
+
        regmap_debugfs_exit(map);
        regmap_range_exit(map);
        if (map->bus && map->bus->free_context)