diff options
| author | Peng Fan <peng.fan@nxp.com> | 2026-10-02 21:11:17 +0800 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-10-06 18:08:00 +0200 |
| commit | 81556a7aec2254ffb3a35284dad5db5d0cf2f1c7 (patch) | |
| tree | ada2e81087ab00070ed75c61e2a7cfd68c947bb1 /include/linux | |
| parent | 012c37f09490db4d9b51bbcbf8def4436fc60f06 (diff) | |
regcache: extract locked helpers to replace open-coded lock/unlock pairs
The previous patch ("regcache: use the regmap scoped lock guard")
deliberately left regcache_init() with explicit map->lock()/unlock()
calls because the function has a goto err_* cleanup ladder and mixing
goto with cleanup helpers in the same function is discouraged by
cleanup.h.
Solve this by extracting two static helpers:
regcache_locked_op() - acquires the regmap lock via guard(regmap),
invokes an int-returning cache_ops callback
(init, populate), and returns its result.
Returns 0 when the callback is NULL.
regcache_locked_exit() - acquires the regmap lock via guard(regmap)
and invokes the void-returning exit
callback. Returns immediately when the
callback is NULL.
Because the lock scope is now entirely inside the helper functions,
it never crosses a goto target in the caller, so the cleanup.h
concern does not apply.
Convert all four remaining open-coded lock/unlock sites in
regcache_init() (init, populate, error-path exit) and the
scoped_guard in regcache_exit() to use these helpers.
No functional change.
Assisted-by: LLM
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Link: https://patch.msgid.link/20261002-regmap-lock-2nd-v2-1-e172b0501c52@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'include/linux')
0 files changed, 0 insertions, 0 deletions
