Linux IIO development
 help / color / mirror / Atom feed
From: Tzung-Bi Shih <tzungbi@kernel.org>
To: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Cc: linux-iio@vger.kernel.org,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Cheng-Yi Chiang" <cychiang@chromium.org>,
	"Guenter Roeck" <groeck@chromium.org>
Subject: Re: [PATCH 36/39] iio: common: cros_ec_sensors: use iio_push_to_buffers_with_ts()
Date: Tue, 27 Oct 2026 03:19:03 +0000	[thread overview]
Message-ID: <auAYJyyHq0_Hdv8r@google.com> (raw)
In-Reply-To: <20261026-iio-v1-36-8b136778eedf@oss.qualcomm.com>

On Mon, Oct 26, 2026 at 04:05:54PM -0700, Jonathan Cameron wrote:
> Replace the deprecated iio_push_to_buffers_with_timestamp() with
> iio_push_to_buffers_with_ts(), passing the size of the pushed buffer,
> at both call sites.
> 
> Replace the raw samples byte array with a scan struct containing the
> channel data and an aligned timestamp, matching the layout it was
> already manually maintaining and removing the need for the
> CROS_EC_SAMPLE_SIZE size calculation and the casts used to access it
> as an array of s16.
> 
> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>

The patch looks good to me.  Just a minor note below.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>

> diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
...
> @@ -192,19 +191,17 @@ int cros_ec_sensors_push_data(struct iio_dev *indio_dev,
>  	if (!iio_device_try_claim_buffer_mode(indio_dev))
>  		return 0;
>  
> -	out = (s16 *)st->samples;
> -	iio_for_each_active_channel(indio_dev, i) {
> -		*out = data[i];
> -		out++;
> -	}
> +	j = 0;
> +	iio_for_each_active_channel(indio_dev, i)
> +		st->scan.channels[j++] = data[i];

This is a pre-existing issue, but there is no bounds check on `j`.  I'm
not sure if the number of active channels can ever exceed 4.

  reply	other threads:[~2026-10-27  3:19 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
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 [this message]
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=auAYJyyHq0_Hdv8r@google.com \
    --to=tzungbi@kernel.org \
    --cc=andy@kernel.org \
    --cc=cychiang@chromium.org \
    --cc=dlechner@baylibre.com \
    --cc=groeck@chromium.org \
    --cc=jonathan.cameron@oss.qualcomm.com \
    --cc=linux-iio@vger.kernel.org \
    --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