Re: [PATCH 2/2] [media] media: move MEDIA_LNK_FL_INTERFACE_LINK logic to link creation

2015-12-28 Thread Mauro Carvalho Chehab
Em Mon, 28 Dec 2015 02:31:32 +0200
Sakari Ailus  escreveu:

> Hi Mauro,
> 
> (Resending, there was an error in handling the cc field.)
> 
> On Fri, Dec 11, 2015 at 06:17:53PM -0200, Mauro Carvalho Chehab wrote:
> > diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
> > index 181ca0de6e52..7895e17aeee9 100644
> > --- a/drivers/media/media-entity.c
> > +++ b/drivers/media/media-entity.c
> > @@ -526,7 +526,7 @@ media_create_pad_link(struct media_entity *source, u16 
> > source_pad,
> >  
> > link->source = >pads[source_pad];
> > link->sink = >pads[sink_pad];
> > -   link->flags = flags;
> > +   link->flags = flags && ~MEDIA_LNK_FL_INTERFACE_LINK;
> 
> s/&&/&/

Thanks for noticing it. Dan Carpenter sent a patch fixing it.

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


Re: [PATCH 2/2] [media] media: move MEDIA_LNK_FL_INTERFACE_LINK logic to link creation

2015-12-27 Thread Sakari Ailus
Hi Mauro,

(Resending, there was an error in handling the cc field.)

On Fri, Dec 11, 2015 at 06:17:53PM -0200, Mauro Carvalho Chehab wrote:
> diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
> index 181ca0de6e52..7895e17aeee9 100644
> --- a/drivers/media/media-entity.c
> +++ b/drivers/media/media-entity.c
> @@ -526,7 +526,7 @@ media_create_pad_link(struct media_entity *source, u16 
> source_pad,
>  
>   link->source = >pads[source_pad];
>   link->sink = >pads[sink_pad];
> - link->flags = flags;
> + link->flags = flags && ~MEDIA_LNK_FL_INTERFACE_LINK;

s/&&/&/

>  
>   /* Initialize graph object embedded at the new link */
>   media_gobj_create(source->graph_obj.mdev, MEDIA_GRAPH_LINK,
> @@ -756,7 +756,7 @@ struct media_link *media_create_intf_link(struct 
> media_entity *entity,
>  
>   link->intf = intf;
>   link->entity = entity;
> - link->flags = flags;
> + link->flags = flags | MEDIA_LNK_FL_INTERFACE_LINK;
>  
>   /* Initialize graph object embedded at the new link */
>   media_gobj_create(intf->graph_obj.mdev, MEDIA_GRAPH_LINK,

-- 
Kind regards,

Sakari Ailus
e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] [media] media: move MEDIA_LNK_FL_INTERFACE_LINK logic to link creation

2015-12-11 Thread Mauro Carvalho Chehab
Instead of flagging an interface link as MEDIA_LNK_FL_INTERFACE_LINK
only when returning to userspace, do it at link creation time.

That would allow using such flag internally, and cleans up a
little bit the code for G_TOPOLOGY ioctl.

Suggested-by: Hans Verkuil 
Signed-off-by: Mauro Carvalho Chehab 
---
 drivers/media/media-device.c | 3 ---
 drivers/media/media-entity.c | 4 ++--
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
index 6406914a9bf5..c12481c753a0 100644
--- a/drivers/media/media-device.c
+++ b/drivers/media/media-device.c
@@ -361,9 +361,6 @@ static long __media_device_get_topology(struct media_device 
*mdev,
klink.sink_id = link->gobj1->id;
klink.flags = link->flags;
 
-   if (media_type(link->gobj0) != MEDIA_GRAPH_PAD)
-   klink.flags |= MEDIA_LNK_FL_INTERFACE_LINK;
-
if (copy_to_user(ulink, , sizeof(klink)))
ret = -EFAULT;
ulink++;
diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
index 181ca0de6e52..7895e17aeee9 100644
--- a/drivers/media/media-entity.c
+++ b/drivers/media/media-entity.c
@@ -526,7 +526,7 @@ media_create_pad_link(struct media_entity *source, u16 
source_pad,
 
link->source = >pads[source_pad];
link->sink = >pads[sink_pad];
-   link->flags = flags;
+   link->flags = flags && ~MEDIA_LNK_FL_INTERFACE_LINK;
 
/* Initialize graph object embedded at the new link */
media_gobj_create(source->graph_obj.mdev, MEDIA_GRAPH_LINK,
@@ -756,7 +756,7 @@ struct media_link *media_create_intf_link(struct 
media_entity *entity,
 
link->intf = intf;
link->entity = entity;
-   link->flags = flags;
+   link->flags = flags | MEDIA_LNK_FL_INTERFACE_LINK;
 
/* Initialize graph object embedded at the new link */
media_gobj_create(intf->graph_obj.mdev, MEDIA_GRAPH_LINK,
-- 
2.5.0

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