[PATCH RFC v3 04/16] media: ensure that entities will have an object ID

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



All objects need an object ID. However, as v4l2 subdevs embeed
entities internally, the code needs to manually check if the
entity objects were not properly initialized and do it at
entity register time.

Signed-off-by: Mauro Carvalho Chehab <mchehab@xxxxxxxxxxxxxxx>

diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
index e627b0b905ad..960a4e30c68d 100644
--- a/drivers/media/media-device.c
+++ b/drivers/media/media-device.c
@@ -435,6 +435,13 @@ int __must_check media_device_register_entity(struct media_device *mdev,
 	entity->parent = mdev;
 
 	spin_lock(&mdev->lock);
+	/* Initialize media_graph_obj embedded at the entity */
+	graph_obj_init(mdev, MEDIA_GRAPH_ENTITY, &entity->graph_obj);
+
+	/*
+	 * FIXME: should it use the unique object ID or would it
+	 * break support on the legacy MC API?
+	 */
 	if (entity->id == 0)
 		entity->id = mdev->entity_id++;
 	else
@@ -461,6 +468,7 @@ void media_device_unregister_entity(struct media_entity *entity)
 		return;
 
 	spin_lock(&mdev->lock);
+	graph_obj_remove(&entity->graph_obj);
 	list_del(&entity->list);
 	spin_unlock(&mdev->lock);
 	entity->parent = NULL;
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux