summaryrefslogtreecommitdiff
path: root/drivers/media/mc/mc-entity.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2024-01-15 01:30:02 +0300
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2024-02-05 16:29:34 +0300
commitbaeddf94aa61879b118f2faa37ed126d772670cc (patch)
treee9360092fdf3f4f90f2871b0d23c57c58f9e8189 /drivers/media/mc/mc-entity.c
parenteb2f932100288dbb881eadfed02e1459c6b9504c (diff)
downloadlinux-baeddf94aa61879b118f2faa37ed126d772670cc.tar.xz
media: mc: Add num_links flag to media_pad
Maintain a counter of the links connected to a pad in the media_pad structure. This helps checking if a pad is connected to anything, which will be used in the pipeline building code. Cc: stable@vger.kernel.org # 6.1 Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Diffstat (limited to 'drivers/media/mc/mc-entity.c')
-rw-r--r--drivers/media/mc/mc-entity.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/media/mc/mc-entity.c b/drivers/media/mc/mc-entity.c
index 7839e3f68efa..c2d8f59b62c1 100644
--- a/drivers/media/mc/mc-entity.c
+++ b/drivers/media/mc/mc-entity.c
@@ -1038,6 +1038,9 @@ static void __media_entity_remove_link(struct media_entity *entity,
/* Remove the reverse links for a data link. */
if ((link->flags & MEDIA_LNK_FL_LINK_TYPE) == MEDIA_LNK_FL_DATA_LINK) {
+ link->source->num_links--;
+ link->sink->num_links--;
+
if (link->source->entity == entity)
remote = link->sink->entity;
else
@@ -1143,6 +1146,9 @@ media_create_pad_link(struct media_entity *source, u16 source_pad,
sink->num_links++;
source->num_links++;
+ link->source->num_links++;
+ link->sink->num_links++;
+
return 0;
}
EXPORT_SYMBOL_GPL(media_create_pad_link);