Skip to contentSkip to conversation

iio: adc: ti-ads1018: Drop iio_device_claim_buffer_mode() call

PATCH In review Kurt Borja 2 participants 3 messages Dec 17, 2025 – Dec 22, 2025

Subsystems (2)
lore
Share & tools
lore

Kurt Borja

author maintainer
#0 lore raw

PATCH 1/1 iio: adc: ti-ads1018: Drop iio_device_claim_buffer_mode() call

Drop iio_device_claim_buffer_mode() call in ads1018_trigger_handler() as it's not actually protecting anything.

---
 drivers/iio/adc/ti-ads1018.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/iio/adc/ti-ads1018.c +3 -9
index af08702b62d2..b34184f68e63 100644
@@ -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

Signature · 1 line
 ~ Kurt
maintainer
#1 lore raw
Quoted 4 lines · On Tue, 16 Dec 2025 19:52:01 -0500 Kurt Borja <[email protected]> wrote:

Drop iio_device_claim_buffer_mode() call in ads1018_trigger_handler() as it's not actually protecting anything.

I squashed this in. One comment inline.

Quoted 19 lines
---
 drivers/iio/adc/ti-ads1018.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/iio/adc/ti-ads1018.c +0 -3
index af08702b62d2..b34184f68e63 100644
@@ -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);

drivers/iio/adc/ti-ads1018.c static irqreturn_t ads1018_trigger_handler(int irq, void *p) · line 569

Quoted 8 lines
drivers/iio/adc/ti-ads1018.c +1 -3
@@ -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

Quoted 14 lines
drivers/iio/adc/ti-ads1018.c +2 -4
+		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

author maintainer
#2 lore raw
Quoted 33 lines · Jonathan Cameron
Quoted 4 lines · On Tue, 16 Dec 2025 19:52:01 -0500 Kurt Borja <[email protected]> wrote:

Drop iio_device_claim_buffer_mode() call in ads1018_trigger_handler() as it's not actually protecting anything.

I squashed this in. One comment inline.

Quoted 25 lines
---
 drivers/iio/adc/ti-ads1018.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/iio/adc/ti-ads1018.c +0 -5
index af08702b62d2..b34184f68e63 100644
@@ -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;
 
Quoted 5 lines

drivers/iio/adc/ti-ads1018.c static irqreturn_t ads1018_trigger_handler(int irq, void *p) · line 569

Quoted 2 lines
drivers/iio/adc/ti-ads1018.c +1 -1
-	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!

Signature · 1 line
 ~ Kurt