[PATCH RFC 3/4] regcache: rbtree: use the regmap scoped lock guard

From: Peng Fan (OSS)

Date: Mon Sep 21 2026 - 02:07:35 EST


From: Peng Fan <peng.fan@xxxxxxx>

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@xxxxxxx>
---
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