Re: [PATCH v5 2/7] iio: core: Refactor iio_device_claim_direct() implementation

Kurt Borja
2026-01-22T22:21:02Z

On Thu Jan 22, 2026 at 2:04 PM -05, Jonathan Cameron wrote:
> On Tue, 20 Jan 2026 01:20:42 -0500
> Kurt Borja <kuurtb@gmail.com> wrote:
>
>> In order to eventually unify the locking API, implement
>> iio_device_claim_direct() fully inline, with the use of
>> __iio_dev_mode_lock(), which takes care of sparse annotations.
>>
>> Reviewed-by: David Lechner <dlechner@baylibre.com>
>> Reviewed-by: Nuno Sá <nuno.sa@analog.com>
>> Signed-off-by: Kurt Borja <kuurtb@gmail.com>
>
> So sparse does change what it moans about with this one in precisely one instance
> There are 9 false positives with Al Viro's updated sparse - I haven't checked the
> original one recently.

Hi Jonathan,

Upstream sparse is kinda broken right now.

I'm not getting any false positives on the locking stuff but a BUNCH of
"error: bad constant expresion" on MODULE_*() macros so I don't fully
trust it.

I know at least one subsystem maintainer is getting these too so I guess
it's an upstream problem.

>
> Anyhow,
> drivers/iio/adc/ad7173.c:416:12: warning: context imbalance in 'ad7173_set_filter_type' - different lock contexts for basic block
> becomes
>
> drivers/iio/adc/ad7173.c:425:9: warning: context imbalance in 'ad7173_set_filter_type' - unexpected unlock

This one is interesting because I can't figure out why sparse hates it.

>
> Lets go with a bit meh for that and move on...
>

--
Thanks,
~ Kurt