From: srinivas pandruvada <srinivas.pandruvada@linux.intel.com>
To: "Jonathan Cameron" <jic23@kernel.org>,
linux-iio@vger.kernel.org,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>
Cc: "Mudit Sharma" <muditsharma.info@gmail.com>,
"Jiri Kosina" <jikos@kernel.org>,
"Javier Carrasco" <javier.carrasco.cruz@gmail.com>,
"Matti Vaittinen" <mazziesaccount@gmail.com>,
"Abhash Jha" <abhashkumarjha123@gmail.com>,
"Astrid Rost" <astrid.rost@axis.com>,
"Mårten Lindahl" <marten.lindahl@axis.com>,
"Gwendal Grignou" <gwendal@chromium.org>,
"Christian Eggers" <ChristianEggersceggers@arri.de>,
"Jonathan Cameron" <Jonathan.Cameron@huawei.com>
Subject: Re: [PATCH 16/16] iio: light: Simple conversions to iio_push_to_buffers_with_ts()
Date: Mon, 04 Aug 2025 06:29:10 -0700 [thread overview]
Message-ID: <7ae1bb4d28e7958cdda7fb53807017034f67628a.camel@linux.intel.com> (raw)
In-Reply-To: <20250802164436.515988-17-jic23@kernel.org>
On Sat, 2025-08-02 at 17:44 +0100, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> This new function allows for runtime checks on the provided source
> buffer
> being of sufficient size to accommodate the enabled channel data
> layout and
> the naturally aligned s64 timestamp (which is non obvious and a
> frequent
> source of bugs in the past).
>
> This patch includes the remaining simple cases for light sensor
> drivers.
>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Mudit Sharma <muditsharma.info@gmail.com>
> Cc: Jiri Kosina <jikos@kernel.org>
> Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> Cc: Javier Carrasco <javier.carrasco.cruz@gmail.com>
> Cc: Matti Vaittinen <mazziesaccount@gmail.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> ---
> drivers/iio/light/bh1745.c | 4 ++--
> drivers/iio/light/hid-sensor-als.c | 5 +++--
> drivers/iio/light/ltr501.c | 4 ++--
> drivers/iio/light/opt4060.c | 2 +-
> drivers/iio/light/rohm-bu27034.c | 3 ++-
> drivers/iio/light/rpr0521.c | 4 ++--
> drivers/iio/light/si1145.c | 5 +++--
> drivers/iio/light/vcnl4000.c | 4 ++--
> drivers/iio/light/veml6030.c | 2 +-
> 9 files changed, 18 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/iio/light/bh1745.c b/drivers/iio/light/bh1745.c
> index 4e9bd8f831f7..74a7bf9d610d 100644
> --- a/drivers/iio/light/bh1745.c
> +++ b/drivers/iio/light/bh1745.c
> @@ -755,8 +755,8 @@ static irqreturn_t bh1745_trigger_handler(int
> interrupt, void *p)
> scan.chans[j++] = value;
> }
>
> - 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);
> diff --git a/drivers/iio/light/hid-sensor-als.c
> b/drivers/iio/light/hid-sensor-als.c
> index 830e5ae7f34a..384572844162 100644
> --- a/drivers/iio/light/hid-sensor-als.c
> +++ b/drivers/iio/light/hid-sensor-als.c
> @@ -262,8 +262,9 @@ static int als_proc_event(struct
> hid_sensor_hub_device *hsdev,
> if (!als_state->timestamp)
> als_state->timestamp =
> iio_get_time_ns(indio_dev);
>
> - iio_push_to_buffers_with_timestamp(indio_dev,
> &als_state->scan,
> - als_state-
> >timestamp);
> + iio_push_to_buffers_with_ts(indio_dev, &als_state-
> >scan,
> + sizeof(als_state->scan),
> + als_state->timestamp);
> als_state->timestamp = 0;
> }
>
> diff --git a/drivers/iio/light/ltr501.c b/drivers/iio/light/ltr501.c
> index debf57a52d1c..022e0693983b 100644
> --- a/drivers/iio/light/ltr501.c
> +++ b/drivers/iio/light/ltr501.c
> @@ -1315,8 +1315,8 @@ static irqreturn_t ltr501_trigger_handler(int
> irq, void *p)
> scan.channels[j++] = psdata & LTR501_PS_DATA_MASK;
> }
>
> - 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:
> iio_trigger_notify_done(indio_dev->trig);
> diff --git a/drivers/iio/light/opt4060.c
> b/drivers/iio/light/opt4060.c
> index 566f1bb8fe2a..3c8d34b97dc8 100644
> --- a/drivers/iio/light/opt4060.c
> +++ b/drivers/iio/light/opt4060.c
> @@ -1104,7 +1104,7 @@ static irqreturn_t opt4060_trigger_handler(int
> irq, void *p)
> }
> }
>
> - iio_push_to_buffers_with_timestamp(idev, &raw, pf-
> >timestamp);
> + iio_push_to_buffers_with_ts(idev, &raw, sizeof(raw), pf-
> >timestamp);
> err_read:
> iio_trigger_notify_done(idev->trig);
> return IRQ_HANDLED;
> diff --git a/drivers/iio/light/rohm-bu27034.c
> b/drivers/iio/light/rohm-bu27034.c
> index 7cec5e943373..28d111ac8c0a 100644
> --- a/drivers/iio/light/rohm-bu27034.c
> +++ b/drivers/iio/light/rohm-bu27034.c
> @@ -1193,7 +1193,8 @@ static int bu27034_buffer_thread(void *arg)
> */
> data->scan.mlux = (u32)mlux;
> }
> - iio_push_to_buffers_with_timestamp(idev, &data-
> >scan, tstamp);
> + iio_push_to_buffers_with_ts(idev, &data->scan,
> + sizeof(data->scan),
> tstamp);
> }
>
> return 0;
> diff --git a/drivers/iio/light/rpr0521.c
> b/drivers/iio/light/rpr0521.c
> index c50183f07240..fbd116272921 100644
> --- a/drivers/iio/light/rpr0521.c
> +++ b/drivers/iio/light/rpr0521.c
> @@ -457,8 +457,8 @@ static irqreturn_t
> rpr0521_trigger_consumer_handler(int irq, void *p)
> data->scan.channels,
> (3 * 2) + 1); /* 3 * 16-bit + (discarded) int
> clear reg. */
> if (!err)
> - iio_push_to_buffers_with_timestamp(indio_dev,
> - &data->scan, pf-
> >timestamp);
> + iio_push_to_buffers_with_ts(indio_dev, &data->scan,
> + sizeof(data->scan), pf-
> >timestamp);
> else
> dev_err(&data->client->dev,
> "Trigger consumer can't read from
> sensor.\n");
> diff --git a/drivers/iio/light/si1145.c b/drivers/iio/light/si1145.c
> index 4aa02afd853e..f8eb251eca8d 100644
> --- a/drivers/iio/light/si1145.c
> +++ b/drivers/iio/light/si1145.c
> @@ -494,8 +494,9 @@ static irqreturn_t si1145_trigger_handler(int
> irq, void *private)
> goto done;
> }
>
> - 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));
>
> done:
> iio_trigger_notify_done(indio_dev->trig);
> diff --git a/drivers/iio/light/vcnl4000.c
> b/drivers/iio/light/vcnl4000.c
> index eccf690eae8c..cc81a30b7c70 100644
> --- a/drivers/iio/light/vcnl4000.c
> +++ b/drivers/iio/light/vcnl4000.c
> @@ -1698,8 +1698,8 @@ static irqreturn_t vcnl4010_trigger_handler(int
> irq, void *p)
> if (!data_read)
> goto end;
>
> - 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));
>
> end:
> iio_trigger_notify_done(indio_dev->trig);
> diff --git a/drivers/iio/light/veml6030.c
> b/drivers/iio/light/veml6030.c
> index 0945f146bedb..6bcacae3863c 100644
> --- a/drivers/iio/light/veml6030.c
> +++ b/drivers/iio/light/veml6030.c
> @@ -903,7 +903,7 @@ static irqreturn_t veml6030_trigger_handler(int
> irq, void *p)
> scan.chans[i++] = reg;
> }
>
> - iio_push_to_buffers_with_timestamp(iio, &scan, pf-
> >timestamp);
> + iio_push_to_buffers_with_ts(iio, &scan, sizeof(scan), pf-
> >timestamp);
>
> done:
> iio_trigger_notify_done(iio->trig);
next prev parent reply other threads:[~2025-08-04 13:29 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-02 16:44 [PATCH 00/16] IIO: Enable runtime checks on buffers size and related Jonathan Cameron
2025-08-02 16:44 ` [PATCH 01/16] iio: light: as73211: Ensure buffer holes are zeroed Jonathan Cameron
2025-08-04 6:39 ` Matti Vaittinen
2025-08-02 16:44 ` [PATCH 02/16] iio: light: vcnl4035: Fix endianness vs data placement in buffer issue Jonathan Cameron
2025-08-03 19:16 ` Andy Shevchenko
2025-08-16 14:46 ` Jonathan Cameron
2025-08-04 6:38 ` Matti Vaittinen
2025-08-02 16:44 ` [PATCH 03/16] iio: light: as73211: Use iio_push_to_buffers_with_ts() to allow source size runtime check Jonathan Cameron
2025-08-02 16:44 ` [PATCH 04/16] iio: light: vcnl4035: Use a structure to make buffer arrangement explicit Jonathan Cameron
2025-08-04 6:52 ` Matti Vaittinen
2025-08-02 16:44 ` [PATCH 05/16] iio: light: vcnl4035: Use iio_push_to_buffers_with_ts() to allow runtime source buffer size check Jonathan Cameron
2025-08-04 6:57 ` Matti Vaittinen
2025-08-16 14:48 ` Jonathan Cameron
2025-08-02 16:44 ` [PATCH 06/16] iio: light: acpi-als: Use a structure for layout of data to push to buffer Jonathan Cameron
2025-08-03 19:24 ` Andy Shevchenko
2025-08-16 14:50 ` Jonathan Cameron
2025-08-02 16:44 ` [PATCH 07/16] iio: light: acpi-als: Use iio_push_to_buffers_with_ts() to allow runtime source size check Jonathan Cameron
2025-08-16 14:52 ` Jonathan Cameron
2025-08-02 16:44 ` [PATCH 08/16] iio: light: adjd_s311: Use iio_push_to_buffers_with_ts() to allow source size runtime check Jonathan Cameron
2025-08-04 7:04 ` Matti Vaittinen
2025-08-16 14:52 ` Jonathan Cameron
2025-08-02 16:44 ` [PATCH 09/16] iio: light: isl29125: " Jonathan Cameron
2025-08-04 7:06 ` Matti Vaittinen
2025-08-16 14:52 ` Jonathan Cameron
2025-08-02 16:44 ` [PATCH 10/16] iio: light: max44000: " Jonathan Cameron
2025-08-03 19:26 ` Andy Shevchenko
2025-08-16 14:55 ` Jonathan Cameron
2025-08-04 7:08 ` Matti Vaittinen
2025-08-02 16:44 ` [PATCH 11/16] iio: light: st_uvis25: " Jonathan Cameron
2025-08-04 7:09 ` Matti Vaittinen
2025-08-16 14:56 ` Jonathan Cameron
2025-08-02 16:44 ` [PATCH 12/16] iio: light: tcs3414: " Jonathan Cameron
2025-08-16 14:57 ` Jonathan Cameron
2025-08-02 16:44 ` [PATCH 13/16] iio: light: tcs3472: " Jonathan Cameron
2025-08-16 14:58 ` Jonathan Cameron
2025-08-02 16:44 ` [PATCH 14/16] iio: light: vcnl4000: Use a structure to make buffer arrangement explicit Jonathan Cameron
2025-08-04 7:00 ` Mårten Lindahl
2025-08-16 14:59 ` Jonathan Cameron
2025-08-02 16:44 ` [PATCH 15/16] iio: light: vl6180: Use iio_push_to_buffers_with_ts() to allow source size runtime check Jonathan Cameron
2025-08-16 14:59 ` Jonathan Cameron
2025-08-02 16:44 ` [PATCH 16/16] iio: light: Simple conversions to iio_push_to_buffers_with_ts() Jonathan Cameron
2025-08-04 8:01 ` Matti Vaittinen
2025-08-04 13:29 ` srinivas pandruvada [this message]
2025-08-16 15:00 ` Jonathan Cameron
2025-08-03 19:43 ` [PATCH 00/16] IIO: Enable runtime checks on buffers size and related 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=7ae1bb4d28e7958cdda7fb53807017034f67628a.camel@linux.intel.com \
--to=srinivas.pandruvada@linux.intel.com \
--cc=ChristianEggersceggers@arri.de \
--cc=Jonathan.Cameron@huawei.com \
--cc=abhashkumarjha123@gmail.com \
--cc=andy@kernel.org \
--cc=astrid.rost@axis.com \
--cc=dlechner@baylibre.com \
--cc=gwendal@chromium.org \
--cc=javier.carrasco.cruz@gmail.com \
--cc=jic23@kernel.org \
--cc=jikos@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=marten.lindahl@axis.com \
--cc=mazziesaccount@gmail.com \
--cc=muditsharma.info@gmail.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;
as well as URLs for NNTP newsgroup(s).