All of lore.kernel.org
 help / color / mirror / Atom feed
From: Javier Martinez Canillas <javier@osg.samsung.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: linux-kernel@vger.kernel.org,
	Hans Verkuil <hans.verkuil@cisco.com>,
	Mauro Carvalho Chehab <mchehab@osg.samsung.com>,
	linux-media@vger.kernel.org
Subject: Re: [PATCH 4/5] [media] uvcvideo: create pad links after subdev registration
Date: Mon, 7 Dec 2015 12:04:50 -0300	[thread overview]
Message-ID: <5665A012.90509@osg.samsung.com> (raw)
In-Reply-To: <2329250.FAlNbDTqBe@avalon>

Hello Laurent,

On 12/05/2015 11:44 PM, Laurent Pinchart wrote:
> Hi Javier,
> 
> Thank you for the patch.
>

Thanks for your review.
 
> On Monday 07 September 2015 16:10:25 Javier Martinez Canillas wrote:
> 
> [snip]
> 
>> From 8be356e77eeefdc5c0738dd429205f3398c5b76c Mon Sep 17 00:00:00 2001
>> From: Javier Martinez Canillas <javier@osg.samsung.com>
>> Date: Thu, 3 Sep 2015 13:46:06 +0200
>> Subject: [PATCH v2 4/5] [media] uvcvideo: create pad links after subdev
>>  registration
>>
>> The uvc driver creates the pads links before the media entity is
>> registered with the media device. This doesn't work now that obj
>> IDs are used to create links so the media_device has to be set.
>>
>> Move entities registration logic before pads links creation.
>>
>> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
>> ---
>>
>> Changes since v1:
>>  - Don't try to register a UVC entity subdev for type UVC_TT_STREAMING.
>>
>>  drivers/media/usb/uvc/uvc_entity.c | 23 +++++++++++++++++++----
>>  1 file changed, 19 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/media/usb/uvc/uvc_entity.c
>> b/drivers/media/usb/uvc/uvc_entity.c index 429e428ccd93..7f82b65b238e
>> 100644
>> --- a/drivers/media/usb/uvc/uvc_entity.c
>> +++ b/drivers/media/usb/uvc/uvc_entity.c
>> @@ -26,6 +26,15 @@
>>  static int uvc_mc_register_entity(struct uvc_video_chain *chain,
>>         struct uvc_entity *entity)
>>  {
>> +       if (UVC_ENTITY_TYPE(entity) == UVC_TT_STREAMING)
>> +               return 0;
>> +
>> +       return v4l2_device_register_subdev(&chain->dev->vdev,
>> &entity->subdev);
>> +}
>> +
>> +static int uvc_mc_create_pads_links(struct uvc_video_chain *chain,
>> +                                   struct uvc_entity *entity)
>> +{
>>         const u32 flags = MEDIA_LNK_FL_ENABLED | MEDIA_LNK_FL_IMMUTABLE;
>>         struct media_entity *sink;
>>         unsigned int i;
>> @@ -62,10 +71,7 @@ static int uvc_mc_register_entity(struct uvc_video_chain
>> *chain, return ret;
>>         }
>>  
>> -       if (UVC_ENTITY_TYPE(entity) == UVC_TT_STREAMING)
>> -               return 0;
>> -
>> -       return v4l2_device_register_subdev(&chain->dev->vdev,
>> &entity->subdev);
>> +       return 0;
>>  }
>>  
>>  static struct v4l2_subdev_ops uvc_subdev_ops = {
>> @@ -124,5 +130,14 @@ int uvc_mc_register_entities(struct uvc_video_chain
>> *chain) }
>>         }
>>  
>> +       list_for_each_entry(entity, &chain->entities, chain) {
>> +               ret = uvc_mc_create_pads_links(chain, entity);
> 
> You can call this uvc_mc_create_links(), there's no other type of links in the 
> driver.
>

Ok.
 
>> +               if (ret < 0) {
>> +                       uvc_printk(KERN_INFO, "Failed to create pads links
>> for "
> 
> Same here, I'd s/pad links/links/.
>

Ok.
 
>> +                                  "entity %u\n", entity->id);
>> +                       return ret;
>> +               }
>> +       }
> 
> This creates three loops, and I think that's one too much. The reason why init 
> and register are separate is that the latter creates links, which requires all 
> entities to be initialized. If you move link create after registration I 
> believe you can init and register in a single loop (just move the 
> v4l2_device_register_subdev() call in the appropriate location in 
> uvc_mc_init_entity()) and then create links in a second loop.
> 

You are right, I'll simplify this to only have two loops as suggested.

>>         return 0;
>>  }
> 

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America

  reply	other threads:[~2015-12-07 15:04 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-03 16:00 [PATCH 0/5] [media] Create pads links after entities registration Javier Martinez Canillas
2015-09-03 16:00 ` Javier Martinez Canillas
2015-09-03 16:00 ` [PATCH 1/5] [media] staging: omap4iss: separate links creation from entities init Javier Martinez Canillas
2015-12-06  3:10   ` Laurent Pinchart
2015-12-07 15:19     ` Javier Martinez Canillas
2015-09-03 16:00 ` [PATCH 2/5] [media] v4l: vsp1: create pad links after subdev registration Javier Martinez Canillas
2015-09-03 16:00   ` Javier Martinez Canillas
2015-12-06  2:46   ` Laurent Pinchart
2015-12-06  2:46     ` Laurent Pinchart
2015-09-03 16:00 ` [PATCH 3/5] [media] v4l: vsp1: separate links creation from entities init Javier Martinez Canillas
2015-09-03 16:00   ` Javier Martinez Canillas
2015-12-06  2:51   ` Laurent Pinchart
2015-12-06  2:51     ` Laurent Pinchart
2015-12-07 15:08     ` Javier Martinez Canillas
2015-12-07 15:08       ` Javier Martinez Canillas
2015-09-03 16:00 ` [PATCH 4/5] [media] uvcvideo: create pad links after subdev registration Javier Martinez Canillas
2015-09-07 14:10   ` Javier Martinez Canillas
2015-12-06  2:44     ` Laurent Pinchart
2015-12-07 15:04       ` Javier Martinez Canillas [this message]
2015-09-03 16:00 ` [PATCH 5/5] [media] smiapp: " Javier Martinez Canillas
2015-12-06  2:33   ` Laurent Pinchart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5665A012.90509@osg.samsung.com \
    --to=javier@osg.samsung.com \
    --cc=hans.verkuil@cisco.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@osg.samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.