IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp()
Subsystems (19)
cover IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp()
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.
Thanks,
Jonathan
p.s. First time I've used b4 prep for a series, so fingers crossed :)
---
Jonathan Cameron (39):
iio: adc: ti-adc161s626: use iio_push_to_buffers_with_ts()
iio: adc: mt6360-adc: use iio_push_to_buffers_with_ts()
iio: adc: ad4130: use iio_push_to_buffers_with_ts()
iio: addac: ad74413r: use iio_push_to_buffers_with_ts()
iio: hid-sensors: use iio_push_to_buffers_with_ts()
iio: gyro: mpu3050: use iio_push_to_buffers_with_ts()
iio: imu: bno055: use iio_push_to_buffers_with_ts()
iio: light: as73211: use iio_push_to_buffers_with_ts()
iio: light: vcnl4035: use iio_push_to_buffers_with_ts()
iio: pressure: mprls0025pa: use iio_push_to_buffers_with_ts()
iio: pressure: ms5611: use iio_push_to_buffers_with_ts()
iio: proximity: isl29501: use iio_push_to_buffers_with_ts()
iio: proximity: sx9500: use iio_push_to_buffers_with_ts()
iio: imu: smi330: use iio_push_to_buffers_with_ts()
iio: imu: bmi270: use iio_push_to_buffers_with_ts()
iio: imu: inv_icm42600: use iio_push_to_buffers_with_ts()
iio: health: afe4403: use iio_push_to_buffers_with_ts()
iio: health: afe4404: use iio_push_to_buffers_with_ts()
iio: adc: ad799x: use iio_push_to_buffers_with_ts()
iio: common: scmi_sensors: use iio_push_to_buffers_with_ts()
iio: adc: ad7766: use iio_push_to_buffers_with_ts()
iio: imu: smi240: use iio_push_to_buffers_with_ts()
iio: adc: cc10001_adc: use iio_push_to_buffers_with_ts()
iio: adc: hx711: use iio_push_to_buffers_with_ts()
iio: potentiostat: lmp91000: use iio_push_to_buffers_with_ts() with a scan struct on stack
iio: humidity: am2315: use iio_push_to_buffers_with_ts() with a scan struct on stack
iio: humidity: hdc100x: use iio_push_to_buffers_with_ts() with a scan struct on stack
iio: imu: bmi323: use iio_push_to_buffers_with_ts()
iio: gyro: fxas21002c: restrict available_scan_masks to all angular velocity channels
iio: gyro: fxas21002c: use iio_push_to_buffers_with_ts() with explicit structure
iio: adc: ad7887: ensure tx_cmd_buf is DMA safe
iio: adc: ad7887: use iio_push_to_buffers_with_ts()
iio: humidity: hts221: align scan buffer for DMA safety
iio: humidity: hts221: use iio_push_to_buffers_with_ts()
iio: accel: bmc150-accel-core: use iio_push_to_buffers_with_ts()
iio: common: cros_ec_sensors: use iio_push_to_buffers_with_ts()
iio: common: ssp_sensors: use iio_push_to_buffers_with_ts()
iio: imu: st_lsm6dsx: use iio_push_to_buffers_with_ts()
iio: imu: bmi160: use iio_push_to_buffers_with_ts()drivers/iio/accel/bmc150-accel-core.c | 12 ++++----- drivers/iio/accel/bmc150-accel.h | 1 - drivers/iio/adc/ad4130.c | 5 ++-- drivers/iio/adc/ad7766.c | 14 +++------- drivers/iio/adc/ad7887.c | 20 +++++--------- drivers/iio/adc/ad799x.c | 9 +++---- drivers/iio/adc/cc10001_adc.c | 22 +++------------ drivers/iio/adc/hx711.c | 21 +++++---------- drivers/iio/adc/mt6360-adc.c | 3 ++- drivers/iio/adc/ti-adc161s626.c | 3 ++- drivers/iio/addac/ad74413r.c | 5 ++-- .../common/cros_ec_sensors/cros_ec_sensors_core.c | 24 ++++++++--------- drivers/iio/common/scmi_sensors/scmi_iio.c | 7 +++-- drivers/iio/common/ssp_sensors/ssp_iio.c | 28 ++++++------------- drivers/iio/gyro/fxas21002c_core.c | 31 ++++++++++++++-------- drivers/iio/gyro/hid-sensor-gyro-3d.c | 5 ++-- drivers/iio/gyro/mpu3050-core.c | 2 +- drivers/iio/health/afe4403.c | 10 +++---- drivers/iio/health/afe4404.c | 9 +++---- drivers/iio/humidity/am2315.c | 23 +++++++--------- drivers/iio/humidity/hdc100x.c | 15 +++++------ drivers/iio/humidity/hid-sensor-humidity.c | 5 ++-- drivers/iio/humidity/hts221.h | 2 +- drivers/iio/humidity/hts221_buffer.c | 4 +-- drivers/iio/imu/bmi160/bmi160.h | 7 ----- drivers/iio/imu/bmi160/bmi160_core.c | 6 +++-- drivers/iio/imu/bmi270/bmi270_core.c | 4 +-- drivers/iio/imu/bmi323/bmi323_core.c | 20 +++++++------- drivers/iio/imu/bno055/bno055.c | 4 +-- drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c | 3 ++- drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c | 3 ++- drivers/iio/imu/smi240.c | 13 +++------ drivers/iio/imu/smi330/smi330_core.c | 3 ++- drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c | 17 +++++++----- drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 5 ++-- drivers/iio/light/as73211.c | 3 ++- drivers/iio/light/vcnl4035.c | 4 +-- 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 +-- drivers/iio/potentiostat/lmp91000.c | 15 ++++++----- drivers/iio/pressure/mprls0025pa.c | 4 +-- drivers/iio/pressure/ms5611_core.c | 4 +-- drivers/iio/proximity/isl29501.c | 3 ++- drivers/iio/proximity/sx9500.c | 4 +-- include/linux/iio/common/cros_ec_sensors_core.h | 18 +++++-------- include/linux/iio/common/ssp_sensors.h | 2 -- 47 files changed, 196 insertions(+), 258 deletions(-)
---
base-commit: c9dbe2a47f635465c9985b7af74d2ae310e98125
change-id: 20261026-iio-b9364d28fa05
Best regards,
Signature · 1 line
Jonathan Cameron <[email protected]>
PATCH 1/39 iio: adc: ti-adc161s626: use iio_push_to_buffers_with_ts()
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().
---
Cc: Matt Ranostay <[email protected]>
--- drivers/iio/adc/ti-adc161s626.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/adc/ti-adc161s626.c +2 -1
@@ -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);
Signature · 1 line
2.43.0
PATCH 2/39 iio: adc: mt6360-adc: use iio_push_to_buffers_with_ts()
In reply to Jonathan CameronReplace 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().
---
Cc: Gene Chen <[email protected]>
--- drivers/iio/adc/mt6360-adc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/adc/mt6360-adc.c +2 -1
@@ -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);
Signature · 1 line
2.43.0
PATCH 3/39 iio: adc: ad4130: use iio_push_to_buffers_with_ts()
In reply to Jonathan CameronReplace 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.
---
Cc: Jonathan Santos <[email protected]>
--- drivers/iio/adc/ad4130.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/iio/adc/ad4130.c +3 -2
@@ -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);
Signature · 1 line
2.43.0
PATCH 4/39 iio: addac: ad74413r: use iio_push_to_buffers_with_ts()
In reply to Jonathan CameronReplace the deprecated iio_push_to_buffers_with_timestamp() with iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
---
Cc: Antoniu Miclaus <[email protected]>
--- drivers/iio/addac/ad74413r.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/iio/addac/ad74413r.c +3 -2
@@ -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);
Signature · 1 line
2.43.0
Re: [PATCH 04/39] iio: addac: ad74413r: use iio_push_to_buffers_with_ts()
Quoted 4 lines · On Mon, 26 Oct 2026 16:05:22 -0700 Jonathan Cameron…
Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_push_to_buffers_with_ts(), passing the size of the pushed buffer.Signed-off-by Jonathan Cameron <[email protected]>
In the interests of nibbling down at the outstanding list, I've applied patches 1-4 as they are all on the trivial side.
Thanks,
Jonathan
Quoted 23 lines
---
Cc: Antoniu Miclaus <[email protected]>--- drivers/iio/addac/ad74413r.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/iio/addac/ad74413r.c +3
-2@@ -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);
PATCH 5/39 iio: hid-sensors: use iio_push_to_buffers_with_ts()
In reply to Jonathan CameronReplace 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.
---
Cc: Jiri Kosina <[email protected]>
Cc: Srinivas Pandruvada <[email protected]>
Cc: Zhang Lixu <[email protected]>
--- 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(-)
drivers/iio/gyro/hid-sensor-gyro-3d.c +3 -2
@@ -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 ; }
drivers/iio/humidity/hid-sensor-humidity.c +3 -2
@@ -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 ; }
drivers/iio/magnetometer/hid-sensor-magn-3d.c +6 -15
@@ -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++){
drivers/iio/orientation/hid-sensor-incl-3d.c +4 -3
@@ -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 ; }
drivers/iio/position/hid-sensor-custom-intel-hinge.c +2 -2
@@ -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 ; }
Signature · 1 line
2.43.0
srinivas pandruvada
maintainerRe: [PATCH 05/39] iio: hid-sensors: use iio_push_to_buffers_with_ts()
Quoted 8 lines · Jonathan Cameron
Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_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 <[email protected]>
LGTM.
I will do some quick test on this and let you know.
Thanks,
Srinivas
Quoted 159 lines
---
Cc: Jiri Kosina <[email protected]>
Cc: Srinivas Pandruvada <[email protected]>
Cc: Zhang Lixu <[email protected]>
---
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(-)drivers/iio/gyro/hid-sensor-gyro-3d.c +0
-0@@ -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);drivers/iio/gyro/hid-sensor-gyro-3d.c +0
-1- iio_push_to_buffers_with_timestamp(indio_dev,
&gyro_state->scan,drivers/iio/gyro/hid-sensor-gyro-3d.c +0
-1- gyro_state-Quoted 1 line
timestamp);
drivers/iio/gyro/hid-sensor-gyro-3d.c +1
-0+ iio_push_to_buffers_with_ts(indio_dev, &gyro_state-Quoted 1 line
scan,
drivers/iio/gyro/hid-sensor-gyro-3d.c +1
-0+ sizeof(gyro_state-Quoted 1 line
scan),
drivers/iio/gyro/hid-sensor-gyro-3d.c +1
-0+ gyro_state->timestamp);
gyro_state->timestamp= 0;
}drivers/iio/humidity/hid-sensor-humidity.c +0
-0@@ -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))drivers/iio/humidity/hid-sensor-humidity.c +0
-1- iio_push_to_buffers_with_timestamp(indio_dev,
&humid_st->scan,drivers/iio/humidity/hid-sensor-humidity.c +0
-1-
iio_get_time_ns(indio_dev));drivers/iio/humidity/hid-sensor-humidity.c +1
-0+ iio_push_to_buffers_with_ts(indio_dev, &humid_st-Quoted 1 line
scan,
drivers/iio/humidity/hid-sensor-humidity.c +2
-0+ sizeof(humid_st->scan), +
iio_get_time_ns(indio_dev));
return 0;
}drivers/iio/magnetometer/hid-sensor-magn-3d.c +0
-0@@ -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];drivers/iio/magnetometer/hid-sensor-magn-3d.c +2
-2-/* 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];drivers/iio/magnetometer/hid-sensor-magn-3d.c +0
-0@@ -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);drivers/iio/magnetometer/hid-sensor-magn-3d.c +0
-2- iio_push_to_buffers_with_timestamp(indio_dev, - magn_state-Quoted 1 line
iio_vals,drivers/iio/magnetometer/hid-sensor-magn-3d.c +0
-1- magn_state-Quoted 1 line
timestamp);
drivers/iio/magnetometer/hid-sensor-magn-3d.c +3
-0+ iio_push_to_buffers_with_ts(indio_dev, + magn_state->iio_vals, + sizeof(magn_state-Quoted 1 line
iio_vals),drivers/iio/magnetometer/hid-sensor-magn-3d.c +1
-0+ magn_state->timestamp);
magn_state->timestamp= 0;
}drivers/iio/magnetometer/hid-sensor-magn-3d.c +0
-0@@ -379,16 +380,6 @@ static int magn_3d_parse_report(structplatform_device *pdev, return -ENOMEM; }drivers/iio/magnetometer/hid-sensor-magn-3d.c +0
-1-/* attr_count include timestamp channel, and the iio_vals should be aligned to 8byte */
drivers/iio/magnetometer/hid-sensor-magn-3d.c +0
-2- st->iio_vals = devm_kcalloc(&pdev->dev, - ((attr_count + 1) % 2 +(
attr_count+ 1) / 2) * 2,drivers/iio/magnetometer/hid-sensor-magn-3d.c +0
-4- sizeof(u32), GFP_KERNEL); -if (!st->iio_vals) { - dev_err(&pdev->dev, - "failed to allocate space for iio valuesarray\n");
drivers/iio/magnetometer/hid-sensor-magn-3d.c +0
-3-return -ENOMEM ; - } -for (i = 0,
*chan_count= 0;
i <MAGN_3D_CHANNEL_MAX&&*chan_count<attr_count; i++){drivers/iio/orientation/hid-sensor-incl-3d.c +0
-0@@ -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);drivers/iio/orientation/hid-sensor-incl-3d.c +0
-2- iio_push_to_buffers_with_timestamp(indio_dev, - &incl_state-Quoted 1 line
scan,
drivers/iio/orientation/hid-sensor-incl-3d.c +0
-1- incl_state-Quoted 1 line
timestamp);
drivers/iio/orientation/hid-sensor-incl-3d.c +3
-0+ iio_push_to_buffers_with_ts(indio_dev, + &incl_state->scan, + sizeof(incl_state-Quoted 1 line
scan),
drivers/iio/orientation/hid-sensor-incl-3d.c +1
-0+ incl_state->timestamp);
incl_state->timestamp= 0;
}drivers/iio/position/hid-sensor-custom-intel-hinge.c +0
-0@@ -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);drivers/iio/position/hid-sensor-custom-intel-hinge.c +0
-1- iio_push_to_buffers_with_timestamp(indio_dev, &st-Quoted 1 line
scan,
drivers/iio/position/hid-sensor-custom-intel-hinge.c +2
-1- st->timestamp); + iio_push_to_buffers_with_ts(indio_dev, &st->scan, + sizeof(st->scan), st-Quoted 1 line
timestamp);
st->timestamp= 0;
}
Jonathan Cameron
maintainerRe: [PATCH 05/39] iio: hid-sensors: use iio_push_to_buffers_with_ts()
Quoted 4 lines · On Mon, 26 Oct 2026 17:06:23 -0700 srinivas pandruvada…
Quoted 3 lines · Jonathan Cameron
Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
Quoted 8 lines
Quoted 5 lines
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 <[email protected]>LGTM.
I will do some quick test on this and let you know.
No huge rush. This is the only one I'm going to leave unapplied that doesn't need changes (as far as I know!) for now.
Thanks,
Jonathan
Quoted 164 lines
Thanks,
SrinivasQuoted 159 lines
---
Cc: Jiri Kosina <[email protected]>
Cc: Srinivas Pandruvada <[email protected]>
Cc: Zhang Lixu <[email protected]>
---
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(-)drivers/iio/gyro/hid-sensor-gyro-3d.c +0
-0@@ -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);drivers/iio/gyro/hid-sensor-gyro-3d.c +0
-1- iio_push_to_buffers_with_timestamp(indio_dev,
&gyro_state->scan,drivers/iio/gyro/hid-sensor-gyro-3d.c +0
-1- gyro_state-Quoted 1 line
timestamp);
drivers/iio/gyro/hid-sensor-gyro-3d.c +1
-0+ iio_push_to_buffers_with_ts(indio_dev, &gyro_state-Quoted 1 line
scan,
drivers/iio/gyro/hid-sensor-gyro-3d.c +1
-0+ sizeof(gyro_state-Quoted 1 line
scan),
drivers/iio/gyro/hid-sensor-gyro-3d.c +1
-0+ gyro_state->timestamp);
gyro_state->timestamp= 0;
}drivers/iio/humidity/hid-sensor-humidity.c +0
-0@@ -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))drivers/iio/humidity/hid-sensor-humidity.c +0
-1- iio_push_to_buffers_with_timestamp(indio_dev,
&humid_st->scan,drivers/iio/humidity/hid-sensor-humidity.c +0
-1-
iio_get_time_ns(indio_dev));drivers/iio/humidity/hid-sensor-humidity.c +1
-0+ iio_push_to_buffers_with_ts(indio_dev, &humid_st-Quoted 1 line
scan,
drivers/iio/humidity/hid-sensor-humidity.c +2
-0+ sizeof(humid_st->scan), +
iio_get_time_ns(indio_dev));
return 0;
}drivers/iio/magnetometer/hid-sensor-magn-3d.c +0
-0@@ -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];drivers/iio/magnetometer/hid-sensor-magn-3d.c +2
-2-/* 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];drivers/iio/magnetometer/hid-sensor-magn-3d.c +0
-0@@ -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);drivers/iio/magnetometer/hid-sensor-magn-3d.c +0
-2- iio_push_to_buffers_with_timestamp(indio_dev, - magn_state-Quoted 1 line
iio_vals,drivers/iio/magnetometer/hid-sensor-magn-3d.c +0
-1- magn_state-Quoted 1 line
timestamp);
drivers/iio/magnetometer/hid-sensor-magn-3d.c +3
-0+ iio_push_to_buffers_with_ts(indio_dev, + magn_state->iio_vals, + sizeof(magn_state-Quoted 1 line
iio_vals),drivers/iio/magnetometer/hid-sensor-magn-3d.c +1
-0+ magn_state->timestamp);
magn_state->timestamp= 0;
}drivers/iio/magnetometer/hid-sensor-magn-3d.c +0
-0@@ -379,16 +380,6 @@ static int magn_3d_parse_report(structplatform_device *pdev, return -ENOMEM; }drivers/iio/magnetometer/hid-sensor-magn-3d.c +0
-1-/* attr_count include timestamp channel, and the iio_vals should be aligned to 8byte */
drivers/iio/magnetometer/hid-sensor-magn-3d.c +0
-2- st->iio_vals = devm_kcalloc(&pdev->dev, - ((attr_count + 1) % 2 +(
attr_count+ 1) / 2) * 2,drivers/iio/magnetometer/hid-sensor-magn-3d.c +0
-4- sizeof(u32), GFP_KERNEL); -if (!st->iio_vals) { - dev_err(&pdev->dev, - "failed to allocate space for iio valuesarray\n");
drivers/iio/magnetometer/hid-sensor-magn-3d.c +0
-3-return -ENOMEM ; - } -for (i = 0,
*chan_count= 0;
i <MAGN_3D_CHANNEL_MAX&&*chan_count<attr_count; i++){drivers/iio/orientation/hid-sensor-incl-3d.c +0
-0@@ -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);drivers/iio/orientation/hid-sensor-incl-3d.c +0
-2- iio_push_to_buffers_with_timestamp(indio_dev, - &incl_state-Quoted 1 line
scan,
drivers/iio/orientation/hid-sensor-incl-3d.c +0
-1- incl_state-Quoted 1 line
timestamp);
drivers/iio/orientation/hid-sensor-incl-3d.c +3
-0+ iio_push_to_buffers_with_ts(indio_dev, + &incl_state->scan, + sizeof(incl_state-Quoted 1 line
scan),
drivers/iio/orientation/hid-sensor-incl-3d.c +1
-0+ incl_state->timestamp);
incl_state->timestamp= 0;
}drivers/iio/position/hid-sensor-custom-intel-hinge.c +0
-0@@ -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);drivers/iio/position/hid-sensor-custom-intel-hinge.c +0
-1- iio_push_to_buffers_with_timestamp(indio_dev, &st-Quoted 1 line
scan,
drivers/iio/position/hid-sensor-custom-intel-hinge.c +2
-1- st->timestamp); + iio_push_to_buffers_with_ts(indio_dev, &st->scan, + sizeof(st->scan), st-Quoted 1 line
timestamp);
st->timestamp= 0;
}
Re: [PATCH 05/39] iio: hid-sensors: use iio_push_to_buffers_with_ts()
Hi Jonathan,
Quoted 13 lines · Jonathan Cameron
Quoted 10 lines · On Mon, 26 Oct 2026 17:06:23 -0700 srinivas pandruvada…
Quoted 9 lines · Jonathan Cameron
Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_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.
Quoted 9 lines
Quoted 5 lines
Quoted 2 lines
Signed-off-by: Jonathan Cameron
<[email protected]>LGTM.
I will do some quick test on this and let you know.No huge rush. This is the only one I'm going to leave unapplied that doesn't need changes (as far as I know!) for now.
Thanks,
Srinivas
Quoted 184 lines
Thanks,
Jonathan
Quoted 180 lines
Thanks,
SrinivasQuoted 175 lines
---
Cc: Jiri Kosina <[email protected]>
Cc: Srinivas Pandruvada <[email protected]>
Cc: Zhang Lixu <[email protected]>
---
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(-)drivers/iio/gyro/hid-sensor-gyro-3d.c +0
-0@@ -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);drivers/iio/gyro/hid-sensor-gyro-3d.c +0
-1- iio_push_to_buffers_with_timestamp(indio_dev,
&gyro_state->scan,drivers/iio/gyro/hid-sensor-gyro-3d.c +0
-1- gyro_state-Quoted 1 line
timestamp);
drivers/iio/gyro/hid-sensor-gyro-3d.c +1
-0+ iio_push_to_buffers_with_ts(indio_dev,&gyro_state-
Quoted 1 line
scan,
drivers/iio/gyro/hid-sensor-gyro-3d.c +1
-0+ sizeof(gyro_state-Quoted 1 line
scan),
drivers/iio/gyro/hid-sensor-gyro-3d.c +1
-0+ gyro_state-Quoted 1 line
timestamp);
gyro_state->timestamp= 0;
}drivers/iio/humidity/hid-sensor-humidity.c +0
-0@@ -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-Quoted 1 line
common_attributes.data_ready))
drivers/iio/humidity/hid-sensor-humidity.c +0
-1- iio_push_to_buffers_with_timestamp(indio_dev,
&humid_st->scan,drivers/iio/humidity/hid-sensor-humidity.c +0
-1-
iio_get_time_ns(indio_dev));drivers/iio/humidity/hid-sensor-humidity.c +1
-0+ iio_push_to_buffers_with_ts(indio_dev,&humid_st-
Quoted 1 line
scan,
drivers/iio/humidity/hid-sensor-humidity.c +1
-0+ sizeof(humid_st-Quoted 1 line
scan),
drivers/iio/humidity/hid-sensor-humidity.c +1
-0+
iio_get_time_ns(indio_dev));
return 0;
}drivers/iio/magnetometer/hid-sensor-magn-3d.c +0
-0@@ -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];drivers/iio/magnetometer/hid-sensor-magn-3d.c +2
-2-/* 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];drivers/iio/magnetometer/hid-sensor-magn-3d.c +0
-0@@ -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);drivers/iio/magnetometer/hid-sensor-magn-3d.c +0
-2- iio_push_to_buffers_with_timestamp(indio_dev, - magn_state-Quoted 1 line
iio_vals,drivers/iio/magnetometer/hid-sensor-magn-3d.c +0
-1- magn_state-Quoted 1 line
timestamp);
drivers/iio/magnetometer/hid-sensor-magn-3d.c +2
-0+ iio_push_to_buffers_with_ts(indio_dev, + magn_state-Quoted 1 line
iio_vals,drivers/iio/magnetometer/hid-sensor-magn-3d.c +1
-0+ sizeof(magn_state-Quoted 1 line
iio_vals),drivers/iio/magnetometer/hid-sensor-magn-3d.c +1
-0+ magn_state-Quoted 1 line
timestamp);
magn_state->timestamp= 0;
}drivers/iio/magnetometer/hid-sensor-magn-3d.c +0
-0@@ -379,16 +380,6 @@ static int magn_3d_parse_report(structplatform_device *pdev, return -ENOMEM; }drivers/iio/magnetometer/hid-sensor-magn-3d.c +0
-1-/* attr_count include timestamp channel, and the
iio_vals
should be aligned to 8byte */drivers/iio/magnetometer/hid-sensor-magn-3d.c +0
-2- st->iio_vals = devm_kcalloc(&pdev->dev, - ((attr_count + 1) % 2 +(
attr_count+ 1) / 2) * 2,drivers/iio/magnetometer/hid-sensor-magn-3d.c +0
-4- sizeof(u32), GFP_KERNEL); -if (!st->iio_vals) { - dev_err(&pdev->dev, - "failed to allocate space for iio valuesarray\n");
drivers/iio/magnetometer/hid-sensor-magn-3d.c +0
-3-return -ENOMEM ; - } -for (i = 0,
*chan_count= 0;
i <MAGN_3D_CHANNEL_MAX&&*chan_count<attr_count; i++){drivers/iio/orientation/hid-sensor-incl-3d.c +0
-0@@ -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);drivers/iio/orientation/hid-sensor-incl-3d.c +0
-2- iio_push_to_buffers_with_timestamp(indio_dev, - &incl_state-Quoted 1 line
scan,
drivers/iio/orientation/hid-sensor-incl-3d.c +0
-1- incl_state-Quoted 1 line
timestamp);
drivers/iio/orientation/hid-sensor-incl-3d.c +3
-0+ iio_push_to_buffers_with_ts(indio_dev, + &incl_state->scan, + sizeof(incl_state-Quoted 1 line
scan),
drivers/iio/orientation/hid-sensor-incl-3d.c +1
-0+ incl_state-Quoted 1 line
timestamp);
incl_state->timestamp= 0;
}drivers/iio/position/hid-sensor-custom-intel-hinge.c +0
-0@@ -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);drivers/iio/position/hid-sensor-custom-intel-hinge.c +0
-1- iio_push_to_buffers_with_timestamp(indio_dev,&st-
Quoted 1 line
scan,
drivers/iio/position/hid-sensor-custom-intel-hinge.c +0
-1- st-Quoted 1 line
timestamp);
drivers/iio/position/hid-sensor-custom-intel-hinge.c +1
-0+ iio_push_to_buffers_with_ts(indio_dev, &st-Quoted 1 line
scan,
drivers/iio/position/hid-sensor-custom-intel-hinge.c +1
-0+ sizeof(st->scan),st-
Quoted 1 line
timestamp);
st->timestamp= 0;
}
Jonathan Cameron
maintainerRe: [PATCH 05/39] iio: hid-sensors: use iio_push_to_buffers_with_ts()
Quoted 18 lines · On Sun, 15 Nov 2026 12:06:03 -0800 srinivas pandruvada…
Hi Jonathan,
Quoted 16 lines · Jonathan Cameron
Quoted 13 lines · On Mon, 26 Oct 2026 17:06:23 -0700 srinivas pandruvada…
Quoted 11 lines · Jonathan Cameron
Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_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
<[email protected]>
Quoted 9 lines
Quoted 6 lines
Quoted 2 lines
LGTM.
I will do some quick test on this and let you know.No huge rush. This is the only one I'm going to leave unapplied that doesn't need changes (as far as I know!) for now.
Tested-by Srinivas Pandruvada <[email protected]>
Thanks. Applied.
Quoted 188 lines
Thanks,
SrinivasQuoted 184 lines
Thanks,
Jonathan
Quoted 180 lines
Thanks,
SrinivasQuoted 175 lines
---
Cc: Jiri Kosina <[email protected]>
Cc: Srinivas Pandruvada <[email protected]>
Cc: Zhang Lixu <[email protected]>
---
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(-)drivers/iio/gyro/hid-sensor-gyro-3d.c +0
-0@@ -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);drivers/iio/gyro/hid-sensor-gyro-3d.c +0
-1- iio_push_to_buffers_with_timestamp(indio_dev,
&gyro_state->scan,drivers/iio/gyro/hid-sensor-gyro-3d.c +0
-1- gyro_state-Quoted 1 line
timestamp);
drivers/iio/gyro/hid-sensor-gyro-3d.c +1
-0+ iio_push_to_buffers_with_ts(indio_dev,&gyro_state-
Quoted 1 line
scan,
drivers/iio/gyro/hid-sensor-gyro-3d.c +1
-0+ sizeof(gyro_state-Quoted 1 line
scan),
drivers/iio/gyro/hid-sensor-gyro-3d.c +1
-0+ gyro_state-Quoted 1 line
timestamp);
gyro_state->timestamp= 0;
}drivers/iio/humidity/hid-sensor-humidity.c +0
-0@@ -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-Quoted 1 line
common_attributes.data_ready))
drivers/iio/humidity/hid-sensor-humidity.c +0
-1- iio_push_to_buffers_with_timestamp(indio_dev,
&humid_st->scan,drivers/iio/humidity/hid-sensor-humidity.c +0
-1-
iio_get_time_ns(indio_dev));drivers/iio/humidity/hid-sensor-humidity.c +1
-0+ iio_push_to_buffers_with_ts(indio_dev,&humid_st-
Quoted 1 line
scan,
drivers/iio/humidity/hid-sensor-humidity.c +1
-0+ sizeof(humid_st-Quoted 1 line
scan),
drivers/iio/humidity/hid-sensor-humidity.c +1
-0+
iio_get_time_ns(indio_dev));
return 0;
}drivers/iio/magnetometer/hid-sensor-magn-3d.c +0
-0@@ -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];drivers/iio/magnetometer/hid-sensor-magn-3d.c +2
-2-/* 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];drivers/iio/magnetometer/hid-sensor-magn-3d.c +0
-0@@ -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);drivers/iio/magnetometer/hid-sensor-magn-3d.c +0
-2- iio_push_to_buffers_with_timestamp(indio_dev, - magn_state-Quoted 1 line
iio_vals,drivers/iio/magnetometer/hid-sensor-magn-3d.c +0
-1- magn_state-Quoted 1 line
timestamp);
drivers/iio/magnetometer/hid-sensor-magn-3d.c +2
-0+ iio_push_to_buffers_with_ts(indio_dev, + magn_state-Quoted 1 line
iio_vals,drivers/iio/magnetometer/hid-sensor-magn-3d.c +1
-0+ sizeof(magn_state-Quoted 1 line
iio_vals),drivers/iio/magnetometer/hid-sensor-magn-3d.c +1
-0+ magn_state-Quoted 1 line
timestamp);
magn_state->timestamp= 0;
}drivers/iio/magnetometer/hid-sensor-magn-3d.c +0
-0@@ -379,16 +380,6 @@ static int magn_3d_parse_report(structplatform_device *pdev, return -ENOMEM; }drivers/iio/magnetometer/hid-sensor-magn-3d.c +0
-1-/* attr_count include timestamp channel, and the
iio_vals
should be aligned to 8byte */drivers/iio/magnetometer/hid-sensor-magn-3d.c +0
-2- st->iio_vals = devm_kcalloc(&pdev->dev, - ((attr_count + 1) % 2 +(
attr_count+ 1) / 2) * 2,drivers/iio/magnetometer/hid-sensor-magn-3d.c +0
-4- sizeof(u32), GFP_KERNEL); -if (!st->iio_vals) { - dev_err(&pdev->dev, - "failed to allocate space for iio valuesarray\n");
drivers/iio/magnetometer/hid-sensor-magn-3d.c +0
-3-return -ENOMEM ; - } -for (i = 0,
*chan_count= 0;
i <MAGN_3D_CHANNEL_MAX&&*chan_count<attr_count; i++){drivers/iio/orientation/hid-sensor-incl-3d.c +0
-0@@ -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);drivers/iio/orientation/hid-sensor-incl-3d.c +0
-2- iio_push_to_buffers_with_timestamp(indio_dev, - &incl_state-Quoted 1 line
scan,
drivers/iio/orientation/hid-sensor-incl-3d.c +0
-1- incl_state-Quoted 1 line
timestamp);
drivers/iio/orientation/hid-sensor-incl-3d.c +3
-0+ iio_push_to_buffers_with_ts(indio_dev, + &incl_state->scan, + sizeof(incl_state-Quoted 1 line
scan),
drivers/iio/orientation/hid-sensor-incl-3d.c +1
-0+ incl_state-Quoted 1 line
timestamp);
incl_state->timestamp= 0;
}drivers/iio/position/hid-sensor-custom-intel-hinge.c +0
-0@@ -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);drivers/iio/position/hid-sensor-custom-intel-hinge.c +0
-1- iio_push_to_buffers_with_timestamp(indio_dev,&st-
Quoted 1 line
scan,
drivers/iio/position/hid-sensor-custom-intel-hinge.c +0
-1- st-Quoted 1 line
timestamp);
drivers/iio/position/hid-sensor-custom-intel-hinge.c +1
-0+ iio_push_to_buffers_with_ts(indio_dev, &st-Quoted 1 line
scan,
drivers/iio/position/hid-sensor-custom-intel-hinge.c +1
-0+ sizeof(st->scan),st-
Quoted 1 line
timestamp);
st->timestamp= 0;
}
Re: [PATCH 05/39] iio: hid-sensors: use iio_push_to_buffers_with_ts()
In reply to Jonathan CameronQuoted 6 lines · Jonathan Cameron
Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_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.
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH 6/39 iio: gyro: mpu3050: use iio_push_to_buffers_with_ts()
In reply to Jonathan CameronReplace 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().
---
Cc: Cong Nguyen <[email protected]>
Cc: Ethan Tidmore <[email protected]>
--- drivers/iio/gyro/mpu3050-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/gyro/mpu3050-core.c +1 -1
@@ -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);
Signature · 1 line
2.43.0
PATCH 7/39 iio: imu: bno055: use iio_push_to_buffers_with_ts()
In reply to Jonathan CameronReplace the deprecated iio_push_to_buffers_with_timestamp() with iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
--- drivers/iio/imu/bno055/bno055.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/imu/bno055/bno055.c +2 -2
@@ -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);
Signature · 1 line
2.43.0
Re: [PATCH 07/39] iio: imu: bno055: use iio_push_to_buffers_with_ts()
Quoted 4 lines · On Mon, 26 Oct 2026 16:05:25 -0700 Jonathan Cameron…
Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_push_to_buffers_with_ts(), passing the size of the pushed buffer.Signed-off-by Jonathan Cameron <[email protected]>
More nibbling. Applied 6 and 7.
I should have moved that hid one. Initially I had it incorrectly not using a fixed sized buffer for all cases and so it looked trivial. When I fixed that I failed to shuffle it to later in the series where the more 'interesting' cases lie.
Note there are still a few 'really interesting' cases that I haven't figure out how to deal with at all yet.
Jonathan
Quoted 20 lines
--- drivers/iio/imu/bno055/bno055.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/iio/imu/bno055/bno055.c +2
-2@@ -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);
PATCH 8/39 iio: light: as73211: use iio_push_to_buffers_with_ts()
In reply to Jonathan CameronReplace 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().
---
Cc: Christian Eggers <[email protected]>
Cc: Javier Carrasco <[email protected]>
--- drivers/iio/light/as73211.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/light/as73211.c +2 -1
@@ -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);
Signature · 1 line
2.43.0
Re: [PATCH 08/39] iio: light: as73211: use iio_push_to_buffers_with_ts()
Quoted 17 lines · Jonathan Cameron
Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_push_to_buffers_with_ts(), passing the size of the pushed buffer, which is on the stack and local toas73211_trigger_handler().Signed-off-by Jonathan Cameron <[email protected]>---
Cc: Christian Eggers <[email protected]>
Cc: Javier Carrasco <[email protected]>--- drivers/iio/light/as73211.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/iio/light/as73211.c +0
-0
drivers/iio/light/as73211.c static irqreturn_t as73211_trigger_handler(int irq __always_unused, void *p) · line 702
Quoted 9 lines
drivers/iio/light/as73211.c +2
-1@@ -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);
Jonathan Cameron
maintainerRe: [PATCH 08/39] iio: light: as73211: use iio_push_to_buffers_with_ts()
Quoted 21 lines · On Mon, 26 Oct 2026 21:09:05 -0500 "Javier Carrasco"…
Quoted 20 lines · Jonathan Cameron
Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_push_to_buffers_with_ts(), passing the size of the pushed buffer, which is on the stack and local toas73211_trigger_handler().Signed-off-by Jonathan Cameron <[email protected]>---
Cc: Christian Eggers <[email protected]>
Cc: Javier Carrasco <[email protected]>--- drivers/iio/light/as73211.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/iio/light/as73211.c +0
-0@@ -695,7 +695,8 @@ static irqreturn_t as73211_trigger_handler(int irq __always_unused, void *p) } }
Quoted 8 lines
drivers/iio/light/as73211.c static irqreturn_t as73211_trigger_handler(int irq __always_unused, void *p) · line 702
Quoted 6 lines
drivers/iio/light/as73211.c +2
-1-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 <[email protected]>
Applied thanks,
J
Quoted 1 line
PATCH 9/39 iio: light: vcnl4035: use iio_push_to_buffers_with_ts()
In reply to Jonathan CameronReplace 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().
--- drivers/iio/light/vcnl4035.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/light/vcnl4035.c +2 -2
@@ -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);
Signature · 1 line
2.43.0
PATCH 10/39 iio: pressure: mprls0025pa: use iio_push_to_buffers_with_ts()
In reply to Jonathan CameronReplace 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.
---
Cc: Petre Rodan <[email protected]>
--- drivers/iio/pressure/mprls0025pa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/pressure/mprls0025pa.c +2 -2
@@ -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);
Signature · 1 line
2.43.0
PATCH 11/39 iio: pressure: ms5611: use iio_push_to_buffers_with_ts()
In reply to Jonathan CameronReplace 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().
--- drivers/iio/pressure/ms5611_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/pressure/ms5611_core.c +2 -2
@@ -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);
Signature · 1 line
2.43.0
Jonathan Cameron
maintainerRe: [PATCH 11/39] iio: pressure: ms5611: use iio_push_to_buffers_with_ts()
Quoted 5 lines · On Mon, 26 Oct 2026 16:05:29 -0700 Jonathan Cameron…
Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_push_to_buffers_with_ts(), passing the size of the pushed buffer, which is on the stack and local toms5611_trigger_handler().Signed-off-by Jonathan Cameron <[email protected]>
Applied 9-11. More nibbling away at the set to cut down on what is outstanding.
My own fault of course for sending a large set :(
Jonathan
Quoted 20 lines
--- drivers/iio/pressure/ms5611_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/iio/pressure/ms5611_core.c +2
-2@@ -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);
PATCH 12/39 iio: proximity: isl29501: use iio_push_to_buffers_with_ts()
In reply to Jonathan CameronReplace the deprecated iio_push_to_buffers_with_timestamp() with iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
--- drivers/iio/proximity/isl29501.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/proximity/isl29501.c +2 -1
@@ -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 ;
Signature · 1 line
2.43.0
Re: [PATCH 12/39] iio: proximity: isl29501: use iio_push_to_buffers_with_ts()
Quoted 2 lines · Jonathan Cameron
Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
...
drivers/iio/proximity/isl29501.c static irqreturn_t isl29501_trigger_handler(int irq, void *p) · line 952
Quoted 3 lines
drivers/iio/proximity/isl29501.c +2
-1-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).
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 12/39] iio: proximity: isl29501: use iio_push_to_buffers_with_ts()
Quoted 4 lines · On Tue, 27 Oct 2026 10:22:10 +0200 Andy Shevchenko…
Quoted 2 lines · Jonathan Cameron
Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
Quoted 8 lines
...
drivers/iio/proximity/isl29501.c static irqreturn_t isl29501_trigger_handler(int irq, void *p) · line 952
Quoted 3 lines
drivers/iio/proximity/isl29501.c +2
-1-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).
Tweaked.
I'm also not sure why this one doesn't mention it's local and on the stack so I added that to the commit message whilst applying.
Thanks
Jonathan
PATCH 13/39 iio: proximity: sx9500: use iio_push_to_buffers_with_ts()
In reply to Jonathan CameronReplace 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().
--- drivers/iio/proximity/sx9500.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/proximity/sx9500.c +2 -2
@@ -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);
Signature · 1 line
2.43.0
PATCH 14/39 iio: imu: smi330: use iio_push_to_buffers_with_ts()
In reply to Jonathan CameronReplace the deprecated iio_push_to_buffers_with_timestamp() with iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
---
Cc: Jianping Shen <[email protected]>
--- drivers/iio/imu/smi330/smi330_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/imu/smi330/smi330_core.c +2 -1
@@ -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);
Signature · 1 line
2.43.0
PATCH 15/39 iio: imu: bmi270: use iio_push_to_buffers_with_ts()
In reply to Jonathan CameronReplace the deprecated iio_push_to_buffers_with_timestamp() with iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
---
Cc: Jianping Shen <[email protected]>
Cc: Alex Lanzano <[email protected]>
Cc: Justin Weiss <[email protected]>
--- drivers/iio/imu/bmi270/bmi270_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/imu/bmi270/bmi270_core.c +2 -2
@@ -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 ;
Signature · 1 line
2.43.0
Jonathan Cameron
maintainerRe: [PATCH 15/39] iio: imu: bmi270: use iio_push_to_buffers_with_ts()
Quoted 2 lines · On Mon, 26 Oct 2026 16:05:33 -0700 Jonathan Cameron…
Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
Applied patches 13-15. I think I'll stop there for now as the patches are getting more complex perhaps and should have more review time.
Also, beer o'clock ;)
J
Quoted 26 lines
Signed-off-by Jonathan Cameron <[email protected]>---
Cc: Jianping Shen <[email protected]>
Cc: Alex Lanzano <[email protected]>
Cc: Justin Weiss <[email protected]>--- drivers/iio/imu/bmi270/bmi270_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/iio/imu/bmi270/bmi270_core.c +2
-2@@ -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 ;
PATCH 16/39 iio: imu: inv_icm42600: use iio_push_to_buffers_with_ts()
In reply to Jonathan CameronReplace the deprecated iio_push_to_buffers_with_timestamp() with iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
---
Cc: Jean-Baptiste Maneyrol <[email protected]>
--- 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(-)
drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c +2 -1
@@ -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) {
drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c +2 -1
@@ -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 ;
Signature · 1 line
2.43.0
Re: [PATCH 16/39] iio: imu: inv_icm42600: use iio_push_to_buffers_with_ts()
Quoted 4 lines · On Mon, 26 Oct 2026 16:05:34 -0700 Jonathan Cameron…
Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_push_to_buffers_with_ts(), passing the size of the pushed buffer.Signed-off-by Jonathan Cameron <[email protected]>
Applied. This one is obviously fine as the buffer is right there on the stack in both cases.
Quoted 36 lines
---
Cc: Jean-Baptiste Maneyrol <[email protected]>--- 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(-)drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c +2
-1@@ -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) {drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c +2
-1@@ -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 ;
PATCH 17/39 iio: health: afe4403: use iio_push_to_buffers_with_ts()
In reply to Jonathan CameronReplace 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.
---
Cc: Andrew F. Davis <[email protected]>
--- drivers/iio/health/afe4403.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/iio/health/afe4403.c +4 -6
@@ -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);
Signature · 1 line
2.43.0
Re: [PATCH 17/39] iio: health: afe4403: use iio_push_to_buffers_with_ts()
Quoted 7 lines · Jonathan Cameron
Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_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.
...
drivers/iio/health/afe4403.c static irqreturn_t afe4403_trigger_handler(int irq, void *private) · line 313
Quoted 6 lines
static
irqreturn_tafe4403_trigger_handler(int irq, void *private)drivers/iio/health/afe4403.c +1
-0int 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.
...
drivers/iio/health/afe4403.c static irqreturn_t afe4403_trigger_handler(int irq, void *private) · line 337
Quoted 4 lines
drivers/iio/health/afe4403.c +2
-2-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.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Jonathan Cameron
maintainerRe: [PATCH 17/39] iio: health: afe4403: use iio_push_to_buffers_with_ts()
Quoted 21 lines · On Tue, 27 Oct 2026 10:25:09 +0200 Andy Shevchenko…
Quoted 7 lines · Jonathan Cameron
Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_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....
drivers/iio/health/afe4403.c static irqreturn_t afe4403_trigger_handler(int irq, void *private) · line 313
Quoted 6 lines
static
irqreturn_tafe4403_trigger_handler(int irq, void *private)drivers/iio/health/afe4403.c +1
-0int 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.
Quoted 9 lines
...
drivers/iio/health/afe4403.c static irqreturn_t afe4403_trigger_handler(int irq, void *private) · line 337
Quoted 4 lines
drivers/iio/health/afe4403.c +2
-2-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.
Both done and applied.
Thanks,
J
PATCH 18/39 iio: health: afe4404: use iio_push_to_buffers_with_ts()
In reply to Jonathan CameronReplace 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.
---
Cc: Andrew F. Davis <[email protected]>
--- drivers/iio/health/afe4404.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/iio/health/afe4404.c +4 -5
@@ -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);
Signature · 1 line
2.43.0
Re: [PATCH 18/39] iio: health: afe4404: use iio_push_to_buffers_with_ts()
Quoted 7 lines · Jonathan Cameron
Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_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.
...
drivers/iio/health/afe4404.c static irqreturn_t afe4404_trigger_handler(int irq, void *private) · line 331
Quoted 6 lines
static
irqreturn_tafe4404_trigger_handler(int irq, void *private)drivers/iio/health/afe4404.c +1
-0struct 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.
...
drivers/iio/health/afe4404.c static irqreturn_t afe4404_trigger_handler(int irq, void *private) · line 335
Quoted 4 lines
drivers/iio/health/afe4404.c +1
-1iio_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).
Quoted 3 lines
drivers/iio/health/afe4404.c +0
-0if (ret) goto err; }
...
drivers/iio/health/afe4404.c static irqreturn_t afe4404_trigger_handler(int irq, void *private) · line 341
Quoted 4 lines
drivers/iio/health/afe4404.c +2
-2-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?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Jonathan Cameron
maintainerRe: [PATCH 18/39] iio: health: afe4404: use iio_push_to_buffers_with_ts()
Quoted 39 lines · On Tue, 27 Oct 2026 10:27:23 +0200 Andy Shevchenko…
Quoted 7 lines · Jonathan Cameron
Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_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....
drivers/iio/health/afe4404.c static irqreturn_t afe4404_trigger_handler(int irq, void *private) · line 331
Quoted 6 lines
static
irqreturn_tafe4404_trigger_handler(int irq, void *private)drivers/iio/health/afe4404.c +1
-0struct 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.
...
drivers/iio/health/afe4404.c static irqreturn_t afe4404_trigger_handler(int irq, void *private) · line 335
Quoted 4 lines
drivers/iio/health/afe4404.c +1
-1iio_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).
drivers/iio/health/afe4404.c static irqreturn_t afe4404_trigger_handler(int irq, void *private) · line 338
Quoted 3 lines
drivers/iio/health/afe4404.c +0
-0if (ret) goto err; }
Quoted 9 lines
...
drivers/iio/health/afe4404.c static irqreturn_t afe4404_trigger_handler(int irq, void *private) · line 341
Quoted 4 lines
drivers/iio/health/afe4404.c +2
-2-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?
All tweaks made and applied.
J
PATCH 19/39 iio: adc: ad799x: use iio_push_to_buffers_with_ts()
In reply to Jonathan CameronReplace 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().
---
Cc: Archit Anant <[email protected]>
Cc: Stefano Manni <[email protected]>
--- drivers/iio/adc/ad799x.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/iio/adc/ad799x.c +4 -5
@@ -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);
Signature · 1 line
2.43.0
Re: [PATCH 19/39] iio: adc: ad799x: use iio_push_to_buffers_with_ts()
Quoted 5 lines · Jonathan Cameron
Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_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 viaIIO_DECLARE_BUFFER_WITH_TS().
...
drivers/iio/adc/ad799x.c static irqreturn_t ad799x_trigger_handler(int irq, void *p) · line 225
Quoted 4 lines
drivers/iio/adc/ad799x.c +1
-1b_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).
Signature · 2 lines
With Best Regards, Andy Shevchenko
Jonathan Cameron
maintainerRe: [PATCH 19/39] iio: adc: ad799x: use iio_push_to_buffers_with_ts()
Quoted 16 lines · On Tue, 27 Oct 2026 10:29:57 +0200 Andy Shevchenko…
Quoted 5 lines · Jonathan Cameron
Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_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 viaIIO_DECLARE_BUFFER_WITH_TS()....
drivers/iio/adc/ad799x.c static irqreturn_t ad799x_trigger_handler(int irq, void *p) · line 225
Quoted 4 lines
drivers/iio/adc/ad799x.c +1
-1b_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
Quoted 7 lines
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).
Tweaked and applied.
Thanks,
J
PATCH 20/39 iio: common: scmi_sensors: use iio_push_to_buffers_with_ts()
In reply to Jonathan CameronReplace 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.
---
Cc: Jyoti Bhayana <[email protected]>
--- drivers/iio/common/scmi_sensors/scmi_iio.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/iio/common/scmi_sensors/scmi_iio.c +3 -4
@@ -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 ; }
Signature · 1 line
2.43.0
Re: [PATCH 20/39] iio: common: scmi_sensors: use iio_push_to_buffers_with_ts()
Quoted 10 lines · On Mon, 26 Oct 2026 16:05:38 -0700 Jonathan Cameron…
Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_push_to_buffers_with_ts(), passing the size of the pushed buffer.Replace the manually sized
iio_bufarray withIIO_DECLARE_BUFFER_WITH_TS()so that the timestamp space and alignment are handled consistently with other drivers.Signed-off-by Jonathan Cameron <[email protected]>---
Cc: Jyoti Bhayana <[email protected]>
Applied,
PATCH 21/39 iio: adc: ad7766: use iio_push_to_buffers_with_ts()
In reply to Jonathan CameronReplace the deprecated iio_push_to_buffers_with_timestamp() with iio_push_to_buffers_with_ts().
Replace the data buffer with one declared viaIIO_DECLARE_DMA_BUFFER_WITH_TS().
---
Cc: Sebastian Andrzej Siewior <[email protected]>
--- drivers/iio/adc/ad7766.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
drivers/iio/adc/ad7766.c +4 -10
@@ -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);
Signature · 1 line
2.43.0
Re: [PATCH 21/39] iio: adc: ad7766: use iio_push_to_buffers_with_ts()
Quoted 10 lines · On Mon, 26 Oct 2026 16:05:39 -0700 Jonathan Cameron…
Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_push_to_buffers_with_ts().Replace the data buffer with one declared via
IIO_DECLARE_DMA_BUFFER_WITH_TS().Signed-off-by Jonathan Cameron <[email protected]>---
Cc: Sebastian Andrzej Siewior <[email protected]>
Applied.
PATCH 22/39 iio: imu: smi240: use iio_push_to_buffers_with_ts()
In reply to Jonathan CameronReplace 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().
---
Cc: Shen Jianping <[email protected]>
--- drivers/iio/imu/smi240.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-)
drivers/iio/imu/smi240.c +3 -10
@@ -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);
Signature · 1 line
2.43.0
Re: [PATCH 22/39] iio: imu: smi240: use iio_push_to_buffers_with_ts()
Quoted 9 lines · On Mon, 26 Oct 2026 16:05:40 -0700 Jonathan Cameron…
Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_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 viaIIO_DECLARE_BUFFER_WITH_TS().Signed-off-by Jonathan Cameron <[email protected]>---
Cc: Shen Jianping <[email protected]>
Applied.
PATCH 23/39 iio: adc: cc10001_adc: use iio_push_to_buffers_with_ts()
In reply to Jonathan CameronReplace 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.
--- drivers/iio/adc/cc10001_adc.c | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-)
drivers/iio/adc/cc10001_adc.c +3 -19
@@ -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,
Signature · 1 line
2.43.0
Re: [PATCH 23/39] iio: adc: cc10001_adc: use iio_push_to_buffers_with_ts()
Quoted 6 lines · Jonathan Cameron
Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_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 viaIIO_DECLARE_BUFFER_WITH_TS(), removing the now unneededupdate_scan_mode()callback.
...
drivers/iio/adc/cc10001_adc.c static irqreturn_t cc10001_adc_trigger_h(int irq, void *p) · line 142
Quoted 7 lines
static
irqreturn_tcc10001_adc_trigger_h(int irq, void *p)drivers/iio/adc/cc10001_adc.c +1
-1unsigned 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?
Quoted 1 line
int i;
Signature · 2 lines
With Best Regards, Andy Shevchenko
Jonathan Cameron
maintainerRe: [PATCH 23/39] iio: adc: cc10001_adc: use iio_push_to_buffers_with_ts()
Quoted 12 lines · On Tue, 27 Oct 2026 10:32:22 +0200 Andy Shevchenko…
Quoted 6 lines · Jonathan Cameron
Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_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 viaIIO_DECLARE_BUFFER_WITH_TS(), removing the now unneededupdate_scan_mode()callback....
Quoted 1 line
static
irqreturn_tcc10001_adc_trigger_h(int irq, void *p)
Quoted 7 lines
drivers/iio/adc/cc10001_adc.c static irqreturn_t cc10001_adc_trigger_h(int irq, void *p) · line 142
Quoted 5 lines
drivers/iio/adc/cc10001_adc.c +1
-1unsigned 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?
Tweaked whilst applying
Thanks,
Jonathan
Quoted 3 lines
Quoted 2 lines
int i;
PATCH 24/39 iio: adc: hx711: use iio_push_to_buffers_with_ts()
In reply to Jonathan CameronReplace 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().
---
Cc: Piyush Patle <[email protected]>
--- drivers/iio/adc/hx711.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-)
drivers/iio/adc/hx711.c +7 -14
@@ -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);
Signature · 1 line
2.43.0
Re: [PATCH 24/39] iio: adc: hx711: use iio_push_to_buffers_with_ts()
Quoted 4 lines · Jonathan Cameron
Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_push_to_buffers_with_ts(), passing the size of the pushed buffer.Move the buffer onto the stack, local to
hx711_trigger().
...
drivers/iio/adc/hx711.c static irqreturn_t hx711_trigger(int irq, void *p) · line 406
Quoted 4 lines
drivers/iio/adc/hx711.c +2
-2-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?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Jonathan Cameron
maintainerRe: [PATCH 24/39] iio: adc: hx711: use iio_push_to_buffers_with_ts()
Quoted 6 lines · On Tue, 27 Oct 2026 10:33:47 +0200 Andy Shevchenko…
Quoted 4 lines · Jonathan Cameron
Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_push_to_buffers_with_ts(), passing the size of the pushed buffer.Move the buffer onto the stack, local to
hx711_trigger().
Quoted 9 lines
...
drivers/iio/adc/hx711.c static irqreturn_t hx711_trigger(int irq, void *p) · line 406
Quoted 4 lines
drivers/iio/adc/hx711.c +2
-2-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?
Tweaked and applied.
PATCH 25/39 iio: potentiostat: lmp91000: use iio_push_to_buffers_with_ts() with a scan struct on stack
In reply to Jonathan CameronMove 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.
--- drivers/iio/potentiostat/lmp91000.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/iio/potentiostat/lmp91000.c +8 -7
@@ -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);
Signature · 1 line
2.43.0
Jonathan Cameron
AppliedRe: [PATCH 25/39] iio: potentiostat: lmp91000: use iio_push_to_buffers_with_ts() with a scan struct on stack
Quoted 7 lines · On Mon, 26 Oct 2026 16:05:43 -0700 Jonathan Cameron…
Move the scan buffer out of struct
lmp91000_dataand make it local tolmp91000_buffer_handler(), as it has no need to persist between calls.Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_push_to_buffers_with_ts(), passing the size of the pushed buffer.Signed-off-by Jonathan Cameron <[email protected]>
Applied.
Quoted 42 lines
--- drivers/iio/potentiostat/lmp91000.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)drivers/iio/potentiostat/lmp91000.c +8
-7@@ -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);
PATCH 26/39 iio: humidity: am2315: use iio_push_to_buffers_with_ts() with a scan struct on stack
In reply to Jonathan CameronMove 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.
---
Cc: Nicolás Antinori <[email protected]>
--- drivers/iio/humidity/am2315.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-)
drivers/iio/humidity/am2315.c +10 -13
@@ -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 ;
Signature · 1 line
2.43.0
Re: [PATCH 26/39] iio: humidity: am2315: use iio_push_to_buffers_with_ts() with a scan struct on stack
Quoted 6 lines · Jonathan Cameron
Move the scan buffer out of struct
am2315_dataand make it local toam2315_trigger_handler(), as it has no need to persist between calls. This also removes the need to holddata->lockwhile filling it in.Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
...
drivers/iio/humidity/am2315.c static irqreturn_t am2315_trigger_handler(int irq, void *p) · line 187
Quoted 6 lines
drivers/iio/humidity/am2315.c +2
-2i =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.
Quoted 2 lines
(quoted diff) +0
-0i++; }
...
drivers/iio/humidity/am2315.c static irqreturn_t am2315_trigger_handler(int irq, void *p) · line 193
Quoted 4 lines
drivers/iio/humidity/am2315.c +2
-2-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?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 26/39] iio: humidity: am2315: use iio_push_to_buffers_with_ts() with a scan struct on stack
In reply to Jonathan CameronQuoted 8 lines · Jonathan Cameron
Move the scan buffer out of struct
am2315_dataand make it local toam2315_trigger_handler(), as it has no need to persist between calls. This also removes the need to holddata->lockwhile filling it in.Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_push_to_buffers_with_ts(), passing the size of the pushed buffer.Signed-off-by Jonathan Cameron <[email protected]>
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.
Re: [PATCH 26/39] iio: humidity: am2315: use iio_push_to_buffers_with_ts() with a scan struct on stack
Quoted 16 lines · On Tue, 27 Oct 2026 13:13:13 -0300 Nicolás Antinori…
Quoted 8 lines · Jonathan Cameron
Move the scan buffer out of struct
am2315_dataand make it local toam2315_trigger_handler(), as it has no need to persist between calls. This also removes the need to holddata->lockwhile filling it in.Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_push_to_buffers_with_ts(), passing the size of the pushed buffer.Signed-off-by Jonathan Cameron <[email protected]>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
Quoted 6 lines
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 <[email protected]>
Thanks!
Applied
J
PATCH 27/39 iio: humidity: hdc100x: use iio_push_to_buffers_with_ts() with a scan struct on stack
In reply to Jonathan CameronMove 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.
--- drivers/iio/humidity/hdc100x.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/iio/humidity/hdc100x.c +7 -8
@@ -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);
Signature · 1 line
2.43.0
Re: [PATCH 27/39] iio: humidity: hdc100x: use iio_push_to_buffers_with_ts() with a scan struct on stack
Quoted 9 lines · On Mon, 26 Oct 2026 16:05:45 -0700 Jonathan Cameron…
Move the scan buffer out of struct
hdc100x_dataand make it local tohdc100x_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()withiio_push_to_buffers_with_ts(), passing the size of the pushed buffer.Signed-off-by Jonathan Cameron <[email protected]>
Applied.
PATCH 28/39 iio: imu: bmi323: use iio_push_to_buffers_with_ts()
In reply to Jonathan CameronReplace 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.
--- drivers/iio/imu/bmi323/bmi323_core.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-)
drivers/iio/imu/bmi323/bmi323_core.c +9 -11
@@ -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);
Signature · 1 line
2.43.0
Re: [PATCH 28/39] iio: imu: bmi323: use iio_push_to_buffers_with_ts()
Quoted 9 lines · On Mon, 26 Oct 2026 16:05:46 -0700 Jonathan Cameron…
Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_push_to_buffers_with_ts(), passing the size of the pushed buffer.Also replace the two
for_each_set_bit()loops overindio_dev->active_scan_maskwith the equivalentiio_for_each_active_channel()helper and remove local variable that did not help readability.Signed-off-by Jonathan Cameron <[email protected]>
Applied.
PATCH 29/39 iio: gyro: fxas21002c: restrict available_scan_masks to all angular velocity channels
In reply to Jonathan Cameronfxas21002c_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.
--- drivers/iio/gyro/fxas21002c_core.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/iio/gyro/fxas21002c_core.c +6 -0
@@ -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;
Signature · 1 line
2.43.0
PATCH 30/39 iio: gyro: fxas21002c: use iio_push_to_buffers_with_ts() with explicit structure
In reply to Jonathan CameronReplace 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.
--- drivers/iio/gyro/fxas21002c_core.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-)
drivers/iio/gyro/fxas21002c_core.c +14 -11
@@ -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);
Signature · 1 line
2.43.0
Jonathan Cameron
maintainerRe: [PATCH 30/39] iio: gyro: fxas21002c: use iio_push_to_buffers_with_ts() with explicit structure
Quoted 11 lines · On Mon, 26 Oct 2026 16:05:48 -0700 Jonathan Cameron…
Replace the s16 buffer[8] with a struct containing the 3 channels followed by an
aligned_s64timestamp, named scan.Correct the channel array type to
__be16to match the declaredscan_type.Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_push_to_buffers_with_ts(), passing the size of the pushed buffer, which is a structure within theiio_priv()data.Signed-off-by Jonathan Cameron <[email protected]>
Applied 29 and 30. Some fuzz due to crossing with Brian's runtime pm work. Just line number changes so should be clean.
Thanks,
Jonathan
PATCH 31/39 iio: adc: ad7887: ensure tx_cmd_buf is DMA safe
In reply to Jonathan CameronSPI 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.
--- drivers/iio/adc/ad7887.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/ad7887.c +1 -1
@@ -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
Signature · 1 line
2.43.0
Re: [PATCH 31/39] iio: adc: ad7887: ensure tx_cmd_buf is DMA safe
Quoted 9 lines · On Mon, 26 Oct 2026 16:05:49 -0700 Jonathan Cameron…
SPI transfers require DMA safe buffers. Mark
tx_cmd_bufwith__aligned(IIO_DMA_MINALIGN)to ensure it does not share a cache line with other data.
tx_cmd_bufcould 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 <[email protected]>
Applied.
Quoted 18 lines
--- drivers/iio/adc/ad7887.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/adc/ad7887.c +1
-1@@ -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
PATCH 32/39 iio: adc: ad7887: use iio_push_to_buffers_with_ts()
In reply to Jonathan CameronReplace 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.
---
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(-)
drivers/iio/adc/ad7887.c +6 -12
@@ -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 ;
Signature · 1 line
2.43.0
Re: [PATCH 32/39] iio: adc: ad7887: use iio_push_to_buffers_with_ts()
Quoted 8 lines · Jonathan Cameron
Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_push_to_buffers_with_ts(), passing the size of the pushed buffer, which is a structure within theiio_priv()data.Replace the data buffer with one declared via
IIO_DECLARE_DMA_BUFFER_WITH_TS(), for 2__be16channels.Use
be16_to_cpu()to replace the opencoded equivalent.
...
Quoted 2 lines
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.
...
drivers/iio/adc/ad7887.c static int ad7887_scan_direct(struct ad7887_state *st, unsigned ch) · line 135
Quoted 2 lines
drivers/iio/adc/ad7887.c +1
-1-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.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 32/39] iio: adc: ad7887: use iio_push_to_buffers_with_ts()
Quoted 19 lines · On Tue, 27 Oct 2026 12:24:14 +0200 Andy Shevchenko…
Quoted 8 lines · Jonathan Cameron
Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_push_to_buffers_with_ts(), passing the size of the pushed buffer, which is a structure within theiio_priv()data.Replace the data buffer with one declared via
IIO_DECLARE_DMA_BUFFER_WITH_TS(), for 2__be16channels.Use
be16_to_cpu()to replace the opencoded equivalent....
Quoted 2 lines
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.
Quoted 8 lines
...
drivers/iio/adc/ad7887.c static int ad7887_scan_direct(struct ad7887_state *st, unsigned ch) · line 135
Quoted 2 lines
drivers/iio/adc/ad7887.c +1
-1-return (st->data[(ch *2 )] <<8 ) | st->data[(ch *2 ) +1 ]; +return be16_to_cpu (st->data[ch]);Add
asm/byteorder.hinto 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).
Signature · 2 lines
Kind regards, Joshua Crofts
Jonathan Cameron
maintainerRe: [PATCH 32/39] iio: adc: ad7887: use iio_push_to_buffers_with_ts()
Quoted 22 lines · On Tue, 27 Oct 2026 12:46:29 +0100 Joshua Crofts <[email protected]> wrote:
Quoted 19 lines · On Tue, 27 Oct 2026 12:24:14 +0200 Andy Shevchenko…
Quoted 8 lines · Jonathan Cameron
Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_push_to_buffers_with_ts(), passing the size of the pushed buffer, which is a structure within theiio_priv()data.Replace the data buffer with one declared via
IIO_DECLARE_DMA_BUFFER_WITH_TS(), for 2__be16channels.Use
be16_to_cpu()to replace the opencoded equivalent....
Quoted 2 lines
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.
Quoted 7 lines
Quoted 7 lines
...
drivers/iio/adc/ad7887.c static int ad7887_scan_direct(struct ad7887_state *st, unsigned ch) · line 135
Quoted 2 lines
drivers/iio/adc/ad7887.c +1
-1-return (st->data[(ch *2 )] <<8 ) | st->data[(ch *2 ) +1 ]; +return be16_to_cpu (st->data[ch]);Add
asm/byteorder.hinto include block. And yes, the include block is a mess in this driver.
Done.
Quoted 5 lines
Quoted 1 line
I will probably do a series removing
kernel.hfrom a subset of drivers in IIO again (it's really painful though).
That one can be a long term project. It's nice to have as cuts down on wrong choices in new drivers (via cut and paste), but it is isolated to each individual driver so the blast radius of bad includes isn't huge!
Jonathan
PATCH 33/39 iio: humidity: hts221: align scan buffer for DMA safety
In reply to Jonathan Cameronhw->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).
---
Cc: Adi Nata <[email protected]>
--- drivers/iio/humidity/hts221.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/humidity/hts221.h +1 -1
@@ -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;
Signature · 1 line
2.43.0
PATCH 34/39 iio: humidity: hts221: use iio_push_to_buffers_with_ts()
In reply to Jonathan CameronReplace the deprecated iio_push_to_buffers_with_timestamp() with iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
---
Cc: Adi Nata <[email protected]>
--- drivers/iio/humidity/hts221_buffer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/humidity/hts221_buffer.c +2 -2
@@ -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);
Signature · 1 line
2.43.0
Jonathan Cameron
maintainerRe: [PATCH 34/39] iio: humidity: hts221: use iio_push_to_buffers_with_ts()
Quoted 6 lines · On Mon, 26 Oct 2026 16:05:52 -0700 Jonathan Cameron…
Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_push_to_buffers_with_ts(), passing the size of the pushed buffer.Signed-off-by Jonathan Cameron <[email protected]>---
Cc: Adi Nata <[email protected]>
Applied 33 and 34.
Thanks,
PATCH 35/39 iio: accel: bmc150-accel-core: use iio_push_to_buffers_with_ts()
In reply to Jonathan CameronReplace 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.
--- drivers/iio/accel/bmc150-accel-core.c | 12 ++++++------ drivers/iio/accel/bmc150-accel.h | 1 - 2 files changed, 6 insertions(+), 7 deletions(-)
drivers/iio/accel/bmc150-accel-core.c +6 -6
@@ -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 ;
drivers/iio/accel/bmc150-accel.h +0 -1
@@ -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
Signature · 1 line
2.43.0
Re: [PATCH 35/39] iio: accel: bmc150-accel-core: use iio_push_to_buffers_with_ts()
Quoted 9 lines · Jonathan Cameron
Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_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
__le16to match the scan buffer's channels array. Widen the mutex-held region to cover the use of scan.
...
drivers/iio/accel/bmc150-accel.h struct bmc150_accel_data { · line 67
Quoted 2 lines
drivers/iio/accel/bmc150-accel.h +0
-1u8 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").
Signature · 2 lines
With Best Regards, Andy Shevchenko
Jonathan Cameron
maintainerRe: [PATCH 35/39] iio: accel: bmc150-accel-core: use iio_push_to_buffers_with_ts()
Quoted 20 lines · On Tue, 27 Oct 2026 12:27:56 +0200 Andy Shevchenko…
Quoted 9 lines · Jonathan Cameron
Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_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
__le16to match the scan buffer's channels array. Widen the mutex-held region to cover the use of scan....
drivers/iio/accel/bmc150-accel.h struct bmc150_accel_data { · line 67
Quoted 2 lines
drivers/iio/accel/bmc150-accel.h +0
-1u8 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).
Quoted 3 lines
It might be this one
8c5f649119f4("iio: accel: kionix-kx022a: use scan struct for one-shot and trigger reads").
There was indeed a discussion for this driver that touched on this for this driver. That also included a dma safety fix that I don't have here!
https://lore.kernel.org/all/[email protected]/
+CC Yash in case they intend to come back to this topic.
If not I'll come back to this one when I get to the nasty conversions and come up with a combination of Yash's series and the interface change this one is focused on.
Thanks and impressive memory given how many similar patches we've had come past recently!
Jonathan
PATCH 36/39 iio: common: cros_ec_sensors: use iio_push_to_buffers_with_ts()
In reply to Jonathan CameronReplace 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.
---
Cc: Cheng-Yi Chiang <[email protected]>
Cc: Tzung-Bi Shih <[email protected]>
Cc: Guenter Roeck <[email protected]>
--- .../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(-)
drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c +11 -13
@@ -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:/*
include/linux/iio/common/cros_ec_sensors_core.h +7 -11
@@ -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);
Signature · 1 line
2.43.0
Re: [PATCH 36/39] iio: common: cros_ec_sensors: use iio_push_to_buffers_with_ts()
Quoted 11 lines · Jonathan Cameron
Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_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_SIZEsize calculation and the casts used to access it as an array of s16.Signed-off-by Jonathan Cameron <[email protected]>
The patch looks good to me. Just a minor note below.
Quoted 1 line
drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c +0
-0
...
drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c int cros_ec_sensors_push_data(struct iio_dev *indio_dev, · line 196
Quoted 12 lines
drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c +3
-5@@ -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.
Jonathan Cameron
maintainerRe: [PATCH 36/39] iio: common: cros_ec_sensors: use iio_push_to_buffers_with_ts()
Quoted 23 lines · On Tue, 27 Oct 2026 03:19:03 +0000 Tzung-Bi Shih <[email protected]> wrote:
Quoted 11 lines · Jonathan Cameron
Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_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_SIZEsize calculation and the casts used to access it as an array of s16.Signed-off-by Jonathan Cameron <[email protected]>The patch looks good to me. Just a minor note below.
Reviewed-by Tzung-Bi Shih <[email protected]>Quoted 1 line
drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c +0
-0...
Quoted 4 lines
drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c +0
-0@@ -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 ;
Quoted 12 lines
drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c int cros_ec_sensors_push_data(struct iio_dev *indio_dev, · line 196
Quoted 8 lines
drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c +3
-5- 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.
It might be a good idea to add a sanity check for that, but job for another day.
Applied this one with the tweak that Andy requested.
Thanks,
Jonathan
Re: [PATCH 36/39] iio: common: cros_ec_sensors: use iio_push_to_buffers_with_ts()
In reply to Jonathan CameronQuoted 9 lines · Jonathan Cameron
Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_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_SIZEsize calculation and the casts used to access it as an array of s16.
...
drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c irqreturn_t cros_ec_sensors_capture(int irq, void *p)
Quoted 6 lines
drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c +2
-2-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.
Quoted 1 line
drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c +1
-0+ iio_get_time_ns(indio_dev));
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH 37/39 iio: common: ssp_sensors: use iio_push_to_buffers_with_ts()
In reply to Jonathan CameronReplace the deprecated iio_push_to_buffers_with_timestamp() with iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
--- drivers/iio/common/ssp_sensors/ssp_iio.c | 28 ++++++++-------------------- include/linux/iio/common/ssp_sensors.h | 2 -- 2 files changed, 8 insertions(+), 22 deletions(-)
drivers/iio/common/ssp_sensors/ssp_iio.c +8 -20
@@ -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" );
include/linux/iio/common/ssp_sensors.h +0 -2
@@ -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,
Signature · 1 line
2.43.0
Re: [PATCH 37/39] iio: common: ssp_sensors: use iio_push_to_buffers_with_ts()
Quoted 4 lines · On Mon, 26 Oct 2026 16:05:55 -0700 Jonathan Cameron…
Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_push_to_buffers_with_ts(), passing the size of the pushed buffer.Signed-off-by Jonathan Cameron <[email protected]>
Applied.
PATCH 38/39 iio: imu: st_lsm6dsx: use iio_push_to_buffers_with_ts()
In reply to Jonathan CameronReplace the deprecated iio_push_to_buffers_with_timestamp() with iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
---
Cc: Francesco Lavra <[email protected]>
Cc: Lorenzo Bianconi <[email protected]>
--- 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(-)
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c +10 -7
@@ -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); } }
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c +3 -2
@@ -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 ;
Signature · 1 line
2.43.0
Re: [PATCH 38/39] iio: imu: st_lsm6dsx: use iio_push_to_buffers_with_ts()
Quoted 4 lines · Jonathan Cameron
Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_push_to_buffers_with_ts(), passing the size of the pushed buffer.Signed-off-by Jonathan Cameron <[email protected]>
Re: [PATCH 38/39] iio: imu: st_lsm6dsx: use iio_push_to_buffers_with_ts()
In reply to Jonathan CameronQuoted 2 lines · Jonathan Cameron
Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
...
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c int st_lsm6dsx_read_fifo(struct st_lsm6dsx_hw *hw) · line 503
Quoted 9 lines
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c +2
-1if (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.
Quoted 2 lines
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c +0
-0gyro_sip--; }
Signature · 2 lines
With Best Regards, Andy Shevchenko
Jonathan Cameron
maintainerRe: [PATCH 38/39] iio: imu: st_lsm6dsx: use iio_push_to_buffers_with_ts()
Quoted 6 lines · On Tue, 27 Oct 2026 12:55:31 +0200 Andy Shevchenko…
Quoted 2 lines · Jonathan Cameron
Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_push_to_buffers_with_ts(), passing the size of the pushed buffer....
Quoted 12 lines
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c int st_lsm6dsx_read_fifo(struct st_lsm6dsx_hw *hw) · line 503
Quoted 9 lines
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c +2
-1if (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.
True. Maybe worth someone taking a look.
Applied this one.
Thanks,
Jonathan
Quoted 4 lines
Quoted 3 lines
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c +0
-0gyro_sip--; }
PATCH 39/39 iio: imu: bmi160: use iio_push_to_buffers_with_ts()
In reply to Jonathan CameronReplace 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.
--- drivers/iio/imu/bmi160/bmi160.h | 7 ------- drivers/iio/imu/bmi160/bmi160_core.c | 6 ++++-- 2 files changed, 4 insertions(+), 9 deletions(-)
drivers/iio/imu/bmi160/bmi160.h +0 -7
@@ -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;
drivers/iio/imu/bmi160/bmi160_core.c +4 -2
@@ -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 ;
Signature · 1 line
2.43.0
Re: [PATCH 39/39] iio: imu: bmi160: use iio_push_to_buffers_with_ts()
Quoted 6 lines · Jonathan Cameron
Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_push_to_buffers_with_ts(), passing the size of the pushed buffer.Move the scan buffer off struct
bmi160_dataand onto the stack ofbmi160_trigger_handler()as a zero-initializedIIO_DECLARE_BUFFER_WITH_TS()array, since it is only ever used locally within that function.
...
drivers/iio/imu/bmi160/bmi160_core.c static irqreturn_t bmi160_trigger_handler(int irq, void *p) · line 448
Quoted 3 lines
drivers/iio/imu/bmi160/bmi160_core.c +2
-1-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?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Jonathan Cameron
maintainerRe: [PATCH 39/39] iio: imu: bmi160: use iio_push_to_buffers_with_ts()
Quoted 8 lines · On Tue, 27 Oct 2026 12:56:10 +0200 Andy Shevchenko…
Quoted 6 lines · Jonathan Cameron
Replace the deprecated
iio_push_to_buffers_with_timestamp()withiio_push_to_buffers_with_ts(), passing the size of the pushed buffer.Move the scan buffer off struct
bmi160_dataand onto the stack ofbmi160_trigger_handler()as a zero-initializedIIO_DECLARE_BUFFER_WITH_TS()array, since it is only ever used locally within that function.
Quoted 8 lines
...
drivers/iio/imu/bmi160/bmi160_core.c static irqreturn_t bmi160_trigger_handler(int irq, void *p) · line 448
Quoted 3 lines
drivers/iio/imu/bmi160/bmi160_core.c +2
-1-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?
Tweaked and applied.
Thanks for casting your eagle eyes over these!
Jonathan
Quoted 13 lines · Jonathan Cameron
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()withiio_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.
Quoted 7 lines
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.
assuming we get a positive feedback from Srinivas on testing HID sensors case.
Signature · 2 lines
With Best Regards, Andy Shevchenko