Commit 57cf79b7 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

[media] media: add a linked list to track interfaces by mdev

The media device should list the interface objects, so add a linked list
for those interfaces in struct media_device.
Acked-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 8211b187
...@@ -381,6 +381,7 @@ int __must_check __media_device_register(struct media_device *mdev, ...@@ -381,6 +381,7 @@ int __must_check __media_device_register(struct media_device *mdev,
return -EINVAL; return -EINVAL;
INIT_LIST_HEAD(&mdev->entities); INIT_LIST_HEAD(&mdev->entities);
INIT_LIST_HEAD(&mdev->interfaces);
spin_lock_init(&mdev->lock); spin_lock_init(&mdev->lock);
mutex_init(&mdev->graph_mutex); mutex_init(&mdev->graph_mutex);
......
...@@ -849,6 +849,8 @@ static void media_interface_init(struct media_device *mdev, ...@@ -849,6 +849,8 @@ static void media_interface_init(struct media_device *mdev,
INIT_LIST_HEAD(&intf->links); INIT_LIST_HEAD(&intf->links);
media_gobj_init(mdev, gobj_type, &intf->graph_obj); media_gobj_init(mdev, gobj_type, &intf->graph_obj);
list_add_tail(&intf->list, &mdev->interfaces);
} }
/* Functions related to the media interface via device nodes */ /* Functions related to the media interface via device nodes */
...@@ -877,6 +879,7 @@ EXPORT_SYMBOL_GPL(media_devnode_create); ...@@ -877,6 +879,7 @@ EXPORT_SYMBOL_GPL(media_devnode_create);
void media_devnode_remove(struct media_intf_devnode *devnode) void media_devnode_remove(struct media_intf_devnode *devnode)
{ {
media_gobj_remove(&devnode->intf.graph_obj); media_gobj_remove(&devnode->intf.graph_obj);
list_del(&devnode->intf.list);
kfree(devnode); kfree(devnode);
} }
EXPORT_SYMBOL_GPL(media_devnode_remove); EXPORT_SYMBOL_GPL(media_devnode_remove);
......
...@@ -46,6 +46,7 @@ struct device; ...@@ -46,6 +46,7 @@ struct device;
* @link_id: Unique ID used on the last link registered * @link_id: Unique ID used on the last link registered
* @intf_devnode_id: Unique ID used on the last interface devnode registered * @intf_devnode_id: Unique ID used on the last interface devnode registered
* @entities: List of registered entities * @entities: List of registered entities
* @interfaces: List of registered interfaces
* @lock: Entities list lock * @lock: Entities list lock
* @graph_mutex: Entities graph operation lock * @graph_mutex: Entities graph operation lock
* @link_notify: Link state change notification callback * @link_notify: Link state change notification callback
...@@ -77,6 +78,7 @@ struct media_device { ...@@ -77,6 +78,7 @@ struct media_device {
u32 intf_devnode_id; u32 intf_devnode_id;
struct list_head entities; struct list_head entities;
struct list_head interfaces;
/* Protects the entities list */ /* Protects the entities list */
spinlock_t lock; spinlock_t lock;
......
...@@ -156,6 +156,8 @@ struct media_entity { ...@@ -156,6 +156,8 @@ struct media_entity {
* struct media_intf_devnode - Define a Kernel API interface * struct media_intf_devnode - Define a Kernel API interface
* *
* @graph_obj: embedded graph object * @graph_obj: embedded graph object
* @list: Linked list used to find other interfaces that belong
* to the same media controller
* @links: List of links pointing to graph entities * @links: List of links pointing to graph entities
* @type: Type of the interface as defined at the * @type: Type of the interface as defined at the
* uapi/media/media.h header, e. g. * uapi/media/media.h header, e. g.
...@@ -164,6 +166,7 @@ struct media_entity { ...@@ -164,6 +166,7 @@ struct media_entity {
*/ */
struct media_interface { struct media_interface {
struct media_gobj graph_obj; struct media_gobj graph_obj;
struct list_head list;
struct list_head links; struct list_head links;
u32 type; u32 type;
u32 flags; u32 flags;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment