int __must_check media_device_register_entity(struct media_device *mdev,
struct media_entity *entity)
{
+ int i;
+
/* Warn if we apparently re-register an entity */
WARN_ON(entity->parent != NULL);
entity->parent = mdev;
/* 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++)
+ media_gobj_init(mdev, MEDIA_GRAPH_PAD,
+ &entity->pads[i].graph_obj);
+
spin_unlock(&mdev->lock);
return 0;
*/
void media_device_unregister_entity(struct media_entity *entity)
{
+ int i;
struct media_device *mdev = entity->parent;
if (mdev == NULL)
return;
spin_lock(&mdev->lock);
+ 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);
* @hw_revision: Hardware device revision
* @driver_version: Device driver version
* @entity_id: Unique ID used on the last entity registered
+ * @pad_id: Unique ID used on the last pad registered
* @entities: List of registered entities
* @lock: Entities list lock
* @graph_mutex: Entities graph operation lock
u32 driver_version;
u32 entity_id;
+ u32 pad_id;
struct list_head entities;
* enum media_gobj_type - type of a graph object
*
* @MEDIA_GRAPH_ENTITY: Identify a media entity
+ * @MEDIA_GRAPH_PAD: Identify a media pad
*/
enum media_gobj_type {
MEDIA_GRAPH_ENTITY,
+ MEDIA_GRAPH_PAD,
};
#define MEDIA_BITS_PER_TYPE 8
};
struct media_pad {
+ struct media_gobj graph_obj;
struct media_entity *entity; /* Entity this pad belongs to */
u16 index; /* Pad index in the entity pads array */
unsigned long flags; /* Pad flags (MEDIA_PAD_FL_*) */