Re: [PATCH 3/5] media: entity: Skip non-data links in graph iteration

Sakari Ailus
2021-12-14T15:01:30Z

Hi Daniel,

On Mon, Dec 13, 2021 at 11:28:47PM +0000, Daniel Scally wrote:
> When iterating over the media graph, don't follow links that are not
> pad-to-pad links.
>
> Signed-off-by: Daniel Scally <djrscally@gmail.com>
> ---
> Changes since the rfc:
>
> - new patch
>
> drivers/media/mc/mc-entity.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/media/mc/mc-entity.c b/drivers/media/mc/mc-entity.c
> index d79eb88bc167..aeddc3f6310e 100644
> --- a/drivers/media/mc/mc-entity.c
> +++ b/drivers/media/mc/mc-entity.c
> @@ -325,6 +325,14 @@ 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 pad-to-pad link, don't follow it */

This comment should mention data links, not pad-to-pad links.

Seems fine apart from this.

> + if ((link->flags & MEDIA_LNK_FL_LINK_TYPE) != MEDIA_LNK_FL_DATA_LINK) {
> + link_top(graph) = link_top(graph)->next;
> + dev_dbg(entity->graph_obj.mdev->dev, "walk: skipping %s link\n",
> + link_type(link));
> + 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;

--
Kind regards,

Sakari Ailus