diff options
author | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-08-24 08:46:46 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2016-01-11 12:18:54 -0200 |
commit | 7c4696a910d404eda3477e76a35c155a6b83ca3e (patch) | |
tree | ae45edea906b8c513642fa5fb324200b981e6d29 /drivers/media/media-entity.c | |
parent | 8309f47c32c04aae30698389073ec8c6d1b7e986 (diff) | |
download | lwn-7c4696a910d404eda3477e76a35c155a6b83ca3e.tar.gz lwn-7c4696a910d404eda3477e76a35c155a6b83ca3e.zip |
[media] media-entity: unregister entity links
Add functions to explicitly unregister all entity links.
This function is called automatically when an entity
link is destroyed.
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/media-entity.c')
-rw-r--r-- | drivers/media/media-entity.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c index 1b2fd724cdbf..ceae708bdad4 100644 --- a/drivers/media/media-entity.c +++ b/drivers/media/media-entity.c @@ -891,6 +891,7 @@ EXPORT_SYMBOL_GPL(media_devnode_create); void media_devnode_remove(struct media_intf_devnode *devnode) { + media_remove_intf_links(&devnode->intf); media_gobj_remove(&devnode->intf.graph_obj); kfree(devnode); } @@ -932,3 +933,25 @@ void media_remove_intf_link(struct media_link *link) mutex_unlock(&link->graph_obj.mdev->graph_mutex); } EXPORT_SYMBOL_GPL(media_remove_intf_link); + +void __media_remove_intf_links(struct media_interface *intf) +{ + struct media_link *link, *tmp; + + list_for_each_entry_safe(link, tmp, &intf->links, list) + __media_remove_intf_link(link); + +} +EXPORT_SYMBOL_GPL(__media_remove_intf_links); + +void media_remove_intf_links(struct media_interface *intf) +{ + /* Do nothing if the intf is not registered. */ + if (intf->graph_obj.mdev == NULL) + return; + + mutex_lock(&intf->graph_obj.mdev->graph_mutex); + __media_remove_intf_links(intf); + mutex_unlock(&intf->graph_obj.mdev->graph_mutex); +} +EXPORT_SYMBOL_GPL(media_remove_intf_links); |