Re: [PATCH v2 4/7] iio: core: Add cleanup.h support for iio_device_claim_*()
From: David Lechner
Date: Sat Dec 27 2025 - 13:21:05 EST
On 12/27/25 12:04 PM, Kurt Borja wrote:
> On Tue Dec 23, 2025 at 12:23 PM -05, David Lechner wrote:
>> On 12/11/25 8:45 PM, Kurt Borja wrote:
>>> Add guard classes for iio_device_claim_*() conditional locks. This will
>>> aid drivers write safer and cleaner code when dealing with some common
>>> patterns.
>>>
>>
...
>>> + */
>>> +#define IIO_DEV_ACQUIRE_ERR(_var_ptr) \
>>> + ACQUIRE_ERR(__priv__iio_dev_mode_lock_try_buffer, _var_ptr)
>>
>> There is no error code here, so calling it "ERR" seems wrong.
>> Maybe IIO_DEV_ACQUIRE_FAILED()?
>
> Here I'd prefer to keep it as _ERR so users can make the immediate
> association. But I don't feel strongly about it.
I'm afraid I fail to make any association with _ERR() and something that
doesn't have an error code.
Is this about following the established pattern with ACQUIRE() and
ACQUIRE_ERR()? Usually, I am strongly in favor of following patterns
like this. But in this case, I just doesn't make logical sense.