diff options
| author | Peng Fan <peng.fan@nxp.com> | 2026-09-24 14:30:52 +0800 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-09-28 19:49:36 +0100 |
| commit | 80328b41ea2887229fbdc1bd03357ae0a9fa43f2 (patch) | |
| tree | 4ab2911f8d6461546aa5b54e6ba3c32890d1e7f2 /include/linux/workqueue_api.h | |
| parent | 93f51579e7df248780214094418f205253383cc5 (diff) | |
regmap: convert lock/unlock to a scoped guard
The regmap lock and unlock callbacks are invoked directly as
map->lock(map->lock_arg) / map->unlock(map->lock_arg) at every call
site. This open-coded pattern requires manual unlocking on every
return path, which spreads goto out_unlock chains and duplicated
unlock statements throughout the code and is an easy place to leak
the lock on an error path.
Define a scoped guard for the regmap lock in internal.h. The lock and
unlock callbacks are chosen at init time (mutex, spinlock, raw
spinlock, hwspinlock or none) and return void, so an unconditional
DEFINE_GUARD() is sufficient.
Convert all lock/unlock users in regmap.c to guard(regmap)() for
function-scope critical sections and scoped_guard(regmap, ...) where
work must run outside the lock (e.g. regmap_register_patch() calling
regmap_async_complete()). This drops every manual unlock and the
associated goto out_unlock labels with no functional change.
Assisted-by: LLM
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Link: https://patch.msgid.link/20260924-regmap-lock-guard-v3-1-8a6127223c16@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'include/linux/workqueue_api.h')
0 files changed, 0 insertions, 0 deletions
