[PATCH v4 0/2] iio: adc: Use guard(mutex) to manage locks
From: Vaibhav Chahar
Date: Thu Nov 26 2026 - 06:45:08 EST
Convert mcp3564 and palmas_gpadc to use guard(mutex) instead of manual
mutex_lock() and mutex_unlock() calls to simplify error handling paths.
Changes in v4:
- mcp3564: Drop blank lines before `if (ret)` checks and add blank lines
after `guard(mutex)` in `mcp3564_read_raw()` to improve readibility.
- palmas_gpadc: Move `palmas_gpadc_read_done()` inside
`palmas_gpadc_read_raw_locked()` and drop unused `ret` from
`palmas_gpadc_read_raw()`, moved conditional check inside
`case IIO_EV_INFO_VALUE:`.
Changes in v3:
- mcp3564: Use of guard(mutex) across all paths. (Dropping __func__
from dev_dbg() calls will follow in a separate patch.)
- palmas_gpadc: Make helper function palmas_gpadc_read_raw_locked() so
palmas_gpadc_read_done() always runs before unlocking safely.
Changes in v2:
- Patch 1 (mcp3564): Wrap switch cases containing guard() in braces,
add blank lines around guard() calls, and clean up the commit message.
- Patch 2 (palmas_gpadc): New patch converting palmas_gpadc calls to
guard(mutex).
Vaibhav Chahar (2):
iio: adc: mcp3564: Use guard() to manage mutex
iio: adc: palmas_gpadc: Use guard(mutex) to manage locks
drivers/iio/adc/mcp3564.c | 103 ++++++++++++++-------------
drivers/iio/adc/palmas_gpadc.c | 126 ++++++++++++++-------------------
2 files changed, 107 insertions(+), 122 deletions(-)
--
2.56.0