From: Mark Brown <broonie@kernel.org>
To: "Liam R. Howlett" <Liam.Howlett@oracle.com>
Cc: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>,
maple-tree@lists.infradead.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, Mark Brown <broonie@kernel.org>
Subject: [PATCH 2/5] regmap: Hold the regmap lock when allocating and freeing the cache
Date: Thu, 22 Aug 2024 20:13:36 +0100 [thread overview]
Message-ID: <20240822-b4-regmap-maple-nolock-v1-2-d5e6dbae3396@kernel.org> (raw)
In-Reply-To: <20240822-b4-regmap-maple-nolock-v1-0-d5e6dbae3396@kernel.org>
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>
---
drivers/base/regmap/regcache.c | 4 ++++
drivers/base/regmap/regmap.c | 1 +
2 files changed, 5 insertions(+)
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index 7ec1ec605335..d3659ba3cc11 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -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);
}
}
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index bfc6bc1eb3a4..9ed842d17642 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -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)
--
2.39.2
next prev parent reply other threads:[~2024-08-25 17:21 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-22 19:13 [PATCH 0/5] regmap: Improve lock handling with maple tree Mark Brown
2024-08-22 19:13 ` [PATCH 1/5] maple_tree: Allow external locks to be configured with their map Mark Brown
2024-08-22 19:21 ` Matthew Wilcox
2024-08-22 19:48 ` Mark Brown
2024-08-22 19:55 ` Matthew Wilcox
2024-08-22 20:45 ` Mark Brown
2024-08-22 19:13 ` Mark Brown [this message]
[not found] ` <CGME20240828100239eucas1p2afc0d3088c66468061baf81c5676882a@eucas1p2.samsung.com>
2024-08-28 10:02 ` [PATCH 2/5] regmap: Hold the regmap lock when allocating and freeing the cache Marek Szyprowski
2024-08-28 11:32 ` Mark Brown
2024-08-22 19:13 ` [PATCH 3/5] regmap: Use locking during kunit tests Mark Brown
2024-08-22 19:13 ` [PATCH 4/5] regmap: Wrap maple tree locking Mark Brown
2024-08-22 19:13 ` [PATCH 5/5] regmap: Don't double lock maple cache when using a regmap provided lock Mark Brown
2024-08-23 22:57 ` (subset) [PATCH 0/5] regmap: Improve lock handling with maple tree Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240822-b4-regmap-maple-nolock-v1-2-d5e6dbae3396@kernel.org \
--to=broonie@kernel.org \
--cc=Liam.Howlett@oracle.com \
--cc=cristian.ciocaltea@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=maple-tree@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).