* [PATCH 01/39] iio: adc: ti-adc161s626: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp() Jonathan Cameron
@ 2026-10-26 23:05 ` Jonathan Cameron
2026-10-26 23:05 ` [PATCH 02/39] iio: adc: mt6360-adc: " Jonathan Cameron
` (38 subsequent siblings)
39 siblings, 0 replies; 60+ messages in thread
From: Jonathan Cameron @ 2026-10-26 23:05 UTC (permalink / raw)
To: linux-iio
Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Matt Ranostay
Replace the deprecated iio_push_to_buffers_with_timestamp() with
iio_push_to_buffers_with_ts(), passing the size of the pushed buffer,
which is on the stack and local to ti_adc_trigger_handler().
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
Cc: Matt Ranostay <mranostay@gmail.com>
---
drivers/iio/adc/ti-adc161s626.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/adc/ti-adc161s626.c b/drivers/iio/adc/ti-adc161s626.c
index 422df0685580..a0ebe90cff3c 100644
--- a/drivers/iio/adc/ti-adc161s626.c
+++ b/drivers/iio/adc/ti-adc161s626.c
@@ -118,7 +118,8 @@ static irqreturn_t ti_adc_trigger_handler(int irq, void *private)
goto exit_notify_done;
scan.data = val;
- iio_push_to_buffers_with_timestamp(indio_dev, &scan, iio_get_time_ns(indio_dev));
+ iio_push_to_buffers_with_ts(indio_dev, &scan, sizeof(scan),
+ iio_get_time_ns(indio_dev));
exit_notify_done:
iio_trigger_notify_done(indio_dev->trig);
--
2.43.0
^ permalink raw reply related [flat|nested] 60+ messages in thread* [PATCH 02/39] iio: adc: mt6360-adc: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp() Jonathan Cameron
2026-10-26 23:05 ` [PATCH 01/39] iio: adc: ti-adc161s626: use iio_push_to_buffers_with_ts() Jonathan Cameron
@ 2026-10-26 23:05 ` Jonathan Cameron
2026-10-26 23:05 ` [PATCH 03/39] iio: adc: ad4130: " Jonathan Cameron
` (37 subsequent siblings)
39 siblings, 0 replies; 60+ messages in thread
From: Jonathan Cameron @ 2026-10-26 23:05 UTC (permalink / raw)
To: linux-iio
Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Gene Chen
Replace the deprecated iio_push_to_buffers_with_timestamp() with
iio_push_to_buffers_with_ts(), passing the size of the pushed buffer,
which is on the stack and local to mt6360_adc_trigger_handler().
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
Cc: Gene Chen <gene_chen@richtek.com>
---
drivers/iio/adc/mt6360-adc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/adc/mt6360-adc.c b/drivers/iio/adc/mt6360-adc.c
index e59b13e88aa2..a09e3e38c390 100644
--- a/drivers/iio/adc/mt6360-adc.c
+++ b/drivers/iio/adc/mt6360-adc.c
@@ -275,7 +275,8 @@ static irqreturn_t mt6360_adc_trigger_handler(int irq, void *p)
data.values[i++] = val;
}
- iio_push_to_buffers_with_timestamp(indio_dev, &data, iio_get_time_ns(indio_dev));
+ iio_push_to_buffers_with_ts(indio_dev, &data, sizeof(data),
+ iio_get_time_ns(indio_dev));
out:
iio_trigger_notify_done(indio_dev->trig);
--
2.43.0
^ permalink raw reply related [flat|nested] 60+ messages in thread* [PATCH 03/39] iio: adc: ad4130: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp() Jonathan Cameron
2026-10-26 23:05 ` [PATCH 01/39] iio: adc: ti-adc161s626: use iio_push_to_buffers_with_ts() Jonathan Cameron
2026-10-26 23:05 ` [PATCH 02/39] iio: adc: mt6360-adc: " Jonathan Cameron
@ 2026-10-26 23:05 ` Jonathan Cameron
2026-10-26 23:05 ` [PATCH 04/39] iio: addac: ad74413r: " Jonathan Cameron
` (36 subsequent siblings)
39 siblings, 0 replies; 60+ messages in thread
From: Jonathan Cameron @ 2026-10-26 23:05 UTC (permalink / raw)
To: linux-iio
Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Jonathan Santos
Replace the deprecated iio_push_to_buffers_with_timestamp() with
iio_push_to_buffers_with_ts(), passing the size of the pushed buffer,
which is a structure within the iio_priv() data.
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
Cc: Jonathan Santos <Jonathan.Santos@analog.com>
---
drivers/iio/adc/ad4130.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/adc/ad4130.c b/drivers/iio/adc/ad4130.c
index 3ffc4b765e0e..9763a811caa3 100644
--- a/drivers/iio/adc/ad4130.c
+++ b/drivers/iio/adc/ad4130.c
@@ -704,8 +704,9 @@ static irqreturn_t ad4130_trigger_handler(int irq, void *p)
if (ret < 0)
goto err_out;
- iio_push_to_buffers_with_timestamp(indio_dev, &st->scan_channels,
- iio_get_time_ns(indio_dev));
+ iio_push_to_buffers_with_ts(indio_dev, &st->scan_channels,
+ sizeof(st->scan_channels),
+ iio_get_time_ns(indio_dev));
err_out:
iio_trigger_notify_done(indio_dev->trig);
--
2.43.0
^ permalink raw reply related [flat|nested] 60+ messages in thread* [PATCH 04/39] iio: addac: ad74413r: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp() Jonathan Cameron
` (2 preceding siblings ...)
2026-10-26 23:05 ` [PATCH 03/39] iio: adc: ad4130: " Jonathan Cameron
@ 2026-10-26 23:05 ` Jonathan Cameron
2026-10-26 23:05 ` [PATCH 05/39] iio: hid-sensors: " Jonathan Cameron
` (35 subsequent siblings)
39 siblings, 0 replies; 60+ messages in thread
From: Jonathan Cameron @ 2026-10-26 23:05 UTC (permalink / raw)
To: linux-iio
Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Antoniu Miclaus
Replace the deprecated iio_push_to_buffers_with_timestamp() with
iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
Cc: Antoniu Miclaus <antoniu.miclaus@analog.com>
---
drivers/iio/addac/ad74413r.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/addac/ad74413r.c b/drivers/iio/addac/ad74413r.c
index 2e5a58e48a89..8d9d3d5f09c6 100644
--- a/drivers/iio/addac/ad74413r.c
+++ b/drivers/iio/addac/ad74413r.c
@@ -798,8 +798,9 @@ static irqreturn_t ad74413r_trigger_handler(int irq, void *p)
for (i = 0; i < st->adc_active_channels; i++)
ad74413r_crc_check(st, &rx_buf[i * AD74413R_FRAME_SIZE]);
- iio_push_to_buffers_with_timestamp(indio_dev, &st->adc_samples_buf,
- iio_get_time_ns(indio_dev));
+ iio_push_to_buffers_with_ts(indio_dev, &st->adc_samples_buf,
+ sizeof(st->adc_samples_buf),
+ iio_get_time_ns(indio_dev));
out:
iio_trigger_notify_done(indio_dev->trig);
--
2.43.0
^ permalink raw reply related [flat|nested] 60+ messages in thread* [PATCH 05/39] iio: hid-sensors: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp() Jonathan Cameron
` (3 preceding siblings ...)
2026-10-26 23:05 ` [PATCH 04/39] iio: addac: ad74413r: " Jonathan Cameron
@ 2026-10-26 23:05 ` Jonathan Cameron
2026-10-27 0:06 ` srinivas pandruvada
2026-10-27 8:21 ` Andy Shevchenko
2026-10-26 23:05 ` [PATCH 06/39] iio: gyro: mpu3050: " Jonathan Cameron
` (34 subsequent siblings)
39 siblings, 2 replies; 60+ messages in thread
From: Jonathan Cameron @ 2026-10-26 23:05 UTC (permalink / raw)
To: linux-iio
Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Jiri Kosina, Srinivas Pandruvada, Zhang Lixu
Replace the deprecated iio_push_to_buffers_with_timestamp() with
iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
For hid-sensor-magn-3d, use IIO_DECLARE_BUFFER_WITH_TS() to suize the
buffer for the maximum number of channels supported avoiding need
for separate allocation.
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
Cc: Jiri Kosina <jikos@kernel.org>
Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: Zhang Lixu <lixu.zhang@intel.com>
---
drivers/iio/gyro/hid-sensor-gyro-3d.c | 5 +++--
drivers/iio/humidity/hid-sensor-humidity.c | 5 +++--
drivers/iio/magnetometer/hid-sensor-magn-3d.c | 21 ++++++---------------
drivers/iio/orientation/hid-sensor-incl-3d.c | 7 ++++---
.../iio/position/hid-sensor-custom-intel-hinge.c | 4 ++--
5 files changed, 18 insertions(+), 24 deletions(-)
diff --git a/drivers/iio/gyro/hid-sensor-gyro-3d.c b/drivers/iio/gyro/hid-sensor-gyro-3d.c
index 66778315e86d..083e82cf561c 100644
--- a/drivers/iio/gyro/hid-sensor-gyro-3d.c
+++ b/drivers/iio/gyro/hid-sensor-gyro-3d.c
@@ -182,8 +182,9 @@ static int gyro_3d_proc_event(struct hid_sensor_hub_device *hsdev,
if (!gyro_state->timestamp)
gyro_state->timestamp = iio_get_time_ns(indio_dev);
- iio_push_to_buffers_with_timestamp(indio_dev, &gyro_state->scan,
- gyro_state->timestamp);
+ iio_push_to_buffers_with_ts(indio_dev, &gyro_state->scan,
+ sizeof(gyro_state->scan),
+ gyro_state->timestamp);
gyro_state->timestamp = 0;
}
diff --git a/drivers/iio/humidity/hid-sensor-humidity.c b/drivers/iio/humidity/hid-sensor-humidity.c
index 12c88efe66be..c09986346c8f 100644
--- a/drivers/iio/humidity/hid-sensor-humidity.c
+++ b/drivers/iio/humidity/hid-sensor-humidity.c
@@ -132,8 +132,9 @@ static int humidity_proc_event(struct hid_sensor_hub_device *hsdev,
struct hid_humidity_state *humid_st = iio_priv(indio_dev);
if (atomic_read(&humid_st->common_attributes.data_ready))
- iio_push_to_buffers_with_timestamp(indio_dev, &humid_st->scan,
- iio_get_time_ns(indio_dev));
+ iio_push_to_buffers_with_ts(indio_dev, &humid_st->scan,
+ sizeof(humid_st->scan),
+ iio_get_time_ns(indio_dev));
return 0;
}
diff --git a/drivers/iio/magnetometer/hid-sensor-magn-3d.c b/drivers/iio/magnetometer/hid-sensor-magn-3d.c
index c8b4fa7785c9..f869560b47fc 100644
--- a/drivers/iio/magnetometer/hid-sensor-magn-3d.c
+++ b/drivers/iio/magnetometer/hid-sensor-magn-3d.c
@@ -37,8 +37,8 @@ struct magn_3d_state {
struct hid_sensor_common rot_attributes;
struct hid_sensor_hub_attribute_info magn[MAGN_3D_CHANNEL_MAX];
- /* dynamically sized array to hold sensor values */
- u32 *iio_vals;
+ /* array sized to hold maximum set of sensor values */
+ IIO_DECLARE_BUFFER_WITH_TS(u32, iio_vals, MAGN_3D_CHANNEL_MAX);
/* array of pointers to sensor value */
u32 *magn_val_addr[MAGN_3D_CHANNEL_MAX];
@@ -275,9 +275,10 @@ static int magn_3d_proc_event(struct hid_sensor_hub_device *hsdev,
if (!magn_state->timestamp)
magn_state->timestamp = iio_get_time_ns(indio_dev);
- iio_push_to_buffers_with_timestamp(indio_dev,
- magn_state->iio_vals,
- magn_state->timestamp);
+ iio_push_to_buffers_with_ts(indio_dev,
+ magn_state->iio_vals,
+ sizeof(magn_state->iio_vals),
+ magn_state->timestamp);
magn_state->timestamp = 0;
}
@@ -379,16 +380,6 @@ static int magn_3d_parse_report(struct platform_device *pdev,
return -ENOMEM;
}
- /* attr_count include timestamp channel, and the iio_vals should be aligned to 8byte */
- st->iio_vals = devm_kcalloc(&pdev->dev,
- ((attr_count + 1) % 2 + (attr_count + 1) / 2) * 2,
- sizeof(u32), GFP_KERNEL);
- if (!st->iio_vals) {
- dev_err(&pdev->dev,
- "failed to allocate space for iio values array\n");
- return -ENOMEM;
- }
-
for (i = 0, *chan_count = 0;
i < MAGN_3D_CHANNEL_MAX && *chan_count < attr_count;
i++){
diff --git a/drivers/iio/orientation/hid-sensor-incl-3d.c b/drivers/iio/orientation/hid-sensor-incl-3d.c
index b5f70732d035..3880e479a499 100644
--- a/drivers/iio/orientation/hid-sensor-incl-3d.c
+++ b/drivers/iio/orientation/hid-sensor-incl-3d.c
@@ -194,9 +194,10 @@ static int incl_3d_proc_event(struct hid_sensor_hub_device *hsdev,
if (!incl_state->timestamp)
incl_state->timestamp = iio_get_time_ns(indio_dev);
- iio_push_to_buffers_with_timestamp(indio_dev,
- &incl_state->scan,
- incl_state->timestamp);
+ iio_push_to_buffers_with_ts(indio_dev,
+ &incl_state->scan,
+ sizeof(incl_state->scan),
+ incl_state->timestamp);
incl_state->timestamp = 0;
}
diff --git a/drivers/iio/position/hid-sensor-custom-intel-hinge.c b/drivers/iio/position/hid-sensor-custom-intel-hinge.c
index 101d84b533c9..98a5e3e03bba 100644
--- a/drivers/iio/position/hid-sensor-custom-intel-hinge.c
+++ b/drivers/iio/position/hid-sensor-custom-intel-hinge.c
@@ -198,8 +198,8 @@ static int hinge_proc_event(struct hid_sensor_hub_device *hsdev,
if (!st->timestamp)
st->timestamp = iio_get_time_ns(indio_dev);
- iio_push_to_buffers_with_timestamp(indio_dev, &st->scan,
- st->timestamp);
+ iio_push_to_buffers_with_ts(indio_dev, &st->scan,
+ sizeof(st->scan), st->timestamp);
st->timestamp = 0;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 60+ messages in thread* Re: [PATCH 05/39] iio: hid-sensors: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 ` [PATCH 05/39] iio: hid-sensors: " Jonathan Cameron
@ 2026-10-27 0:06 ` srinivas pandruvada
2026-10-27 8:21 ` Andy Shevchenko
1 sibling, 0 replies; 60+ messages in thread
From: srinivas pandruvada @ 2026-10-27 0:06 UTC (permalink / raw)
To: Jonathan Cameron, linux-iio
Cc: David Lechner, Nuno Sá, Andy Shevchenko, Jiri Kosina,
Zhang Lixu
On Mon, 2026-10-26 at 16:05 -0700, Jonathan Cameron wrote:
> Replace the deprecated iio_push_to_buffers_with_timestamp() with
> iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
>
> For hid-sensor-magn-3d, use IIO_DECLARE_BUFFER_WITH_TS() to suize the
> buffer for the maximum number of channels supported avoiding need
> for separate allocation.
>
> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
LGTM.
I will do some quick test on this and let you know.
Thanks,
Srinivas
> ---
> Cc: Jiri Kosina <jikos@kernel.org>
> Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> Cc: Zhang Lixu <lixu.zhang@intel.com>
> ---
> drivers/iio/gyro/hid-sensor-gyro-3d.c | 5 +++--
> drivers/iio/humidity/hid-sensor-humidity.c | 5 +++--
> drivers/iio/magnetometer/hid-sensor-magn-3d.c | 21 ++++++-----
> ----------
> drivers/iio/orientation/hid-sensor-incl-3d.c | 7 ++++---
> .../iio/position/hid-sensor-custom-intel-hinge.c | 4 ++--
> 5 files changed, 18 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/iio/gyro/hid-sensor-gyro-3d.c
> b/drivers/iio/gyro/hid-sensor-gyro-3d.c
> index 66778315e86d..083e82cf561c 100644
> --- a/drivers/iio/gyro/hid-sensor-gyro-3d.c
> +++ b/drivers/iio/gyro/hid-sensor-gyro-3d.c
> @@ -182,8 +182,9 @@ static int gyro_3d_proc_event(struct
> hid_sensor_hub_device *hsdev,
> if (!gyro_state->timestamp)
> gyro_state->timestamp =
> iio_get_time_ns(indio_dev);
>
> - iio_push_to_buffers_with_timestamp(indio_dev,
> &gyro_state->scan,
> - gyro_state-
> >timestamp);
> + iio_push_to_buffers_with_ts(indio_dev, &gyro_state-
> >scan,
> + sizeof(gyro_state-
> >scan),
> + gyro_state->timestamp);
>
> gyro_state->timestamp = 0;
> }
> diff --git a/drivers/iio/humidity/hid-sensor-humidity.c
> b/drivers/iio/humidity/hid-sensor-humidity.c
> index 12c88efe66be..c09986346c8f 100644
> --- a/drivers/iio/humidity/hid-sensor-humidity.c
> +++ b/drivers/iio/humidity/hid-sensor-humidity.c
> @@ -132,8 +132,9 @@ static int humidity_proc_event(struct
> hid_sensor_hub_device *hsdev,
> struct hid_humidity_state *humid_st = iio_priv(indio_dev);
>
> if (atomic_read(&humid_st->common_attributes.data_ready))
> - iio_push_to_buffers_with_timestamp(indio_dev,
> &humid_st->scan,
> -
> iio_get_time_ns(indio_dev));
> + iio_push_to_buffers_with_ts(indio_dev, &humid_st-
> >scan,
> + sizeof(humid_st->scan),
> +
> iio_get_time_ns(indio_dev));
>
> return 0;
> }
> diff --git a/drivers/iio/magnetometer/hid-sensor-magn-3d.c
> b/drivers/iio/magnetometer/hid-sensor-magn-3d.c
> index c8b4fa7785c9..f869560b47fc 100644
> --- a/drivers/iio/magnetometer/hid-sensor-magn-3d.c
> +++ b/drivers/iio/magnetometer/hid-sensor-magn-3d.c
> @@ -37,8 +37,8 @@ struct magn_3d_state {
> struct hid_sensor_common rot_attributes;
> struct hid_sensor_hub_attribute_info
> magn[MAGN_3D_CHANNEL_MAX];
>
> - /* dynamically sized array to hold sensor values */
> - u32 *iio_vals;
> + /* array sized to hold maximum set of sensor values */
> + IIO_DECLARE_BUFFER_WITH_TS(u32, iio_vals,
> MAGN_3D_CHANNEL_MAX);
> /* array of pointers to sensor value */
> u32 *magn_val_addr[MAGN_3D_CHANNEL_MAX];
>
> @@ -275,9 +275,10 @@ static int magn_3d_proc_event(struct
> hid_sensor_hub_device *hsdev,
> if (!magn_state->timestamp)
> magn_state->timestamp =
> iio_get_time_ns(indio_dev);
>
> - iio_push_to_buffers_with_timestamp(indio_dev,
> - magn_state-
> >iio_vals,
> - magn_state-
> >timestamp);
> + iio_push_to_buffers_with_ts(indio_dev,
> + magn_state->iio_vals,
> + sizeof(magn_state-
> >iio_vals),
> + magn_state->timestamp);
> magn_state->timestamp = 0;
> }
>
> @@ -379,16 +380,6 @@ static int magn_3d_parse_report(struct
> platform_device *pdev,
> return -ENOMEM;
> }
>
> - /* attr_count include timestamp channel, and the iio_vals
> should be aligned to 8byte */
> - st->iio_vals = devm_kcalloc(&pdev->dev,
> - ((attr_count + 1) % 2 +
> (attr_count + 1) / 2) * 2,
> - sizeof(u32), GFP_KERNEL);
> - if (!st->iio_vals) {
> - dev_err(&pdev->dev,
> - "failed to allocate space for iio values
> array\n");
> - return -ENOMEM;
> - }
> -
> for (i = 0, *chan_count = 0;
> i < MAGN_3D_CHANNEL_MAX && *chan_count < attr_count;
> i++){
> diff --git a/drivers/iio/orientation/hid-sensor-incl-3d.c
> b/drivers/iio/orientation/hid-sensor-incl-3d.c
> index b5f70732d035..3880e479a499 100644
> --- a/drivers/iio/orientation/hid-sensor-incl-3d.c
> +++ b/drivers/iio/orientation/hid-sensor-incl-3d.c
> @@ -194,9 +194,10 @@ static int incl_3d_proc_event(struct
> hid_sensor_hub_device *hsdev,
> if (!incl_state->timestamp)
> incl_state->timestamp =
> iio_get_time_ns(indio_dev);
>
> - iio_push_to_buffers_with_timestamp(indio_dev,
> - &incl_state-
> >scan,
> - incl_state-
> >timestamp);
> + iio_push_to_buffers_with_ts(indio_dev,
> + &incl_state->scan,
> + sizeof(incl_state-
> >scan),
> + incl_state->timestamp);
>
> incl_state->timestamp = 0;
> }
> diff --git a/drivers/iio/position/hid-sensor-custom-intel-hinge.c
> b/drivers/iio/position/hid-sensor-custom-intel-hinge.c
> index 101d84b533c9..98a5e3e03bba 100644
> --- a/drivers/iio/position/hid-sensor-custom-intel-hinge.c
> +++ b/drivers/iio/position/hid-sensor-custom-intel-hinge.c
> @@ -198,8 +198,8 @@ static int hinge_proc_event(struct
> hid_sensor_hub_device *hsdev,
> if (!st->timestamp)
> st->timestamp = iio_get_time_ns(indio_dev);
>
> - iio_push_to_buffers_with_timestamp(indio_dev, &st-
> >scan,
> - st->timestamp);
> + iio_push_to_buffers_with_ts(indio_dev, &st->scan,
> + sizeof(st->scan), st-
> >timestamp);
>
> st->timestamp = 0;
> }
^ permalink raw reply [flat|nested] 60+ messages in thread* Re: [PATCH 05/39] iio: hid-sensors: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 ` [PATCH 05/39] iio: hid-sensors: " Jonathan Cameron
2026-10-27 0:06 ` srinivas pandruvada
@ 2026-10-27 8:21 ` Andy Shevchenko
1 sibling, 0 replies; 60+ messages in thread
From: Andy Shevchenko @ 2026-10-27 8:21 UTC (permalink / raw)
To: Jonathan Cameron
Cc: linux-iio, David Lechner, Nuno Sá, Andy Shevchenko,
Jiri Kosina, Srinivas Pandruvada, Zhang Lixu
On Mon, Oct 26, 2026 at 04:05:23PM -0700, Jonathan Cameron wrote:
> Replace the deprecated iio_push_to_buffers_with_timestamp() with
> iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
>
> For hid-sensor-magn-3d, use IIO_DECLARE_BUFFER_WITH_TS() to suize the
> buffer for the maximum number of channels supported avoiding need
> for separate allocation.
I was staring at this for a while. The feeling is that it has to work
as we don't register more channels than it was reported by the HW.
Since the patch makes the buffer static of maximum size, the _with_ts()
should handle this correctly.
But it would be nice to check, indeed.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 60+ messages in thread
* [PATCH 06/39] iio: gyro: mpu3050: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp() Jonathan Cameron
` (4 preceding siblings ...)
2026-10-26 23:05 ` [PATCH 05/39] iio: hid-sensors: " Jonathan Cameron
@ 2026-10-26 23:05 ` Jonathan Cameron
2026-10-26 23:05 ` [PATCH 07/39] iio: imu: bno055: " Jonathan Cameron
` (33 subsequent siblings)
39 siblings, 0 replies; 60+ messages in thread
From: Jonathan Cameron @ 2026-10-26 23:05 UTC (permalink / raw)
To: linux-iio
Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Cong Nguyen, Ethan Tidmore
Replace the deprecated iio_push_to_buffers_with_timestamp() with
iio_push_to_buffers_with_ts(), passing the size of the pushed buffer,
which is on the stack and local to mpu3050_trigger_handler().
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
Cc: Cong Nguyen <congnt264@gmail.com>
Cc: Ethan Tidmore <ethantidmore06@gmail.com>
---
drivers/iio/gyro/mpu3050-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/gyro/mpu3050-core.c b/drivers/iio/gyro/mpu3050-core.c
index 07c0f9011c63..f91b1173c2a2 100644
--- a/drivers/iio/gyro/mpu3050-core.c
+++ b/drivers/iio/gyro/mpu3050-core.c
@@ -637,7 +637,7 @@ static irqreturn_t mpu3050_trigger_handler(int irq, void *p)
goto out_trigger_unlock;
}
- iio_push_to_buffers_with_timestamp(indio_dev, &scan, timestamp);
+ iio_push_to_buffers_with_ts(indio_dev, &scan, sizeof(scan), timestamp);
out_trigger_unlock:
mutex_unlock(&mpu3050->lock);
--
2.43.0
^ permalink raw reply related [flat|nested] 60+ messages in thread* [PATCH 07/39] iio: imu: bno055: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp() Jonathan Cameron
` (5 preceding siblings ...)
2026-10-26 23:05 ` [PATCH 06/39] iio: gyro: mpu3050: " Jonathan Cameron
@ 2026-10-26 23:05 ` Jonathan Cameron
2026-10-26 23:05 ` [PATCH 08/39] iio: light: as73211: " Jonathan Cameron
` (32 subsequent siblings)
39 siblings, 0 replies; 60+ messages in thread
From: Jonathan Cameron @ 2026-10-26 23:05 UTC (permalink / raw)
To: linux-iio; +Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko
Replace the deprecated iio_push_to_buffers_with_timestamp() with
iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
drivers/iio/imu/bno055/bno055.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/imu/bno055/bno055.c b/drivers/iio/imu/bno055/bno055.c
index d0101607a9b3..b1c7b4f88bf1 100644
--- a/drivers/iio/imu/bno055/bno055.c
+++ b/drivers/iio/imu/bno055/bno055.c
@@ -1543,8 +1543,8 @@ static irqreturn_t bno055_trigger_handler(int irq, void *p)
mask, priv->buf.chans, &buf_idx);
if (!ret)
- iio_push_to_buffers_with_timestamp(iio_dev,
- &priv->buf, pf->timestamp);
+ iio_push_to_buffers_with_ts(iio_dev, &priv->buf,
+ sizeof(priv->buf), pf->timestamp);
done:
mutex_unlock(&priv->lock);
iio_trigger_notify_done(iio_dev->trig);
--
2.43.0
^ permalink raw reply related [flat|nested] 60+ messages in thread* [PATCH 08/39] iio: light: as73211: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp() Jonathan Cameron
` (6 preceding siblings ...)
2026-10-26 23:05 ` [PATCH 07/39] iio: imu: bno055: " Jonathan Cameron
@ 2026-10-26 23:05 ` Jonathan Cameron
2026-10-27 2:09 ` Javier Carrasco
2026-10-26 23:05 ` [PATCH 09/39] iio: light: vcnl4035: " Jonathan Cameron
` (31 subsequent siblings)
39 siblings, 1 reply; 60+ messages in thread
From: Jonathan Cameron @ 2026-10-26 23:05 UTC (permalink / raw)
To: linux-iio
Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Christian Eggers, Javier Carrasco
Replace the deprecated iio_push_to_buffers_with_timestamp() with
iio_push_to_buffers_with_ts(), passing the size of the pushed buffer,
which is on the stack and local to as73211_trigger_handler().
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
Cc: Christian Eggers <ceggers@arri.de>
Cc: Javier Carrasco <javier.carrasco.cruz@gmail.com>
---
drivers/iio/light/as73211.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/light/as73211.c b/drivers/iio/light/as73211.c
index 67f33bbe1c13..675866029cd7 100644
--- a/drivers/iio/light/as73211.c
+++ b/drivers/iio/light/as73211.c
@@ -695,7 +695,8 @@ static irqreturn_t as73211_trigger_handler(int irq __always_unused, void *p)
}
}
- iio_push_to_buffers_with_timestamp(indio_dev, &scan, iio_get_time_ns(indio_dev));
+ iio_push_to_buffers_with_ts(indio_dev, &scan, sizeof(scan),
+ iio_get_time_ns(indio_dev));
done:
mutex_unlock(&data->mutex);
--
2.43.0
^ permalink raw reply related [flat|nested] 60+ messages in thread* Re: [PATCH 08/39] iio: light: as73211: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 ` [PATCH 08/39] iio: light: as73211: " Jonathan Cameron
@ 2026-10-27 2:09 ` Javier Carrasco
0 siblings, 0 replies; 60+ messages in thread
From: Javier Carrasco @ 2026-10-27 2:09 UTC (permalink / raw)
To: Jonathan Cameron, linux-iio
Cc: David Lechner, Nuno Sá, Andy Shevchenko, Christian Eggers,
Javier Carrasco
On Mon Oct 26, 2026 at 6:05 PM EST, Jonathan Cameron wrote:
> Replace the deprecated iio_push_to_buffers_with_timestamp() with
> iio_push_to_buffers_with_ts(), passing the size of the pushed buffer,
> which is on the stack and local to as73211_trigger_handler().
>
> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
> ---
> Cc: Christian Eggers <ceggers@arri.de>
> Cc: Javier Carrasco <javier.carrasco.cruz@gmail.com>
> ---
> drivers/iio/light/as73211.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iio/light/as73211.c b/drivers/iio/light/as73211.c
> index 67f33bbe1c13..675866029cd7 100644
> --- a/drivers/iio/light/as73211.c
> +++ b/drivers/iio/light/as73211.c
> @@ -695,7 +695,8 @@ static irqreturn_t as73211_trigger_handler(int irq __always_unused, void *p)
> }
> }
>
> - iio_push_to_buffers_with_timestamp(indio_dev, &scan, iio_get_time_ns(indio_dev));
> + iio_push_to_buffers_with_ts(indio_dev, &scan, sizeof(scan),
> + iio_get_time_ns(indio_dev));
>
> done:
> mutex_unlock(&data->mutex);
Reviewed-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
^ permalink raw reply [flat|nested] 60+ messages in thread
* [PATCH 09/39] iio: light: vcnl4035: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp() Jonathan Cameron
` (7 preceding siblings ...)
2026-10-26 23:05 ` [PATCH 08/39] iio: light: as73211: " Jonathan Cameron
@ 2026-10-26 23:05 ` Jonathan Cameron
2026-10-26 23:05 ` [PATCH 10/39] iio: pressure: mprls0025pa: " Jonathan Cameron
` (30 subsequent siblings)
39 siblings, 0 replies; 60+ messages in thread
From: Jonathan Cameron @ 2026-10-26 23:05 UTC (permalink / raw)
To: linux-iio; +Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko
Replace the deprecated iio_push_to_buffers_with_timestamp() with
iio_push_to_buffers_with_ts(), passing the size of the pushed buffer,
which is on the stack and local to vcnl4035_trigger_consumer_handler().
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
drivers/iio/light/vcnl4035.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/light/vcnl4035.c b/drivers/iio/light/vcnl4035.c
index ce1bd42b0c7c..23bd0d42363d 100644
--- a/drivers/iio/light/vcnl4035.c
+++ b/drivers/iio/light/vcnl4035.c
@@ -118,8 +118,8 @@ static irqreturn_t vcnl4035_trigger_consumer_handler(int irq, void *p)
}
buffer.als_data = val;
- iio_push_to_buffers_with_timestamp(indio_dev, &buffer,
- iio_get_time_ns(indio_dev));
+ iio_push_to_buffers_with_ts(indio_dev, &buffer, sizeof(buffer),
+ iio_get_time_ns(indio_dev));
fail_read:
iio_trigger_notify_done(indio_dev->trig);
--
2.43.0
^ permalink raw reply related [flat|nested] 60+ messages in thread* [PATCH 10/39] iio: pressure: mprls0025pa: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp() Jonathan Cameron
` (8 preceding siblings ...)
2026-10-26 23:05 ` [PATCH 09/39] iio: light: vcnl4035: " Jonathan Cameron
@ 2026-10-26 23:05 ` Jonathan Cameron
2026-10-26 23:05 ` [PATCH 11/39] iio: pressure: ms5611: " Jonathan Cameron
` (29 subsequent siblings)
39 siblings, 0 replies; 60+ messages in thread
From: Jonathan Cameron @ 2026-10-26 23:05 UTC (permalink / raw)
To: linux-iio
Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Petre Rodan
Replace the deprecated iio_push_to_buffers_with_timestamp() with
iio_push_to_buffers_with_ts(), passing the size of the pushed buffer,
which is a structure within the iio_priv() data.
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
Cc: Petre Rodan <petre.rodan@subdimension.ro>
---
drivers/iio/pressure/mprls0025pa.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/pressure/mprls0025pa.c b/drivers/iio/pressure/mprls0025pa.c
index c21f0a050660..1454c2837077 100644
--- a/drivers/iio/pressure/mprls0025pa.c
+++ b/drivers/iio/pressure/mprls0025pa.c
@@ -277,8 +277,8 @@ static irqreturn_t mpr_trigger_handler(int irq, void *p)
if (ret < 0)
goto err;
- iio_push_to_buffers_with_timestamp(indio_dev, &data->chan,
- iio_get_time_ns(indio_dev));
+ iio_push_to_buffers_with_ts(indio_dev, &data->chan, sizeof(data->chan),
+ iio_get_time_ns(indio_dev));
err:
mutex_unlock(&data->lock);
--
2.43.0
^ permalink raw reply related [flat|nested] 60+ messages in thread* [PATCH 11/39] iio: pressure: ms5611: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp() Jonathan Cameron
` (9 preceding siblings ...)
2026-10-26 23:05 ` [PATCH 10/39] iio: pressure: mprls0025pa: " Jonathan Cameron
@ 2026-10-26 23:05 ` Jonathan Cameron
2026-10-26 23:05 ` [PATCH 12/39] iio: proximity: isl29501: " Jonathan Cameron
` (28 subsequent siblings)
39 siblings, 0 replies; 60+ messages in thread
From: Jonathan Cameron @ 2026-10-26 23:05 UTC (permalink / raw)
To: linux-iio; +Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko
Replace the deprecated iio_push_to_buffers_with_timestamp() with
iio_push_to_buffers_with_ts(), passing the size of the pushed buffer,
which is on the stack and local to ms5611_trigger_handler().
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
drivers/iio/pressure/ms5611_core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/pressure/ms5611_core.c b/drivers/iio/pressure/ms5611_core.c
index bdac27bd5a5d..72c769f9b6ad 100644
--- a/drivers/iio/pressure/ms5611_core.c
+++ b/drivers/iio/pressure/ms5611_core.c
@@ -224,8 +224,8 @@ static irqreturn_t ms5611_trigger_handler(int irq, void *p)
if (ret < 0)
goto err;
- iio_push_to_buffers_with_timestamp(indio_dev, &scan,
- iio_get_time_ns(indio_dev));
+ iio_push_to_buffers_with_ts(indio_dev, &scan, sizeof(scan),
+ iio_get_time_ns(indio_dev));
err:
iio_trigger_notify_done(indio_dev->trig);
--
2.43.0
^ permalink raw reply related [flat|nested] 60+ messages in thread* [PATCH 12/39] iio: proximity: isl29501: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp() Jonathan Cameron
` (10 preceding siblings ...)
2026-10-26 23:05 ` [PATCH 11/39] iio: pressure: ms5611: " Jonathan Cameron
@ 2026-10-26 23:05 ` Jonathan Cameron
2026-10-27 8:22 ` Andy Shevchenko
2026-10-26 23:05 ` [PATCH 13/39] iio: proximity: sx9500: " Jonathan Cameron
` (27 subsequent siblings)
39 siblings, 1 reply; 60+ messages in thread
From: Jonathan Cameron @ 2026-10-26 23:05 UTC (permalink / raw)
To: linux-iio; +Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko
Replace the deprecated iio_push_to_buffers_with_timestamp() with
iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
drivers/iio/proximity/isl29501.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/proximity/isl29501.c b/drivers/iio/proximity/isl29501.c
index a98a9975323c..149bd57bfdf0 100644
--- a/drivers/iio/proximity/isl29501.c
+++ b/drivers/iio/proximity/isl29501.c
@@ -948,7 +948,8 @@ static irqreturn_t isl29501_trigger_handler(int irq, void *p)
scan.data = value;
}
- iio_push_to_buffers_with_timestamp(indio_dev, &scan, pf->timestamp);
+ iio_push_to_buffers_with_ts(indio_dev, &scan, sizeof(scan),
+ pf->timestamp);
iio_trigger_notify_done(indio_dev->trig);
return IRQ_HANDLED;
--
2.43.0
^ permalink raw reply related [flat|nested] 60+ messages in thread* Re: [PATCH 12/39] iio: proximity: isl29501: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 ` [PATCH 12/39] iio: proximity: isl29501: " Jonathan Cameron
@ 2026-10-27 8:22 ` Andy Shevchenko
0 siblings, 0 replies; 60+ messages in thread
From: Andy Shevchenko @ 2026-10-27 8:22 UTC (permalink / raw)
To: Jonathan Cameron; +Cc: linux-iio, David Lechner, Nuno Sá, Andy Shevchenko
On Mon, Oct 26, 2026 at 04:05:30PM -0700, Jonathan Cameron wrote:
> Replace the deprecated iio_push_to_buffers_with_timestamp() with
> iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
...
> - iio_push_to_buffers_with_timestamp(indio_dev, &scan, pf->timestamp);
> + iio_push_to_buffers_with_ts(indio_dev, &scan, sizeof(scan),
> + pf->timestamp);
I would leave it on a single line (83 characters only).
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 60+ messages in thread
* [PATCH 13/39] iio: proximity: sx9500: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp() Jonathan Cameron
` (11 preceding siblings ...)
2026-10-26 23:05 ` [PATCH 12/39] iio: proximity: isl29501: " Jonathan Cameron
@ 2026-10-26 23:05 ` Jonathan Cameron
2026-10-26 23:05 ` [PATCH 14/39] iio: imu: smi330: " Jonathan Cameron
` (26 subsequent siblings)
39 siblings, 0 replies; 60+ messages in thread
From: Jonathan Cameron @ 2026-10-26 23:05 UTC (permalink / raw)
To: linux-iio; +Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko
Replace the deprecated iio_push_to_buffers_with_timestamp() with
iio_push_to_buffers_with_ts(), passing the size of the pushed buffer,
which is on the stack and local to sx9500_trigger_handler().
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
drivers/iio/proximity/sx9500.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/proximity/sx9500.c b/drivers/iio/proximity/sx9500.c
index cd67d88d2be4..a2709faa0106 100644
--- a/drivers/iio/proximity/sx9500.c
+++ b/drivers/iio/proximity/sx9500.c
@@ -647,8 +647,8 @@ static irqreturn_t sx9500_trigger_handler(int irq, void *private)
scan.chan[i++] = val;
}
- iio_push_to_buffers_with_timestamp(indio_dev, &scan,
- iio_get_time_ns(indio_dev));
+ iio_push_to_buffers_with_ts(indio_dev, &scan, sizeof(scan),
+ iio_get_time_ns(indio_dev));
out:
mutex_unlock(&data->mutex);
--
2.43.0
^ permalink raw reply related [flat|nested] 60+ messages in thread* [PATCH 14/39] iio: imu: smi330: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp() Jonathan Cameron
` (12 preceding siblings ...)
2026-10-26 23:05 ` [PATCH 13/39] iio: proximity: sx9500: " Jonathan Cameron
@ 2026-10-26 23:05 ` Jonathan Cameron
2026-10-26 23:05 ` [PATCH 15/39] iio: imu: bmi270: " Jonathan Cameron
` (25 subsequent siblings)
39 siblings, 0 replies; 60+ messages in thread
From: Jonathan Cameron @ 2026-10-26 23:05 UTC (permalink / raw)
To: linux-iio
Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Jianping Shen
Replace the deprecated iio_push_to_buffers_with_timestamp() with
iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
Cc: Jianping Shen <Jianping.Shen@de.bosch.com>
---
drivers/iio/imu/smi330/smi330_core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/imu/smi330/smi330_core.c b/drivers/iio/imu/smi330/smi330_core.c
index 7ec5ae7f521a..ef7f00825b4a 100644
--- a/drivers/iio/imu/smi330/smi330_core.c
+++ b/drivers/iio/imu/smi330/smi330_core.c
@@ -628,7 +628,8 @@ static irqreturn_t smi330_trigger_handler(int irq, void *p)
if (ret)
goto out;
- iio_push_to_buffers_with_timestamp(indio_dev, data->buf, pf->timestamp);
+ iio_push_to_buffers_with_ts(indio_dev, data->buf, sizeof(data->buf),
+ pf->timestamp);
out:
iio_trigger_notify_done(indio_dev->trig);
--
2.43.0
^ permalink raw reply related [flat|nested] 60+ messages in thread* [PATCH 15/39] iio: imu: bmi270: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp() Jonathan Cameron
` (13 preceding siblings ...)
2026-10-26 23:05 ` [PATCH 14/39] iio: imu: smi330: " Jonathan Cameron
@ 2026-10-26 23:05 ` Jonathan Cameron
2026-10-26 23:05 ` [PATCH 16/39] iio: imu: inv_icm42600: " Jonathan Cameron
` (24 subsequent siblings)
39 siblings, 0 replies; 60+ messages in thread
From: Jonathan Cameron @ 2026-10-26 23:05 UTC (permalink / raw)
To: linux-iio
Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Jianping Shen, Alex Lanzano, Justin Weiss
Replace the deprecated iio_push_to_buffers_with_timestamp() with
iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
Cc: Jianping Shen <Jianping.Shen@de.bosch.com>
Cc: Alex Lanzano <lanzano.alex@gmail.com>
Cc: Justin Weiss <justin@justinweiss.com>
---
drivers/iio/imu/bmi270/bmi270_core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/imu/bmi270/bmi270_core.c b/drivers/iio/imu/bmi270/bmi270_core.c
index fbcf6bb87acc..83a9a96c3ca9 100644
--- a/drivers/iio/imu/bmi270/bmi270_core.c
+++ b/drivers/iio/imu/bmi270/bmi270_core.c
@@ -851,8 +851,8 @@ static irqreturn_t bmi270_trigger_handler(int irq, void *p)
if (ret)
goto done;
- iio_push_to_buffers_with_timestamp(indio_dev, &data->buffer,
- pf->timestamp);
+ iio_push_to_buffers_with_ts(indio_dev, &data->buffer,
+ sizeof(data->buffer), pf->timestamp);
done:
iio_trigger_notify_done(indio_dev->trig);
return IRQ_HANDLED;
--
2.43.0
^ permalink raw reply related [flat|nested] 60+ messages in thread* [PATCH 16/39] iio: imu: inv_icm42600: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp() Jonathan Cameron
` (14 preceding siblings ...)
2026-10-26 23:05 ` [PATCH 15/39] iio: imu: bmi270: " Jonathan Cameron
@ 2026-10-26 23:05 ` Jonathan Cameron
2026-10-26 23:05 ` [PATCH 17/39] iio: health: afe4403: " Jonathan Cameron
` (23 subsequent siblings)
39 siblings, 0 replies; 60+ messages in thread
From: Jonathan Cameron @ 2026-10-26 23:05 UTC (permalink / raw)
To: linux-iio
Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Jean-Baptiste Maneyrol
Replace the deprecated iio_push_to_buffers_with_timestamp() with
iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
Cc: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
---
drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c | 3 ++-
drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c b/drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c
index cc8c074777c9..d40300af9b3c 100644
--- a/drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c
+++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c
@@ -1250,7 +1250,8 @@ int inv_icm42600_accel_parse_fifo(struct iio_dev *indio_dev)
/* convert 8 bits FIFO temperature in high resolution format */
buffer.temp = temp ? (*temp * 64) : 0;
ts_val = inv_sensors_timestamp_pop(ts);
- iio_push_to_buffers_with_timestamp(indio_dev, &buffer, ts_val);
+ iio_push_to_buffers_with_ts(indio_dev, &buffer, sizeof(buffer),
+ ts_val);
}
if (st->timestamp.accel_force_odr) {
diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c b/drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c
index 4e20d61d897b..f895226f4a39 100644
--- a/drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c
+++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c
@@ -829,7 +829,8 @@ int inv_icm42600_gyro_parse_fifo(struct iio_dev *indio_dev)
/* convert 8 bits FIFO temperature in high resolution format */
buffer.temp = temp ? (*temp * 64) : 0;
ts_val = inv_sensors_timestamp_pop(ts);
- iio_push_to_buffers_with_timestamp(indio_dev, &buffer, ts_val);
+ iio_push_to_buffers_with_ts(indio_dev, &buffer, sizeof(buffer),
+ ts_val);
}
return 0;
--
2.43.0
^ permalink raw reply related [flat|nested] 60+ messages in thread* [PATCH 17/39] iio: health: afe4403: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp() Jonathan Cameron
` (15 preceding siblings ...)
2026-10-26 23:05 ` [PATCH 16/39] iio: imu: inv_icm42600: " Jonathan Cameron
@ 2026-10-26 23:05 ` Jonathan Cameron
2026-10-27 8:25 ` Andy Shevchenko
2026-10-26 23:05 ` [PATCH 18/39] iio: health: afe4404: " Jonathan Cameron
` (22 subsequent siblings)
39 siblings, 1 reply; 60+ messages in thread
From: Jonathan Cameron @ 2026-10-26 23:05 UTC (permalink / raw)
To: linux-iio
Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Andrew F. Davis
Replace the deprecated iio_push_to_buffers_with_timestamp() with
iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
The pushed buffer is never a direct SPI/DMA transfer target, so move
it from the per-device state to the stack. Use
IIO_DECLARE_BUFFER_WITH_TS() since the timestamp offset depends on the
number of enabled channels, and zero initialize it.
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
Cc: Andrew F. Davis <afd@ti.com>
---
drivers/iio/health/afe4403.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/iio/health/afe4403.c b/drivers/iio/health/afe4403.c
index 2a648532242a..d35c00a2bafe 100644
--- a/drivers/iio/health/afe4403.c
+++ b/drivers/iio/health/afe4403.c
@@ -64,7 +64,6 @@ static const struct reg_field afe4403_reg_fields[] = {
* @regulator: Pointer to the regulator for the IC
* @trig: IIO trigger for this device
* @irq: ADC_RDY line interrupt number
- * @buffer: Used to construct data layout to push into IIO buffer.
*/
struct afe4403_data {
struct spi_device *spi;
@@ -73,8 +72,6 @@ struct afe4403_data {
struct regulator *regulator;
struct iio_trigger *trig;
int irq;
- /* Ensure suitable alignment for timestamp */
- s32 buffer[8] __aligned(8);
};
enum afe4403_chan_id {
@@ -313,6 +310,7 @@ static irqreturn_t afe4403_trigger_handler(int irq, void *private)
int ret, bit, i = 0;
u8 tx[4] = {AFE440X_CONTROL0, 0x0, 0x0, AFE440X_CONTROL0_READ};
u8 rx[3];
+ IIO_DECLARE_BUFFER_WITH_TS(s32, scan, 8) = { };
/* Enable reading from the device */
ret = spi_write_then_read(afe->spi, tx, 4, NULL, 0);
@@ -326,7 +324,7 @@ static irqreturn_t afe4403_trigger_handler(int irq, void *private)
if (ret)
goto err;
- afe->buffer[i++] = get_unaligned_be24(&rx[0]);
+ scan[i++] = get_unaligned_be24(&rx[0]);
}
/* Disable reading from the device */
@@ -335,8 +333,8 @@ static irqreturn_t afe4403_trigger_handler(int irq, void *private)
if (ret)
goto err;
- iio_push_to_buffers_with_timestamp(indio_dev, afe->buffer,
- pf->timestamp);
+ iio_push_to_buffers_with_ts(indio_dev, scan, sizeof(scan),
+ pf->timestamp);
err:
iio_trigger_notify_done(indio_dev->trig);
--
2.43.0
^ permalink raw reply related [flat|nested] 60+ messages in thread* Re: [PATCH 17/39] iio: health: afe4403: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 ` [PATCH 17/39] iio: health: afe4403: " Jonathan Cameron
@ 2026-10-27 8:25 ` Andy Shevchenko
0 siblings, 0 replies; 60+ messages in thread
From: Andy Shevchenko @ 2026-10-27 8:25 UTC (permalink / raw)
To: Jonathan Cameron
Cc: linux-iio, David Lechner, Nuno Sá, Andy Shevchenko,
Andrew F. Davis
On Mon, Oct 26, 2026 at 04:05:35PM -0700, Jonathan Cameron wrote:
> Replace the deprecated iio_push_to_buffers_with_timestamp() with
> iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
>
> The pushed buffer is never a direct SPI/DMA transfer target, so move
> it from the per-device state to the stack. Use
> IIO_DECLARE_BUFFER_WITH_TS() since the timestamp offset depends on the
> number of enabled channels, and zero initialize it.
...
> static irqreturn_t afe4403_trigger_handler(int irq, void *private)
> int ret, bit, i = 0;
> u8 tx[4] = {AFE440X_CONTROL0, 0x0, 0x0, AFE440X_CONTROL0_READ};
> u8 rx[3];
> + IIO_DECLARE_BUFFER_WITH_TS(s32, scan, 8) = { };
I would move it a bit up, giving the visible context to be even before
'int ret...' line.
...
> - iio_push_to_buffers_with_timestamp(indio_dev, afe->buffer,
> - pf->timestamp);
> + iio_push_to_buffers_with_ts(indio_dev, scan, sizeof(scan),
> + pf->timestamp);
One line of 82 characters is okay I believe.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 60+ messages in thread
* [PATCH 18/39] iio: health: afe4404: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp() Jonathan Cameron
` (16 preceding siblings ...)
2026-10-26 23:05 ` [PATCH 17/39] iio: health: afe4403: " Jonathan Cameron
@ 2026-10-26 23:05 ` Jonathan Cameron
2026-10-27 8:27 ` Andy Shevchenko
2026-10-26 23:05 ` [PATCH 19/39] iio: adc: ad799x: " Jonathan Cameron
` (21 subsequent siblings)
39 siblings, 1 reply; 60+ messages in thread
From: Jonathan Cameron @ 2026-10-26 23:05 UTC (permalink / raw)
To: linux-iio
Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Andrew F. Davis
Replace the deprecated iio_push_to_buffers_with_timestamp() with
iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
The pushed buffer is never a direct DMA transfer target, so move it
from the per-device state to the stack. Use
IIO_DECLARE_BUFFER_WITH_TS() since the timestamp offset depends on the
number of enabled channels, and zero initialize it.
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
Cc: Andrew F. Davis <afd@ti.com>
---
drivers/iio/health/afe4404.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/iio/health/afe4404.c b/drivers/iio/health/afe4404.c
index 22cd46eca217..561b563c98d5 100644
--- a/drivers/iio/health/afe4404.c
+++ b/drivers/iio/health/afe4404.c
@@ -82,7 +82,6 @@ static const struct reg_field afe4404_reg_fields[] = {
* @regulator: Pointer to the regulator for the IC
* @trig: IIO trigger for this device
* @irq: ADC_RDY line interrupt number
- * @buffer: Used to construct a scan to push to the iio buffer.
*/
struct afe4404_data {
struct regmap *regmap;
@@ -90,7 +89,6 @@ struct afe4404_data {
struct regulator *regulator;
struct iio_trigger *trig;
int irq;
- s32 buffer[10] __aligned(8);
};
enum afe4404_chan_id {
@@ -330,16 +328,17 @@ static irqreturn_t afe4404_trigger_handler(int irq, void *private)
struct iio_dev *indio_dev = pf->indio_dev;
struct afe4404_data *afe = iio_priv(indio_dev);
int ret, bit, i = 0;
+ IIO_DECLARE_BUFFER_WITH_TS(s32, scan, 10) = { };
iio_for_each_active_channel(indio_dev, bit) {
ret = regmap_read(afe->regmap, afe4404_channel_values[bit],
- &afe->buffer[i++]);
+ &scan[i++]);
if (ret)
goto err;
}
- iio_push_to_buffers_with_timestamp(indio_dev, afe->buffer,
- pf->timestamp);
+ iio_push_to_buffers_with_ts(indio_dev, scan, sizeof(scan),
+ pf->timestamp);
err:
iio_trigger_notify_done(indio_dev->trig);
--
2.43.0
^ permalink raw reply related [flat|nested] 60+ messages in thread* Re: [PATCH 18/39] iio: health: afe4404: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 ` [PATCH 18/39] iio: health: afe4404: " Jonathan Cameron
@ 2026-10-27 8:27 ` Andy Shevchenko
0 siblings, 0 replies; 60+ messages in thread
From: Andy Shevchenko @ 2026-10-27 8:27 UTC (permalink / raw)
To: Jonathan Cameron
Cc: linux-iio, David Lechner, Nuno Sá, Andy Shevchenko,
Andrew F. Davis
On Mon, Oct 26, 2026 at 04:05:36PM -0700, Jonathan Cameron wrote:
> Replace the deprecated iio_push_to_buffers_with_timestamp() with
> iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
>
> The pushed buffer is never a direct DMA transfer target, so move it
> from the per-device state to the stack. Use
> IIO_DECLARE_BUFFER_WITH_TS() since the timestamp offset depends on the
> number of enabled channels, and zero initialize it.
...
> static irqreturn_t afe4404_trigger_handler(int irq, void *private)
> struct iio_dev *indio_dev = pf->indio_dev;
> struct afe4404_data *afe = iio_priv(indio_dev);
> int ret, bit, i = 0;
> + IIO_DECLARE_BUFFER_WITH_TS(s32, scan, 10) = { };
Move it one line up.
...
> iio_for_each_active_channel(indio_dev, bit) {
> ret = regmap_read(afe->regmap, afe4404_channel_values[bit],
> - &afe->buffer[i++]);
> + &scan[i++]);
Also possible to have now
struct regmap *map = afe->regmap;
...
ret = regmap_read(map, afe4404_channel_values[bit], &scan[i++]);
(which will have the same amount of LoC).
> if (ret)
> goto err;
> }
...
> - iio_push_to_buffers_with_timestamp(indio_dev, afe->buffer,
> - pf->timestamp);
> + iio_push_to_buffers_with_ts(indio_dev, scan, sizeof(scan),
> + pf->timestamp);
One line?
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 60+ messages in thread
* [PATCH 19/39] iio: adc: ad799x: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp() Jonathan Cameron
` (17 preceding siblings ...)
2026-10-26 23:05 ` [PATCH 18/39] iio: health: afe4404: " Jonathan Cameron
@ 2026-10-26 23:05 ` Jonathan Cameron
2026-10-27 8:29 ` Andy Shevchenko
2026-10-26 23:05 ` [PATCH 20/39] iio: common: scmi_sensors: " Jonathan Cameron
` (20 subsequent siblings)
39 siblings, 1 reply; 60+ messages in thread
From: Jonathan Cameron @ 2026-10-26 23:05 UTC (permalink / raw)
To: linux-iio
Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Archit Anant, Stefano Manni
Replace the deprecated iio_push_to_buffers_with_timestamp() with
iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
Move the buffer onto the stack, local to ad799x_trigger_handler(), and
declare it via IIO_DECLARE_BUFFER_WITH_TS().
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
Cc: Archit Anant <architanant5@gmail.com>
Cc: Stefano Manni <stefano.manni@gmail.com>
---
drivers/iio/adc/ad799x.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/iio/adc/ad799x.c b/drivers/iio/adc/ad799x.c
index bb076d8f5dd5..2282535e21ea 100644
--- a/drivers/iio/adc/ad799x.c
+++ b/drivers/iio/adc/ad799x.c
@@ -138,8 +138,6 @@ struct ad799x_state {
unsigned int transfer_size;
int vref_uV;
-
- IIO_DECLARE_BUFFER_WITH_TS(__be16, rx_buf, AD799X_MAX_CHANNELS);
};
static int ad799x_write_config(struct ad799x_state *st, u16 val)
@@ -197,6 +195,7 @@ static irqreturn_t ad799x_trigger_handler(int irq, void *p)
struct iio_poll_func *pf = p;
struct iio_dev *indio_dev = pf->indio_dev;
struct ad799x_state *st = iio_priv(indio_dev);
+ IIO_DECLARE_BUFFER_WITH_TS(__be16, rx_buf, AD799X_MAX_CHANNELS) = { };
int b_sent;
u8 cmd;
@@ -223,12 +222,12 @@ static irqreturn_t ad799x_trigger_handler(int irq, void *p)
b_sent = i2c_smbus_read_i2c_block_data(st->client,
cmd, st->transfer_size,
- (u8 *)st->rx_buf);
+ (u8 *)rx_buf);
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, rx_buf, sizeof(rx_buf),
+ iio_get_time_ns(indio_dev));
out:
iio_trigger_notify_done(indio_dev->trig);
--
2.43.0
^ permalink raw reply related [flat|nested] 60+ messages in thread* Re: [PATCH 19/39] iio: adc: ad799x: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 ` [PATCH 19/39] iio: adc: ad799x: " Jonathan Cameron
@ 2026-10-27 8:29 ` Andy Shevchenko
0 siblings, 0 replies; 60+ messages in thread
From: Andy Shevchenko @ 2026-10-27 8:29 UTC (permalink / raw)
To: Jonathan Cameron
Cc: linux-iio, David Lechner, Nuno Sá, Andy Shevchenko,
Archit Anant, Stefano Manni
On Mon, Oct 26, 2026 at 04:05:37PM -0700, Jonathan Cameron wrote:
> Replace the deprecated iio_push_to_buffers_with_timestamp() with
> iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
>
> Move the buffer onto the stack, local to ad799x_trigger_handler(), and
> declare it via IIO_DECLARE_BUFFER_WITH_TS().
...
> b_sent = i2c_smbus_read_i2c_block_data(st->client,
> cmd, st->transfer_size,
> - (u8 *)st->rx_buf);
> + (u8 *)rx_buf);
Indentation is broken (even in the original code). I would reformat as
b_sent = i2c_smbus_read_i2c_block_data(st->client,
cmd, st->transfer_size,
(u8 *)rx_buf);
(yes, it's possible to move cmd up, but for the sake of less intrusiveness and
better reading the changes fixing indentation just good enough).
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 60+ messages in thread
* [PATCH 20/39] iio: common: scmi_sensors: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp() Jonathan Cameron
` (18 preceding siblings ...)
2026-10-26 23:05 ` [PATCH 19/39] iio: adc: ad799x: " Jonathan Cameron
@ 2026-10-26 23:05 ` Jonathan Cameron
2026-10-26 23:05 ` [PATCH 21/39] iio: adc: ad7766: " Jonathan Cameron
` (19 subsequent siblings)
39 siblings, 0 replies; 60+ messages in thread
From: Jonathan Cameron @ 2026-10-26 23:05 UTC (permalink / raw)
To: linux-iio
Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Jyoti Bhayana
Replace the deprecated iio_push_to_buffers_with_timestamp() with
iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
Replace the manually sized iio_buf array with
IIO_DECLARE_BUFFER_WITH_TS() so that the timestamp space and
alignment are handled consistently with other drivers.
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
Cc: Jyoti Bhayana <jbhayana@google.com>
---
drivers/iio/common/scmi_sensors/scmi_iio.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/iio/common/scmi_sensors/scmi_iio.c b/drivers/iio/common/scmi_sensors/scmi_iio.c
index 442b40ef27cf..f488dda0e386 100644
--- a/drivers/iio/common/scmi_sensors/scmi_iio.c
+++ b/drivers/iio/common/scmi_sensors/scmi_iio.c
@@ -30,8 +30,7 @@ struct scmi_iio_priv {
struct iio_dev *indio_dev;
/* lock to protect against multiple access to the device */
struct mutex lock;
- /* adding one additional channel for timestamp */
- s64 iio_buf[SCMI_IIO_NUM_OF_AXIS + 1];
+ IIO_DECLARE_BUFFER_WITH_TS(s64, iio_buf, SCMI_IIO_NUM_OF_AXIS);
struct notifier_block sensor_update_nb;
u32 *freq_avail;
};
@@ -78,8 +77,8 @@ static int scmi_iio_sensor_update_cb(struct notifier_block *nb,
}
scmi_iio_dev = sensor->indio_dev;
- iio_push_to_buffers_with_timestamp(scmi_iio_dev, sensor->iio_buf,
- time_ns);
+ iio_push_to_buffers_with_ts(scmi_iio_dev, sensor->iio_buf,
+ sizeof(sensor->iio_buf), time_ns);
return NOTIFY_OK;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 60+ messages in thread* [PATCH 21/39] iio: adc: ad7766: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp() Jonathan Cameron
` (19 preceding siblings ...)
2026-10-26 23:05 ` [PATCH 20/39] iio: common: scmi_sensors: " Jonathan Cameron
@ 2026-10-26 23:05 ` Jonathan Cameron
2026-10-26 23:05 ` [PATCH 22/39] iio: imu: smi240: " Jonathan Cameron
` (18 subsequent siblings)
39 siblings, 0 replies; 60+ messages in thread
From: Jonathan Cameron @ 2026-10-26 23:05 UTC (permalink / raw)
To: linux-iio
Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Sebastian Andrzej Siewior
Replace the deprecated iio_push_to_buffers_with_timestamp() with
iio_push_to_buffers_with_ts().
Replace the data buffer with one declared via
IIO_DECLARE_DMA_BUFFER_WITH_TS().
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
drivers/iio/adc/ad7766.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/drivers/iio/adc/ad7766.c b/drivers/iio/adc/ad7766.c
index 92957196de59..2afb466cf911 100644
--- a/drivers/iio/adc/ad7766.c
+++ b/drivers/iio/adc/ad7766.c
@@ -44,13 +44,7 @@ struct ad7766 {
struct spi_transfer xfer;
struct spi_message msg;
- /*
- * DMA (thus cache coherency maintenance) may require the
- * transfer buffers to live in their own cache lines.
- * Make the buffer large enough for one 24 bit sample and one 64 bit
- * aligned 64 bit timestamp.
- */
- unsigned char data[ALIGN(3, sizeof(s64)) + sizeof(s64)] __aligned(IIO_DMA_MINALIGN);
+ IIO_DECLARE_DMA_BUFFER_WITH_TS(s32, data, 1);
};
/*
@@ -74,8 +68,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);
@@ -269,7 +263,7 @@ static int ad7766_probe(struct spi_device *spi)
ad7766->spi = spi;
/* First byte always 0 */
- ad7766->xfer.rx_buf = &ad7766->data[1];
+ ad7766->xfer.rx_buf = (u8 *)ad7766->data + 1;
ad7766->xfer.len = 3;
spi_message_init(&ad7766->msg);
--
2.43.0
^ permalink raw reply related [flat|nested] 60+ messages in thread* [PATCH 22/39] iio: imu: smi240: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp() Jonathan Cameron
` (20 preceding siblings ...)
2026-10-26 23:05 ` [PATCH 21/39] iio: adc: ad7766: " Jonathan Cameron
@ 2026-10-26 23:05 ` Jonathan Cameron
2026-10-26 23:05 ` [PATCH 23/39] iio: adc: cc10001_adc: " Jonathan Cameron
` (17 subsequent siblings)
39 siblings, 0 replies; 60+ messages in thread
From: Jonathan Cameron @ 2026-10-26 23:05 UTC (permalink / raw)
To: linux-iio
Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Shen Jianping
Replace the deprecated iio_push_to_buffers_with_timestamp() with
iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
Move the buffer onto the stack, local to smi240_trigger_handler(), and
declare it via IIO_DECLARE_BUFFER_WITH_TS().
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
Cc: Shen Jianping <Jianping.Shen@de.bosch.com>
---
drivers/iio/imu/smi240.c | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/drivers/iio/imu/smi240.c b/drivers/iio/imu/smi240.c
index f419296bba88..a9d9600be30c 100644
--- a/drivers/iio/imu/smi240.c
+++ b/drivers/iio/imu/smi240.c
@@ -111,14 +111,6 @@ struct smi240_data {
u16 anglvel_filter_freq;
u8 built_in_self_test_count;
enum capture_mode capture;
- /*
- * Ensure natural alignment for timestamp if present.
- * Channel size: 2 bytes.
- * Max length needed: 2 * 3 channels + temp channel + 2 bytes padding + 8 byte ts.
- * If fewer channels are enabled, less space may be needed, as
- * long as the timestamp is still aligned to 8 bytes.
- */
- s16 buf[12] __aligned(8);
__be32 spi_buf __aligned(IIO_DMA_MINALIGN);
};
@@ -370,6 +362,7 @@ static irqreturn_t smi240_trigger_handler(int irq, void *p)
struct iio_poll_func *pf = p;
struct iio_dev *indio_dev = pf->indio_dev;
struct smi240_data *data = iio_priv(indio_dev);
+ IIO_DECLARE_BUFFER_WITH_TS(s16, buf, SMI240_SCAN_GYRO_Z + 1) = { };
int base = SMI240_DATA_CAP_FIRST_REG, i = 0;
int ret, chan, sample;
@@ -380,10 +373,10 @@ static irqreturn_t smi240_trigger_handler(int irq, void *p)
data->capture = SMI240_CAPTURE_OFF;
if (ret)
goto out;
- data->buf[i++] = sample;
+ buf[i++] = sample;
}
- iio_push_to_buffers_with_timestamp(indio_dev, data->buf, pf->timestamp);
+ iio_push_to_buffers_with_ts(indio_dev, buf, sizeof(buf), pf->timestamp);
out:
iio_trigger_notify_done(indio_dev->trig);
--
2.43.0
^ permalink raw reply related [flat|nested] 60+ messages in thread* [PATCH 23/39] iio: adc: cc10001_adc: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp() Jonathan Cameron
` (21 preceding siblings ...)
2026-10-26 23:05 ` [PATCH 22/39] iio: imu: smi240: " Jonathan Cameron
@ 2026-10-26 23:05 ` Jonathan Cameron
2026-10-27 8:32 ` Andy Shevchenko
2026-10-26 23:05 ` [PATCH 24/39] iio: adc: hx711: " Jonathan Cameron
` (16 subsequent siblings)
39 siblings, 1 reply; 60+ messages in thread
From: Jonathan Cameron @ 2026-10-26 23:05 UTC (permalink / raw)
To: linux-iio; +Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko
Replace the deprecated iio_push_to_buffers_with_timestamp() with
iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
Move the buffer onto the stack, local to cc10001_adc_trigger_h(), and
declare it via IIO_DECLARE_BUFFER_WITH_TS(), removing the now unneeded
update_scan_mode() callback.
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
drivers/iio/adc/cc10001_adc.c | 22 +++-------------------
1 file changed, 3 insertions(+), 19 deletions(-)
diff --git a/drivers/iio/adc/cc10001_adc.c b/drivers/iio/adc/cc10001_adc.c
index d42b747325aa..c7ea718305a2 100644
--- a/drivers/iio/adc/cc10001_adc.c
+++ b/drivers/iio/adc/cc10001_adc.c
@@ -55,7 +55,6 @@ struct cc10001_adc_device {
void __iomem *reg_base;
struct clk *adc_clk;
struct regulator *reg;
- u16 *buf;
bool shared;
struct mutex lock;
@@ -140,12 +139,11 @@ static irqreturn_t cc10001_adc_trigger_h(int irq, void *p)
unsigned int channel;
unsigned int scan_idx;
bool sample_invalid;
- u16 *data;
+ IIO_DECLARE_BUFFER_WITH_TS(u16, data, CC10001_ADC_NUM_CHANNELS) = { };
int i;
indio_dev = pf->indio_dev;
adc_dev = iio_priv(indio_dev);
- data = adc_dev->buf;
mutex_lock(&adc_dev->lock);
@@ -178,8 +176,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_get_time_ns(indio_dev));
+ iio_push_to_buffers_with_ts(indio_dev, data, sizeof(data),
+ iio_get_time_ns(indio_dev));
iio_trigger_notify_done(indio_dev->trig);
return IRQ_HANDLED;
@@ -241,22 +239,8 @@ static int cc10001_adc_read_raw(struct iio_dev *indio_dev,
}
}
-static int cc10001_update_scan_mode(struct iio_dev *indio_dev,
- const unsigned long *scan_mask)
-{
- struct cc10001_adc_device *adc_dev = iio_priv(indio_dev);
-
- kfree(adc_dev->buf);
- adc_dev->buf = kmalloc(indio_dev->scan_bytes, GFP_KERNEL);
- if (!adc_dev->buf)
- return -ENOMEM;
-
- return 0;
-}
-
static const struct iio_info cc10001_adc_info = {
.read_raw = &cc10001_adc_read_raw,
- .update_scan_mode = &cc10001_update_scan_mode,
};
static int cc10001_adc_channel_init(struct iio_dev *indio_dev,
--
2.43.0
^ permalink raw reply related [flat|nested] 60+ messages in thread* Re: [PATCH 23/39] iio: adc: cc10001_adc: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 ` [PATCH 23/39] iio: adc: cc10001_adc: " Jonathan Cameron
@ 2026-10-27 8:32 ` Andy Shevchenko
0 siblings, 0 replies; 60+ messages in thread
From: Andy Shevchenko @ 2026-10-27 8:32 UTC (permalink / raw)
To: Jonathan Cameron; +Cc: linux-iio, David Lechner, Nuno Sá, Andy Shevchenko
On Mon, Oct 26, 2026 at 04:05:41PM -0700, Jonathan Cameron wrote:
> Replace the deprecated iio_push_to_buffers_with_timestamp() with
> iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
>
> Move the buffer onto the stack, local to cc10001_adc_trigger_h(), and
> declare it via IIO_DECLARE_BUFFER_WITH_TS(), removing the now unneeded
> update_scan_mode() callback.
...
> static irqreturn_t cc10001_adc_trigger_h(int irq, void *p)
> unsigned int channel;
> unsigned int scan_idx;
> bool sample_invalid;
> - u16 *data;
> + IIO_DECLARE_BUFFER_WITH_TS(u16, data, CC10001_ADC_NUM_CHANNELS) = { };
Move it up?
> int i;
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 60+ messages in thread
* [PATCH 24/39] iio: adc: hx711: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp() Jonathan Cameron
` (22 preceding siblings ...)
2026-10-26 23:05 ` [PATCH 23/39] iio: adc: cc10001_adc: " Jonathan Cameron
@ 2026-10-26 23:05 ` Jonathan Cameron
2026-10-27 8:33 ` Andy Shevchenko
2026-10-26 23:05 ` [PATCH 25/39] iio: potentiostat: lmp91000: use iio_push_to_buffers_with_ts() with a scan struct on stack Jonathan Cameron
` (15 subsequent siblings)
39 siblings, 1 reply; 60+ messages in thread
From: Jonathan Cameron @ 2026-10-26 23:05 UTC (permalink / raw)
To: linux-iio
Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Piyush Patle
Replace the deprecated iio_push_to_buffers_with_timestamp() with
iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
Move the buffer onto the stack, local to hx711_trigger().
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
Cc: Piyush Patle <piyushpatle228@gmail.com>
---
drivers/iio/adc/hx711.c | 21 +++++++--------------
1 file changed, 7 insertions(+), 14 deletions(-)
diff --git a/drivers/iio/adc/hx711.c b/drivers/iio/adc/hx711.c
index 00adafa7cbd7..7eb089215f1e 100644
--- a/drivers/iio/adc/hx711.c
+++ b/drivers/iio/adc/hx711.c
@@ -100,14 +100,6 @@ struct hx711_data {
int gain_scale[HX711_GAIN_MAX];
const struct hx711_chip_info *chip_info;
struct mutex lock;
- /*
- * triggered buffer
- * 2x32-bit channel + 64-bit naturally aligned timestamp
- */
- struct {
- u32 channel[2];
- aligned_s64 timestamp;
- } buffer;
/*
* delay after a rising edge on SCK until the data is ready DOUT
* this is dependent on the hx711 where the datasheet tells a
@@ -397,20 +389,21 @@ static irqreturn_t hx711_trigger(int irq, void *p)
struct iio_poll_func *pf = p;
struct iio_dev *indio_dev = pf->indio_dev;
struct hx711_data *hx711_data = iio_priv(indio_dev);
+ struct {
+ u32 channel[2];
+ aligned_s64 timestamp;
+ } scan = { };
int i, j = 0;
mutex_lock(&hx711_data->lock);
- memset(&hx711_data->buffer, 0, sizeof(hx711_data->buffer));
-
iio_for_each_active_channel(indio_dev, i) {
- hx711_data->buffer.channel[j] =
- hx711_reset_read(hx711_data, &indio_dev->channels[i]);
+ scan.channel[j] = hx711_reset_read(hx711_data, &indio_dev->channels[i]);
j++;
}
- iio_push_to_buffers_with_timestamp(indio_dev, &hx711_data->buffer,
- pf->timestamp);
+ iio_push_to_buffers_with_ts(indio_dev, &scan, sizeof(scan),
+ pf->timestamp);
mutex_unlock(&hx711_data->lock);
--
2.43.0
^ permalink raw reply related [flat|nested] 60+ messages in thread* Re: [PATCH 24/39] iio: adc: hx711: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 ` [PATCH 24/39] iio: adc: hx711: " Jonathan Cameron
@ 2026-10-27 8:33 ` Andy Shevchenko
0 siblings, 0 replies; 60+ messages in thread
From: Andy Shevchenko @ 2026-10-27 8:33 UTC (permalink / raw)
To: Jonathan Cameron
Cc: linux-iio, David Lechner, Nuno Sá, Andy Shevchenko,
Piyush Patle
On Mon, Oct 26, 2026 at 04:05:42PM -0700, Jonathan Cameron wrote:
> Replace the deprecated iio_push_to_buffers_with_timestamp() with
> iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
>
> Move the buffer onto the stack, local to hx711_trigger().
...
> - iio_push_to_buffers_with_timestamp(indio_dev, &hx711_data->buffer,
> - pf->timestamp);
> + iio_push_to_buffers_with_ts(indio_dev, &scan, sizeof(scan),
> + pf->timestamp);
One line?
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 60+ messages in thread
* [PATCH 25/39] iio: potentiostat: lmp91000: use iio_push_to_buffers_with_ts() with a scan struct on stack
2026-10-26 23:05 [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp() Jonathan Cameron
` (23 preceding siblings ...)
2026-10-26 23:05 ` [PATCH 24/39] iio: adc: hx711: " Jonathan Cameron
@ 2026-10-26 23:05 ` Jonathan Cameron
2026-10-26 23:05 ` [PATCH 26/39] iio: humidity: am2315: " Jonathan Cameron
` (14 subsequent siblings)
39 siblings, 0 replies; 60+ messages in thread
From: Jonathan Cameron @ 2026-10-26 23:05 UTC (permalink / raw)
To: linux-iio; +Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko
Move the scan buffer out of struct lmp91000_data and make it local to
lmp91000_buffer_handler(), as it has no need to persist between calls.
Replace the deprecated iio_push_to_buffers_with_timestamp() with
iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
drivers/iio/potentiostat/lmp91000.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/drivers/iio/potentiostat/lmp91000.c b/drivers/iio/potentiostat/lmp91000.c
index 00cb3fea97ca..53f181cbc0b8 100644
--- a/drivers/iio/potentiostat/lmp91000.c
+++ b/drivers/iio/potentiostat/lmp91000.c
@@ -70,8 +70,7 @@ struct lmp91000_data {
struct completion completion;
u8 chan_select;
- /* 64-bit data + 64-bit naturally aligned timestamp */
- u32 buffer[4] __aligned(8);
+ u32 buffer[2];
};
static const struct iio_chan_spec lmp91000_channels[] = {
@@ -135,15 +134,17 @@ static irqreturn_t lmp91000_buffer_handler(int irq, void *private)
struct iio_poll_func *pf = private;
struct iio_dev *indio_dev = pf->indio_dev;
struct lmp91000_data *data = iio_priv(indio_dev);
+ struct {
+ s32 chan;
+ aligned_s64 ts;
+ } scan = { };
int ret, val;
- memset(data->buffer, 0, sizeof(data->buffer));
-
ret = lmp91000_read(data, LMP91000_REG_MODECN_3LEAD, &val);
if (!ret) {
- data->buffer[0] = val;
- iio_push_to_buffers_with_timestamp(indio_dev, data->buffer,
- iio_get_time_ns(indio_dev));
+ scan.chan = val;
+ iio_push_to_buffers_with_ts(indio_dev, &scan, sizeof(scan),
+ iio_get_time_ns(indio_dev));
}
iio_trigger_notify_done(indio_dev->trig);
--
2.43.0
^ permalink raw reply related [flat|nested] 60+ messages in thread* [PATCH 26/39] iio: humidity: am2315: use iio_push_to_buffers_with_ts() with a scan struct on stack
2026-10-26 23:05 [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp() Jonathan Cameron
` (24 preceding siblings ...)
2026-10-26 23:05 ` [PATCH 25/39] iio: potentiostat: lmp91000: use iio_push_to_buffers_with_ts() with a scan struct on stack Jonathan Cameron
@ 2026-10-26 23:05 ` Jonathan Cameron
2026-10-27 9:59 ` Andy Shevchenko
2026-10-27 16:13 ` Nicolás Antinori
2026-10-26 23:05 ` [PATCH 27/39] iio: humidity: hdc100x: " Jonathan Cameron
` (13 subsequent siblings)
39 siblings, 2 replies; 60+ messages in thread
From: Jonathan Cameron @ 2026-10-26 23:05 UTC (permalink / raw)
To: linux-iio
Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Nicolás Antinori
Move the scan buffer out of struct am2315_data and make it local to
am2315_trigger_handler(), as it has no need to persist between calls.
This also removes the need to hold data->lock while filling it in.
Replace the deprecated iio_push_to_buffers_with_timestamp() with
iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
Cc: Nicolás Antinori <nico.antinori.7@gmail.com>
---
drivers/iio/humidity/am2315.c | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/drivers/iio/humidity/am2315.c b/drivers/iio/humidity/am2315.c
index 5c7582f3a4f9..1182b084fa84 100644
--- a/drivers/iio/humidity/am2315.c
+++ b/drivers/iio/humidity/am2315.c
@@ -42,11 +42,6 @@ static const struct am2315_chip_info am2320_chip_info = {
struct am2315_data {
struct i2c_client *client;
struct mutex lock;
- /* Ensure timestamp is naturally aligned */
- struct {
- s16 chans[2];
- aligned_s64 timestamp;
- } scan;
};
struct am2315_sensor_data {
@@ -173,27 +168,29 @@ static irqreturn_t am2315_trigger_handler(int irq, void *p)
struct iio_dev *indio_dev = pf->indio_dev;
struct am2315_data *data = iio_priv(indio_dev);
struct am2315_sensor_data sensor_data;
+ struct {
+ s16 chans[2];
+ aligned_s64 timestamp;
+ } scan = { };
ret = am2315_read_data(data, &sensor_data);
if (ret < 0)
goto err;
- mutex_lock(&data->lock);
if (*(indio_dev->active_scan_mask) == AM2315_ALL_CHANNEL_MASK) {
- data->scan.chans[0] = sensor_data.hum_data;
- data->scan.chans[1] = sensor_data.temp_data;
+ scan.chans[0] = sensor_data.hum_data;
+ scan.chans[1] = sensor_data.temp_data;
} else {
i = 0;
iio_for_each_active_channel(indio_dev, bit) {
- data->scan.chans[i] = (bit ? sensor_data.temp_data :
- sensor_data.hum_data);
+ scan.chans[i] = (bit ? sensor_data.temp_data :
+ sensor_data.hum_data);
i++;
}
}
- mutex_unlock(&data->lock);
- iio_push_to_buffers_with_timestamp(indio_dev, &data->scan,
- pf->timestamp);
+ iio_push_to_buffers_with_ts(indio_dev, &scan, sizeof(scan),
+ pf->timestamp);
err:
iio_trigger_notify_done(indio_dev->trig);
return IRQ_HANDLED;
--
2.43.0
^ permalink raw reply related [flat|nested] 60+ messages in thread* Re: [PATCH 26/39] iio: humidity: am2315: use iio_push_to_buffers_with_ts() with a scan struct on stack
2026-10-26 23:05 ` [PATCH 26/39] iio: humidity: am2315: " Jonathan Cameron
@ 2026-10-27 9:59 ` Andy Shevchenko
2026-10-27 16:13 ` Nicolás Antinori
1 sibling, 0 replies; 60+ messages in thread
From: Andy Shevchenko @ 2026-10-27 9:59 UTC (permalink / raw)
To: Jonathan Cameron
Cc: linux-iio, David Lechner, Nuno Sá, Andy Shevchenko,
Nicolás Antinori
On Mon, Oct 26, 2026 at 04:05:44PM -0700, Jonathan Cameron wrote:
> Move the scan buffer out of struct am2315_data and make it local to
> am2315_trigger_handler(), as it has no need to persist between calls.
> This also removes the need to hold data->lock while filling it in.
>
> Replace the deprecated iio_push_to_buffers_with_timestamp() with
> iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
...
> i = 0;
> iio_for_each_active_channel(indio_dev, bit) {
> - data->scan.chans[i] = (bit ? sensor_data.temp_data :
> - sensor_data.hum_data);
> + scan.chans[i] = (bit ? sensor_data.temp_data :
> + sensor_data.hum_data);
You can drop redundant parentheses.
> i++;
> }
...
> - iio_push_to_buffers_with_timestamp(indio_dev, &data->scan,
> - pf->timestamp);
> + iio_push_to_buffers_with_ts(indio_dev, &scan, sizeof(scan),
> + pf->timestamp);
One line?
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 60+ messages in thread* Re: [PATCH 26/39] iio: humidity: am2315: use iio_push_to_buffers_with_ts() with a scan struct on stack
2026-10-26 23:05 ` [PATCH 26/39] iio: humidity: am2315: " Jonathan Cameron
2026-10-27 9:59 ` Andy Shevchenko
@ 2026-10-27 16:13 ` Nicolás Antinori
1 sibling, 0 replies; 60+ messages in thread
From: Nicolás Antinori @ 2026-10-27 16:13 UTC (permalink / raw)
To: Jonathan Cameron, linux-iio; +Cc: David Lechner, Nuno Sá, Andy Shevchenko
On Mon Oct 26, 2026 at 8:05 PM -03, Jonathan Cameron wrote:
> Move the scan buffer out of struct am2315_data and make it local to
> am2315_trigger_handler(), as it has no need to persist between calls.
> This also removes the need to hold data->lock while filling it in.
>
> Replace the deprecated iio_push_to_buffers_with_timestamp() with
> iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
>
> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Hi! I tested this on an AM2320 sensor in a Raspberry Pi 3b+.
Kernel version:
Linux version 7.3.0-rc1-v8+
Debian clang version 19.1.7 (3+b1), Debian LLD 19.1.7
Everything looks good (no warning or errors). This is the first time I
test a patch, I'll add the Tested-by tag, but please tell me if I am
doing something wrong.
Tested-by: Nicolás Antinori <nico.antinori.7@gmail.com>
^ permalink raw reply [flat|nested] 60+ messages in thread
* [PATCH 27/39] iio: humidity: hdc100x: use iio_push_to_buffers_with_ts() with a scan struct on stack
2026-10-26 23:05 [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp() Jonathan Cameron
` (25 preceding siblings ...)
2026-10-26 23:05 ` [PATCH 26/39] iio: humidity: am2315: " Jonathan Cameron
@ 2026-10-26 23:05 ` Jonathan Cameron
2026-10-26 23:05 ` [PATCH 28/39] iio: imu: bmi323: use iio_push_to_buffers_with_ts() Jonathan Cameron
` (12 subsequent siblings)
39 siblings, 0 replies; 60+ messages in thread
From: Jonathan Cameron @ 2026-10-26 23:05 UTC (permalink / raw)
To: linux-iio; +Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko
Move the scan buffer out of struct hdc100x_data and make it local to
hdc100x_trigger_handler(), as it has no need to persist between calls.
i2c_master_recv() does not require a DMA safe buffer, so this is fine
on the stack.
Replace the deprecated iio_push_to_buffers_with_timestamp() with
iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
drivers/iio/humidity/hdc100x.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/drivers/iio/humidity/hdc100x.c b/drivers/iio/humidity/hdc100x.c
index 9f07101d37f7..e045d340e18d 100644
--- a/drivers/iio/humidity/hdc100x.c
+++ b/drivers/iio/humidity/hdc100x.c
@@ -41,11 +41,6 @@ struct hdc100x_data {
/* integration time of the sensor */
int adc_int_us[2];
- /* Ensure natural alignment of timestamp */
- struct {
- __be16 channels[2];
- aligned_s64 ts;
- } scan;
};
/* integration time in us */
@@ -302,6 +297,10 @@ static irqreturn_t hdc100x_trigger_handler(int irq, void *p)
struct hdc100x_data *data = iio_priv(indio_dev);
struct i2c_client *client = data->client;
int delay = data->adc_int_us[0] + data->adc_int_us[1] + 2*USEC_PER_MSEC;
+ struct {
+ __be16 channels[2];
+ aligned_s64 ts;
+ } scan = { };
int ret;
/* dual read starts at temp register */
@@ -313,14 +312,14 @@ static irqreturn_t hdc100x_trigger_handler(int irq, void *p)
}
usleep_range(delay, delay + 1000);
- ret = i2c_master_recv(client, (u8 *)data->scan.channels, 4);
+ ret = i2c_master_recv(client, (u8 *)scan.channels, 4);
if (ret < 0) {
dev_err(&client->dev, "cannot read sensor data\n");
goto err;
}
- iio_push_to_buffers_with_timestamp(indio_dev, &data->scan,
- iio_get_time_ns(indio_dev));
+ iio_push_to_buffers_with_ts(indio_dev, &scan, sizeof(scan),
+ iio_get_time_ns(indio_dev));
err:
mutex_unlock(&data->lock);
iio_trigger_notify_done(indio_dev->trig);
--
2.43.0
^ permalink raw reply related [flat|nested] 60+ messages in thread* [PATCH 28/39] iio: imu: bmi323: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp() Jonathan Cameron
` (26 preceding siblings ...)
2026-10-26 23:05 ` [PATCH 27/39] iio: humidity: hdc100x: " Jonathan Cameron
@ 2026-10-26 23:05 ` Jonathan Cameron
2026-10-26 23:05 ` [PATCH 29/39] iio: gyro: fxas21002c: restrict available_scan_masks to all angular velocity channels Jonathan Cameron
` (11 subsequent siblings)
39 siblings, 0 replies; 60+ messages in thread
From: Jonathan Cameron @ 2026-10-26 23:05 UTC (permalink / raw)
To: linux-iio; +Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko
Replace the deprecated iio_push_to_buffers_with_timestamp() with
iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
Also replace the two for_each_set_bit() loops over
indio_dev->active_scan_mask with the equivalent
iio_for_each_active_channel() helper and remove local variable
that did not help readability.
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
drivers/iio/imu/bmi323/bmi323_core.c | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/drivers/iio/imu/bmi323/bmi323_core.c b/drivers/iio/imu/bmi323/bmi323_core.c
index ebeb1b10c38c..f1baf7304533 100644
--- a/drivers/iio/imu/bmi323/bmi323_core.c
+++ b/drivers/iio/imu/bmi323/bmi323_core.c
@@ -1069,7 +1069,7 @@ static int __bmi323_fifo_flush(struct iio_dev *indio_dev)
{
struct bmi323_data *data = iio_priv(indio_dev);
int i, ret, fifo_lvl, frame_count, bit, index;
- __le16 *frame, *pchannels;
+ __le16 *frame;
u64 sample_period;
s64 tstamp;
@@ -1108,15 +1108,13 @@ static int __bmi323_fifo_flush(struct iio_dev *indio_dev)
for (i = 0; i < frame_count; i++) {
frame = &data->fifo_buff[i * BMI323_FIFO_FRAME_LENGTH];
- pchannels = &data->buffer.channels[0];
index = 0;
- for_each_set_bit(bit, indio_dev->active_scan_mask,
- BMI323_CHAN_MAX)
- pchannels[index++] = frame[bit];
+ iio_for_each_active_channel(indio_dev, bit)
+ data->buffer.channels[index++] = frame[bit];
- iio_push_to_buffers_with_timestamp(indio_dev, &data->buffer,
- tstamp);
+ iio_push_to_buffers_with_ts(indio_dev, &data->buffer,
+ sizeof(data->buffer), tstamp);
tstamp += sample_period;
}
@@ -1425,8 +1423,7 @@ static irqreturn_t bmi323_trigger_handler(int irq, void *p)
if (ret)
goto out;
} else {
- for_each_set_bit(bit, indio_dev->active_scan_mask,
- BMI323_CHAN_MAX) {
+ iio_for_each_active_channel(indio_dev, bit) {
ret = regmap_raw_read(data->regmap,
BMI323_ACCEL_X_REG + bit,
&data->buffer.channels[index++],
@@ -1436,8 +1433,9 @@ static irqreturn_t bmi323_trigger_handler(int irq, void *p)
}
}
- iio_push_to_buffers_with_timestamp(indio_dev, &data->buffer,
- iio_get_time_ns(indio_dev));
+ iio_push_to_buffers_with_ts(indio_dev, &data->buffer,
+ sizeof(data->buffer),
+ iio_get_time_ns(indio_dev));
out:
iio_trigger_notify_done(indio_dev->trig);
--
2.43.0
^ permalink raw reply related [flat|nested] 60+ messages in thread* [PATCH 29/39] iio: gyro: fxas21002c: restrict available_scan_masks to all angular velocity channels
2026-10-26 23:05 [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp() Jonathan Cameron
` (27 preceding siblings ...)
2026-10-26 23:05 ` [PATCH 28/39] iio: imu: bmi323: use iio_push_to_buffers_with_ts() Jonathan Cameron
@ 2026-10-26 23:05 ` Jonathan Cameron
2026-10-26 23:05 ` [PATCH 30/39] iio: gyro: fxas21002c: use iio_push_to_buffers_with_ts() with explicit structure Jonathan Cameron
` (10 subsequent siblings)
39 siblings, 0 replies; 60+ messages in thread
From: Jonathan Cameron @ 2026-10-26 23:05 UTC (permalink / raw)
To: linux-iio
Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
stable
fxas21002c_trigger_handler() always performs a single bulk read of all
three angular velocity channels, regardless of which channels are
actually enabled in indio_dev->active_scan_mask. Restrict
available_scan_masks to the one valid combination of all three
channels, so the IIO core demux can provide to buffer consumers only
the channels they actually requested.
Fixes: a0701b6263ae ("iio: gyro: add core driver for fxas21002c")
Cc: stable@vger.kernel.org
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
drivers/iio/gyro/fxas21002c_core.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/iio/gyro/fxas21002c_core.c b/drivers/iio/gyro/fxas21002c_core.c
index a88670207cec..6ef3ba2bd1f8 100644
--- a/drivers/iio/gyro/fxas21002c_core.c
+++ b/drivers/iio/gyro/fxas21002c_core.c
@@ -714,6 +714,11 @@ static const struct iio_chan_spec fxas21002c_channels[] = {
FXAS21002C_CHANNEL(Z),
};
+static const unsigned long fxas21002c_scan_masks[] = {
+ BIT(CHANNEL_SCAN_INDEX_X) | BIT(CHANNEL_SCAN_INDEX_Y) | BIT(CHANNEL_SCAN_INDEX_Z),
+ 0
+};
+
static const struct iio_info fxas21002c_info = {
.attrs = &fxas21002c_attrs_group,
.read_raw = &fxas21002c_read_raw,
@@ -969,6 +974,7 @@ int fxas21002c_core_probe(struct device *dev, struct regmap *regmap, int irq,
indio_dev->channels = fxas21002c_channels;
indio_dev->num_channels = ARRAY_SIZE(fxas21002c_channels);
+ indio_dev->available_scan_masks = fxas21002c_scan_masks;
indio_dev->name = name;
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->info = &fxas21002c_info;
--
2.43.0
^ permalink raw reply related [flat|nested] 60+ messages in thread* [PATCH 30/39] iio: gyro: fxas21002c: use iio_push_to_buffers_with_ts() with explicit structure
2026-10-26 23:05 [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp() Jonathan Cameron
` (28 preceding siblings ...)
2026-10-26 23:05 ` [PATCH 29/39] iio: gyro: fxas21002c: restrict available_scan_masks to all angular velocity channels Jonathan Cameron
@ 2026-10-26 23:05 ` Jonathan Cameron
2026-10-26 23:05 ` [PATCH 31/39] iio: adc: ad7887: ensure tx_cmd_buf is DMA safe Jonathan Cameron
` (9 subsequent siblings)
39 siblings, 0 replies; 60+ messages in thread
From: Jonathan Cameron @ 2026-10-26 23:05 UTC (permalink / raw)
To: linux-iio; +Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko
Replace the s16 buffer[8] with a struct containing the 3 channels
followed by an aligned_s64 timestamp, named scan.
Correct the channel array type to __be16 to match the declared
scan_type.
Replace the deprecated iio_push_to_buffers_with_timestamp() with
iio_push_to_buffers_with_ts(), passing the size of the pushed buffer,
which is a structure within the iio_priv() data.
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
drivers/iio/gyro/fxas21002c_core.c | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/drivers/iio/gyro/fxas21002c_core.c b/drivers/iio/gyro/fxas21002c_core.c
index 6ef3ba2bd1f8..82379cd55b3f 100644
--- a/drivers/iio/gyro/fxas21002c_core.c
+++ b/drivers/iio/gyro/fxas21002c_core.c
@@ -134,6 +134,13 @@ static const int fxas21002c_range_values[] = {
4000, 2000, 1000, 500, 250
};
+enum fxas21002c_channel_index {
+ CHANNEL_SCAN_INDEX_X,
+ CHANNEL_SCAN_INDEX_Y,
+ CHANNEL_SCAN_INDEX_Z,
+ CHANNEL_SCAN_MAX
+};
+
struct fxas21002c_data {
u8 chip_id;
enum fxas21002c_mode_state mode;
@@ -153,14 +160,10 @@ struct fxas21002c_data {
* DMA (thus cache coherency maintenance) may require the
* transfer buffers live in their own cache lines.
*/
- s16 buffer[8] __aligned(IIO_DMA_MINALIGN);
-};
-
-enum fxas21002c_channel_index {
- CHANNEL_SCAN_INDEX_X,
- CHANNEL_SCAN_INDEX_Y,
- CHANNEL_SCAN_INDEX_Z,
- CHANNEL_SCAN_MAX,
+ struct {
+ __be16 chans[CHANNEL_SCAN_MAX];
+ aligned_s64 ts;
+ } scan __aligned(IIO_DMA_MINALIGN);
};
static int fxas21002c_odr_hz_from_value(struct fxas21002c_data *data, u8 value)
@@ -738,12 +741,12 @@ static irqreturn_t fxas21002c_trigger_handler(int irq, void *p)
goto out_unlock;
ret = regmap_bulk_read(data->regmap, FXAS21002C_REG_OUT_X_MSB,
- data->buffer, CHANNEL_SCAN_MAX * sizeof(s16));
+ data->scan.chans, sizeof(data->scan.chans));
if (ret < 0)
goto out_pm_put;
- iio_push_to_buffers_with_timestamp(indio_dev, data->buffer,
- data->timestamp);
+ iio_push_to_buffers_with_ts(indio_dev, &data->scan,
+ sizeof(data->scan), data->timestamp);
out_pm_put:
fxas21002c_pm_put(data);
--
2.43.0
^ permalink raw reply related [flat|nested] 60+ messages in thread* [PATCH 31/39] iio: adc: ad7887: ensure tx_cmd_buf is DMA safe
2026-10-26 23:05 [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp() Jonathan Cameron
` (29 preceding siblings ...)
2026-10-26 23:05 ` [PATCH 30/39] iio: gyro: fxas21002c: use iio_push_to_buffers_with_ts() with explicit structure Jonathan Cameron
@ 2026-10-26 23:05 ` Jonathan Cameron
2026-10-26 23:05 ` [PATCH 32/39] iio: adc: ad7887: use iio_push_to_buffers_with_ts() Jonathan Cameron
` (8 subsequent siblings)
39 siblings, 0 replies; 60+ messages in thread
From: Jonathan Cameron @ 2026-10-26 23:05 UTC (permalink / raw)
To: linux-iio; +Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko
SPI transfers require DMA safe buffers. Mark tx_cmd_buf with
__aligned(IIO_DMA_MINALIGN) to ensure it does not share a cache line
with other data.
tx_cmd_buf could share a cacheline with data, but the next patch will
obscure that a little so separate marking used for readability
purposes.
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
drivers/iio/adc/ad7887.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/adc/ad7887.c b/drivers/iio/adc/ad7887.c
index 62aaedbce748..b1d9da19e7a2 100644
--- a/drivers/iio/adc/ad7887.c
+++ b/drivers/iio/adc/ad7887.c
@@ -63,7 +63,7 @@ struct ad7887_state {
struct spi_transfer xfer[4];
struct spi_message msg[3];
struct spi_message *ring_msg;
- unsigned char tx_cmd_buf[4];
+ unsigned char tx_cmd_buf[4] __aligned(IIO_DMA_MINALIGN);
/*
* DMA (thus cache coherency maintenance) may require the
--
2.43.0
^ permalink raw reply related [flat|nested] 60+ messages in thread* [PATCH 32/39] iio: adc: ad7887: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp() Jonathan Cameron
` (30 preceding siblings ...)
2026-10-26 23:05 ` [PATCH 31/39] iio: adc: ad7887: ensure tx_cmd_buf is DMA safe Jonathan Cameron
@ 2026-10-26 23:05 ` Jonathan Cameron
2026-10-27 10:24 ` Andy Shevchenko
2026-10-26 23:05 ` [PATCH 33/39] iio: humidity: hts221: align scan buffer for DMA safety Jonathan Cameron
` (7 subsequent siblings)
39 siblings, 1 reply; 60+ messages in thread
From: Jonathan Cameron @ 2026-10-26 23:05 UTC (permalink / raw)
To: linux-iio; +Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko
Replace the deprecated iio_push_to_buffers_with_timestamp() with
iio_push_to_buffers_with_ts(), passing the size of the pushed buffer,
which is a structure within the iio_priv() data.
Replace the data buffer with one declared via
IIO_DECLARE_DMA_BUFFER_WITH_TS(), for 2 __be16 channels.
Use be16_to_cpu() to replace the opencoded equivalent.
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
Note that the LLM I ran over this patch is unhappy with the data
placement in the pdata path in here.
I have little idea how this is supposed to work and obviously don't
really care about pdata. Would be good if someone who has a device
could take a look at this and clean it up in general.
Otherwise I might just rip out the pdata path in the near future.
This patch being an example of how it is causing maintenance burden.
---
drivers/iio/adc/ad7887.c | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/drivers/iio/adc/ad7887.c b/drivers/iio/adc/ad7887.c
index b1d9da19e7a2..dd1464add06a 100644
--- a/drivers/iio/adc/ad7887.c
+++ b/drivers/iio/adc/ad7887.c
@@ -65,13 +65,7 @@ struct ad7887_state {
struct spi_message *ring_msg;
unsigned char tx_cmd_buf[4] __aligned(IIO_DMA_MINALIGN);
- /*
- * DMA (thus cache coherency maintenance) may require the
- * transfer buffers to live in their own cache lines.
- * Buffer needs to be large enough to hold two 16 bit samples and a
- * 64 bit aligned 64 bit timestamp.
- */
- unsigned char data[ALIGN(4, sizeof(s64)) + sizeof(s64)] __aligned(IIO_DMA_MINALIGN);
+ IIO_DECLARE_DMA_BUFFER_WITH_TS(__be16, data, 2);
};
enum ad7887_supported_device_ids {
@@ -119,8 +113,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);
@@ -138,7 +132,7 @@ static int ad7887_scan_direct(struct ad7887_state *st, unsigned ch)
if (ret)
return ret;
- return (st->data[(ch * 2)] << 8) | st->data[(ch * 2) + 1];
+ return be16_to_cpu(st->data[ch]);
}
static int ad7887_read_raw(struct iio_dev *indio_dev,
@@ -296,7 +290,7 @@ static int ad7887_probe(struct spi_device *spi)
st->xfer[1].tx_buf = &st->tx_cmd_buf[2];
st->xfer[1].len = 2;
- st->xfer[2].rx_buf = &st->data[2];
+ st->xfer[2].rx_buf = &st->data[1];
st->xfer[2].tx_buf = &st->tx_cmd_buf[0];
st->xfer[2].len = 2;
@@ -304,7 +298,7 @@ static int ad7887_probe(struct spi_device *spi)
spi_message_add_tail(&st->xfer[1], &st->msg[AD7887_CH0_CH1]);
spi_message_add_tail(&st->xfer[2], &st->msg[AD7887_CH0_CH1]);
- st->xfer[3].rx_buf = &st->data[2];
+ st->xfer[3].rx_buf = &st->data[1];
st->xfer[3].tx_buf = &st->tx_cmd_buf[2];
st->xfer[3].len = 2;
--
2.43.0
^ permalink raw reply related [flat|nested] 60+ messages in thread* Re: [PATCH 32/39] iio: adc: ad7887: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 ` [PATCH 32/39] iio: adc: ad7887: use iio_push_to_buffers_with_ts() Jonathan Cameron
@ 2026-10-27 10:24 ` Andy Shevchenko
2026-10-27 11:46 ` Joshua Crofts
0 siblings, 1 reply; 60+ messages in thread
From: Andy Shevchenko @ 2026-10-27 10:24 UTC (permalink / raw)
To: Jonathan Cameron; +Cc: linux-iio, David Lechner, Nuno Sá, Andy Shevchenko
On Mon, Oct 26, 2026 at 04:05:50PM -0700, Jonathan Cameron wrote:
> Replace the deprecated iio_push_to_buffers_with_timestamp() with
> iio_push_to_buffers_with_ts(), passing the size of the pushed buffer,
> which is a structure within the iio_priv() data.
>
> Replace the data buffer with one declared via
> IIO_DECLARE_DMA_BUFFER_WITH_TS(), for 2 __be16 channels.
>
> Use be16_to_cpu() to replace the opencoded equivalent.
...
> Otherwise I might just rip out the pdata path in the near future.
> This patch being an example of how it is causing maintenance burden.
I don't see users in the kernel, I think we may just drop it for good.
If anybody wants that, they can use software nodes in the future, no
revert will even be considered.
...
> - return (st->data[(ch * 2)] << 8) | st->data[(ch * 2) + 1];
> + return be16_to_cpu(st->data[ch]);
Add asm/byteorder.h into include block. And yes, the include block is a mess
in this driver.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH 32/39] iio: adc: ad7887: use iio_push_to_buffers_with_ts()
2026-10-27 10:24 ` Andy Shevchenko
@ 2026-10-27 11:46 ` Joshua Crofts
0 siblings, 0 replies; 60+ messages in thread
From: Joshua Crofts @ 2026-10-27 11:46 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Jonathan Cameron, linux-iio, David Lechner, Nuno Sá,
Andy Shevchenko
On Tue, 27 Oct 2026 12:24:14 +0200
Andy Shevchenko <andriy.shevchenko@intel.com> wrote:
> On Mon, Oct 26, 2026 at 04:05:50PM -0700, Jonathan Cameron wrote:
> > Replace the deprecated iio_push_to_buffers_with_timestamp() with
> > iio_push_to_buffers_with_ts(), passing the size of the pushed buffer,
> > which is a structure within the iio_priv() data.
> >
> > Replace the data buffer with one declared via
> > IIO_DECLARE_DMA_BUFFER_WITH_TS(), for 2 __be16 channels.
> >
> > Use be16_to_cpu() to replace the opencoded equivalent.
>
> ...
>
> > Otherwise I might just rip out the pdata path in the near future.
> > This patch being an example of how it is causing maintenance burden.
>
> I don't see users in the kernel, I think we may just drop it for good.
> If anybody wants that, they can use software nodes in the future, no
> revert will even be considered.
>
> ...
>
> > - return (st->data[(ch * 2)] << 8) | st->data[(ch * 2) + 1];
> > + return be16_to_cpu(st->data[ch]);
>
> Add asm/byteorder.h into include block. And yes, the include block is a mess
> in this driver.
>
I will probably do a series removing kernel.h from a subset of drivers
in IIO again (it's really painful though).
--
Kind regards,
Joshua Crofts
^ permalink raw reply [flat|nested] 60+ messages in thread
* [PATCH 33/39] iio: humidity: hts221: align scan buffer for DMA safety
2026-10-26 23:05 [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp() Jonathan Cameron
` (31 preceding siblings ...)
2026-10-26 23:05 ` [PATCH 32/39] iio: adc: ad7887: use iio_push_to_buffers_with_ts() Jonathan Cameron
@ 2026-10-26 23:05 ` Jonathan Cameron
2026-10-26 23:05 ` [PATCH 34/39] iio: humidity: hts221: use iio_push_to_buffers_with_ts() Jonathan Cameron
` (6 subsequent siblings)
39 siblings, 0 replies; 60+ messages in thread
From: Jonathan Cameron @ 2026-10-26 23:05 UTC (permalink / raw)
To: linux-iio
Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Adi Nata
hw->scan is used as the SPI transfer buffer in
hts221_buffer_handler_thread() via regmap_bulk_read(), so it needs to
be DMA safe. Add __aligned(IIO_DMA_MINALIGN).
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
Cc: Adi Nata <adinata.softwareengineer@gmail.com>
---
drivers/iio/humidity/hts221.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/humidity/hts221.h b/drivers/iio/humidity/hts221.h
index 0215f11fc35e..59ed07c308d0 100644
--- a/drivers/iio/humidity/hts221.h
+++ b/drivers/iio/humidity/hts221.h
@@ -41,7 +41,7 @@ struct hts221_hw {
struct {
__le16 channels[2];
aligned_s64 ts;
- } scan;
+ } scan __aligned(IIO_DMA_MINALIGN);
};
extern const struct dev_pm_ops hts221_pm_ops;
--
2.43.0
^ permalink raw reply related [flat|nested] 60+ messages in thread* [PATCH 34/39] iio: humidity: hts221: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp() Jonathan Cameron
` (32 preceding siblings ...)
2026-10-26 23:05 ` [PATCH 33/39] iio: humidity: hts221: align scan buffer for DMA safety Jonathan Cameron
@ 2026-10-26 23:05 ` Jonathan Cameron
2026-10-26 23:05 ` [PATCH 35/39] iio: accel: bmc150-accel-core: " Jonathan Cameron
` (5 subsequent siblings)
39 siblings, 0 replies; 60+ messages in thread
From: Jonathan Cameron @ 2026-10-26 23:05 UTC (permalink / raw)
To: linux-iio
Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Adi Nata
Replace the deprecated iio_push_to_buffers_with_timestamp() with
iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
Cc: Adi Nata <adinata.softwareengineer@gmail.com>
---
drivers/iio/humidity/hts221_buffer.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/humidity/hts221_buffer.c b/drivers/iio/humidity/hts221_buffer.c
index df12c7a25b2e..25e7eff0436d 100644
--- a/drivers/iio/humidity/hts221_buffer.c
+++ b/drivers/iio/humidity/hts221_buffer.c
@@ -179,8 +179,8 @@ static irqreturn_t hts221_buffer_handler_thread(int irq, void *p)
if (err < 0)
goto out;
- iio_push_to_buffers_with_timestamp(iio_dev, &hw->scan,
- iio_get_time_ns(iio_dev));
+ iio_push_to_buffers_with_ts(iio_dev, &hw->scan, sizeof(hw->scan),
+ iio_get_time_ns(iio_dev));
out:
iio_trigger_notify_done(hw->trig);
--
2.43.0
^ permalink raw reply related [flat|nested] 60+ messages in thread* [PATCH 35/39] iio: accel: bmc150-accel-core: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp() Jonathan Cameron
` (33 preceding siblings ...)
2026-10-26 23:05 ` [PATCH 34/39] iio: humidity: hts221: use iio_push_to_buffers_with_ts() Jonathan Cameron
@ 2026-10-26 23:05 ` Jonathan Cameron
2026-10-27 10:27 ` Andy Shevchenko
2026-10-26 23:05 ` [PATCH 36/39] iio: common: cros_ec_sensors: " Jonathan Cameron
` (4 subsequent siblings)
39 siblings, 1 reply; 60+ messages in thread
From: Jonathan Cameron @ 2026-10-26 23:05 UTC (permalink / raw)
To: linux-iio; +Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko
Replace the deprecated iio_push_to_buffers_with_timestamp() with
iio_push_to_buffers_with_ts(), passing the size of the pushed buffer,
at both call sites.
The triggered buffer handler read into a separate fixed buffer rather
than the scan buffer used for the FIFO path. Use the scan buffer
directly and drop the now unused buffer field. This also corrects the
type of the read destination to __le16 to match the scan buffer's
channels array. Widen the mutex-held region to cover the use of scan.
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
drivers/iio/accel/bmc150-accel-core.c | 12 ++++++------
drivers/iio/accel/bmc150-accel.h | 1 -
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/drivers/iio/accel/bmc150-accel-core.c b/drivers/iio/accel/bmc150-accel-core.c
index 46bb36d9366e..4aa282183604 100644
--- a/drivers/iio/accel/bmc150-accel-core.c
+++ b/drivers/iio/accel/bmc150-accel-core.c
@@ -1013,8 +1013,8 @@ static int __bmc150_accel_fifo_flush(struct iio_dev *indio_dev,
memcpy(&data->scan.channels[j++], &buffer[i * 3 + bit],
sizeof(data->scan.channels[0]));
- iio_push_to_buffers_with_timestamp(indio_dev, &data->scan,
- tstamp);
+ iio_push_to_buffers_with_ts(indio_dev, &data->scan,
+ sizeof(data->scan), tstamp);
tstamp += sample_period;
}
@@ -1193,14 +1193,14 @@ static irqreturn_t bmc150_accel_trigger_handler(int irq, void *p)
mutex_lock(&data->mutex);
ret = regmap_bulk_read(data->regmap, BMC150_ACCEL_REG_XOUT_L,
- data->buffer, AXIS_MAX * 2);
- mutex_unlock(&data->mutex);
+ data->scan.channels, AXIS_MAX * 2);
if (ret < 0)
goto err_read;
- iio_push_to_buffers_with_timestamp(indio_dev, data->buffer,
- pf->timestamp);
+ iio_push_to_buffers_with_ts(indio_dev, &data->scan,
+ sizeof(data->scan), pf->timestamp);
err_read:
+ mutex_unlock(&data->mutex);
iio_trigger_notify_done(indio_dev->trig);
return IRQ_HANDLED;
diff --git a/drivers/iio/accel/bmc150-accel.h b/drivers/iio/accel/bmc150-accel.h
index e8f26198359f..853709c0f46b 100644
--- a/drivers/iio/accel/bmc150-accel.h
+++ b/drivers/iio/accel/bmc150-accel.h
@@ -64,7 +64,6 @@ struct bmc150_accel_data {
struct bmc150_accel_trigger triggers[BMC150_ACCEL_TRIGGERS];
struct mutex mutex;
u8 fifo_mode, watermark;
- s16 buffer[8];
/*
* Ensure there is sufficient space and correct alignment for
* the timestamp if enabled
--
2.43.0
^ permalink raw reply related [flat|nested] 60+ messages in thread* Re: [PATCH 35/39] iio: accel: bmc150-accel-core: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 ` [PATCH 35/39] iio: accel: bmc150-accel-core: " Jonathan Cameron
@ 2026-10-27 10:27 ` Andy Shevchenko
0 siblings, 0 replies; 60+ messages in thread
From: Andy Shevchenko @ 2026-10-27 10:27 UTC (permalink / raw)
To: Jonathan Cameron; +Cc: linux-iio, David Lechner, Nuno Sá, Andy Shevchenko
On Mon, Oct 26, 2026 at 04:05:53PM -0700, Jonathan Cameron wrote:
> Replace the deprecated iio_push_to_buffers_with_timestamp() with
> iio_push_to_buffers_with_ts(), passing the size of the pushed buffer,
> at both call sites.
>
> The triggered buffer handler read into a separate fixed buffer rather
> than the scan buffer used for the FIFO path. Use the scan buffer
> directly and drop the now unused buffer field. This also corrects the
> type of the read destination to __le16 to match the scan buffer's
> channels array. Widen the mutex-held region to cover the use of scan.
...
> u8 fifo_mode, watermark;
> - s16 buffer[8];
I have a weak memory that I have seen a patch that reuses scan buffer instead
of dedicated one, but I'm not sure if it was against this driver (and if so,
why it got not applied).
It might be this one 8c5f649119f4 ("iio: accel: kionix-kx022a: use scan struct
for one-shot and trigger reads").
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 60+ messages in thread
* [PATCH 36/39] iio: common: cros_ec_sensors: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp() Jonathan Cameron
` (34 preceding siblings ...)
2026-10-26 23:05 ` [PATCH 35/39] iio: accel: bmc150-accel-core: " Jonathan Cameron
@ 2026-10-26 23:05 ` Jonathan Cameron
2026-10-27 3:19 ` Tzung-Bi Shih
2026-10-27 10:49 ` Andy Shevchenko
2026-10-26 23:05 ` [PATCH 37/39] iio: common: ssp_sensors: " Jonathan Cameron
` (3 subsequent siblings)
39 siblings, 2 replies; 60+ messages in thread
From: Jonathan Cameron @ 2026-10-26 23:05 UTC (permalink / raw)
To: linux-iio
Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Cheng-Yi Chiang, Tzung-Bi Shih, Guenter Roeck
Replace the deprecated iio_push_to_buffers_with_timestamp() with
iio_push_to_buffers_with_ts(), passing the size of the pushed buffer,
at both call sites.
Replace the raw samples byte array with a scan struct containing the
channel data and an aligned timestamp, matching the layout it was
already manually maintaining and removing the need for the
CROS_EC_SAMPLE_SIZE size calculation and the casts used to access it
as an array of s16.
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
Cc: Cheng-Yi Chiang <cychiang@chromium.org>
Cc: Tzung-Bi Shih <tzungbi@kernel.org>
Cc: Guenter Roeck <groeck@chromium.org>
---
.../common/cros_ec_sensors/cros_ec_sensors_core.c | 24 ++++++++++------------
include/linux/iio/common/cros_ec_sensors_core.h | 18 +++++++---------
2 files changed, 18 insertions(+), 24 deletions(-)
diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
index d03e40c91582..721e79f67f7f 100644
--- a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
+++ b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
@@ -181,9 +181,8 @@ int cros_ec_sensors_push_data(struct iio_dev *indio_dev,
s64 timestamp)
{
struct cros_ec_sensors_core_state *st = iio_priv(indio_dev);
- s16 *out;
+ unsigned int i, j;
s64 delta;
- unsigned int i;
/*
* Ignore samples if the buffer is not set: it is needed if the ODR is
@@ -192,19 +191,17 @@ int cros_ec_sensors_push_data(struct iio_dev *indio_dev,
if (!iio_device_try_claim_buffer_mode(indio_dev))
return 0;
- out = (s16 *)st->samples;
- iio_for_each_active_channel(indio_dev, i) {
- *out = data[i];
- out++;
- }
+ j = 0;
+ iio_for_each_active_channel(indio_dev, i)
+ st->scan.channels[j++] = data[i];
if (iio_device_get_clock(indio_dev) != CLOCK_BOOTTIME)
delta = iio_get_time_ns(indio_dev) - cros_ec_get_time_ns();
else
delta = 0;
- iio_push_to_buffers_with_timestamp(indio_dev, st->samples,
- timestamp + delta);
+ iio_push_to_buffers_with_ts(indio_dev, &st->scan, sizeof(st->scan),
+ timestamp + delta);
iio_device_release_buffer_mode(indio_dev);
return 0;
@@ -718,17 +715,18 @@ irqreturn_t cros_ec_sensors_capture(int irq, void *p)
mutex_lock(&st->cmd_lock);
/* Clear capture data. */
- memset(st->samples, 0, indio_dev->scan_bytes);
+ memset(&st->scan, 0, sizeof(st->scan));
/* Read data based on which channels are enabled in scan mask. */
ret = st->read_ec_sensors_data(indio_dev,
*(indio_dev->active_scan_mask),
- (s16 *)st->samples);
+ st->scan.channels);
if (ret < 0)
goto done;
- iio_push_to_buffers_with_timestamp(indio_dev, st->samples,
- iio_get_time_ns(indio_dev));
+ iio_push_to_buffers_with_ts(indio_dev, &st->scan,
+ sizeof(st->scan),
+ iio_get_time_ns(indio_dev));
done:
/*
diff --git a/include/linux/iio/common/cros_ec_sensors_core.h b/include/linux/iio/common/cros_ec_sensors_core.h
index bb966abcde53..25af3bfbef42 100644
--- a/include/linux/iio/common/cros_ec_sensors_core.h
+++ b/include/linux/iio/common/cros_ec_sensors_core.h
@@ -24,12 +24,6 @@ enum {
/* EC returns sensor values using signed 16 bit registers */
#define CROS_EC_SENSOR_BITS 16
-/*
- * 4 16 bit channels are allowed.
- * Good enough for current sensors, they use up to 3 16 bit vectors.
- */
-#define CROS_EC_SAMPLE_SIZE (sizeof(s64) * 2)
-
typedef irqreturn_t (*cros_ec_sensors_capture_t)(int irq, void *p);
/**
@@ -48,10 +42,9 @@ typedef irqreturn_t (*cros_ec_sensors_capture_t)(int irq, void *p);
* @calib: calibration parameters. Note that trigger
* captured data will always provide the calibrated
* data
- * @samples: static array to hold data from a single capture.
- * For each channel we need 2 bytes, except for
- * the timestamp. The timestamp is always last and
- * is always 8-byte aligned.
+ * @scan: structure to hold data from a single capture.
+ * Up to 4 16 bit channels, followed by an 8-byte
+ * aligned timestamp.
* @read_ec_sensors_data: function used for accessing sensors values
* @fifo_max_event_count: Size of the EC sensor FIFO
* @frequencies: Table of known available frequencies:
@@ -75,7 +68,10 @@ struct cros_ec_sensors_core_state {
u16 scale;
} calib[CROS_EC_SENSOR_MAX_AXIS];
s8 sign[CROS_EC_SENSOR_MAX_AXIS];
- u8 samples[CROS_EC_SAMPLE_SIZE] __aligned(8);
+ struct {
+ s16 channels[4];
+ aligned_s64 timestamp;
+ } scan;
int (*read_ec_sensors_data)(struct iio_dev *indio_dev,
unsigned long scan_mask, s16 *data);
--
2.43.0
^ permalink raw reply related [flat|nested] 60+ messages in thread* Re: [PATCH 36/39] iio: common: cros_ec_sensors: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 ` [PATCH 36/39] iio: common: cros_ec_sensors: " Jonathan Cameron
@ 2026-10-27 3:19 ` Tzung-Bi Shih
2026-10-27 10:49 ` Andy Shevchenko
1 sibling, 0 replies; 60+ messages in thread
From: Tzung-Bi Shih @ 2026-10-27 3:19 UTC (permalink / raw)
To: Jonathan Cameron
Cc: linux-iio, David Lechner, Nuno Sá, Andy Shevchenko,
Cheng-Yi Chiang, Guenter Roeck
On Mon, Oct 26, 2026 at 04:05:54PM -0700, Jonathan Cameron wrote:
> Replace the deprecated iio_push_to_buffers_with_timestamp() with
> iio_push_to_buffers_with_ts(), passing the size of the pushed buffer,
> at both call sites.
>
> Replace the raw samples byte array with a scan struct containing the
> channel data and an aligned timestamp, matching the layout it was
> already manually maintaining and removing the need for the
> CROS_EC_SAMPLE_SIZE size calculation and the casts used to access it
> as an array of s16.
>
> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
The patch looks good to me. Just a minor note below.
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
> diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
...
> @@ -192,19 +191,17 @@ int cros_ec_sensors_push_data(struct iio_dev *indio_dev,
> if (!iio_device_try_claim_buffer_mode(indio_dev))
> return 0;
>
> - out = (s16 *)st->samples;
> - iio_for_each_active_channel(indio_dev, i) {
> - *out = data[i];
> - out++;
> - }
> + j = 0;
> + iio_for_each_active_channel(indio_dev, i)
> + st->scan.channels[j++] = data[i];
This is a pre-existing issue, but there is no bounds check on `j`. I'm
not sure if the number of active channels can ever exceed 4.
^ permalink raw reply [flat|nested] 60+ messages in thread* Re: [PATCH 36/39] iio: common: cros_ec_sensors: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 ` [PATCH 36/39] iio: common: cros_ec_sensors: " Jonathan Cameron
2026-10-27 3:19 ` Tzung-Bi Shih
@ 2026-10-27 10:49 ` Andy Shevchenko
1 sibling, 0 replies; 60+ messages in thread
From: Andy Shevchenko @ 2026-10-27 10:49 UTC (permalink / raw)
To: Jonathan Cameron
Cc: linux-iio, David Lechner, Nuno Sá, Andy Shevchenko,
Cheng-Yi Chiang, Tzung-Bi Shih, Guenter Roeck
On Mon, Oct 26, 2026 at 04:05:54PM -0700, Jonathan Cameron wrote:
> Replace the deprecated iio_push_to_buffers_with_timestamp() with
> iio_push_to_buffers_with_ts(), passing the size of the pushed buffer,
> at both call sites.
>
> Replace the raw samples byte array with a scan struct containing the
> channel data and an aligned timestamp, matching the layout it was
> already manually maintaining and removing the need for the
> CROS_EC_SAMPLE_SIZE size calculation and the casts used to access it
> as an array of s16.
...
> - iio_push_to_buffers_with_timestamp(indio_dev, st->samples,
> - iio_get_time_ns(indio_dev));
> + iio_push_to_buffers_with_ts(indio_dev, &st->scan,
> + sizeof(st->scan),
There is room on the previous line for this one.
> + iio_get_time_ns(indio_dev));
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 60+ messages in thread
* [PATCH 37/39] iio: common: ssp_sensors: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp() Jonathan Cameron
` (35 preceding siblings ...)
2026-10-26 23:05 ` [PATCH 36/39] iio: common: cros_ec_sensors: " Jonathan Cameron
@ 2026-10-26 23:05 ` Jonathan Cameron
2026-10-26 23:05 ` [PATCH 38/39] iio: imu: st_lsm6dsx: " Jonathan Cameron
` (2 subsequent siblings)
39 siblings, 0 replies; 60+ messages in thread
From: Jonathan Cameron @ 2026-10-26 23:05 UTC (permalink / raw)
To: linux-iio; +Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko
Replace the deprecated iio_push_to_buffers_with_timestamp() with
iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
drivers/iio/common/ssp_sensors/ssp_iio.c | 28 ++++++++--------------------
include/linux/iio/common/ssp_sensors.h | 2 --
2 files changed, 8 insertions(+), 22 deletions(-)
diff --git a/drivers/iio/common/ssp_sensors/ssp_iio.c b/drivers/iio/common/ssp_sensors/ssp_iio.c
index 78ac689de2fe..a2a5a6292c47 100644
--- a/drivers/iio/common/ssp_sensors/ssp_iio.c
+++ b/drivers/iio/common/ssp_sensors/ssp_iio.c
@@ -7,7 +7,6 @@
#include <linux/iio/buffer.h>
#include <linux/iio/kfifo_buf.h>
#include <linux/module.h>
-#include <linux/slab.h>
#include <linux/unaligned.h>
#include <linux/units.h>
#include "ssp_iio_sensor.h"
@@ -24,13 +23,6 @@ int ssp_common_buffer_postenable(struct iio_dev *indio_dev)
struct ssp_sensor_data *spd = iio_priv(indio_dev);
struct ssp_data *data = dev_get_drvdata(indio_dev->dev.parent->parent);
- /* the allocation is made in post because scan size is known in this
- * moment
- * */
- spd->buffer = kmalloc(indio_dev->scan_bytes, GFP_KERNEL | GFP_DMA);
- if (!spd->buffer)
- return -ENOMEM;
-
return ssp_enable_sensor(data, spd->type,
ssp_get_sensor_delay(data, spd->type));
}
@@ -45,17 +37,10 @@ EXPORT_SYMBOL_NS(ssp_common_buffer_postenable, "IIO_SSP_SENSORS");
*/
int ssp_common_buffer_postdisable(struct iio_dev *indio_dev)
{
- int ret;
struct ssp_sensor_data *spd = iio_priv(indio_dev);
struct ssp_data *data = dev_get_drvdata(indio_dev->dev.parent->parent);
- ret = ssp_disable_sensor(data, spd->type);
- if (ret < 0)
- return ret;
-
- kfree(spd->buffer);
-
- return ret;
+ return ssp_disable_sensor(data, spd->type);
}
EXPORT_SYMBOL_NS(ssp_common_buffer_postdisable, "IIO_SSP_SENSORS");
@@ -72,8 +57,11 @@ EXPORT_SYMBOL_NS(ssp_common_buffer_postdisable, "IIO_SSP_SENSORS");
int ssp_common_process_data(struct iio_dev *indio_dev, void *buf,
unsigned int len, int64_t timestamp)
{
+ struct {
+ __le16 channels[3];
+ aligned_s64 timestamp;
+ } scan = { };
int64_t calculated_time;
- struct ssp_sensor_data *spd = iio_priv(indio_dev);
if (indio_dev->scan_bytes == 0)
return 0;
@@ -81,13 +69,13 @@ int ssp_common_process_data(struct iio_dev *indio_dev, void *buf,
/*
* it always sends full set of samples, remember about available masks
*/
- memcpy(spd->buffer, buf, len);
+ memcpy(scan.channels, buf, len);
calculated_time = timestamp +
(int64_t)get_unaligned_le32(buf + len) * MEGA;
- return iio_push_to_buffers_with_timestamp(indio_dev, spd->buffer,
- calculated_time);
+ return iio_push_to_buffers_with_ts(indio_dev, &scan, sizeof(scan),
+ calculated_time);
}
EXPORT_SYMBOL_NS(ssp_common_process_data, "IIO_SSP_SENSORS");
diff --git a/include/linux/iio/common/ssp_sensors.h b/include/linux/iio/common/ssp_sensors.h
index 06c9b4b563b3..bfadf8eae558 100644
--- a/include/linux/iio/common/ssp_sensors.h
+++ b/include/linux/iio/common/ssp_sensors.h
@@ -48,13 +48,11 @@ struct ssp_data;
* struct ssp_sensor_data - Sensor object
* @process_data: Callback to feed sensor data.
* @type: Used sensor type.
- * @buffer: Received data buffer.
*/
struct ssp_sensor_data {
int (*process_data)(struct iio_dev *indio_dev, void *buf,
int64_t timestamp);
enum ssp_sensor_type type;
- u8 *buffer;
};
void ssp_register_consumer(struct iio_dev *indio_dev,
--
2.43.0
^ permalink raw reply related [flat|nested] 60+ messages in thread* [PATCH 38/39] iio: imu: st_lsm6dsx: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp() Jonathan Cameron
` (36 preceding siblings ...)
2026-10-26 23:05 ` [PATCH 37/39] iio: common: ssp_sensors: " Jonathan Cameron
@ 2026-10-26 23:05 ` Jonathan Cameron
2026-10-27 6:15 ` Francesco Lavra
2026-10-27 10:55 ` Andy Shevchenko
2026-10-26 23:05 ` [PATCH 39/39] iio: imu: bmi160: " Jonathan Cameron
2026-10-27 10:57 ` [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp() Andy Shevchenko
39 siblings, 2 replies; 60+ messages in thread
From: Jonathan Cameron @ 2026-10-26 23:05 UTC (permalink / raw)
To: linux-iio
Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Francesco Lavra, Lorenzo Bianconi
Replace the deprecated iio_push_to_buffers_with_timestamp() with
iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
Cc: Francesco Lavra <flavra@baylibre.com>
Cc: Lorenzo Bianconi <lorenzo@kernel.org>
---
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c | 17 ++++++++++-------
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 5 +++--
2 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
index 777d479f10c0..c60192775ce8 100644
--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
+++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c
@@ -496,9 +496,10 @@ int st_lsm6dsx_read_fifo(struct st_lsm6dsx_hw *hw)
if (gyro_sensor->samples_to_discard > 0)
gyro_sensor->samples_to_discard--;
else
- iio_push_to_buffers_with_timestamp(
+ iio_push_to_buffers_with_ts(
hw->iio_devs[ST_LSM6DSX_ID_GYRO],
&hw->scan[ST_LSM6DSX_ID_GYRO],
+ sizeof(hw->scan[ST_LSM6DSX_ID_GYRO]),
gyro_sensor->ts_ref + ts);
gyro_sip--;
}
@@ -510,16 +511,18 @@ int st_lsm6dsx_read_fifo(struct st_lsm6dsx_hw *hw)
if (acc_sensor->samples_to_discard > 0)
acc_sensor->samples_to_discard--;
else
- iio_push_to_buffers_with_timestamp(
+ iio_push_to_buffers_with_ts(
hw->iio_devs[ST_LSM6DSX_ID_ACC],
&hw->scan[ST_LSM6DSX_ID_ACC],
+ sizeof(hw->scan[ST_LSM6DSX_ID_ACC]),
acc_sensor->ts_ref + ts);
acc_sip--;
}
if (ext_sip > 0 && !(sip % ext_sensor->decimator)) {
- iio_push_to_buffers_with_timestamp(
+ iio_push_to_buffers_with_ts(
hw->iio_devs[ST_LSM6DSX_ID_EXT0],
&hw->scan[ST_LSM6DSX_ID_EXT0],
+ sizeof(hw->scan[ST_LSM6DSX_ID_EXT0]),
ext_sensor->ts_ref + ts);
ext_sip--;
}
@@ -549,7 +552,7 @@ static bool st_lsm6dsx_check_data(u8 tag, __le16 *data)
}
static int st_lsm6dsx_push_tagged_data(struct st_lsm6dsx_hw *hw, u8 tag,
- __le16 *data, s64 ts)
+ __le16 *data, size_t len, s64 ts)
{
struct st_lsm6dsx_sensor *sensor;
struct iio_dev *iio_dev;
@@ -597,8 +600,7 @@ static int st_lsm6dsx_push_tagged_data(struct st_lsm6dsx_hw *hw, u8 tag,
}
sensor = iio_priv(iio_dev);
- iio_push_to_buffers_with_timestamp(iio_dev, data,
- ts + sensor->ts_ref);
+ iio_push_to_buffers_with_ts(iio_dev, data, len, ts + sensor->ts_ref);
return 0;
}
@@ -617,7 +619,7 @@ int st_lsm6dsx_read_tagged_fifo(struct st_lsm6dsx_hw *hw)
u16 fifo_len, fifo_diff_mask;
/*
* Alignment needed as this can ultimately be passed to a
- * call to iio_push_to_buffers_with_timestamp() which
+ * call to iio_push_to_buffers_with_ts() which
* must be passed a buffer that is aligned to 8 bytes so
* as to allow insertion of a naturally aligned timestamp.
*/
@@ -690,6 +692,7 @@ int st_lsm6dsx_read_tagged_fifo(struct st_lsm6dsx_hw *hw)
} else {
st_lsm6dsx_push_tagged_data(hw, tag,
iio_buff.data,
+ sizeof(iio_buff),
ts);
}
}
diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
index 360f1365f892..81ff0b32ec40 100644
--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
+++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
@@ -2798,8 +2798,9 @@ static irqreturn_t st_lsm6dsx_sw_trigger_handler_thread(int irq,
hw->scan[sensor->id].channels,
sizeof(hw->scan[sensor->id].channels));
- iio_push_to_buffers_with_timestamp(iio_dev, &hw->scan[sensor->id],
- iio_get_time_ns(iio_dev));
+ iio_push_to_buffers_with_ts(iio_dev, &hw->scan[sensor->id],
+ sizeof(hw->scan[sensor->id]),
+ iio_get_time_ns(iio_dev));
iio_trigger_notify_done(iio_dev->trig);
return IRQ_HANDLED;
--
2.43.0
^ permalink raw reply related [flat|nested] 60+ messages in thread* Re: [PATCH 38/39] iio: imu: st_lsm6dsx: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 ` [PATCH 38/39] iio: imu: st_lsm6dsx: " Jonathan Cameron
@ 2026-10-27 6:15 ` Francesco Lavra
2026-10-27 10:55 ` Andy Shevchenko
1 sibling, 0 replies; 60+ messages in thread
From: Francesco Lavra @ 2026-10-27 6:15 UTC (permalink / raw)
To: Jonathan Cameron, linux-iio
Cc: David Lechner, Nuno Sá, Andy Shevchenko, Lorenzo Bianconi
[-- Attachment #1: Type: text/plain, Size: 332 bytes --]
On Mon, 2026-10-26 at 16:05 -0700, Jonathan Cameron wrote:
> Replace the deprecated iio_push_to_buffers_with_timestamp() with
> iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
>
> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Reviewed-by: Francesco Lavra <flavra@baylibre.com>
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH 38/39] iio: imu: st_lsm6dsx: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 ` [PATCH 38/39] iio: imu: st_lsm6dsx: " Jonathan Cameron
2026-10-27 6:15 ` Francesco Lavra
@ 2026-10-27 10:55 ` Andy Shevchenko
1 sibling, 0 replies; 60+ messages in thread
From: Andy Shevchenko @ 2026-10-27 10:55 UTC (permalink / raw)
To: Jonathan Cameron
Cc: linux-iio, David Lechner, Nuno Sá, Andy Shevchenko,
Francesco Lavra, Lorenzo Bianconi
On Mon, Oct 26, 2026 at 04:05:56PM -0700, Jonathan Cameron wrote:
> Replace the deprecated iio_push_to_buffers_with_timestamp() with
> iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
...
> if (gyro_sensor->samples_to_discard > 0)
> gyro_sensor->samples_to_discard--;
> else
> - iio_push_to_buffers_with_timestamp(
> + iio_push_to_buffers_with_ts(
> hw->iio_devs[ST_LSM6DSX_ID_GYRO],
> &hw->scan[ST_LSM6DSX_ID_GYRO],
> + sizeof(hw->scan[ST_LSM6DSX_ID_GYRO]),
> gyro_sensor->ts_ref + ts);
Seems like a lot of code duplication in all three cases.
But yeah, it's out of scope of this change.
> gyro_sip--;
> }
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 60+ messages in thread
* [PATCH 39/39] iio: imu: bmi160: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp() Jonathan Cameron
` (37 preceding siblings ...)
2026-10-26 23:05 ` [PATCH 38/39] iio: imu: st_lsm6dsx: " Jonathan Cameron
@ 2026-10-26 23:05 ` Jonathan Cameron
2026-10-27 10:56 ` Andy Shevchenko
2026-10-27 10:57 ` [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp() Andy Shevchenko
39 siblings, 1 reply; 60+ messages in thread
From: Jonathan Cameron @ 2026-10-26 23:05 UTC (permalink / raw)
To: linux-iio; +Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko
Replace the deprecated iio_push_to_buffers_with_timestamp() with
iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
Move the scan buffer off struct bmi160_data and onto the stack of
bmi160_trigger_handler() as a zero-initialized IIO_DECLARE_BUFFER_WITH_TS()
array, since it is only ever used locally within that function.
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
drivers/iio/imu/bmi160/bmi160.h | 7 -------
drivers/iio/imu/bmi160/bmi160_core.c | 6 ++++--
2 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/drivers/iio/imu/bmi160/bmi160.h b/drivers/iio/imu/bmi160/bmi160.h
index ffbe8205e703..629844c34f1a 100644
--- a/drivers/iio/imu/bmi160/bmi160.h
+++ b/drivers/iio/imu/bmi160/bmi160.h
@@ -10,13 +10,6 @@ struct bmi160_data {
struct iio_trigger *trig;
struct regulator_bulk_data supplies[2];
struct iio_mount_matrix orientation;
- /*
- * Ensure natural alignment for timestamp if present.
- * Max length needed: 2 * 3 channels + 4 bytes padding + 8 byte ts.
- * If fewer channels are enabled, less space may be needed, as
- * long as the timestamp is still aligned to 8 bytes.
- */
- __le16 buf[12] __aligned(8);
};
extern const struct regmap_config bmi160_regmap_config;
diff --git a/drivers/iio/imu/bmi160/bmi160_core.c b/drivers/iio/imu/bmi160/bmi160_core.c
index 1e73a7f1f017..1bbca85f9f14 100644
--- a/drivers/iio/imu/bmi160/bmi160_core.c
+++ b/drivers/iio/imu/bmi160/bmi160_core.c
@@ -432,6 +432,7 @@ static irqreturn_t bmi160_trigger_handler(int irq, void *p)
struct iio_poll_func *pf = p;
struct iio_dev *indio_dev = pf->indio_dev;
struct bmi160_data *data = iio_priv(indio_dev);
+ IIO_DECLARE_BUFFER_WITH_TS(__le16, scan, 6) = { };
int i, ret, j = 0, base = BMI160_REG_DATA_MAGN_XOUT_L;
__le16 sample;
@@ -440,10 +441,11 @@ static irqreturn_t bmi160_trigger_handler(int irq, void *p)
&sample, sizeof(sample));
if (ret)
goto done;
- data->buf[j++] = sample;
+ scan[j++] = sample;
}
- iio_push_to_buffers_with_timestamp(indio_dev, data->buf, pf->timestamp);
+ iio_push_to_buffers_with_ts(indio_dev, scan, sizeof(scan),
+ pf->timestamp);
done:
iio_trigger_notify_done(indio_dev->trig);
return IRQ_HANDLED;
--
2.43.0
^ permalink raw reply related [flat|nested] 60+ messages in thread* Re: [PATCH 39/39] iio: imu: bmi160: use iio_push_to_buffers_with_ts()
2026-10-26 23:05 ` [PATCH 39/39] iio: imu: bmi160: " Jonathan Cameron
@ 2026-10-27 10:56 ` Andy Shevchenko
0 siblings, 0 replies; 60+ messages in thread
From: Andy Shevchenko @ 2026-10-27 10:56 UTC (permalink / raw)
To: Jonathan Cameron; +Cc: linux-iio, David Lechner, Nuno Sá, Andy Shevchenko
On Mon, Oct 26, 2026 at 04:05:57PM -0700, Jonathan Cameron wrote:
> Replace the deprecated iio_push_to_buffers_with_timestamp() with
> iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
>
> Move the scan buffer off struct bmi160_data and onto the stack of
> bmi160_trigger_handler() as a zero-initialized IIO_DECLARE_BUFFER_WITH_TS()
> array, since it is only ever used locally within that function.
...
> - iio_push_to_buffers_with_timestamp(indio_dev, data->buf, pf->timestamp);
> + iio_push_to_buffers_with_ts(indio_dev, scan, sizeof(scan),
> + pf->timestamp);
One line?
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp()
2026-10-26 23:05 [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp() Jonathan Cameron
` (38 preceding siblings ...)
2026-10-26 23:05 ` [PATCH 39/39] iio: imu: bmi160: " Jonathan Cameron
@ 2026-10-27 10:57 ` Andy Shevchenko
39 siblings, 0 replies; 60+ messages in thread
From: Andy Shevchenko @ 2026-10-27 10:57 UTC (permalink / raw)
To: Jonathan Cameron
Cc: linux-iio, David Lechner, Nuno Sá, Andy Shevchenko,
Matt Ranostay, Gene Chen, Jonathan Santos, Antoniu Miclaus,
Jiri Kosina, Srinivas Pandruvada, Zhang Lixu, Cong Nguyen,
Ethan Tidmore, Christian Eggers, Javier Carrasco, Petre Rodan,
Jianping Shen, Alex Lanzano, Justin Weiss, Jean-Baptiste Maneyrol,
Andrew F. Davis, Archit Anant, Stefano Manni, Jyoti Bhayana,
Sebastian Andrzej Siewior, Piyush Patle, Nicolás Antinori,
stable, Adi Nata, Cheng-Yi Chiang, Tzung-Bi Shih, Guenter Roeck,
Francesco Lavra, Lorenzo Bianconi
On Mon, Oct 26, 2026 at 04:05:18PM -0700, Jonathan Cameron wrote:
> A bit of technical debt cleanup that was partly a discovery exercise in
> using AI tooling for this sort of somewhat messy subsystem maintenance
> activity.
>
> Replace iio_push_to_buffers_with_timestamp() with
> iio_push_to_buffers_with_ts() which includes a runtime check that
> there is sufficient space to insert the timestamp.
>
> A few other modifications of related code seen whilst working through
> these and a couple of fixes for DMA safety. Those are not sent as
> separate fixes as they are in old drivers and we have had no
> reports of problems. So no rush to get upstream.
>
> The remaining users of iio_push_to_buffers_with_timestamp() are
> the more complex cases that will require more careful review so
> are left for the next series.
>
> I appreciate this is a large series, so if you have time to take
> a look review what you can and I'll nibble away at applying the
> ones that have received sufficient review.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
assuming we get a positive feedback from Srinivas on testing HID sensors case.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 60+ messages in thread