From: Josh Wu <josh.wu@atmel.com>
To: unlisted-recipients:; (no To-header on input)@casper.infradead.org
Cc: <g.liakhovetski@gmx.de>, <m.chehab@samsung.com>,
<linux-media@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<sylvester.nawrocki@gmail.com>
Subject: Re: [PATCH v2] [media] ov2640: add support for async device registration
Date: Wed, 26 Mar 2014 14:27:14 +0800 [thread overview]
Message-ID: <53327342.1020705@atmel.com> (raw)
In-Reply-To: <1395306109-11016-1-git-send-email-josh.wu@atmel.com>
Hi, all
since v4l2_clk_get() WON'T return EPROBE_DEFER. So this version of patch
is invalid.
Please drop this version of the patch.
Sorry for the noise.
Best Regards,
Josh Wu
On 3/20/2014 5:01 PM, Josh Wu wrote:
> Since the the v4l2_clk_get() may return a EPROBE_DEFER during async
> probing. So move the v4l2_clk_get() to the beginning of the
> probe(). Only when we get mclk successfully we continue the probe.
>
> Signed-off-by: Josh Wu <josh.wu@atmel.com>
> ---
> v1 -> v2:
> just return PTR_ERR(clk) as it can be -EPROBE_DEFER.
> refined the commit message
>
> drivers/media/i2c/soc_camera/ov2640.c | 43 +++++++++++++++++++++------------
> 1 file changed, 28 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/media/i2c/soc_camera/ov2640.c b/drivers/media/i2c/soc_camera/ov2640.c
> index 6c6b1c3..7c77a15 100644
> --- a/drivers/media/i2c/soc_camera/ov2640.c
> +++ b/drivers/media/i2c/soc_camera/ov2640.c
> @@ -22,6 +22,7 @@
> #include <linux/videodev2.h>
>
> #include <media/soc_camera.h>
> +#include <media/v4l2-async.h>
> #include <media/v4l2-clk.h>
> #include <media/v4l2-subdev.h>
> #include <media/v4l2-ctrls.h>
> @@ -1069,6 +1070,7 @@ static int ov2640_probe(struct i2c_client *client,
> struct ov2640_priv *priv;
> struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
> struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
> + struct v4l2_clk *clk;
> int ret;
>
> if (!ssdd) {
> @@ -1083,13 +1085,20 @@ static int ov2640_probe(struct i2c_client *client,
> return -EIO;
> }
>
> + clk = v4l2_clk_get(&client->dev, "mclk");
> + if (IS_ERR(clk))
> + return PTR_ERR(clk);
> +
> priv = devm_kzalloc(&client->dev, sizeof(struct ov2640_priv), GFP_KERNEL);
> if (!priv) {
> dev_err(&adapter->dev,
> "Failed to allocate memory for private data!\n");
> - return -ENOMEM;
> + ret = -ENOMEM;
> + goto err_kzalloc;
> }
>
> + priv->clk = clk;
> +
> 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,
> @@ -1097,23 +1106,26 @@ 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_kzalloc;
> }
>
> ret = ov2640_video_probe(client);
> - if (ret) {
> - v4l2_clk_put(priv->clk);
> -eclkget:
> - v4l2_ctrl_handler_free(&priv->hdl);
> - } else {
> - dev_info(&adapter->dev, "OV2640 Probed\n");
> - }
> + if (ret)
> + goto err_probe;
> +
> + ret = v4l2_async_register_subdev(&priv->subdev);
> + if (ret)
> + goto err_probe;
> +
> + dev_info(&adapter->dev, "OV2640 Probed\n");
> + return 0;
> +
> +err_probe:
> + v4l2_ctrl_handler_free(&priv->hdl);
> +err_kzalloc:
> + v4l2_clk_put(clk);
>
> return ret;
> }
> @@ -1122,6 +1134,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);
WARNING: multiple messages have this Message-ID (diff)
From: Josh Wu <josh.wu@atmel.com>
To: unlisted-recipients:; (no To-header on input)
Cc: <g.liakhovetski@gmx.de>, <m.chehab@samsung.com>,
<linux-media@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<sylvester.nawrocki@gmail.com>
Subject: Re: [PATCH v2] [media] ov2640: add support for async device registration
Date: Wed, 26 Mar 2014 14:27:14 +0800 [thread overview]
Message-ID: <53327342.1020705@atmel.com> (raw)
In-Reply-To: <1395306109-11016-1-git-send-email-josh.wu@atmel.com>
Hi, all
since v4l2_clk_get() WON'T return EPROBE_DEFER. So this version of patch
is invalid.
Please drop this version of the patch.
Sorry for the noise.
Best Regards,
Josh Wu
On 3/20/2014 5:01 PM, Josh Wu wrote:
> Since the the v4l2_clk_get() may return a EPROBE_DEFER during async
> probing. So move the v4l2_clk_get() to the beginning of the
> probe(). Only when we get mclk successfully we continue the probe.
>
> Signed-off-by: Josh Wu <josh.wu@atmel.com>
> ---
> v1 -> v2:
> just return PTR_ERR(clk) as it can be -EPROBE_DEFER.
> refined the commit message
>
> drivers/media/i2c/soc_camera/ov2640.c | 43 +++++++++++++++++++++------------
> 1 file changed, 28 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/media/i2c/soc_camera/ov2640.c b/drivers/media/i2c/soc_camera/ov2640.c
> index 6c6b1c3..7c77a15 100644
> --- a/drivers/media/i2c/soc_camera/ov2640.c
> +++ b/drivers/media/i2c/soc_camera/ov2640.c
> @@ -22,6 +22,7 @@
> #include <linux/videodev2.h>
>
> #include <media/soc_camera.h>
> +#include <media/v4l2-async.h>
> #include <media/v4l2-clk.h>
> #include <media/v4l2-subdev.h>
> #include <media/v4l2-ctrls.h>
> @@ -1069,6 +1070,7 @@ static int ov2640_probe(struct i2c_client *client,
> struct ov2640_priv *priv;
> struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
> struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
> + struct v4l2_clk *clk;
> int ret;
>
> if (!ssdd) {
> @@ -1083,13 +1085,20 @@ static int ov2640_probe(struct i2c_client *client,
> return -EIO;
> }
>
> + clk = v4l2_clk_get(&client->dev, "mclk");
> + if (IS_ERR(clk))
> + return PTR_ERR(clk);
> +
> priv = devm_kzalloc(&client->dev, sizeof(struct ov2640_priv), GFP_KERNEL);
> if (!priv) {
> dev_err(&adapter->dev,
> "Failed to allocate memory for private data!\n");
> - return -ENOMEM;
> + ret = -ENOMEM;
> + goto err_kzalloc;
> }
>
> + priv->clk = clk;
> +
> 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,
> @@ -1097,23 +1106,26 @@ 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_kzalloc;
> }
>
> ret = ov2640_video_probe(client);
> - if (ret) {
> - v4l2_clk_put(priv->clk);
> -eclkget:
> - v4l2_ctrl_handler_free(&priv->hdl);
> - } else {
> - dev_info(&adapter->dev, "OV2640 Probed\n");
> - }
> + if (ret)
> + goto err_probe;
> +
> + ret = v4l2_async_register_subdev(&priv->subdev);
> + if (ret)
> + goto err_probe;
> +
> + dev_info(&adapter->dev, "OV2640 Probed\n");
> + return 0;
> +
> +err_probe:
> + v4l2_ctrl_handler_free(&priv->hdl);
> +err_kzalloc:
> + v4l2_clk_put(clk);
>
> return ret;
> }
> @@ -1122,6 +1134,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);
next prev parent reply other threads:[~2014-03-26 6:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-20 9:01 [PATCH v2] [media] ov2640: add support for async device registration Josh Wu
2014-03-20 9:01 ` Josh Wu
2014-03-26 6:27 ` Josh Wu [this message]
2014-03-26 6:27 ` 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=53327342.1020705@atmel.com \
--to=josh.wu@atmel.com \
--cc=g.liakhovetski@gmx.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=m.chehab@samsung.com \
--cc=sylvester.nawrocki@gmail.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.