Skip to contentSkip to conversation

iio: adc: replace deprecated iio_push_to_buffers_with_timestamp()

PATCH In review Atharv Dubey 3 participants 15 messages Mar 16 – Mar 19

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover iio: adc: replace deprecated iio_push_to_buffers_with_timestamp()

Hello ,

The helper iio_push_to_buffers_with_timestamp() is deprecated in the IIO subsystem. The recommended replacement is iio_push_to_buffers_with_ts().

This patch series updates multiple ADC drivers to use the newer helper API. No functional changes are intended; the patches only replace the deprecated calls and adjust arguments where required.

The goal is to remove usage of the deprecated helper and keep the drivers aligned with the current IIO buffer interface.

Regards,
Atharv

---
Atharv Dubey (11):
iio: ad_sigma_delta: replace deprecated
iio_push_to_buffers_with_timestamp()
iio: ad7766: replace deprecated iio_push_to_buffers_with_timestamp()
iio: adc : ads7950 : replace deprecated
iio_push_to_buffers_with_timestamp()
iio: adc : cc10001 : replace deprecated
iio_push_to_buffers_with_timestamp()
iio: adc : ad7887 : replace deprecated
iio_push_to_buffers_with_timestamp()
iio: adc : hx711 : replace deprecated
iio_push_to_buffers_with_timestamp()
iio: adc : at91 : replace deprecated
iio_push_to_buffers_with_timestamp()
iio: adc : ad799x : replace deprecated
iio_push_to_buffers_with_timestamp()
iio: adc : adc161s626 : replace deprecated
iio_push_to_buffers_with_timestamp()
iio: adc : mt6360 : replace deprecated
iio_push_to_buffers_with_timestamp()
iio: adc : ad7944 : replace deprecated
iio_push_to_buffers_with_timestamp()

 drivers/iio/adc/ad7766.c         |  4 ++--
 drivers/iio/adc/ad7887.c         |  4 ++--
 drivers/iio/adc/ad7944.c         | 10 ++++++----
 drivers/iio/adc/ad799x.c         |  5 +++--
 drivers/iio/adc/ad_sigma_delta.c |  6 +++---
 drivers/iio/adc/at91_adc.c       |  2 +-
 drivers/iio/adc/cc10001_adc.c    |  3 ++-
 drivers/iio/adc/hx711.c          |  5 +++--
 drivers/iio/adc/mt6360-adc.c     |  2 +-
 drivers/iio/adc/ti-adc161s626.c  |  5 +++--
 drivers/iio/adc/ti-ads7950.c     |  2 +-
 11 files changed, 27 insertions(+), 21 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

cover iio: adc: replace deprecated iio_push_to_buffers_with_timestamp()

Hello ,

The helper iio_push_to_buffers_with_timestamp() is deprecated in the IIO subsystem. The recommended replacement is iio_push_to_buffers_with_ts().

This patch series updates multiple ADC drivers to use the newer helper API. No functional changes are intended; the patches only replace the deprecated calls and adjust arguments where required.

The goal is to remove usage of the deprecated helper and keep the drivers aligned with the current IIO buffer interface.

Regards,
Atharv

---
Atharv Dubey (11):
iio: ad_sigma_delta: replace deprecated
iio_push_to_buffers_with_timestamp()
iio: ad7766: replace deprecated iio_push_to_buffers_with_timestamp()
iio: adc : ads7950 : replace deprecated
iio_push_to_buffers_with_timestamp()
iio: adc : cc10001 : replace deprecated
iio_push_to_buffers_with_timestamp()
iio: adc : ad7887 : replace deprecated
iio_push_to_buffers_with_timestamp()
iio: adc : hx711 : replace deprecated
iio_push_to_buffers_with_timestamp()
iio: adc : at91 : replace deprecated
iio_push_to_buffers_with_timestamp()
iio: adc : ad799x : replace deprecated
iio_push_to_buffers_with_timestamp()
iio: adc : adc161s626 : replace deprecated
iio_push_to_buffers_with_timestamp()
iio: adc : mt6360 : replace deprecated
iio_push_to_buffers_with_timestamp()
iio: adc : ad7944 : replace deprecated
iio_push_to_buffers_with_timestamp()

 drivers/iio/adc/ad7766.c         |  4 ++--
 drivers/iio/adc/ad7887.c         |  4 ++--
 drivers/iio/adc/ad7944.c         | 10 ++++++----
 drivers/iio/adc/ad799x.c         |  5 +++--
 drivers/iio/adc/ad_sigma_delta.c |  6 +++---
 drivers/iio/adc/at91_adc.c       |  2 +-
 drivers/iio/adc/cc10001_adc.c    |  3 ++-
 drivers/iio/adc/hx711.c          |  5 +++--
 drivers/iio/adc/mt6360-adc.c     |  2 +-
 drivers/iio/adc/ti-adc161s626.c  |  5 +++--
 drivers/iio/adc/ti-ads7950.c     |  2 +-
 11 files changed, 27 insertions(+), 21 deletions(-)
Signature · 1 line
2.43.0
#2 lore raw
Quoted 6 lines · Atharv Dubey

Hello ,

The helper iio_push_to_buffers_with_timestamp() is deprecated in the IIO subsystem. The recommended replacement is iio_push_to_buffers_with_ts().

Quoted 6 lines

This patch series updates multiple ADC drivers to use the newer helper API. No functional changes are intended; the patches only replace the deprecated calls and adjust arguments where required.

The goal is to remove usage of the deprecated helper and keep the drivers aligned with the current IIO buffer interface.

You need to do this very carefully.
Besides that your email thread is broken:
- you have sent 2 time cover letter
- the patches 10 and 11 are detached from email thread.

On top of that there is wrong indentation in many places. I recommend you to choose something less tricky to begin with.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw

Hi Andy,

Quoted 13 lines · Andy Shevchenko
Quoted 6 lines · Atharv Dubey

Hello ,

The helper iio_push_to_buffers_with_timestamp() is deprecated in the IIO subsystem. The recommended replacement is iio_push_to_buffers_with_ts().

Quoted 6 lines

This patch series updates multiple ADC drivers to use the newer helper API. No functional changes are intended; the patches only replace the deprecated calls and adjust arguments where required.

The goal is to remove usage of the deprecated helper and keep the drivers aligned with the current IIO buffer interface.

Quoted 10 lines

You need to do this very carefully.
Besides that your email thread is broken:
- you have sent 2 time cover letter
- the patches 10 and 11 are detached from email thread.

On top of that there is wrong indentation in many places. I recommend you to choose something less tricky to begin with.

I'll recitfy these mistakes and perhaps send a smaller patch for the same. If you have some more simpler things in mind , please let me know. I'll be happy to help out.

Regards,
Atharv

#4 lore raw

PATCH 1/11 iio: ad_sigma_delta: replace deprecated iio_push_to_buffers_with_timestamp()

In reply to Atharv Dubey

iio_push_to_buffers_with_timestamp() is deprecated. Replace it with iio_push_to_buffers_with_ts(), which takes the buffer size as an argument and helps avoid potential buffer overflows.

---
 drivers/iio/adc/ad_sigma_delta.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/iio/adc/ad_sigma_delta.c +3 -3
index 7852884703b0..73f3069da987 100644
@@ -636,7 +636,7 @@ static irqreturn_t ad_sd_trigger_handler(int irq, void *p)
 	 * once, there is no need for sample number tracking.
 	 */
 	if (sigma_delta->active_slots == 1) {
-		iio_push_to_buffers_with_timestamp(indio_dev, data, pf->timestamp);
+		iio_push_to_buffers_with_ts(indio_dev, data, sizeof(data), pf->timestamp);
 		goto irq_handled;
 	}
 
@@ -662,8 +662,8 @@ static irqreturn_t ad_sd_trigger_handler(int irq, void *p)
 
 	if (sigma_delta->current_slot == sigma_delta->active_slots) {
 		sigma_delta->current_slot = 0;
-		iio_push_to_buffers_with_timestamp(indio_dev, sigma_delta->samples_buf,
-						   pf->timestamp);
+		iio_push_to_buffers_with_ts(indio_dev, sigma_delta->samples_buf,
+				sizeof(sigma_delta->sampkes_buf), pf->timestamp);
 	}
 
 irq_handled:
Signature · 1 line
2.43.0
maintainer
#5 lore raw

Re: [PATCH 01/11] iio: ad_sigma_delta: replace deprecated iio_push_to_buffers_with_timestamp()

Quoted 5 lines · On Mon, 16 Mar 2026 22:57:27 +0530 Atharv Dubey <[email protected]> wrote:

iio_push_to_buffers_with_timestamp() is deprecated. Replace it with iio_push_to_buffers_with_ts(), which takes the buffer size as an argument and helps avoid potential buffer overflows.

Hi Atharv,

Thank for you for your patch.

Quoted 9 lines
---
 drivers/iio/adc/ad_sigma_delta.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/iio/adc/ad_sigma_delta.c +0 -0
index 7852884703b0..73f3069da987 100644

drivers/iio/adc/ad_sigma_delta.c static irqreturn_t ad_sd_trigger_handler(int irq, void *p) · line 639

Quoted 5 lines
drivers/iio/adc/ad_sigma_delta.c +1 -1
@@ -636,7 +636,7 @@ static irqreturn_t ad_sd_trigger_handler(int irq, void *p)
 	 * once, there is no need for sample number tracking.
 	 */
 	if (sigma_delta->active_slots == 1) {
-		iio_push_to_buffers_with_timestamp(indio_dev, data, pf->timestamp);
+		iio_push_to_buffers_with_ts(indio_dev, data, sizeof(data), pf->timestamp);

What is sizeof(data) and why is that the right value to pass as the new parameter?

drivers/iio/adc/ad_sigma_delta.c static irqreturn_t ad_sd_trigger_handler(int irq, void *p) · line 666

Quoted 11 lines
drivers/iio/adc/ad_sigma_delta.c +2 -2
 		goto irq_handled;
 	}
 
@@ -662,8 +662,8 @@ static irqreturn_t ad_sd_trigger_handler(int irq, void *p)
 
 	if (sigma_delta->current_slot == sigma_delta->active_slots) {
 		sigma_delta->current_slot = 0;
-		iio_push_to_buffers_with_timestamp(indio_dev, sigma_delta->samples_buf,
-						   pf->timestamp);
+		iio_push_to_buffers_with_ts(indio_dev, sigma_delta->samples_buf,
+				sizeof(sigma_delta->sampkes_buf), pf->timestamp);

Likewise. What value does the new parameter take?

I'm not going to review any more of this version of the series given these are both incorrect in the first patch.

Jonathan

Quoted 3 lines
drivers/iio/adc/ad_sigma_delta.c +0 -0
 	}
 
 irq_handled:
#6 lore raw

Re: [PATCH 01/11] iio: ad_sigma_delta: replace deprecated iio_push_to_buffers_with_timestamp()

Hi Jonathan,

Quoted 42 lines · Jonathan Cameron
Quoted 5 lines · On Mon, 16 Mar 2026 22:57:27 +0530 Atharv Dubey <[email protected]> wrote:

iio_push_to_buffers_with_timestamp() is deprecated. Replace it with iio_push_to_buffers_with_ts(), which takes the buffer size as an argument and helps avoid potential buffer overflows.

Hi Atharv,

Thank for you for your patch.

Quoted 9 lines
---
  drivers/iio/adc/ad_sigma_delta.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
drivers/iio/adc/ad_sigma_delta.c +0 -0
index 7852884703b0..73f3069da987 100644

drivers/iio/adc/ad_sigma_delta.c static irqreturn_t ad_sd_trigger_handler(int irq, void *p) · line 639

Quoted 5 lines
drivers/iio/adc/ad_sigma_delta.c +1 -1
@@ -636,7 +636,7 @@ static irqreturn_t ad_sd_trigger_handler(int irq, void *p)
  	 * once, there is no need for sample number tracking.
  	 */
  	if (sigma_delta->active_slots == 1) {
-		iio_push_to_buffers_with_timestamp(indio_dev, data, pf->timestamp);
+		iio_push_to_buffers_with_ts(indio_dev, data, sizeof(data), pf->timestamp);

What is sizeof(data) and why is that the right value to pass as the new parameter?

drivers/iio/adc/ad_sigma_delta.c static irqreturn_t ad_sd_trigger_handler(int irq, void *p) · line 666

Quoted 11 lines
drivers/iio/adc/ad_sigma_delta.c +2 -2
  		goto irq_handled;
  	}
 
@@ -662,8 +662,8 @@ static irqreturn_t ad_sd_trigger_handler(int irq, void *p)
 
  	if (sigma_delta->current_slot == sigma_delta->active_slots) {
  		sigma_delta->current_slot = 0;
-		iio_push_to_buffers_with_timestamp(indio_dev, sigma_delta->samples_buf,
-						   pf->timestamp);
+		iio_push_to_buffers_with_ts(indio_dev, sigma_delta->samples_buf,
+				sizeof(sigma_delta->sampkes_buf), pf->timestamp);

Likewise. What value does the new parameter take?

Quoted 4 lines

I'm not going to review any more of this version of the series given these are both incorrect in the first patch.

Jonathan

You are right, both the fixes are incorrect let me try more on this. I'll send a smaller patch series first and mark it as an RFC.

Quoted 5 lines

drivers/iio/adc/ad_sigma_delta.c static irqreturn_t ad_sd_trigger_handler(int irq, void *p) · line 669

Quoted 4 lines
drivers/iio/adc/ad_sigma_delta.c +0 -0
  	}
 
  irq_handled:

Regards,
Atharv

#7 lore raw

PATCH 2/11 iio: ad7766: replace deprecated iio_push_to_buffers_with_timestamp()

In reply to Atharv Dubey

iio_push_to_buffers_with_timestamp() is deprecated. Replace it with iio_push_to_buffers_with_ts(), which takes the buffer size as an argument and helps avoid potential buffer overflows.

---
 drivers/iio/adc/ad7766.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/adc/ad7766.c +2 -2
index 9e4a66477d2d..cc47b0474ceb 100644
@@ -74,8 +74,8 @@ static irqreturn_t ad7766_trigger_handler(int irq, void *p)
 	if (ret < 0)
 		goto done;
 
-	iio_push_to_buffers_with_timestamp(indio_dev, ad7766->data,
-		pf->timestamp);
+	iio_push_to_buffers_with_ts(indio_dev, ad7766->data,
+		sizeof(ad7766->data), pf->timestamp);
 done:
 	iio_trigger_notify_done(indio_dev->trig);
 
Signature · 1 line
2.43.0
#8 lore raw

PATCH 3/11 iio: adc : ads7950 : replace deprecated iio_push_to_buffers_with_timestamp()

In reply to Atharv Dubey

iio_push_to_buffers_with_timestamp() is deprecated. Replace it with iio_push_to_buffers_with_ts(), which takes the buffer size as an argument and helps avoid potential buffer overflows.

---
 drivers/iio/adc/ti-ads7950.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/ti-ads7950.c +1 -1
index bbe1ce577789..a3f01ae5783f 100644
@@ -313,7 +313,7 @@ static irqreturn_t ti_ads7950_trigger_handler(int irq, void *p)
 	if (ret < 0)
 		goto out;
 
-	iio_push_to_buffers_with_timestamp(indio_dev, &st->rx_buf[2],
+	iio_push_to_buffers_with_ts(indio_dev, &st->rx_buf[2], sizeof(st->rx_buf)
 					   iio_get_time_ns(indio_dev));
 
 out:
Signature · 1 line
2.43.0
#9 lore raw

PATCH 4/11 iio: adc : cc10001 : replace deprecated iio_push_to_buffers_with_timestamp()

In reply to Atharv Dubey

iio_push_to_buffers_with_timestamp() is deprecated. Replace it with iio_push_to_buffers_with_ts(), which takes the buffer size as an argument and helps avoid potential buffer overflows.

---
 drivers/iio/adc/cc10001_adc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/adc/cc10001_adc.c +2 -1
index 2c51b90b7101..ef105458ffbd 100644
@@ -178,7 +178,8 @@ static irqreturn_t cc10001_adc_trigger_h(int irq, void *p)
 	mutex_unlock(&adc_dev->lock);
 
 	if (!sample_invalid)
-		iio_push_to_buffers_with_timestamp(indio_dev, data,
+		iio_push_to_buffers_with_ts(indio_dev, data,
+						   sizeof(data),
 						   iio_get_time_ns(indio_dev));
 	iio_trigger_notify_done(indio_dev->trig);
 
Signature · 1 line
2.43.0
#10 lore raw

PATCH 5/11 iio: adc : ad7887 : replace deprecated iio_push_to_buffers_with_timestamp()

In reply to Atharv Dubey

iio_push_to_buffers_with_timestamp() is deprecated. Replace it with iio_push_to_buffers_with_ts(), which takes the buffer size as an argument and helps avoid potential buffer overflows.

---
 drivers/iio/adc/ad7887.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/adc/ad7887.c +2 -2
index 87ff95643794..dfc8b1f71c86 100644
@@ -119,8 +119,8 @@ static irqreturn_t ad7887_trigger_handler(int irq, void *p)
 	if (b_sent)
 		goto done;
 
-	iio_push_to_buffers_with_timestamp(indio_dev, st->data,
-		iio_get_time_ns(indio_dev));
+	iio_push_to_buffers_with_ts(indio_dev, st->data,
+		sizeof(st->data), iio_get_time_ns(indio_dev));
 done:
 	iio_trigger_notify_done(indio_dev->trig);
 
Signature · 1 line
2.43.0
#11 lore raw

PATCH 6/11 iio: adc : hx711 : replace deprecated iio_push_to_buffers_with_timestamp()

In reply to Atharv Dubey

iio_push_to_buffers_with_timestamp() is deprecated. Replace it with iio_push_to_buffers_with_ts(), which takes the buffer size as an argument and helps avoid potential buffer overflows.

---
 drivers/iio/adc/hx711.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/iio/adc/hx711.c +3 -2
index 1db8b68a8f64..e3f415b5e2a2 100644
@@ -372,8 +372,9 @@ static irqreturn_t hx711_trigger(int irq, void *p)
 		j++;
 	}
 
-	iio_push_to_buffers_with_timestamp(indio_dev, &hx711_data->buffer,
-							pf->timestamp);
+	iio_push_to_buffers_with_ts(indio_dev, &hx711_data->buffer,
+						sizeof(hx711->buffer),
+						pf->timestamp);
 
 	mutex_unlock(&hx711_data->lock);
 
Signature · 1 line
2.43.0
#12 lore raw

PATCH 7/11 iio: adc : at91 : replace deprecated iio_push_to_buffers_with_timestamp()

In reply to Atharv Dubey

iio_push_to_buffers_with_timestamp() is deprecated. Replace it with iio_push_to_buffers_with_ts(), which takes the buffer size as an argument and helps avoid potential buffer overflows.

---
 drivers/iio/adc/at91_adc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/at91_adc.c +1 -1
index 920dd9ffd27a..840dc9000022 100644
@@ -275,7 +275,7 @@ static irqreturn_t at91_adc_trigger_handler(int irq, void *p)
 		j++;
 	}
 
-	iio_push_to_buffers_with_timestamp(idev, st->buffer, pf->timestamp);
+	iio_push_to_buffers_with_ts(idev, st->buffer, sizeof(st->buffer), pf->timestamp);
 
 	iio_trigger_notify_done(idev->trig);
 
Signature · 1 line
2.43.0
#13 lore raw

PATCH 8/11 iio: adc : ad799x : replace deprecated iio_push_to_buffers_with_timestamp()

In reply to Atharv Dubey

iio_push_to_buffers_with_timestamp() is deprecated. Replace it with iio_push_to_buffers_with_ts(), which takes the buffer size as an argument and helps avoid potential buffer overflows.

---
 drivers/iio/adc/ad799x.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/iio/adc/ad799x.c +3 -2
index 108bb22162ef..6c0470037c55 100644
@@ -221,8 +221,9 @@ static irqreturn_t ad799x_trigger_handler(int irq, void *p)
 	if (b_sent < 0)
 		goto out;
 
-	iio_push_to_buffers_with_timestamp(indio_dev, st->rx_buf,
-			iio_get_time_ns(indio_dev));
+	iio_push_to_buffers_with_ts(indio_dev, st->rx_buf,
+					sizeof(st->rx_buf),
+				iio_get_time_ns(indio_dev));
 out:
 	iio_trigger_notify_done(indio_dev->trig);
 
Signature · 1 line
2.43.0
#14 lore raw

PATCH 9/11 iio: adc : adc161s626 : replace deprecated iio_push_to_buffers_with_timestamp()

In reply to Atharv Dubey

iio_push_to_buffers_with_timestamp() is deprecated. Replace it with iio_push_to_buffers_with_ts(), which takes the buffer size as an argument and helps avoid potential buffer overflows.

---
 drivers/iio/adc/ti-adc161s626.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/iio/adc/ti-adc161s626.c +3 -2
index 28aa6b80160c..88f2daa99d66 100644
@@ -119,8 +119,9 @@ static irqreturn_t ti_adc_trigger_handler(int irq, void *private)
 	ret = ti_adc_read_measurement(data, &indio_dev->channels[0],
 				     (int *) &data->buffer);
 	if (!ret)
-		iio_push_to_buffers_with_timestamp(indio_dev,
-					data->buffer,
+		iio_push_to_buffers_with_ts(indio_dev,
+					data->buffer,
+					sizeof(data->buffer),
 					iio_get_time_ns(indio_dev));
 
 	iio_trigger_notify_done(indio_dev->trig);
Signature · 1 line
2.43.0