intf->type = type;
intf->flags = flags;
+ INIT_LIST_HEAD(&intf->links);
devnode->major = major;
devnode->minor = minor;
kfree(devnode);
}
EXPORT_SYMBOL_GPL(media_devnode_remove);
+
+struct media_link *media_create_intf_link(struct media_entity *entity,
+ struct media_interface *intf,
+ u32 flags)
+{
+ struct media_link *link;
+
+ link = media_add_link(&intf->links);
+ if (link == NULL)
+ return NULL;
+
+ link->intf = intf;
+ link->entity = entity;
+ link->flags = flags;
+
+ /* Initialize graph object embedded at the new link */
+ media_gobj_init(intf->graph_obj.mdev, MEDIA_GRAPH_LINK,
+ &link->graph_obj);
+
+ return link;
+}
+EXPORT_SYMBOL_GPL(media_create_intf_link);
+
+
+static void __media_remove_intf_link(struct media_link *link)
+{
+ media_gobj_remove(&link->graph_obj);
+ kfree(link);
+}
+
+void media_remove_intf_link(struct media_link *link)
+{
+ mutex_lock(&link->graph_obj.mdev->graph_mutex);
+ __media_remove_intf_link(link);
+ mutex_unlock(&link->graph_obj.mdev->graph_mutex);
+}
+EXPORT_SYMBOL_GPL(media_remove_intf_link);
union {
struct media_gobj *gobj0;
struct media_pad *source;
+ struct media_interface *intf;
};
union {
struct media_gobj *gobj1;
struct media_pad *sink;
+ struct media_entity *entity;
};
struct media_link *reverse; /* Link in the reverse direction */
unsigned long flags; /* Link flags (MEDIA_LNK_FL_*) */
* struct media_intf_devnode - Define a Kernel API interface
*
* @graph_obj: embedded graph object
+ * @links: List of links pointing to graph entities
* @type: Type of the interface as defined at the
* uapi/media/media.h header, e. g.
* MEDIA_INTF_T_*
*/
struct media_interface {
struct media_gobj graph_obj;
+ struct list_head links;
u32 type;
u32 flags;
};
u32 major, u32 minor,
gfp_t gfp_flags);
void media_devnode_remove(struct media_intf_devnode *devnode);
+struct media_link *media_create_intf_link(struct media_entity *entity,
+ struct media_interface *intf,
+ u32 flags);
+void media_remove_intf_link(struct media_link *link);
+
#define media_entity_call(entity, operation, args...) \
(((entity)->ops && (entity)->ops->operation) ? \
(entity)->ops->operation((entity) , ##args) : -ENOIOCTLCMD)