Re: [PATCH v7 11/44] [media] media: use entity.graph_obj.mdev instead of .parent

2015-08-26 Thread Mauro Carvalho Chehab
Em Tue, 25 Aug 2015 13:25:15 -0600
Shuah Khan  escreveu:

> On Tue, Aug 25, 2015 at 12:36 AM, Hans Verkuil  wrote:
> > On 08/23/2015 10:17 PM, Mauro Carvalho Chehab wrote:
> >> From: Javier Martinez Canillas 
> >>
> >> 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 
> >>
> >> Signed-off-by: Javier Martinez Canillas 
> >> Signed-off-by: Mauro Carvalho Chehab 
> >
> > Acked-by: Hans Verkuil 
> 
> The change looks good to me. I would really like to see a before and after
> media graph with these changes, this patch and series in general.

Well, it shouldn't change. If something changes, things would be wrong
:)

Btw, Javier is doing a before/after tests on OMAP3. There are a few
fixup things to be added/adjusted (unfortunately, OMAP3 doesn't compile
on x86 COMPILE_TEST), but on his tests, the differences between before
and after, with media-ctl are zero.

As media-ctl is using the legacy API, it shouldn't have any changes
there, otherwise something is broken and should be fixed ;)

I'll spin this patch series with Javier fixes for OMAP at the next 
version of this patch series.

> 
> thanks,
> -- Shuah
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v7 11/44] [media] media: use entity.graph_obj.mdev instead of .parent

2015-08-25 Thread Shuah Khan
On Tue, Aug 25, 2015 at 12:36 AM, Hans Verkuil  wrote:
> On 08/23/2015 10:17 PM, Mauro Carvalho Chehab wrote:
>> From: Javier Martinez Canillas 
>>
>> 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 
>>
>> Signed-off-by: Javier Martinez Canillas 
>> Signed-off-by: Mauro Carvalho Chehab 
>
> Acked-by: Hans Verkuil 

The change looks good to me. I would really like to see a before and after
media graph with these changes, this patch and series in general.

thanks,
-- Shuah
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v7 11/44] [media] media: use entity.graph_obj.mdev instead of .parent

2015-08-24 Thread Hans Verkuil
On 08/23/2015 10:17 PM, Mauro Carvalho Chehab wrote:
> From: Javier Martinez Canillas 
> 
> 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 
> 
> Signed-off-by: Javier Martinez Canillas 
> Signed-off-by: Mauro Carvalho Chehab 

Acked-by: Hans Verkuil 
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v7 11/44] [media] media: use entity.graph_obj.mdev instead of .parent

2015-08-23 Thread Mauro Carvalho Chehab
From: Javier Martinez Canillas 

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 

Signed-off-by: Javier Martinez Canillas 
Signed-off-by: Mauro Carvalho Chehab 

diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
index 0f3844470147..138b18416460 100644
--- a/drivers/media/media-device.c
+++ b/drivers/media/media-device.c
@@ -435,8 +435,8 @@ int __must_check media_device_register_entity(struct 
media_device *mdev,
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 @@ EXPORT_SYMBOL_GPL(media_device_register_entity);
 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 @@ void media_device_unregister_entity(struct media_entity 
*entity)
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);
 
diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
index 35e52cd1fc5a..a23c93369a04 100644
--- a/drivers/media/media-entity.c
+++ b/drivers/media/media-entity.c
@@ -332,7 +332,7 @@ EXPORT_SYMBOL_GPL(media_entity_graph_walk_next);
 __must_check int media_entity_pipeline_start(struct media_entity *entity,
 struct media_pipeline *pipe)
 {
-   struct media_device *mdev = entity->parent;
+   struct media_device *mdev = entity->graph_obj.mdev;
struct media_entity_graph graph;
struct media_entity *entity_err = entity;
int ret;
@@ -387,7 +387,7 @@ __must_check int media_entity_pipeline_start(struct 
media_entity *entity,
 
ret = entity->ops->link_validate(link);
if (ret < 0 && ret != -ENOIOCTLCMD) {
-   dev_dbg(entity->parent->dev,
+   dev_dbg(entity->graph_obj.mdev->dev,
"link validation failed for \"%s\":%u 
-> \"%s\":%u, error %d\n",
link->source->entity->name,
link->source->index,
@@ -401,7 +401,7 @@ __must_check int media_entity_pipeline_start(struct 
media_entity *entity,
 
if (!bitmap_full(active, entity->num_pads)) {
ret = -EPIPE;
-   dev_dbg(entity->parent->dev,
+   dev_dbg(entity->graph_obj.mdev->dev,
"\"%s\":%u must be connected by an enabled 
link\n",
entity->name,
(unsigned)find_first_zero_bit(
@@ -454,7 +454,7 @@ EXPORT_SYMBOL_GPL(media_entity_pipeline_start);
  */
 void media_entity_pipeline_stop(struct media_entity *entity)
 {
-   struct media_device *mdev = entity->parent;
+   struct media_device *mdev = entity->graph_obj.mdev;
struct media_entity_graph graph;
 
mutex_lock(&mdev->graph_mutex);
@@ -490,8 +490,8 @@ struct media_entity *media_entity_get(struct media_entity 
*entity)
if (entity == NULL)
return NULL;
 
-   if (entity->parent->dev &&
-   !try_module_get(entity->parent->dev->driver->owner))
+   if (entity->graph_obj.mdev->dev &&
+   !try_module_get(entity->graph_obj.mdev->dev->driver->owner))
return NULL;
 
return entity;
@@ -511,8 +511,8 @@ void media_entity_put(struct media_entity *entity)
if (entity == NULL)
return;
 
-   if (entity->parent->dev)
-   module_put(entity->parent->dev->driver->owner);
+   if (entity->graph_obj.mdev->dev)
+   module_put(entity->graph_obj.mdev->dev->driver