[PATCH RFC 0/6] iio: core: Introduce cleanup.h support for mode locks
From: Kurt Borja
Date: Wed Dec 03 2025 - 14:19:36 EST
Hi,
In a recent driver review discussion [1], Andy Shevchenko suggested we
add cleanup.h support for the lock API:
iio_device_claim_{direct,buffer_mode}().
Which would allow some nice code simplification* in many places. Some
examples are given as patches, but the last two are the biggest
differences.
Although I was never entirely sure if Andy meant cleanup classes for
locks or for iio_trigger_notify_done(), I still think this is a great
addition to the API :).
Thanks for taking a look!
* It's important to mention that David Lechner expressed some concerns
about this [2], hence why this is an RFC series.
[1] https://lore.kernel.org/linux-iio/aSsBdJZDWcadxEHC@xxxxxxxxxxxxxxxxxx/
[2] https://lore.kernel.org/linux-iio/248b009e-0401-4531-b9f0-56771e16bdef@xxxxxxxxxxxx/
Signed-off-by: Kurt Borja <kuurtb@xxxxxxxxx>
---
Kurt Borja (6):
iio: core: Match iio_device_claim_*() return semantics
iio: core: Match iio_device_claim_*() naming
iio: core: Add cleanup.h support for iio_device_claim_*()
iio: light: vcnl4000: Use cleanup.h for IIO locks
iio: health: max30102: Use cleanup.h for IIO locks
iio: light: opt4060: Use cleanup.h for IIO locks
drivers/iio/adc/ade9000.c | 4 +-
.../common/cros_ec_sensors/cros_ec_sensors_core.c | 7 +--
drivers/iio/health/max30100.c | 4 +-
drivers/iio/health/max30102.c | 24 +++-------
drivers/iio/industrialio-core.c | 34 +++++++++-----
drivers/iio/light/opt4060.c | 52 +++++++---------------
drivers/iio/light/vcnl4000.c | 24 ++++------
include/linux/iio/iio.h | 24 +++++++++-
8 files changed, 83 insertions(+), 90 deletions(-)
---
base-commit: f9e05791642810a0cf6237d39fafd6fec5e0b4bb
change-id: 20251130-lock-impr-6f22748c15e8
--
~ Kurt