Re: [PATCH RFC 3/6] iio: core: Add cleanup.h support for iio_device_claim_*()

From: Andy Shevchenko

Date: Thu Dec 04 2025 - 12:37:07 EST


On Thu, Dec 4, 2025 at 7:18 PM Kurt Borja <kuurtb@xxxxxxxxx> wrote:
> On Wed Dec 3, 2025 at 5:34 PM -05, David Lechner wrote:
> > On 12/3/25 3:50 PM, David Lechner wrote:
> >> On 12/3/25 1:18 PM, Kurt Borja wrote:

...

> > When I made the comments about keeping "mode" in the name, I forgot
> > that DEFINE_GUARD_COND() only extends a DEFINE_GUARD(). So I understand
> > if we need to make names that fit a certain pattern rather than what
> > I suggested.
> >
> > Still would be nice to have:
> >
> > iio_device_claim_mode()
> > iio_device_claim_mode_direct()
> > iio_device_claim_mode_buffer()
> > iio_device_release_mode()
> >
> > Just really annoying to rename iio_device_{claim,release}_direct()
> > everywhere since we just did that. We could keep both names around
> > for a while though to avoid the churn.
>
> If we rename iio_device_claim_direct() (which is huge), maybe we can
> pick shorter names and more descriptive names while at it? I was
> thinking something like:
>
> iio_mode_lock()
> iio_mode_lock_direct()
> iio_mode_lock_buffer()
> iio_mode_unlock()

The device context is important, so at least iio_dev_mode_lock() (and so on).

> Shorter names will also keep lines short when using guards.


--
With Best Regards,
Andy Shevchenko