diff options
author | Daniel Scally <djrscally@gmail.com> | 2022-03-02 22:03:03 +0000 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@kernel.org> | 2022-04-24 07:59:09 +0100 |
commit | 012c87f7696f3191f340d9bd6b4476d8d3bb25ad (patch) | |
tree | 9ec2a7ed21ded95555a57d27bfe36104f33a77bf /drivers/media/mc/mc-entity.c | |
parent | 9d0c23bfe7083f182194ca235156a4098aa59344 (diff) | |
download | linux-012c87f7696f3191f340d9bd6b4476d8d3bb25ad.tar.bz2 |
media: entity: Add support for ancillary links
Add functions to create ancillary links, so that they don't need to
be manually created by users.
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>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'drivers/media/mc/mc-entity.c')
-rw-r--r-- | drivers/media/mc/mc-entity.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/media/mc/mc-entity.c b/drivers/media/mc/mc-entity.c index 4b616b11d8e4..11f5207f73aa 100644 --- a/drivers/media/mc/mc-entity.c +++ b/drivers/media/mc/mc-entity.c @@ -1029,3 +1029,25 @@ void media_remove_intf_links(struct media_interface *intf) mutex_unlock(&mdev->graph_mutex); } EXPORT_SYMBOL_GPL(media_remove_intf_links); + +struct media_link *media_create_ancillary_link(struct media_entity *primary, + struct media_entity *ancillary) +{ + struct media_link *link; + + link = media_add_link(&primary->links); + if (!link) + return ERR_PTR(-ENOMEM); + + link->gobj0 = &primary->graph_obj; + link->gobj1 = &ancillary->graph_obj; + link->flags = MEDIA_LNK_FL_IMMUTABLE | MEDIA_LNK_FL_ENABLED | + MEDIA_LNK_FL_ANCILLARY_LINK; + + /* Initialize graph object embedded in the new link */ + media_gobj_create(primary->graph_obj.mdev, MEDIA_GRAPH_LINK, + &link->graph_obj); + + return link; +} +EXPORT_SYMBOL_GPL(media_create_ancillary_link); |