[PATCH v4 3/9] iio: core: mark the mode lock helpers __context_unsafe
Rupesh Majhi
zoone.rupert at gmail.com
Tue Oct 27 05:49:48 PDT 2026
__iio_dev_mode_lock() and __iio_dev_mode_unlock() are declared to take
and release indio_dev, a token for the mode lock, because the mutex
itself is private to the core. Their bodies take and release the mutex
instead, which context analysis reports once it is on for the core.
Mark both definitions __context_unsafe().
Signed-off-by: Rupesh Majhi <zoone.rupert at gmail.com>
---
Cc: Marco Elver <elver at google.com>
Cc: Bart Van Assche <bvanassche at acm.org>
drivers/iio/industrialio-core.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index d73f2541375f..e9a5d1d905c1 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -2252,6 +2252,7 @@ EXPORT_SYMBOL_GPL(__devm_iio_device_register);
* iio_device_try_claim_buffer_mode() pairs or related helpers instead.
*/
void __iio_dev_mode_lock(struct iio_dev *indio_dev)
+ __context_unsafe(/* returns with mlock held */)
{
mutex_lock(&to_iio_dev_opaque(indio_dev)->mlock);
}
@@ -2262,6 +2263,7 @@ EXPORT_SYMBOL_GPL(__iio_dev_mode_lock);
* @indio_dev: the iio_dev associated with the device
*/
void __iio_dev_mode_unlock(struct iio_dev *indio_dev)
+ __context_unsafe(/* releases mlock */)
{
mutex_unlock(&to_iio_dev_opaque(indio_dev)->mlock);
}
--
2.43.0
More information about the linux-arm-kernel
mailing list