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

Kurt Borja
2026-01-17T19:45:13Z

On Sat Jan 17, 2026 at 7:01 AM -05, Andy Shevchenko wrote:
> пʼятниця, 16 січня 2026 р. David Lechner <dlechner@baylibre.com> пише:
>
>> On 1/6/26 2:06 AM, Kurt Borja 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.
>> >
>> > Signed-off-by: Kurt Borja <kuurtb@gmail.com>
>> > ---
>>
>> ...
>>
>> > diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
>> > index aecda887d833..3cf340208694 100644
>> > --- a/include/linux/iio/iio.h
>> > +++ b/include/linux/iio/iio.h
>> > @@ -664,31 +664,47 @@ int iio_push_event(struct iio_dev *indio_dev, u64
>> ev_code, s64 timestamp);
>> >
>> > void __iio_dev_mode_lock(struct iio_dev *indio_dev)
>> __acquires(indio_dev);
>> > void __iio_dev_mode_unlock(struct iio_dev *indio_dev)
>> __releases(indio_dev);
>> > -bool __iio_device_claim_direct(struct iio_dev *indio_dev);
>> > -void __iio_device_release_direct(struct iio_dev *indio_dev);
>> >
>> > /*
>> > * Helper functions that allow claim and release of direct mode
>> > * in a fashion that doesn't generate many false positives from sparse.
>> > * Note this must remain static inline in the header so that sparse
>> > - * can see the __acquire() marking. Revisit when sparse supports
>> > - * __cond_acquires()
>> > + * can see the __acquires() and __releases() markings.
>> > + */
>> > +
>> nit: I think "attributes" would be more technically correct than
>> "markings" (since we are touching this).
>>
>
> The annotations is slightly better because these are for sparse and not for
> compiler.

Hi Andy,

Yes, annotations also matches the Sparse documentation so I'll go with
that.

--
Thanks,
~ Kurt