Re: [PATCH] iio: adc: qcom-spmi-adc5-gen3: fix lock annotations on mutex helpers

From: Rupesh Majhi

Date: Sun Oct 18 2026 - 17:38:33 EST


On Sun, Oct 04, 2026 at 11:42:56AM +0300, Andy Shevchenko wrote:
> On Sun, Oct 04, 2026 at 12:45:16AM +0300, Rupesh Majhi wrote:
> > The __acquires() and __releases() on adc5_gen3_mutex_lock() and
> > adc5_gen3_mutex_unlock() name adc, a local declared in the body. With
> > context analysis enabled for this file, the build fails:
> >
> > error: use of undeclared identifier 'adc'
> >
> > The lock and unlock are split across these two helpers for the ADC_TM
> > driver, so mark them __context_unsafe() instead.
>
> Doesn't sound right to me. The __acquires() and __releases() IIRC are sparse
> annotations. If clang has something special, it needs to be addressed in
> the compiler-clang.h, no?

Sparse support for them went away in v7.0 with 5b63d0ae94cc
("compiler-context-analysis: Remove Sparse support"). They are now
defined in compiler-context-analysis.h and expand to clang's
acquire_capability() and release_capability(), or to nothing.

The argument is parsed at the declaration, where only dev is in scope,
so no header change can make adc visible there.

Sorry for the slow reply.