diff mbox series

[v2,07/20] iio: dummy: Switch to iio_push_to_buffers_with_ts() and provide size of storage

Message ID 20250406172001.2167607-8-jic23@kernel.org (mailing list archive)
State New
Headers show
Series IIO: Introduce iio_push_to_buffers_with_ts() taking an input buffer length argument. | expand

Commit Message

Jonathan Cameron April 6, 2025, 5:19 p.m. UTC
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Provide the storage size so that the helper can sanity check that it
is large enough for the configured channels.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/dummy/iio_simple_dummy_buffer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Andy Shevchenko April 7, 2025, 9:25 a.m. UTC | #1
On Sun, Apr 06, 2025 at 06:19:48PM +0100, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Provide the storage size so that the helper can sanity check that it
> is large enough for the configured channels.

...

> +	iio_push_to_buffers_with_ts(indio_dev, &scan, sizeof(scan),

> +				    iio_get_time_ns(indio_dev));

It even returns s64! (See the comment to the implementation patch
of _with_ts() call.)
Nuno Sá April 7, 2025, 4:37 p.m. UTC | #2
On Sun, 2025-04-06 at 18:19 +0100, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Provide the storage size so that the helper can sanity check that it
> is large enough for the configured channels.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> ---

Reviewed-by: Nuno Sá <nuno.sa@analog.com>

>  drivers/iio/dummy/iio_simple_dummy_buffer.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/dummy/iio_simple_dummy_buffer.c
> b/drivers/iio/dummy/iio_simple_dummy_buffer.c
> index eca5f0652d23..7b5adbb4a422 100644
> --- a/drivers/iio/dummy/iio_simple_dummy_buffer.c
> +++ b/drivers/iio/dummy/iio_simple_dummy_buffer.c
> @@ -74,8 +74,8 @@ static irqreturn_t iio_simple_dummy_trigger_h(int irq, void
> *p)
>  	iio_for_each_active_channel(indio_dev, j)
>  		scan.data[i++] = fakedata[j];
>  
> -	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));
>  
>  	/*
>  	 * Tell the core we are done with this trigger and ready for the
diff mbox series

Patch

diff --git a/drivers/iio/dummy/iio_simple_dummy_buffer.c b/drivers/iio/dummy/iio_simple_dummy_buffer.c
index eca5f0652d23..7b5adbb4a422 100644
--- a/drivers/iio/dummy/iio_simple_dummy_buffer.c
+++ b/drivers/iio/dummy/iio_simple_dummy_buffer.c
@@ -74,8 +74,8 @@  static irqreturn_t iio_simple_dummy_trigger_h(int irq, void *p)
 	iio_for_each_active_channel(indio_dev, j)
 		scan.data[i++] = fakedata[j];
 
-	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));
 
 	/*
 	 * Tell the core we are done with this trigger and ready for the