Re: [PATCH v2] iio: adc: qcom-spmi-adc5-gen3: fix lock annotations on mutex helpers
From: Andy Shevchenko
Date: Wed Oct 21 2026 - 10:37:39 EST
On Wed, Oct 21, 2026 at 08:24:35AM +0300, Rupesh Majhi wrote:
> 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@xxxxxxxxxx>
> Cc: Bart Van Assche <bvanassche@xxxxxxx>
Move Cc list after the '---' line (similar to the changelog block below),
it will have the same effect on email headers, but won't pollute the commit
message.
> Assisted-by: LLM
As of today we killed that tag, drop it.
> Signed-off-by: Rupesh Majhi <zoone.rupert@xxxxxxxxx>
> ---
> v2: explain __context_unsafe() in commit message (Andy)
> v1: https://lore.kernel.org/linux-iio/20261003214516.128573-1-zoone.rupert@xxxxxxxxx/
>
> 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.
--
With Best Regards,
Andy Shevchenko