From: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>
To: Mark Brown <broonie@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Danilo Krummrich <dakr@kernel.org>
Cc: linux-kernel@vger.kernel.org, driver-core@lists.linux.dev,
Peng Fan <peng.fan@nxp.com>
Subject: [PATCH RFC 3/4] regcache: rbtree: use the regmap scoped lock guard
Date: Mon, 21 Sep 2026 14:03:35 +0800 [thread overview]
Message-ID: <20260921-regmap-lock-guard-v1-3-cdbd97b46074@nxp.com> (raw)
In-Reply-To: <20260921-regmap-lock-guard-v1-0-cdbd97b46074@nxp.com>
From: Peng Fan <peng.fan@nxp.com>
Convert the open-coded map->lock()/map->unlock() pair in rbtree_show()
to guard(regmap)(). The locked region spans the whole function body up
to the single return, so a function-scope guard drops the manual
unlock with no functional change.
Assisted-by: Claude:claude-opus-4.8
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/base/regmap/regcache-rbtree.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/base/regmap/regcache-rbtree.c b/drivers/base/regmap/regcache-rbtree.c
index 520d5f8ba3cd..e2feed6dbecf 100644
--- a/drivers/base/regmap/regcache-rbtree.c
+++ b/drivers/base/regmap/regcache-rbtree.c
@@ -141,7 +141,7 @@ static int rbtree_show(struct seq_file *s, void *ignored)
int registers = 0;
int this_registers, average;
- map->lock(map->lock_arg);
+ guard(regmap)(map);
mem_size = sizeof(*rbtree_ctx);
@@ -168,8 +168,6 @@ static int rbtree_show(struct seq_file *s, void *ignored)
seq_printf(s, "%d nodes, %d registers, average %d registers, used %zu bytes\n",
nodes, registers, average, mem_size);
- map->unlock(map->lock_arg);
-
return 0;
}
--
2.51.0
next prev parent reply other threads:[~2026-09-21 6:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-21 6:03 [PATCH RFC 0/4] regmap: convert map->lock/unlock users to a scoped guard Peng Fan (OSS)
2026-09-21 6:03 ` [PATCH RFC 1/4] regmap: convert lock/unlock " Peng Fan (OSS)
2026-09-21 6:03 ` [PATCH RFC 2/4] regcache: use the regmap scoped lock guard Peng Fan (OSS)
2026-09-21 9:19 ` Mark Brown
2026-09-22 0:32 ` Peng Fan
2026-09-21 6:03 ` Peng Fan (OSS) [this message]
2026-09-21 6:03 ` [PATCH RFC 4/4] regmap: debugfs: " Peng Fan (OSS)
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=20260921-regmap-lock-guard-v1-3-cdbd97b46074@nxp.com \
--to=peng.fan@oss.nxp.com \
--cc=broonie@kernel.org \
--cc=dakr@kernel.org \
--cc=driver-core@lists.linux.dev \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peng.fan@nxp.com \
--cc=rafael@kernel.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
all inboxes | Powered by JetHome®