linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matti Vaittinen <mazziesaccount@gmail.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>,
	"Srinivas Pandruvada" <srinivas.pandruvada@linux.intel.com>,
	"Javier Carrasco" <javier.carrasco.cruz@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 08/16] iio: light: adjd_s311: Use iio_push_to_buffers_with_ts() to allow source size runtime check
Date: Mon, 4 Aug 2025 10:04:40 +0300	[thread overview]
Message-ID: <2cf08478-ee73-45d0-b922-617349d33a7a@gmail.com> (raw)
In-Reply-To: <20250802164436.515988-9-jic23@kernel.org>

On 02/08/2025 19:44, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Also move the structure used as the source to the stack as it is only 16
> bytes and not the target of an DMA or similar.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> ---
>   drivers/iio/light/adjd_s311.c | 12 ++++++------
>   1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/iio/light/adjd_s311.c b/drivers/iio/light/adjd_s311.c
> index cf96e3dd8bc6..edb3d9dc8bed 100644
> --- a/drivers/iio/light/adjd_s311.c
> +++ b/drivers/iio/light/adjd_s311.c
> @@ -54,10 +54,6 @@
>   
>   struct adjd_s311_data {
>   	struct i2c_client *client;
> -	struct {
> -		s16 chans[4];
> -		aligned_s64 ts;
> -	} scan;
>   };
>   
>   enum adjd_s311_channel_idx {
> @@ -120,6 +116,10 @@ static irqreturn_t adjd_s311_trigger_handler(int irq, void *p)
>   	struct adjd_s311_data *data = iio_priv(indio_dev);
>   	s64 time_ns = iio_get_time_ns(indio_dev);
>   	int i, j = 0;
> +	struct {
> +		s16 chans[4];
> +		aligned_s64 ts;
> +	} scan = { };
>   
>   	int ret = adjd_s311_req_data(indio_dev);
>   	if (ret < 0)
> @@ -131,10 +131,10 @@ static irqreturn_t adjd_s311_trigger_handler(int irq, void *p)
>   		if (ret < 0)
>   			goto done;
>   
> -		data->scan.chans[j++] = ret & ADJD_S311_DATA_MASK;
> +		scan.chans[j++] = ret & ADJD_S311_DATA_MASK;
>   	}
>   
> -	iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, time_ns);
> +	iio_push_to_buffers_with_ts(indio_dev, &scan, sizeof(scan), time_ns);
>   
>   done:
>   	iio_trigger_notify_done(indio_dev->trig);

Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com>


  reply	other threads:[~2025-08-04  7:04 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 [this message]
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
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=2cf08478-ee73-45d0-b922-617349d33a7a@gmail.com \
    --to=mazziesaccount@gmail.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=muditsharma.info@gmail.com \
    --cc=nuno.sa@analog.com \
    --cc=srinivas.pandruvada@linux.intel.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).