* [PATCH] iio: adc: ti-ads1018: Drop iio_device_claim_buffer_mode() call
@ 2025-12-17 0:52 Kurt Borja
2025-12-21 18:49 ` Jonathan Cameron
0 siblings, 1 reply; 3+ messages in thread
From: Kurt Borja @ 2025-12-17 0:52 UTC (permalink / raw)
To: Jonathan Cameron
Cc: David Lechner, Nuno Sá, Andy Shevchenko, linux-iio,
linux-kernel, Kurt Borja
Drop iio_device_claim_buffer_mode() call in ads1018_trigger_handler() as
it's not actually protecting anything.
Signed-off-by: Kurt Borja <kuurtb@gmail.com>
---
drivers/iio/adc/ti-ads1018.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/iio/adc/ti-ads1018.c b/drivers/iio/adc/ti-ads1018.c
index af08702b62d2..b34184f68e63 100644
--- a/drivers/iio/adc/ti-ads1018.c
+++ b/drivers/iio/adc/ti-ads1018.c
@@ -557,9 +557,6 @@ static irqreturn_t ads1018_trigger_handler(int irq, void *p)
} scan = {};
int ret;
- 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_spi_read_exclusive(ads1018, &scan.conv, true);
@@ -568,14 +565,11 @@ static irqreturn_t ads1018_trigger_handler(int irq, void *p)
ret = spi_read(ads1018->spi, ads1018->rx_buf, sizeof(ads1018->rx_buf));
scan.conv = ads1018->rx_buf[0];
}
- if (ret)
- goto out_release_buffer;
- iio_push_to_buffers_with_ts(indio_dev, &scan, sizeof(scan), pf->timestamp);
+ if (!ret)
+ iio_push_to_buffers_with_ts(indio_dev, &scan, sizeof(scan),
+ pf->timestamp);
-out_release_buffer:
- iio_device_release_buffer_mode(indio_dev);
-out_notify_done:
iio_trigger_notify_done(indio_dev->trig);
return IRQ_HANDLED;
---
base-commit: a7b10f0963c651a6406d958a5f64b9c5594f84da
change-id: 20251216-ads1018-patch-ad02382e0a04
--
~ Kurt
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] iio: adc: ti-ads1018: Drop iio_device_claim_buffer_mode() call
2025-12-17 0:52 [PATCH] iio: adc: ti-ads1018: Drop iio_device_claim_buffer_mode() call Kurt Borja
@ 2025-12-21 18:49 ` Jonathan Cameron
2025-12-22 22:47 ` Kurt Borja
0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Cameron @ 2025-12-21 18:49 UTC (permalink / raw)
To: Kurt Borja
Cc: David Lechner, Nuno Sá, Andy Shevchenko, linux-iio,
linux-kernel
On Tue, 16 Dec 2025 19:52:01 -0500
Kurt Borja <kuurtb@gmail.com> wrote:
> Drop iio_device_claim_buffer_mode() call in ads1018_trigger_handler() as
> it's not actually protecting anything.
>
> Signed-off-by: Kurt Borja <kuurtb@gmail.com>
I squashed this in. One comment inline.
> ---
> drivers/iio/adc/ti-ads1018.c | 12 +++---------
> 1 file changed, 3 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/iio/adc/ti-ads1018.c b/drivers/iio/adc/ti-ads1018.c
> index af08702b62d2..b34184f68e63 100644
> --- a/drivers/iio/adc/ti-ads1018.c
> +++ b/drivers/iio/adc/ti-ads1018.c
> @@ -557,9 +557,6 @@ static irqreturn_t ads1018_trigger_handler(int irq, void *p)
> } scan = {};
> int ret;
>
> - 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_spi_read_exclusive(ads1018, &scan.conv, true);
> @@ -568,14 +565,11 @@ static irqreturn_t ads1018_trigger_handler(int irq, void *p)
> ret = spi_read(ads1018->spi, ads1018->rx_buf, sizeof(ads1018->rx_buf));
> scan.conv = ads1018->rx_buf[0];
> }
> - if (ret)
> - goto out_release_buffer;
>
> - iio_push_to_buffers_with_ts(indio_dev, &scan, sizeof(scan), pf->timestamp);
> + if (!ret)
Generally I fairly strongly prefer error paths out of line but in this
case I'd rather just get this merged than go around again so I'll leave
this as it stands.
Thanks,
Jonathan
> + iio_push_to_buffers_with_ts(indio_dev, &scan, sizeof(scan),
> + pf->timestamp);
>
> -out_release_buffer:
> - iio_device_release_buffer_mode(indio_dev);
> -out_notify_done:
> iio_trigger_notify_done(indio_dev->trig);
>
> return IRQ_HANDLED;
>
> ---
> base-commit: a7b10f0963c651a6406d958a5f64b9c5594f84da
> change-id: 20251216-ads1018-patch-ad02382e0a04
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] iio: adc: ti-ads1018: Drop iio_device_claim_buffer_mode() call
2025-12-21 18:49 ` Jonathan Cameron
@ 2025-12-22 22:47 ` Kurt Borja
0 siblings, 0 replies; 3+ messages in thread
From: Kurt Borja @ 2025-12-22 22:47 UTC (permalink / raw)
To: Jonathan Cameron, Kurt Borja
Cc: David Lechner, Nuno Sá, Andy Shevchenko, linux-iio,
linux-kernel
On Sun Dec 21, 2025 at 1:49 PM -05, Jonathan Cameron wrote:
> On Tue, 16 Dec 2025 19:52:01 -0500
> Kurt Borja <kuurtb@gmail.com> wrote:
>
>> Drop iio_device_claim_buffer_mode() call in ads1018_trigger_handler() as
>> it's not actually protecting anything.
>>
>> Signed-off-by: Kurt Borja <kuurtb@gmail.com>
> I squashed this in. One comment inline.
>> ---
>> drivers/iio/adc/ti-ads1018.c | 12 +++---------
>> 1 file changed, 3 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/iio/adc/ti-ads1018.c b/drivers/iio/adc/ti-ads1018.c
>> index af08702b62d2..b34184f68e63 100644
>> --- a/drivers/iio/adc/ti-ads1018.c
>> +++ b/drivers/iio/adc/ti-ads1018.c
>> @@ -557,9 +557,6 @@ static irqreturn_t ads1018_trigger_handler(int irq, void *p)
>> } scan = {};
>> int ret;
>>
>> - 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_spi_read_exclusive(ads1018, &scan.conv, true);
>> @@ -568,14 +565,11 @@ static irqreturn_t ads1018_trigger_handler(int irq, void *p)
>> ret = spi_read(ads1018->spi, ads1018->rx_buf, sizeof(ads1018->rx_buf));
>> scan.conv = ads1018->rx_buf[0];
>> }
>> - if (ret)
>> - goto out_release_buffer;
>>
>> - iio_push_to_buffers_with_ts(indio_dev, &scan, sizeof(scan), pf->timestamp);
>> + if (!ret)
> Generally I fairly strongly prefer error paths out of line but in this
> case I'd rather just get this merged than go around again so I'll leave
> this as it stands.
Apologies, I'll keep it in mind.
Thanks, Jonathan!
--
~ Kurt
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-12-22 22:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-17 0:52 [PATCH] iio: adc: ti-ads1018: Drop iio_device_claim_buffer_mode() call Kurt Borja
2025-12-21 18:49 ` Jonathan Cameron
2025-12-22 22:47 ` Kurt Borja
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).