linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] media: pci: mfb4: iio trigger improvements
@ 2025-09-05 19:06 David Lechner
  2025-09-05 19:06 ` [PATCH 1/2] media: pci: mg4b: use aligned_s64 David Lechner
  2025-09-05 19:06 ` [PATCH 2/2] media: pci: mg4b: use iio_push_to_buffers_with_ts() David Lechner
  0 siblings, 2 replies; 6+ messages in thread
From: David Lechner @ 2025-09-05 19:06 UTC (permalink / raw)
  To: Martin Tuma, Mauro Carvalho Chehab
  Cc: linux-iio, linux-media, linux-kernel, Jonathan Cameron,
	David Lechner

This follows up on a couple of suggestions from Jonathan Cameron for
improving the IIO part of the MGB4 driver.

---
David Lechner (2):
      media: pci: mg4b: use aligned_s64
      media: pci: mg4b: use iio_push_to_buffers_with_ts()

 drivers/media/pci/mgb4/mgb4_trigger.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
base-commit: be5d4872e528796df9d7425f2bd9b3893eb3a42c
change-id: 20250905-media-pci-mfb4-iio-trigger-improvements-9e223e8401db

Best regards,
-- 
David Lechner <dlechner@baylibre.com>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] media: pci: mg4b: use aligned_s64
  2025-09-05 19:06 [PATCH 0/2] media: pci: mfb4: iio trigger improvements David Lechner
@ 2025-09-05 19:06 ` David Lechner
  2025-09-07  9:32   ` Jonathan Cameron
  2025-09-05 19:06 ` [PATCH 2/2] media: pci: mg4b: use iio_push_to_buffers_with_ts() David Lechner
  1 sibling, 1 reply; 6+ messages in thread
From: David Lechner @ 2025-09-05 19:06 UTC (permalink / raw)
  To: Martin Tuma, Mauro Carvalho Chehab
  Cc: linux-iio, linux-media, linux-kernel, Jonathan Cameron,
	David Lechner

Use aligned_s64 for IIO timestamp field instead of explicit __align().
This is the convention used throughout the IIO subsystem. No functional
change.

Suggested-by: Jonathan Cameron <jic23@kernel.org>
Closes: https://lore.kernel.org/linux-iio/20250724115610.011110fb@jic23-huawei/
Signed-off-by: David Lechner <dlechner@baylibre.com>
---
 drivers/media/pci/mgb4/mgb4_trigger.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/pci/mgb4/mgb4_trigger.c b/drivers/media/pci/mgb4/mgb4_trigger.c
index d7dddc5c8728e81c6249b03a4cbf692da15a4ced..bed8bbd4bc595d1d131b9919c6f3b705e43ba3c4 100644
--- a/drivers/media/pci/mgb4/mgb4_trigger.c
+++ b/drivers/media/pci/mgb4/mgb4_trigger.c
@@ -17,6 +17,7 @@
 #include <linux/iio/triggered_buffer.h>
 #include <linux/pci.h>
 #include <linux/dma/amd_xdma.h>
+#include <linux/types.h>
 #include "mgb4_core.h"
 #include "mgb4_trigger.h"
 
@@ -90,7 +91,7 @@ static irqreturn_t trigger_handler(int irq, void *p)
 	struct trigger_data *st = iio_priv(indio_dev);
 	struct {
 		u32 data;
-		s64 ts __aligned(8);
+		aligned_s64 ts;
 	} scan = { };
 
 	scan.data = mgb4_read_reg(&st->mgbdev->video, 0xA0);

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] media: pci: mg4b: use iio_push_to_buffers_with_ts()
  2025-09-05 19:06 [PATCH 0/2] media: pci: mfb4: iio trigger improvements David Lechner
  2025-09-05 19:06 ` [PATCH 1/2] media: pci: mg4b: use aligned_s64 David Lechner
@ 2025-09-05 19:06 ` David Lechner
  2025-09-07  9:32   ` Jonathan Cameron
  1 sibling, 1 reply; 6+ messages in thread
From: David Lechner @ 2025-09-05 19:06 UTC (permalink / raw)
  To: Martin Tuma, Mauro Carvalho Chehab
  Cc: linux-iio, linux-media, linux-kernel, Jonathan Cameron,
	David Lechner

Replace iio_push_to_buffers_with_timestamp() with
iio_push_to_buffers_with_ts(). This adds an extra argument with the
buffer size to ensure that we aren't writing past the end of the buffer.
No functional change.

Suggested-by: Jonathan Cameron <jic23@kernel.org>
Closes: https://lore.kernel.org/linux-iio/20250724115610.011110fb@jic23-huawei/
Signed-off-by: David Lechner <dlechner@baylibre.com>
---
 drivers/media/pci/mgb4/mgb4_trigger.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/pci/mgb4/mgb4_trigger.c b/drivers/media/pci/mgb4/mgb4_trigger.c
index bed8bbd4bc595d1d131b9919c6f3b705e43ba3c4..4f9a35904b4186618a554e3047d6b46ff7ed74be 100644
--- a/drivers/media/pci/mgb4/mgb4_trigger.c
+++ b/drivers/media/pci/mgb4/mgb4_trigger.c
@@ -97,7 +97,7 @@ static irqreturn_t trigger_handler(int irq, void *p)
 	scan.data = mgb4_read_reg(&st->mgbdev->video, 0xA0);
 	mgb4_write_reg(&st->mgbdev->video, 0xA0, scan.data);
 
-	iio_push_to_buffers_with_timestamp(indio_dev, &scan, pf->timestamp);
+	iio_push_to_buffers_with_ts(indio_dev, &scan, sizeof(scan), pf->timestamp);
 	iio_trigger_notify_done(indio_dev->trig);
 
 	mgb4_write_reg(&st->mgbdev->video, 0xB4, 1U << 11);

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] media: pci: mg4b: use aligned_s64
  2025-09-05 19:06 ` [PATCH 1/2] media: pci: mg4b: use aligned_s64 David Lechner
@ 2025-09-07  9:32   ` Jonathan Cameron
  0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2025-09-07  9:32 UTC (permalink / raw)
  To: David Lechner
  Cc: Martin Tuma, Mauro Carvalho Chehab, linux-iio, linux-media,
	linux-kernel

On Fri, 05 Sep 2025 14:06:19 -0500
David Lechner <dlechner@baylibre.com> wrote:

> Use aligned_s64 for IIO timestamp field instead of explicit __align().
> This is the convention used throughout the IIO subsystem. No functional
> change.
> 
> Suggested-by: Jonathan Cameron <jic23@kernel.org>
> Closes: https://lore.kernel.org/linux-iio/20250724115610.011110fb@jic23-huawei/
> Signed-off-by: David Lechner <dlechner@baylibre.com>

Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>

> ---
>  drivers/media/pci/mgb4/mgb4_trigger.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/pci/mgb4/mgb4_trigger.c b/drivers/media/pci/mgb4/mgb4_trigger.c
> index d7dddc5c8728e81c6249b03a4cbf692da15a4ced..bed8bbd4bc595d1d131b9919c6f3b705e43ba3c4 100644
> --- a/drivers/media/pci/mgb4/mgb4_trigger.c
> +++ b/drivers/media/pci/mgb4/mgb4_trigger.c
> @@ -17,6 +17,7 @@
>  #include <linux/iio/triggered_buffer.h>
>  #include <linux/pci.h>
>  #include <linux/dma/amd_xdma.h>
> +#include <linux/types.h>
>  #include "mgb4_core.h"
>  #include "mgb4_trigger.h"
>  
> @@ -90,7 +91,7 @@ static irqreturn_t trigger_handler(int irq, void *p)
>  	struct trigger_data *st = iio_priv(indio_dev);
>  	struct {
>  		u32 data;
> -		s64 ts __aligned(8);
> +		aligned_s64 ts;
>  	} scan = { };
>  
>  	scan.data = mgb4_read_reg(&st->mgbdev->video, 0xA0);
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] media: pci: mg4b: use iio_push_to_buffers_with_ts()
  2025-09-05 19:06 ` [PATCH 2/2] media: pci: mg4b: use iio_push_to_buffers_with_ts() David Lechner
@ 2025-09-07  9:32   ` Jonathan Cameron
  0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2025-09-07  9:32 UTC (permalink / raw)
  To: David Lechner
  Cc: Martin Tuma, Mauro Carvalho Chehab, linux-iio, linux-media,
	linux-kernel

On Fri, 05 Sep 2025 14:06:20 -0500
David Lechner <dlechner@baylibre.com> wrote:

> Replace iio_push_to_buffers_with_timestamp() with
> iio_push_to_buffers_with_ts(). This adds an extra argument with the
> buffer size to ensure that we aren't writing past the end of the buffer.
> No functional change.
> 
> Suggested-by: Jonathan Cameron <jic23@kernel.org>
> Closes: https://lore.kernel.org/linux-iio/20250724115610.011110fb@jic23-huawei/
> Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>

> ---
>  drivers/media/pci/mgb4/mgb4_trigger.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/pci/mgb4/mgb4_trigger.c b/drivers/media/pci/mgb4/mgb4_trigger.c
> index bed8bbd4bc595d1d131b9919c6f3b705e43ba3c4..4f9a35904b4186618a554e3047d6b46ff7ed74be 100644
> --- a/drivers/media/pci/mgb4/mgb4_trigger.c
> +++ b/drivers/media/pci/mgb4/mgb4_trigger.c
> @@ -97,7 +97,7 @@ static irqreturn_t trigger_handler(int irq, void *p)
>  	scan.data = mgb4_read_reg(&st->mgbdev->video, 0xA0);
>  	mgb4_write_reg(&st->mgbdev->video, 0xA0, scan.data);
>  
> -	iio_push_to_buffers_with_timestamp(indio_dev, &scan, pf->timestamp);
> +	iio_push_to_buffers_with_ts(indio_dev, &scan, sizeof(scan), pf->timestamp);
>  	iio_trigger_notify_done(indio_dev->trig);
>  
>  	mgb4_write_reg(&st->mgbdev->video, 0xB4, 1U << 11);
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] media: pci: mg4b: use aligned_s64
       [not found] <4501714e-8433-404a-a526-fd6919031f39@gpxsee.org>
@ 2025-09-08 16:36 ` Martin Tůma
  0 siblings, 0 replies; 6+ messages in thread
From: Martin Tůma @ 2025-09-08 16:36 UTC (permalink / raw)
  To: linux-iio, linux-kernel, linux-media, jic23, mchehab


On 9/5/25 9:06 PM, David Lechner wrote:
> Use aligned_s64 for IIO timestamp field instead of explicit __align().
> This is the convention used throughout the IIO subsystem. No functional
> change.
> 
> Suggested-by: Jonathan Cameron <jic23@kernel.org>
> Closes: https://lore.kernel.org/linux-iio/20250724115610.011110fb@jic23-huawei/
> Signed-off-by: David Lechner <dlechner@baylibre.com>

Reviewed-by: Martin Tůma <martin.tuma@digiteqautomotive.com>

> ---
>   drivers/media/pci/mgb4/mgb4_trigger.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/pci/mgb4/mgb4_trigger.c b/drivers/media/pci/mgb4/mgb4_trigger.c
> index d7dddc5c8728e81c6249b03a4cbf692da15a4ced..bed8bbd4bc595d1d131b9919c6f3b705e43ba3c4 100644
> --- a/drivers/media/pci/mgb4/mgb4_trigger.c
> +++ b/drivers/media/pci/mgb4/mgb4_trigger.c
> @@ -17,6 +17,7 @@
>   #include <linux/iio/triggered_buffer.h>
>   #include <linux/pci.h>
>   #include <linux/dma/amd_xdma.h>
> +#include <linux/types.h>
>   #include "mgb4_core.h"
>   #include "mgb4_trigger.h"
>   
> @@ -90,7 +91,7 @@ static irqreturn_t trigger_handler(int irq, void *p)
>   	struct trigger_data *st = iio_priv(indio_dev);
>   	struct {
>   		u32 data;
> -		s64 ts __aligned(8);
> +		aligned_s64 ts;
>   	} scan = { };
>   
>   	scan.data = mgb4_read_reg(&st->mgbdev->video, 0xA0);
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-09-08 16:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-05 19:06 [PATCH 0/2] media: pci: mfb4: iio trigger improvements David Lechner
2025-09-05 19:06 ` [PATCH 1/2] media: pci: mg4b: use aligned_s64 David Lechner
2025-09-07  9:32   ` Jonathan Cameron
2025-09-05 19:06 ` [PATCH 2/2] media: pci: mg4b: use iio_push_to_buffers_with_ts() David Lechner
2025-09-07  9:32   ` Jonathan Cameron
     [not found] <4501714e-8433-404a-a526-fd6919031f39@gpxsee.org>
2025-09-08 16:36 ` [PATCH 1/2] media: pci: mg4b: use aligned_s64 Martin Tůma

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).