All of lore.kernel.org
 help / color / mirror / Atom feed
From: josh.wu@atmel.com (Josh Wu)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v5 2/4] media: ov2640: add async probe function
Date: Mon, 2 Mar 2015 09:48:30 +0800	[thread overview]
Message-ID: <54F3C16E.9040703@atmel.com> (raw)
In-Reply-To: <Pine.LNX.4.64.1503012202460.2412@axis700.grange>

On 3/2/2015 5:06 AM, Guennadi Liakhovetski wrote:
> Hi Josh,
>
> Thanks for a patch update. I think it looks good as a first step in your
> patch series, just a minor comment below:
>
> On Tue, 10 Feb 2015, Josh Wu wrote:
>
>> In async probe, there is a case that ov2640 is probed before the
>> host device which provided 'mclk'.
>> To support this async probe, we will get 'mclk' at first in the probe(),
>> if failed it will return -EPROBE_DEFER. That will let ov2640 wait for
>> the host device probed.
>>
>> Signed-off-by: Josh Wu <josh.wu@atmel.com>
>> ---
>>
>> Changes in v5:
>> - don't change the ov2640_s_power() code.
>> - will get 'mclk' at the beginning of ov2640_probe().
>>
>> Changes in v4: None
>> Changes in v3: None
>> Changes in v2: None
>>
>>   drivers/media/i2c/soc_camera/ov2640.c | 29 +++++++++++++++++++----------
>>   1 file changed, 19 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/media/i2c/soc_camera/ov2640.c b/drivers/media/i2c/soc_camera/ov2640.c
>> index 1fdce2f..057dd49 100644
>> --- a/drivers/media/i2c/soc_camera/ov2640.c
>> +++ b/drivers/media/i2c/soc_camera/ov2640.c
>> @@ -1068,6 +1068,10 @@ static int ov2640_probe(struct i2c_client *client,
>>   		return -ENOMEM;
>>   	}
>>   
>> +	priv->clk = v4l2_clk_get(&client->dev, "mclk");
>> +	if (IS_ERR(priv->clk))
>> +		return -EPROBE_DEFER;
>> +
>>   	v4l2_i2c_subdev_init(&priv->subdev, client, &ov2640_subdev_ops);
>>   	v4l2_ctrl_handler_init(&priv->hdl, 2);
>>   	v4l2_ctrl_new_std(&priv->hdl, &ov2640_ctrl_ops,
>> @@ -1075,24 +1079,28 @@ static int ov2640_probe(struct i2c_client *client,
>>   	v4l2_ctrl_new_std(&priv->hdl, &ov2640_ctrl_ops,
>>   			V4L2_CID_HFLIP, 0, 1, 1, 0);
>>   	priv->subdev.ctrl_handler = &priv->hdl;
>> -	if (priv->hdl.error)
>> -		return priv->hdl.error;
>> -
>> -	priv->clk = v4l2_clk_get(&client->dev, "mclk");
>> -	if (IS_ERR(priv->clk)) {
>> -		ret = PTR_ERR(priv->clk);
>> -		goto eclkget;
>> +	if (priv->hdl.error) {
>> +		ret = priv->hdl.error;
>> +		goto err_clk;
>>   	}
>>   
>>   	ret = ov2640_video_probe(client);
>>   	if (ret) {
>> -		v4l2_clk_put(priv->clk);
>> -eclkget:
>> -		v4l2_ctrl_handler_free(&priv->hdl);
>> +		goto err_videoprobe;
> Since you add a "goto" here, you don't need an "else" after it, and the
> "probed" success message should go down, so, just make it
>
> 	ret = ov2640_video_probe(client);
> 	if (ret < 0)
> 		goto err_videoprobe;
>
> 	ret = v4l2_async_register_subdev(&priv->subdev);
> 	if (ret < 0)
> 		goto err_videoprobe;
>
> 	dev_info(&adapter->dev, "OV2640 Probed\n");
>
> 	return 0;
>
> err_...

Yes. This looks better.
I'll update and resend this patch. This change is independent and no 
need to resend the whole patch series.
Thanks.

Best Regards,
Josh Wu

>
> Thanks
> Guennadi
>
>>   	} else {
>>   		dev_info(&adapter->dev, "OV2640 Probed\n");
>>   	}
>>   
>> +	ret = v4l2_async_register_subdev(&priv->subdev);
>> +	if (ret < 0)
>> +		goto err_videoprobe;
>> +
>> +	return 0;
>> +
>> +err_videoprobe:
>> +	v4l2_ctrl_handler_free(&priv->hdl);
>> +err_clk:
>> +	v4l2_clk_put(priv->clk);
>>   	return ret;
>>   }
>>   
>> @@ -1100,6 +1108,7 @@ static int ov2640_remove(struct i2c_client *client)
>>   {
>>   	struct ov2640_priv       *priv = to_ov2640(client);
>>   
>> +	v4l2_async_unregister_subdev(&priv->subdev);
>>   	v4l2_clk_put(priv->clk);
>>   	v4l2_device_unregister_subdev(&priv->subdev);
>>   	v4l2_ctrl_handler_free(&priv->hdl);
>> -- 
>> 1.9.1
>>

WARNING: multiple messages have this Message-ID (diff)
From: Josh Wu <josh.wu@atmel.com>
To: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Linux Media Mailing List <linux-media@vger.kernel.org>,
	linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v5 2/4] media: ov2640: add async probe function
Date: Mon, 2 Mar 2015 09:48:30 +0800	[thread overview]
Message-ID: <54F3C16E.9040703@atmel.com> (raw)
In-Reply-To: <Pine.LNX.4.64.1503012202460.2412@axis700.grange>

On 3/2/2015 5:06 AM, Guennadi Liakhovetski wrote:
> Hi Josh,
>
> Thanks for a patch update. I think it looks good as a first step in your
> patch series, just a minor comment below:
>
> On Tue, 10 Feb 2015, Josh Wu wrote:
>
>> In async probe, there is a case that ov2640 is probed before the
>> host device which provided 'mclk'.
>> To support this async probe, we will get 'mclk' at first in the probe(),
>> if failed it will return -EPROBE_DEFER. That will let ov2640 wait for
>> the host device probed.
>>
>> Signed-off-by: Josh Wu <josh.wu@atmel.com>
>> ---
>>
>> Changes in v5:
>> - don't change the ov2640_s_power() code.
>> - will get 'mclk' at the beginning of ov2640_probe().
>>
>> Changes in v4: None
>> Changes in v3: None
>> Changes in v2: None
>>
>>   drivers/media/i2c/soc_camera/ov2640.c | 29 +++++++++++++++++++----------
>>   1 file changed, 19 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/media/i2c/soc_camera/ov2640.c b/drivers/media/i2c/soc_camera/ov2640.c
>> index 1fdce2f..057dd49 100644
>> --- a/drivers/media/i2c/soc_camera/ov2640.c
>> +++ b/drivers/media/i2c/soc_camera/ov2640.c
>> @@ -1068,6 +1068,10 @@ static int ov2640_probe(struct i2c_client *client,
>>   		return -ENOMEM;
>>   	}
>>   
>> +	priv->clk = v4l2_clk_get(&client->dev, "mclk");
>> +	if (IS_ERR(priv->clk))
>> +		return -EPROBE_DEFER;
>> +
>>   	v4l2_i2c_subdev_init(&priv->subdev, client, &ov2640_subdev_ops);
>>   	v4l2_ctrl_handler_init(&priv->hdl, 2);
>>   	v4l2_ctrl_new_std(&priv->hdl, &ov2640_ctrl_ops,
>> @@ -1075,24 +1079,28 @@ static int ov2640_probe(struct i2c_client *client,
>>   	v4l2_ctrl_new_std(&priv->hdl, &ov2640_ctrl_ops,
>>   			V4L2_CID_HFLIP, 0, 1, 1, 0);
>>   	priv->subdev.ctrl_handler = &priv->hdl;
>> -	if (priv->hdl.error)
>> -		return priv->hdl.error;
>> -
>> -	priv->clk = v4l2_clk_get(&client->dev, "mclk");
>> -	if (IS_ERR(priv->clk)) {
>> -		ret = PTR_ERR(priv->clk);
>> -		goto eclkget;
>> +	if (priv->hdl.error) {
>> +		ret = priv->hdl.error;
>> +		goto err_clk;
>>   	}
>>   
>>   	ret = ov2640_video_probe(client);
>>   	if (ret) {
>> -		v4l2_clk_put(priv->clk);
>> -eclkget:
>> -		v4l2_ctrl_handler_free(&priv->hdl);
>> +		goto err_videoprobe;
> Since you add a "goto" here, you don't need an "else" after it, and the
> "probed" success message should go down, so, just make it
>
> 	ret = ov2640_video_probe(client);
> 	if (ret < 0)
> 		goto err_videoprobe;
>
> 	ret = v4l2_async_register_subdev(&priv->subdev);
> 	if (ret < 0)
> 		goto err_videoprobe;
>
> 	dev_info(&adapter->dev, "OV2640 Probed\n");
>
> 	return 0;
>
> err_...

Yes. This looks better.
I'll update and resend this patch. This change is independent and no 
need to resend the whole patch series.
Thanks.

Best Regards,
Josh Wu

>
> Thanks
> Guennadi
>
>>   	} else {
>>   		dev_info(&adapter->dev, "OV2640 Probed\n");
>>   	}
>>   
>> +	ret = v4l2_async_register_subdev(&priv->subdev);
>> +	if (ret < 0)
>> +		goto err_videoprobe;
>> +
>> +	return 0;
>> +
>> +err_videoprobe:
>> +	v4l2_ctrl_handler_free(&priv->hdl);
>> +err_clk:
>> +	v4l2_clk_put(priv->clk);
>>   	return ret;
>>   }
>>   
>> @@ -1100,6 +1108,7 @@ static int ov2640_remove(struct i2c_client *client)
>>   {
>>   	struct ov2640_priv       *priv = to_ov2640(client);
>>   
>> +	v4l2_async_unregister_subdev(&priv->subdev);
>>   	v4l2_clk_put(priv->clk);
>>   	v4l2_device_unregister_subdev(&priv->subdev);
>>   	v4l2_ctrl_handler_free(&priv->hdl);
>> -- 
>> 1.9.1
>>

WARNING: multiple messages have this Message-ID (diff)
From: Josh Wu <josh.wu@atmel.com>
To: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	"Linux Media Mailing List" <linux-media@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<devicetree@vger.kernel.org>
Subject: Re: [PATCH v5 2/4] media: ov2640: add async probe function
Date: Mon, 2 Mar 2015 09:48:30 +0800	[thread overview]
Message-ID: <54F3C16E.9040703@atmel.com> (raw)
In-Reply-To: <Pine.LNX.4.64.1503012202460.2412@axis700.grange>

On 3/2/2015 5:06 AM, Guennadi Liakhovetski wrote:
> Hi Josh,
>
> Thanks for a patch update. I think it looks good as a first step in your
> patch series, just a minor comment below:
>
> On Tue, 10 Feb 2015, Josh Wu wrote:
>
>> In async probe, there is a case that ov2640 is probed before the
>> host device which provided 'mclk'.
>> To support this async probe, we will get 'mclk' at first in the probe(),
>> if failed it will return -EPROBE_DEFER. That will let ov2640 wait for
>> the host device probed.
>>
>> Signed-off-by: Josh Wu <josh.wu@atmel.com>
>> ---
>>
>> Changes in v5:
>> - don't change the ov2640_s_power() code.
>> - will get 'mclk' at the beginning of ov2640_probe().
>>
>> Changes in v4: None
>> Changes in v3: None
>> Changes in v2: None
>>
>>   drivers/media/i2c/soc_camera/ov2640.c | 29 +++++++++++++++++++----------
>>   1 file changed, 19 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/media/i2c/soc_camera/ov2640.c b/drivers/media/i2c/soc_camera/ov2640.c
>> index 1fdce2f..057dd49 100644
>> --- a/drivers/media/i2c/soc_camera/ov2640.c
>> +++ b/drivers/media/i2c/soc_camera/ov2640.c
>> @@ -1068,6 +1068,10 @@ static int ov2640_probe(struct i2c_client *client,
>>   		return -ENOMEM;
>>   	}
>>   
>> +	priv->clk = v4l2_clk_get(&client->dev, "mclk");
>> +	if (IS_ERR(priv->clk))
>> +		return -EPROBE_DEFER;
>> +
>>   	v4l2_i2c_subdev_init(&priv->subdev, client, &ov2640_subdev_ops);
>>   	v4l2_ctrl_handler_init(&priv->hdl, 2);
>>   	v4l2_ctrl_new_std(&priv->hdl, &ov2640_ctrl_ops,
>> @@ -1075,24 +1079,28 @@ static int ov2640_probe(struct i2c_client *client,
>>   	v4l2_ctrl_new_std(&priv->hdl, &ov2640_ctrl_ops,
>>   			V4L2_CID_HFLIP, 0, 1, 1, 0);
>>   	priv->subdev.ctrl_handler = &priv->hdl;
>> -	if (priv->hdl.error)
>> -		return priv->hdl.error;
>> -
>> -	priv->clk = v4l2_clk_get(&client->dev, "mclk");
>> -	if (IS_ERR(priv->clk)) {
>> -		ret = PTR_ERR(priv->clk);
>> -		goto eclkget;
>> +	if (priv->hdl.error) {
>> +		ret = priv->hdl.error;
>> +		goto err_clk;
>>   	}
>>   
>>   	ret = ov2640_video_probe(client);
>>   	if (ret) {
>> -		v4l2_clk_put(priv->clk);
>> -eclkget:
>> -		v4l2_ctrl_handler_free(&priv->hdl);
>> +		goto err_videoprobe;
> Since you add a "goto" here, you don't need an "else" after it, and the
> "probed" success message should go down, so, just make it
>
> 	ret = ov2640_video_probe(client);
> 	if (ret < 0)
> 		goto err_videoprobe;
>
> 	ret = v4l2_async_register_subdev(&priv->subdev);
> 	if (ret < 0)
> 		goto err_videoprobe;
>
> 	dev_info(&adapter->dev, "OV2640 Probed\n");
>
> 	return 0;
>
> err_...

Yes. This looks better.
I'll update and resend this patch. This change is independent and no 
need to resend the whole patch series.
Thanks.

Best Regards,
Josh Wu

>
> Thanks
> Guennadi
>
>>   	} else {
>>   		dev_info(&adapter->dev, "OV2640 Probed\n");
>>   	}
>>   
>> +	ret = v4l2_async_register_subdev(&priv->subdev);
>> +	if (ret < 0)
>> +		goto err_videoprobe;
>> +
>> +	return 0;
>> +
>> +err_videoprobe:
>> +	v4l2_ctrl_handler_free(&priv->hdl);
>> +err_clk:
>> +	v4l2_clk_put(priv->clk);
>>   	return ret;
>>   }
>>   
>> @@ -1100,6 +1108,7 @@ static int ov2640_remove(struct i2c_client *client)
>>   {
>>   	struct ov2640_priv       *priv = to_ov2640(client);
>>   
>> +	v4l2_async_unregister_subdev(&priv->subdev);
>>   	v4l2_clk_put(priv->clk);
>>   	v4l2_device_unregister_subdev(&priv->subdev);
>>   	v4l2_ctrl_handler_free(&priv->hdl);
>> -- 
>> 1.9.1
>>


  reply	other threads:[~2015-03-02  1:48 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-10  9:31 [PATCH v5 0/4] media: ov2640: add device tree support Josh Wu
2015-02-10  9:31 ` Josh Wu
2015-02-10  9:31 ` Josh Wu
2015-02-10  9:31 ` [PATCH v5 1/4] media: soc-camera: use icd->control instead of icd->pdev for reset() Josh Wu
2015-02-10  9:31   ` Josh Wu
2015-02-10  9:31   ` Josh Wu
2015-02-10  9:31 ` [PATCH v5 2/4] media: ov2640: add async probe function Josh Wu
2015-02-10  9:31   ` Josh Wu
2015-02-10  9:31   ` Josh Wu
2015-03-01 21:06   ` Guennadi Liakhovetski
2015-03-01 21:06     ` Guennadi Liakhovetski
2015-03-02  1:48     ` Josh Wu [this message]
2015-03-02  1:48       ` Josh Wu
2015-03-02  1:48       ` Josh Wu
2015-03-02  1:52     ` [PATCH v5 2/4][resend] " Josh Wu
2015-03-02  1:52       ` Josh Wu
2015-03-02  1:52       ` Josh Wu
2015-02-10  9:31 ` [PATCH v5 3/4] media: ov2640: add primary dt support Josh Wu
2015-02-10  9:31   ` Josh Wu
2015-02-10  9:31   ` Josh Wu
2015-02-16 16:48   ` Lad, Prabhakar
2015-02-16 16:48     ` Lad, Prabhakar
2015-02-16 16:48     ` Lad, Prabhakar
2015-02-25  3:54     ` Josh Wu
2015-02-25  3:54       ` Josh Wu
2015-02-26  0:36       ` Lad, Prabhakar
2015-02-26  0:36         ` Lad, Prabhakar
2015-02-10  9:31 ` [PATCH v5 4/4] media: ov2640: dt: add the device tree binding document Josh Wu
2015-02-10  9:31   ` Josh Wu
2015-02-10  9:31   ` Josh Wu

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=54F3C16E.9040703@atmel.com \
    --to=josh.wu@atmel.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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.