[libcamera-devel,v3,1/5] media: entity: Skip non-data links in graph iteration
diff mbox series

Message ID 20220302220304.1327896-2-djrscally@gmail.com
State Not Applicable
Headers show
Series
  • Introduce ancillary links
Related show

Commit Message

Daniel Scally March 2, 2022, 10:03 p.m. UTC
When iterating over the media graph, don't follow links that are not
data links.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Daniel Scally <djrscally@gmail.com>
---

Changes since v2:

	- None

Changes since v1:

	- Moved to the head of the series
	- s/pad-to-pad/data (Sakari)
	- Dropped the debug message (Laurent)

Changes since the rfc:

	- new patch

 drivers/media/mc/mc-entity.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Nicolas Dufresne via libcamera-devel March 9, 2022, 3:42 p.m. UTC | #1
Hi !

Thanks for the patch !

On 02/03/2022 23:03, Daniel Scally wrote:
> When iterating over the media graph, don't follow links that are not
> data links.
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Signed-off-by: Daniel Scally <djrscally@gmail.com>

Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>

> ---
> 
> Changes since v2:
> 
> 	- None
> 
> Changes since v1:
> 
> 	- Moved to the head of the series
> 	- s/pad-to-pad/data (Sakari)
> 	- Dropped the debug message (Laurent)
> 
> Changes since the rfc:
> 
> 	- new patch
> 
>   drivers/media/mc/mc-entity.c | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/media/mc/mc-entity.c b/drivers/media/mc/mc-entity.c
> index b411f9796191..d0563ee4b28b 100644
> --- a/drivers/media/mc/mc-entity.c
> +++ b/drivers/media/mc/mc-entity.c
> @@ -295,6 +295,12 @@ static void media_graph_walk_iter(struct media_graph *graph)
>   
>   	link = list_entry(link_top(graph), typeof(*link), list);
>   
> +	/* If the link is not a data link, don't follow it */
> +	if ((link->flags & MEDIA_LNK_FL_LINK_TYPE) != MEDIA_LNK_FL_DATA_LINK) {
> +		link_top(graph) = link_top(graph)->next;
> +		return;
> +	}
> +
>   	/* The link is not enabled so we do not follow. */
>   	if (!(link->flags & MEDIA_LNK_FL_ENABLED)) {
>   		link_top(graph) = link_top(graph)->next;

Patch
diff mbox series

diff --git a/drivers/media/mc/mc-entity.c b/drivers/media/mc/mc-entity.c
index b411f9796191..d0563ee4b28b 100644
--- a/drivers/media/mc/mc-entity.c
+++ b/drivers/media/mc/mc-entity.c
@@ -295,6 +295,12 @@  static void media_graph_walk_iter(struct media_graph *graph)
 
 	link = list_entry(link_top(graph), typeof(*link), list);
 
+	/* If the link is not a data link, don't follow it */
+	if ((link->flags & MEDIA_LNK_FL_LINK_TYPE) != MEDIA_LNK_FL_DATA_LINK) {
+		link_top(graph) = link_top(graph)->next;
+		return;
+	}
+
 	/* The link is not enabled so we do not follow. */
 	if (!(link->flags & MEDIA_LNK_FL_ENABLED)) {
 		link_top(graph) = link_top(graph)->next;