Re: [PATCH v8 17/55] [media] omap3isp: separate links creation from entities init

2015-11-23 Thread Javier Martinez Canillas
Hello Laurent,

On 11/23/2015 12:55 PM, Laurent Pinchart wrote:
> Hi Javier and Mauro,
> 
> Thank you for the patch.
>

Thanks for your feedback.
 
> On Monday 12 October 2015 13:43:05 Mauro Carvalho Chehab wrote:
>> From: Javier Martinez Canillas 
>>
>> The omap3isp driver initializes the entities and creates the pads links
>> before the entities are registered with the media device. This does not
>> work now that object IDs are used to create links so the media_device
>> has to be set.
>>
>> Split out the pads links creation from the entity initialization so are
>> made after the entities registration.
> 
> Is a part of this sentence missing ?
> 

The sentence is not clear indeed, I think it should be something like:

"so the links are created after the entities have been registered with
the media device"

>> Suggested-by: Mauro Carvalho Chehab 
>> Signed-off-by: Javier Martinez Canillas 
>>
>> Series-to: linux-ker...@vger.kernel.org
>> Series-cc: Mauro Carvalho Chehab 
>> Series-cc: linux-media@vger.kernel.org
>> Series-cc: Shuah Khan 
>> Series-cc: Laurent Pinchart 
>>
>> Cover-letter:
> 
> I don't think those are known tags. Could you rework the commit message to 
> merge both part into something coherent without copying the cover letter ?
>

Yes, sorry about that. I use patman to manage and post my patches and
forgot to remove the patman tags before handling the patches to Mauro.

I mentioned to him already and he told me that would strip the tags
before pushing to the media tree or posting the patches again.

[remove left over cover letter from a different series]

>>
>> Change-Id: I44abb9b67d6378cbd54ba4e0673a5d6d5721fc77
> 
> No gerrit craziness please.
>

I believe this is something similar, a left over from Mauro since he
uses gerrit to manage this patch series.

>> ---
>>  drivers/media/platform/omap3isp/isp.c| 152 ++--
>>  drivers/media/platform/omap3isp/ispccdc.c|  22 ++--
>>  drivers/media/platform/omap3isp/ispccdc.h|   1 +
>>  drivers/media/platform/omap3isp/ispccp2.c|  22 ++--
>>  drivers/media/platform/omap3isp/ispccp2.h|   1 +
>>  drivers/media/platform/omap3isp/ispcsi2.c|  22 ++--
>>  drivers/media/platform/omap3isp/ispcsi2.h|   1 +
>>  drivers/media/platform/omap3isp/isppreview.c |  33 +++---
>>  drivers/media/platform/omap3isp/isppreview.h |   1 +
>>  drivers/media/platform/omap3isp/ispresizer.c |  33 +++---
>>  drivers/media/platform/omap3isp/ispresizer.h |   1 +
>>  11 files changed, 185 insertions(+), 104 deletions(-)
>>
>> diff --git a/drivers/media/platform/omap3isp/isp.c
>> b/drivers/media/platform/omap3isp/isp.c index aa13b17d19a0..b8f6f81d2db2
>> 100644
>> --- a/drivers/media/platform/omap3isp/isp.c
>> +++ b/drivers/media/platform/omap3isp/isp.c
>> @@ -1933,6 +1933,100 @@ done:
>>  return ret;
>>  }
>>
>> +/*
>> + * isp_create_pads_links - Pads links creation for the subdevices
>> + * @isp : Pointer to ISP device
> 
> Missing blank line here. And missing description of the function for that 
> matter. You can use
> 
> "This function creates all links between ISP internal and external entities."
> 
>> + * return negative error code or zero on success
> 
> In kerneldoc style that should be
> 
> Return: A negative error code on failure or zero on success. Possible error 
> codes are those returned by media_create_pad_link().
> 
> Same for the other functions below, the return line should start with 
> "Return:".
>

You are right, the kerneldoc is not correct. I'll fix it.

>> + */
>> +static int isp_create_pads_links(struct isp_device *isp)
> 
> This should be called isp_create_pad_links() if you want the include the pad 
> prefix, but I'd just name it isp_create_links() as the driver doesn't handle 
> any other kind of links. Same for all the *_create_pads_links() functions 
> below.
>

Ok.

>> +{
>> +int ret;
>> +
>> +ret = omap3isp_csi2_create_pads_links(isp);
>> +if (ret < 0) {
>> +dev_err(isp->dev, "CSI2 pads links creation failed\n");
> 
> That's lots of error strings. You would save memory by turning the messages 
> into "%s pads links creation failed\n", "CSI2" as the compiler will then 
> avoid 
> multiple copies of the first string.
> 
> I would actually remove the messages as the only source of error is a memory 
> allocation failure, which will already print a message. You could add a 
> single 
> dev_err() in the location where isp_create_pads_links() is called if you want 
> to.
>

Agreed, I'll just remove the messages.

>> +return ret;
>> +}
>> +
>> +ret = omap3isp_ccp2_create_pads_links(isp);
>> +if (ret < 0) {
>> +dev_err(isp->dev, "CCP2 pads links creation failed\n");
>> +return ret;
>> +}
>> +
>> +ret = omap3isp_ccdc_create_pads_links(isp);
>> +if (ret < 0) {
>> + 

Re: [PATCH v8 17/55] [media] omap3isp: separate links creation from entities init

2015-11-23 Thread Laurent Pinchart
Hi Javier and Mauro,

Thank you for the patch.

On Monday 12 October 2015 13:43:05 Mauro Carvalho Chehab wrote:
> From: Javier Martinez Canillas 
> 
> The omap3isp driver initializes the entities and creates the pads links
> before the entities are registered with the media device. This does not
> work now that object IDs are used to create links so the media_device
> has to be set.
> 
> Split out the pads links creation from the entity initialization so are
> made after the entities registration.

Is a part of this sentence missing ?

> Suggested-by: Mauro Carvalho Chehab 
> Signed-off-by: Javier Martinez Canillas 
> 
> Series-to: linux-ker...@vger.kernel.org
> Series-cc: Mauro Carvalho Chehab 
> Series-cc: linux-media@vger.kernel.org
> Series-cc: Shuah Khan 
> Series-cc: Laurent Pinchart 
> 
> Cover-letter:

I don't think those are known tags. Could you rework the commit message to 
merge both part into something coherent without copying the cover letter ?

> Patches to test MC next gen patches in OMAP3 ISP
> Hello,
> 
> This series contains two patches that are needed to test the
> "[PATCH v7 00/44] MC next generation patches" [0] in a OMAP3
> board by using the omap3isp driver.
> 
> I found two issues during testing, the first one is that the
> media_entity_cleanup() function tries to empty the pad links
> list but the list is initialized when a entity is registered
> causing a NULL pointer deference error.
> 
> The second issue is that the omap3isp driver creates links
> when the entities are initialized but before the media device
> is registered causing a NULL pointer deference as well.
> 
> Patch 1/1 fixes the first issue by removing the links list
> empty logic from media_entity_cleanup() since that is made
> in media_device_unregister_entity() and 2/2 fixes the second
> issue by separating the entities initialization from the pads
> links creation after the entities have been registered.
> 
> Patch 1/1 was posted before [1] but forgot to add the [media]
> prefix in the subject line so I'm including in this set again.
> Sorry about that.
> 
> The testing was made on an OMAP3 DM3735 IGEPv2 board and test
> that the media-ctl -p prints out the topology. More extensive
> testing will be made but I wanted to share these patches in
> order to make easier for other people that were looking at it.
> 
> [0]: https://www.mail-archive.com/linux-media@vger.kernel.org/msg91528.html
> [1]: https://lkml.org/lkml/2015/8/24/649
> 
> Best regards,
> Javier
> END
> 
> Change-Id: I44abb9b67d6378cbd54ba4e0673a5d6d5721fc77

No gerrit craziness please.

> ---
>  drivers/media/platform/omap3isp/isp.c| 152 ++--
>  drivers/media/platform/omap3isp/ispccdc.c|  22 ++--
>  drivers/media/platform/omap3isp/ispccdc.h|   1 +
>  drivers/media/platform/omap3isp/ispccp2.c|  22 ++--
>  drivers/media/platform/omap3isp/ispccp2.h|   1 +
>  drivers/media/platform/omap3isp/ispcsi2.c|  22 ++--
>  drivers/media/platform/omap3isp/ispcsi2.h|   1 +
>  drivers/media/platform/omap3isp/isppreview.c |  33 +++---
>  drivers/media/platform/omap3isp/isppreview.h |   1 +
>  drivers/media/platform/omap3isp/ispresizer.c |  33 +++---
>  drivers/media/platform/omap3isp/ispresizer.h |   1 +
>  11 files changed, 185 insertions(+), 104 deletions(-)
> 
> diff --git a/drivers/media/platform/omap3isp/isp.c
> b/drivers/media/platform/omap3isp/isp.c index aa13b17d19a0..b8f6f81d2db2
> 100644
> --- a/drivers/media/platform/omap3isp/isp.c
> +++ b/drivers/media/platform/omap3isp/isp.c
> @@ -1933,6 +1933,100 @@ done:
>   return ret;
>  }
> 
> +/*
> + * isp_create_pads_links - Pads links creation for the subdevices
> + * @isp : Pointer to ISP device

Missing blank line here. And missing description of the function for that 
matter. You can use

"This function creates all links between ISP internal and external entities."

> + * return negative error code or zero on success

In kerneldoc style that should be

Return: A negative error code on failure or zero on success. Possible error 
codes are those returned by media_create_pad_link().

Same for the other functions below, the return line should start with 
"Return:".

> + */
> +static int isp_create_pads_links(struct isp_device *isp)

This should be called isp_create_pad_links() if you want the include the pad 
prefix, but I'd just name it isp_create_links() as the driver doesn't handle 
any other kind of links. Same for all the *_create_pads_links() functions 
below.

> +{
> + int ret;
> +
> + ret = omap3isp_csi2_create_pads_links(isp);
> + if (ret < 0) {
> + dev_err(isp->dev, "CSI2 pads links creation failed\n");

That's lots of error strings. You would save memory by turning the messages 
into "%s pads links creation failed\n", "CSI2" as the compiler will then avoid 
multiple