Linux IIO development
 help / color / mirror / Atom feed
From: srinivas pandruvada <srinivas.pandruvada@linux.intel.com>
To: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>,
	 linux-iio@vger.kernel.org
Cc: "David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Jiri Kosina" <jikos@kernel.org>,
	"Zhang Lixu" <lixu.zhang@intel.com>
Subject: Re: [PATCH 05/39] iio: hid-sensors: use iio_push_to_buffers_with_ts()
Date: Mon, 26 Oct 2026 17:06:23 -0700	[thread overview]
Message-ID: <60eab26805ad63d1b39d80fb9a47b0ba9bb5789d.camel@linux.intel.com> (raw)
In-Reply-To: <20261026-iio-v1-5-8b136778eedf@oss.qualcomm.com>

On Mon, 2026-10-26 at 16:05 -0700, Jonathan Cameron wrote:
> Replace the deprecated iio_push_to_buffers_with_timestamp() with
> iio_push_to_buffers_with_ts(), passing the size of the pushed buffer.
> 
> For hid-sensor-magn-3d, use IIO_DECLARE_BUFFER_WITH_TS() to suize the
> buffer for the maximum number of channels supported avoiding need
> for separate allocation.
> 
> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>

LGTM.
I will do some quick test on this and let you know.

Thanks,
Srinivas

> ---
> Cc: Jiri Kosina <jikos@kernel.org>
> Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> Cc: Zhang Lixu <lixu.zhang@intel.com>
> ---
>  drivers/iio/gyro/hid-sensor-gyro-3d.c               |  5 +++--
>  drivers/iio/humidity/hid-sensor-humidity.c          |  5 +++--
>  drivers/iio/magnetometer/hid-sensor-magn-3d.c       | 21 ++++++-----
> ----------
>  drivers/iio/orientation/hid-sensor-incl-3d.c        |  7 ++++---
>  .../iio/position/hid-sensor-custom-intel-hinge.c    |  4 ++--
>  5 files changed, 18 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/iio/gyro/hid-sensor-gyro-3d.c
> b/drivers/iio/gyro/hid-sensor-gyro-3d.c
> index 66778315e86d..083e82cf561c 100644
> --- a/drivers/iio/gyro/hid-sensor-gyro-3d.c
> +++ b/drivers/iio/gyro/hid-sensor-gyro-3d.c
> @@ -182,8 +182,9 @@ static int gyro_3d_proc_event(struct
> hid_sensor_hub_device *hsdev,
>  		if (!gyro_state->timestamp)
>  			gyro_state->timestamp =
> iio_get_time_ns(indio_dev);
>  
> -		iio_push_to_buffers_with_timestamp(indio_dev,
> &gyro_state->scan,
> -						   gyro_state-
> >timestamp);
> +		iio_push_to_buffers_with_ts(indio_dev, &gyro_state-
> >scan,
> +					    sizeof(gyro_state-
> >scan),
> +					    gyro_state->timestamp);
>  
>  		gyro_state->timestamp = 0;
>  	}
> diff --git a/drivers/iio/humidity/hid-sensor-humidity.c
> b/drivers/iio/humidity/hid-sensor-humidity.c
> index 12c88efe66be..c09986346c8f 100644
> --- a/drivers/iio/humidity/hid-sensor-humidity.c
> +++ b/drivers/iio/humidity/hid-sensor-humidity.c
> @@ -132,8 +132,9 @@ static int humidity_proc_event(struct
> hid_sensor_hub_device *hsdev,
>  	struct hid_humidity_state *humid_st = iio_priv(indio_dev);
>  
>  	if (atomic_read(&humid_st->common_attributes.data_ready))
> -		iio_push_to_buffers_with_timestamp(indio_dev,
> &humid_st->scan,
> -						  
> iio_get_time_ns(indio_dev));
> +		iio_push_to_buffers_with_ts(indio_dev, &humid_st-
> >scan,
> +					    sizeof(humid_st->scan),
> +					   
> iio_get_time_ns(indio_dev));
>  
>  	return 0;
>  }
> diff --git a/drivers/iio/magnetometer/hid-sensor-magn-3d.c
> b/drivers/iio/magnetometer/hid-sensor-magn-3d.c
> index c8b4fa7785c9..f869560b47fc 100644
> --- a/drivers/iio/magnetometer/hid-sensor-magn-3d.c
> +++ b/drivers/iio/magnetometer/hid-sensor-magn-3d.c
> @@ -37,8 +37,8 @@ struct magn_3d_state {
>  	struct hid_sensor_common rot_attributes;
>  	struct hid_sensor_hub_attribute_info
> magn[MAGN_3D_CHANNEL_MAX];
>  
> -	/* dynamically sized array to hold sensor values */
> -	u32 *iio_vals;
> +	/* array sized to hold maximum set of sensor values */
> +	IIO_DECLARE_BUFFER_WITH_TS(u32, iio_vals,
> MAGN_3D_CHANNEL_MAX);
>  	/* array of pointers to sensor value */
>  	u32 *magn_val_addr[MAGN_3D_CHANNEL_MAX];
>  
> @@ -275,9 +275,10 @@ static int magn_3d_proc_event(struct
> hid_sensor_hub_device *hsdev,
>  		if (!magn_state->timestamp)
>  			magn_state->timestamp =
> iio_get_time_ns(indio_dev);
>  
> -		iio_push_to_buffers_with_timestamp(indio_dev,
> -						   magn_state-
> >iio_vals,
> -						   magn_state-
> >timestamp);
> +		iio_push_to_buffers_with_ts(indio_dev,
> +					    magn_state->iio_vals,
> +					    sizeof(magn_state-
> >iio_vals),
> +					    magn_state->timestamp);
>  		magn_state->timestamp = 0;
>  	}
>  
> @@ -379,16 +380,6 @@ static int magn_3d_parse_report(struct
> platform_device *pdev,
>  		return -ENOMEM;
>  	}
>  
> -	/* attr_count include timestamp channel, and the iio_vals
> should be aligned to 8byte */
> -	st->iio_vals = devm_kcalloc(&pdev->dev,
> -				    ((attr_count + 1) % 2 +
> (attr_count + 1) / 2) * 2,
> -				    sizeof(u32), GFP_KERNEL);
> -	if (!st->iio_vals) {
> -		dev_err(&pdev->dev,
> -			"failed to allocate space for iio values
> array\n");
> -		return -ENOMEM;
> -	}
> -
>  	for (i = 0, *chan_count = 0;
>  	i < MAGN_3D_CHANNEL_MAX && *chan_count < attr_count;
>  	i++){
> diff --git a/drivers/iio/orientation/hid-sensor-incl-3d.c
> b/drivers/iio/orientation/hid-sensor-incl-3d.c
> index b5f70732d035..3880e479a499 100644
> --- a/drivers/iio/orientation/hid-sensor-incl-3d.c
> +++ b/drivers/iio/orientation/hid-sensor-incl-3d.c
> @@ -194,9 +194,10 @@ static int incl_3d_proc_event(struct
> hid_sensor_hub_device *hsdev,
>  		if (!incl_state->timestamp)
>  			incl_state->timestamp =
> iio_get_time_ns(indio_dev);
>  
> -		iio_push_to_buffers_with_timestamp(indio_dev,
> -						   &incl_state-
> >scan,
> -						   incl_state-
> >timestamp);
> +		iio_push_to_buffers_with_ts(indio_dev,
> +					    &incl_state->scan,
> +					    sizeof(incl_state-
> >scan),
> +					    incl_state->timestamp);
>  
>  		incl_state->timestamp = 0;
>  	}
> diff --git a/drivers/iio/position/hid-sensor-custom-intel-hinge.c
> b/drivers/iio/position/hid-sensor-custom-intel-hinge.c
> index 101d84b533c9..98a5e3e03bba 100644
> --- a/drivers/iio/position/hid-sensor-custom-intel-hinge.c
> +++ b/drivers/iio/position/hid-sensor-custom-intel-hinge.c
> @@ -198,8 +198,8 @@ static int hinge_proc_event(struct
> hid_sensor_hub_device *hsdev,
>  		if (!st->timestamp)
>  			st->timestamp = iio_get_time_ns(indio_dev);
>  
> -		iio_push_to_buffers_with_timestamp(indio_dev, &st-
> >scan,
> -						   st->timestamp);
> +		iio_push_to_buffers_with_ts(indio_dev, &st->scan,
> +					    sizeof(st->scan), st-
> >timestamp);
>  
>  		st->timestamp = 0;
>  	}

  reply	other threads:[~2026-10-27  0:06 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-26 23:05 [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp() Jonathan Cameron
2026-10-26 23:05 ` [PATCH 01/39] iio: adc: ti-adc161s626: use iio_push_to_buffers_with_ts() Jonathan Cameron
2026-10-26 23:05 ` [PATCH 02/39] iio: adc: mt6360-adc: " Jonathan Cameron
2026-10-26 23:05 ` [PATCH 03/39] iio: adc: ad4130: " Jonathan Cameron
2026-10-26 23:05 ` [PATCH 04/39] iio: addac: ad74413r: " Jonathan Cameron
2026-10-26 23:05 ` [PATCH 05/39] iio: hid-sensors: " Jonathan Cameron
2026-10-27  0:06   ` srinivas pandruvada [this message]
2026-10-27  8:21   ` Andy Shevchenko
2026-10-26 23:05 ` [PATCH 06/39] iio: gyro: mpu3050: " Jonathan Cameron
2026-10-26 23:05 ` [PATCH 07/39] iio: imu: bno055: " Jonathan Cameron
2026-10-26 23:05 ` [PATCH 08/39] iio: light: as73211: " Jonathan Cameron
2026-10-27  2:09   ` Javier Carrasco
2026-10-26 23:05 ` [PATCH 09/39] iio: light: vcnl4035: " Jonathan Cameron
2026-10-26 23:05 ` [PATCH 10/39] iio: pressure: mprls0025pa: " Jonathan Cameron
2026-10-26 23:05 ` [PATCH 11/39] iio: pressure: ms5611: " Jonathan Cameron
2026-10-26 23:05 ` [PATCH 12/39] iio: proximity: isl29501: " Jonathan Cameron
2026-10-27  8:22   ` Andy Shevchenko
2026-10-26 23:05 ` [PATCH 13/39] iio: proximity: sx9500: " Jonathan Cameron
2026-10-26 23:05 ` [PATCH 14/39] iio: imu: smi330: " Jonathan Cameron
2026-10-26 23:05 ` [PATCH 15/39] iio: imu: bmi270: " Jonathan Cameron
2026-10-26 23:05 ` [PATCH 16/39] iio: imu: inv_icm42600: " Jonathan Cameron
2026-10-26 23:05 ` [PATCH 17/39] iio: health: afe4403: " Jonathan Cameron
2026-10-27  8:25   ` Andy Shevchenko
2026-10-26 23:05 ` [PATCH 18/39] iio: health: afe4404: " Jonathan Cameron
2026-10-27  8:27   ` Andy Shevchenko
2026-10-26 23:05 ` [PATCH 19/39] iio: adc: ad799x: " Jonathan Cameron
2026-10-27  8:29   ` Andy Shevchenko
2026-10-26 23:05 ` [PATCH 20/39] iio: common: scmi_sensors: " Jonathan Cameron
2026-10-26 23:05 ` [PATCH 21/39] iio: adc: ad7766: " Jonathan Cameron
2026-10-26 23:05 ` [PATCH 22/39] iio: imu: smi240: " Jonathan Cameron
2026-10-26 23:05 ` [PATCH 23/39] iio: adc: cc10001_adc: " Jonathan Cameron
2026-10-27  8:32   ` Andy Shevchenko
2026-10-26 23:05 ` [PATCH 24/39] iio: adc: hx711: " Jonathan Cameron
2026-10-27  8:33   ` Andy Shevchenko
2026-10-26 23:05 ` [PATCH 25/39] iio: potentiostat: lmp91000: use iio_push_to_buffers_with_ts() with a scan struct on stack Jonathan Cameron
2026-10-26 23:05 ` [PATCH 26/39] iio: humidity: am2315: " Jonathan Cameron
2026-10-27  9:59   ` Andy Shevchenko
2026-10-27 16:13   ` Nicolás Antinori
2026-10-26 23:05 ` [PATCH 27/39] iio: humidity: hdc100x: " Jonathan Cameron
2026-10-26 23:05 ` [PATCH 28/39] iio: imu: bmi323: use iio_push_to_buffers_with_ts() Jonathan Cameron
2026-10-26 23:05 ` [PATCH 29/39] iio: gyro: fxas21002c: restrict available_scan_masks to all angular velocity channels Jonathan Cameron
2026-10-26 23:05 ` [PATCH 30/39] iio: gyro: fxas21002c: use iio_push_to_buffers_with_ts() with explicit structure Jonathan Cameron
2026-10-26 23:05 ` [PATCH 31/39] iio: adc: ad7887: ensure tx_cmd_buf is DMA safe Jonathan Cameron
2026-10-26 23:05 ` [PATCH 32/39] iio: adc: ad7887: use iio_push_to_buffers_with_ts() Jonathan Cameron
2026-10-27 10:24   ` Andy Shevchenko
2026-10-27 11:46     ` Joshua Crofts
2026-10-26 23:05 ` [PATCH 33/39] iio: humidity: hts221: align scan buffer for DMA safety Jonathan Cameron
2026-10-26 23:05 ` [PATCH 34/39] iio: humidity: hts221: use iio_push_to_buffers_with_ts() Jonathan Cameron
2026-10-26 23:05 ` [PATCH 35/39] iio: accel: bmc150-accel-core: " Jonathan Cameron
2026-10-27 10:27   ` Andy Shevchenko
2026-10-26 23:05 ` [PATCH 36/39] iio: common: cros_ec_sensors: " Jonathan Cameron
2026-10-27  3:19   ` Tzung-Bi Shih
2026-10-27 10:49   ` Andy Shevchenko
2026-10-26 23:05 ` [PATCH 37/39] iio: common: ssp_sensors: " Jonathan Cameron
2026-10-26 23:05 ` [PATCH 38/39] iio: imu: st_lsm6dsx: " Jonathan Cameron
2026-10-27  6:15   ` Francesco Lavra
2026-10-27 10:55   ` Andy Shevchenko
2026-10-26 23:05 ` [PATCH 39/39] iio: imu: bmi160: " Jonathan Cameron
2026-10-27 10:56   ` Andy Shevchenko
2026-10-27 10:57 ` [PATCH 00/39] IIO: Continue removing deprecated iio_push_to_buffers_with_timestamp() Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=60eab26805ad63d1b39d80fb9a47b0ba9bb5789d.camel@linux.intel.com \
    --to=srinivas.pandruvada@linux.intel.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jikos@kernel.org \
    --cc=jonathan.cameron@oss.qualcomm.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=lixu.zhang@intel.com \
    --cc=nuno.sa@analog.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox