struct media_entity *entity;
struct media_entity *next;
- list_for_each_entry_safe(entity, next, &mdev->entities, list)
+ list_for_each_entry_safe(entity, next, &mdev->entities, graph_obj.list)
media_device_unregister_entity(entity);
device_remove_file(&mdev->devnode.dev, &dev_attr_model);
spin_lock(&mdev->lock);
/* Initialize media_gobj embedded at the entity */
media_gobj_init(mdev, MEDIA_GRAPH_ENTITY, &entity->graph_obj);
- list_add_tail(&entity->list, &mdev->entities);
/* Initialize objects at the pads */
for (i = 0; i < entity->num_pads; i++)
for (i = 0; i < entity->num_pads; i++)
media_gobj_remove(&entity->pads[i].graph_obj);
media_gobj_remove(&entity->graph_obj);
- list_del(&entity->list);
spin_unlock(&mdev->lock);
entity->graph_obj.mdev = NULL;
}
switch (type) {
case MEDIA_GRAPH_ENTITY:
gobj->id = media_gobj_gen_id(type, ++mdev->entity_id);
+ list_add_tail(&gobj->list, &mdev->entities);
break;
case MEDIA_GRAPH_PAD:
gobj->id = media_gobj_gen_id(type, ++mdev->pad_id);
gobj->id = media_gobj_gen_id(type, ++mdev->link_id);
break;
case MEDIA_GRAPH_INTF_DEVNODE:
+ list_add_tail(&gobj->list, &mdev->interfaces);
gobj->id = media_gobj_gen_id(type, ++mdev->intf_devnode_id);
break;
}
*/
void media_gobj_remove(struct media_gobj *gobj)
{
+ /* Remove the object from mdev list */
+ switch (media_type(gobj)) {
+ case MEDIA_GRAPH_ENTITY:
+ case MEDIA_GRAPH_INTF_DEVNODE:
+ list_del(&gobj->list);
+ break;
+ default:
+ break;
+ }
+
dev_dbg_obj(__func__, gobj);
}
INIT_LIST_HEAD(&intf->links);
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 */
void media_devnode_remove(struct media_intf_devnode *devnode)
{
media_gobj_remove(&devnode->intf.graph_obj);
- list_del(&devnode->intf.list);
kfree(devnode);
}
EXPORT_SYMBOL_GPL(media_devnode_remove);
/* Iterate over all entities. */
#define media_device_for_each_entity(entity, mdev) \
- list_for_each_entry(entity, &(mdev)->entities, list)
+ list_for_each_entry(entity, &(mdev)->entities, graph_obj.list)
/* Iterate over all interfaces. */
#define media_device_for_each_intf(intf, mdev) \
- list_for_each_entry(intf, &(mdev)->interfaces, list)
+ list_for_each_entry(intf, &(mdev)->interfaces, graph_obj.list)
#else
struct media_gobj {
struct media_device *mdev;
u32 id;
+ struct list_head list;
};
struct media_entity {
struct media_gobj graph_obj; /* must be first field in struct */
- struct list_head list;
const char *name; /* Entity name */
u32 type; /* Entity type (MEDIA_ENT_T_*) */
u32 revision; /* Entity revision, driver specific */
*/
struct media_interface {
struct media_gobj graph_obj;
- struct list_head list;
struct list_head links;
u32 type;
u32 flags;