[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <DEN50VFOIB5O.1ENBKI6JQ0ZC@gmail.com>
Date: Mon, 01 Dec 2025 14:47:01 -0500
From: "Kurt Borja" <kuurtb@...il.com>
To: "David Lechner" <dlechner@...libre.com>, "Kurt Borja"
<kuurtb@...il.com>, "Andy Shevchenko" <andriy.shevchenko@...el.com>
Cc: "Jonathan Cameron" <jic23@...nel.org>, "Rob Herring" <robh@...nel.org>,
"Krzysztof Kozlowski" <krzk+dt@...nel.org>, "Conor Dooley"
<conor+dt@...nel.org>, "Tobias Sperling" <tobias.sperling@...ting.com>,
Nuno Sá <nuno.sa@...log.com>, "Andy Shevchenko"
<andy@...nel.org>, <linux-iio@...r.kernel.org>,
<devicetree@...r.kernel.org>, <linux-kernel@...r.kernel.org>, "Jonathan
Cameron" <Jonathan.Cameron@...wei.com>
Subject: Re: [PATCH v3 2/2] iio: adc: Add ti-ads1018 driver
On Mon Dec 1, 2025 at 11:07 AM -05, David Lechner wrote:
...
>>>> + if (iio_device_claim_buffer_mode(indio_dev))
>>>> + goto out_notify_done;
>>>> +
>>>> + if (iio_trigger_using_own(indio_dev)) {
>>>> + disable_irq(ads1018->drdy_irq);
>>>> + ret = ads1018_read_unlocked(ads1018, &scan.conv, true);
>>>> + enable_irq(ads1018->drdy_irq);
>>>> + } else {
>>>> + ret = spi_read(ads1018->spi, ads1018->rx_buf, sizeof(ads1018->rx_buf));
>>>> + scan.conv = ads1018->rx_buf[0];
>>>> + }
>>>> +
>>>> + iio_device_release_buffer_mode(indio_dev);
>>>> +
>>>> + if (ret)
>>>> + goto out_notify_done;
>>>> +
>>>> + iio_push_to_buffers_with_ts(indio_dev, &scan, sizeof(scan), pf->timestamp);
>>>> +
>>>> +out_notify_done:
>>>> + iio_trigger_notify_done(ads1018->indio_trig);
>>>
>>> Jonathan et al., maybe we need an ACQUIRE() class for this? It will solve
>>> the conditional scoped guard case, no?
>
> No, ACQUIRE() is not scoped, just conditional. I don't think it
> will improve anything here.
Maybe I'm not understanding the problem fully?
I interpreted "ACQUIRE() class" as a general GUARD class, i.e.
guard(iio_trigger_notify)(indio_dev->trig);
This way drivers may use other cleanup.h helpers cleaner, because of the
goto problem?
I do think it's a good idea, like a `defer` keyword. But it is a bit
unorthodox using guard for non locks.
--
~ Kurt
Powered by blists - more mailing lists