Re: [PATCH v2 3/7] iio: core: Match iio_device_claim_*() semantics and implementation

From: Andy Shevchenko

Date: Fri Dec 12 2025 - 13:27:14 EST


On Thu, Dec 11, 2025 at 09:45:21PM -0500, Kurt Borja wrote:
> Implement iio_device_claim_buffer_mode() fully inline with the use of
> __iio_dev_mode_lock(), which takes care of sparse annotations.
>
> To completely match iio_device_claim_direct() semantics, we need to
> also change iio_device_claim_buffer_mode() return semantics to usual
> true/false conditional lock semantics.

...

> - if (iio_device_claim_buffer_mode(indio_dev)) {
> + if (!iio_device_claim_buffer_mode(indio_dev)) {
> /*
> * Replacing -EBUSY or other error code
> * returned by iio_device_claim_buffer_mode()

In one of the previous files you removed a comment, and here it's still present.

...

> - if (iio_device_claim_buffer_mode(indio_dev)) {
> + if (!iio_device_claim_buffer_mode(indio_dev)) {
> /*
> * This one is a *bit* hacky. If we cannot claim buffer
> * mode, then try direct mode so that we make sure

Also check if this comment needs to be amended.

--
With Best Regards,
Andy Shevchenko