[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5e8e3ff7-09e2-48c3-a9c4-cd7e5d6b850c@baylibre.com>
Date: Wed, 3 Dec 2025 16:19:01 -0600
From: David Lechner <dlechner@...libre.com>
To: Kurt Borja <kuurtb@...il.com>,
Andy Shevchenko <andriy.shevchenko@...el.com>,
Lars-Peter Clausen <lars@...afoo.de>,
Michael Hennerich <Michael.Hennerich@...log.com>,
Jonathan Cameron <jic23@...nel.org>, Benson Leung <bleung@...omium.org>,
Antoniu Miclaus <antoniu.miclaus@...log.com>,
Gwendal Grignou <gwendal@...omium.org>,
Shrikant Raskar <raskar.shree97@...il.com>,
Per-Daniel Olsson <perdaniel.olsson@...s.com>
Cc: Nuno Sá <nuno.sa@...log.com>,
Andy Shevchenko <andy@...nel.org>, Guenter Roeck <groeck@...omium.org>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>, linux-iio@...r.kernel.org,
linux-kernel@...r.kernel.org, chrome-platform@...ts.linux.dev
Subject: Re: [PATCH RFC 4/6] iio: light: vcnl4000: Use cleanup.h for IIO locks
On 12/3/25 1:18 PM, Kurt Borja wrote:
> Use ACQUIRE() for iio_device_claim_direct().
>
> Signed-off-by: Kurt Borja <kuurtb@...il.com>
> ---
> drivers/iio/light/vcnl4000.c | 24 ++++++++----------------
> 1 file changed, 8 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c
> index 4dbb2294a843..55e5060ce337 100644
> --- a/drivers/iio/light/vcnl4000.c
> +++ b/drivers/iio/light/vcnl4000.c
> @@ -25,6 +25,7 @@
> #include <linux/pm_runtime.h>
> #include <linux/interrupt.h>
> #include <linux/units.h>
> +#include <linux/cleanup.h>
>
> #include <linux/iio/buffer.h>
> #include <linux/iio/events.h>
> @@ -1148,36 +1149,27 @@ static int vcnl4010_write_raw(struct iio_dev *indio_dev,
> struct iio_chan_spec const *chan,
> int val, int val2, long mask)
> {
> - int ret;
> struct vcnl4000_data *data = iio_priv(indio_dev);
>
> - if (!iio_device_claim_direct(indio_dev))
> + ACQUIRE(iio_device_claim_direct, busy)(indio_dev);
> + if (ACQUIRE_ERR(iio_device_claim_direct, &busy))
Calling the cleanup variable `busy` seems odd to me since if
we successfully make the claim, busy will be non-null and
therefore `if (busy)` would evaluate as true even though
it wasn't "busy". I would call it `claim` to match
iio_device_claim_direct().
Powered by blists - more mailing lists