* [PATCH v2] iio: adc: qcom-spmi-adc5-gen3: fix lock annotations on mutex helpers
@ 2026-10-21 5:24 Rupesh Majhi
0 siblings, 0 replies; only message in thread
From: Rupesh Majhi @ 2026-10-21 5:24 UTC (permalink / raw)
To: Andy Shevchenko, David Lechner, Jishnu Prakash, Jonathan Cameron,
Nuno Sá
Cc: linux-arm-msm, linux-iio, linux-kernel, Rupesh Majhi,
Marco Elver, Bart Van Assche
Since commit 5b63d0ae94cc ("compiler-context-analysis: Remove Sparse
support"), __acquires() and __releases() only feed context analysis.
Their argument is parsed before the function body, where only dev is in
scope, so with analysis enabled for this file the build fails:
error: use of undeclared identifier 'adc'
These helpers take and drop the lock for the ADC_TM driver, which only
sees their declarations in the header. Naming the lock there would
mean exposing struct adc5_chip, and with no annotation at all the
analysis flags the unbalanced locking. Mark both __context_unsafe().
Fixes: baff45179e90 ("iio: adc: Add support for QCOM PMIC5 Gen3 ADC")
Cc: Marco Elver <elver@google.com>
Cc: Bart Van Assche <bvanassche@acm.org>
Assisted-by: LLM
Signed-off-by: Rupesh Majhi <zoone.rupert@gmail.com>
---
v2: explain __context_unsafe() in commit message (Andy)
v1: https://lore.kernel.org/linux-iio/20261003214516.128573-1-zoone.rupert@gmail.com/
Found by building with CONTEXT_ANALYSIS_qcom-spmi-adc5-gen3.o=y, which the
driver does not set today. Build tested only, no hardware here.
drivers/iio/adc/qcom-spmi-adc5-gen3.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/adc/qcom-spmi-adc5-gen3.c b/drivers/iio/adc/qcom-spmi-adc5-gen3.c
index c68c6c5f6aca..6a3cabedf4e8 100644
--- a/drivers/iio/adc/qcom-spmi-adc5-gen3.c
+++ b/drivers/iio/adc/qcom-spmi-adc5-gen3.c
@@ -663,7 +663,7 @@ static int adc5_gen3_add_aux_tm_device(struct adc5_chip *adc)
}
void adc5_gen3_mutex_lock(struct device *dev)
- __acquires(&adc->lock)
+ __context_unsafe(/* returns with adc->lock held */)
{
struct iio_dev *indio_dev = dev_get_drvdata(dev->parent);
struct adc5_chip *adc = iio_priv(indio_dev);
@@ -673,7 +673,7 @@ void adc5_gen3_mutex_lock(struct device *dev)
EXPORT_SYMBOL_NS_GPL(adc5_gen3_mutex_lock, "QCOM_SPMI_ADC5_GEN3");
void adc5_gen3_mutex_unlock(struct device *dev)
- __releases(&adc->lock)
+ __context_unsafe(/* releases adc->lock */)
{
struct iio_dev *indio_dev = dev_get_drvdata(dev->parent);
struct adc5_chip *adc = iio_priv(indio_dev);
base-commit: 43ffda3c7f8456bbe641ae8249a077a361b97880
--
2.43.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-21 5:25 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-21 5:24 [PATCH v2] iio: adc: qcom-spmi-adc5-gen3: fix lock annotations on mutex helpers Rupesh Majhi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®