[media] media: use entity.graph_obj.mdev instead of .parent
The struct media_entity has a .parent field that stores a pointer
to the parent struct media_device. But recently a media_gobj was
embedded into the entities and since struct media_gojb already has
a pointer to a struct media_device in the .mdev field, the .parent
field becomes redundant and can be removed.
This patch replaces all the usage of .parent by .graph_obj.mdev so
that field will become unused and can be removed on a later patch.
No functional changes.
The transformation was made using the following coccinelle spatch:
@@
struct media_entity *me;
@@
- me->parent
+ me->graph_obj.mdev
@@
struct media_entity *link;
@@
- link->source->entity->parent
+ link->source->entity->graph_obj.mdev
@@
struct exynos_video_entity *ve;
@@
- ve->vdev.entity.parent
+ ve->vdev.entity.graph_obj.mdev
Suggested-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
index 0f38444..138b184 100644
--- a/drivers/media/media-device.c
+++ b/drivers/media/media-device.c
@@ -435,8 +435,8 @@
int i;
/* Warn if we apparently re-register an entity */
- WARN_ON(entity->parent != NULL);
- entity->parent = mdev;
+ WARN_ON(entity->graph_obj.mdev != NULL);
+ entity->graph_obj.mdev = mdev;
spin_lock(&mdev->lock);
/* Initialize media_gobj embedded at the entity */
@@ -471,7 +471,7 @@
void media_device_unregister_entity(struct media_entity *entity)
{
int i;
- struct media_device *mdev = entity->parent;
+ struct media_device *mdev = entity->graph_obj.mdev;
if (mdev == NULL)
return;
@@ -484,7 +484,7 @@
media_gobj_remove(&entity->graph_obj);
list_del(&entity->list);
spin_unlock(&mdev->lock);
- entity->parent = NULL;
+ entity->graph_obj.mdev = NULL;
}
EXPORT_SYMBOL_GPL(media_device_unregister_entity);