Skip to content

Commit fd4ebc0

Browse files
committed
regmap: Hold the regmap lock when allocating and freeing the cache
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>
1 parent c69bb91 commit fd4ebc0

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

drivers/base/regmap/regcache.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,9 @@ int regcache_init(struct regmap *map, const struct regmap_config *config)
195195
if (map->cache_ops->init) {
196196
dev_dbg(map->dev, "Initializing %s cache\n",
197197
map->cache_ops->name);
198+
map->lock(map->lock_arg);
198199
ret = map->cache_ops->init(map);
200+
map->unlock(map->lock_arg);
199201
if (ret)
200202
goto err_free;
201203
}
@@ -223,7 +225,9 @@ void regcache_exit(struct regmap *map)
223225
if (map->cache_ops->exit) {
224226
dev_dbg(map->dev, "Destroying %s cache\n",
225227
map->cache_ops->name);
228+
map->lock(map->lock_arg);
226229
map->cache_ops->exit(map);
230+
map->unlock(map->lock_arg);
227231
}
228232
}
229233

drivers/base/regmap/regmap.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1445,6 +1445,7 @@ void regmap_exit(struct regmap *map)
14451445
struct regmap_async *async;
14461446

14471447
regcache_exit(map);
1448+
14481449
regmap_debugfs_exit(map);
14491450
regmap_range_exit(map);
14501451
if (map->bus && map->bus->free_context)

0 commit comments

Comments
 (0)