From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Janusz Krzysztofik <jmkrzyszt@gmail.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
Hans Verkuil <hans.verkuil@cisco.com>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/2] media: ov6650: Register with asynchronous subdevice framework
Date: Tue, 2 Apr 2019 11:24:12 +0300 [thread overview]
Message-ID: <20190402082411.nakjtcxu2ggbb472@paasikivi.fi.intel.com> (raw)
In-Reply-To: <20190330010610.15094-3-jmkrzyszt@gmail.com>
Hi Janusz,
On Sat, Mar 30, 2019 at 02:06:10AM +0100, Janusz Krzysztofik wrote:
> Register V4L2 subdevice implemented by the driver to the V4L2
> asynchronous subdevice framework.
>
> Signed-off-by: Janusz Krzysztofik <jmkrzyszt@gmail.com>
> ---
> drivers/media/i2c/ov6650.c | 19 ++++++++++++++-----
> 1 file changed, 14 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/media/i2c/ov6650.c b/drivers/media/i2c/ov6650.c
> index de7d9790f054..7145bb68a9e1 100644
> --- a/drivers/media/i2c/ov6650.c
> +++ b/drivers/media/i2c/ov6650.c
> @@ -804,8 +804,9 @@ static int ov6650_prog_dflt(struct i2c_client *client)
> return ret;
> }
>
> -static int ov6650_video_probe(struct i2c_client *client)
> +static int ov6650_video_probe(struct v4l2_subdev *sd)
> {
> + struct i2c_client *client = v4l2_get_subdevdata(sd);
> struct ov6650 *priv = to_ov6650(client);
> u8 pidh, pidl, midh, midl;
> int ret;
> @@ -817,7 +818,7 @@ static int ov6650_video_probe(struct i2c_client *client)
> return ret;
> }
>
> - ret = ov6650_s_power(&priv->subdev, 1);
> + ret = ov6650_s_power(sd, 1);
> if (ret < 0)
> goto eclkput;
>
> @@ -855,7 +856,7 @@ static int ov6650_video_probe(struct i2c_client *client)
> ret = v4l2_ctrl_handler_setup(&priv->hdl);
>
> done:
> - ov6650_s_power(&priv->subdev, 0);
> + ov6650_s_power(sd, 0);
> if (!ret)
> return 0;
> eclkput:
> @@ -943,6 +944,10 @@ static const struct v4l2_subdev_ops ov6650_subdev_ops = {
> .pad = &ov6650_pad_ops,
> };
>
> +static const struct v4l2_subdev_internal_ops ov6650_internal_ops = {
> + .registered = ov6650_video_probe,
> +};
> +
> /*
> * i2c_driver function
> */
> @@ -1003,7 +1008,11 @@ static int ov6650_probe(struct i2c_client *client,
> priv->code = MEDIA_BUS_FMT_YUYV8_2X8;
> priv->colorspace = V4L2_COLORSPACE_JPEG;
>
> - ret = ov6650_video_probe(client);
> + priv->subdev.internal_ops = &ov6650_internal_ops;
> + priv->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
> + v4l2_i2c_subdev_set_name(&priv->subdev, client, NULL, NULL);
I missed that v4l2_i2c_subdev_init() already calls
v4l2_i2c_subdev_set_name(), so it can be removed from the driver. I've made
the change to the applied patch:
diff --git a/drivers/media/i2c/ov6650.c b/drivers/media/i2c/ov6650.c
index 7145bb68a9e1..1b972e591b48 100644
--- a/drivers/media/i2c/ov6650.c
+++ b/drivers/media/i2c/ov6650.c
@@ -1010,7 +1010,6 @@ static int ov6650_probe(struct i2c_client *client,
priv->subdev.internal_ops = &ov6650_internal_ops;
priv->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
- v4l2_i2c_subdev_set_name(&priv->subdev, client, NULL, NULL);
ret = v4l2_async_register_subdev(&priv->subdev);
if (ret)
> +
> + ret = v4l2_async_register_subdev(&priv->subdev);
> if (ret)
> v4l2_ctrl_handler_free(&priv->hdl);
>
> @@ -1015,7 +1024,7 @@ static int ov6650_remove(struct i2c_client *client)
> struct ov6650 *priv = to_ov6650(client);
>
> v4l2_clk_put(priv->clk);
> - v4l2_device_unregister_subdev(&priv->subdev);
> + v4l2_async_unregister_subdev(&priv->subdev);
> v4l2_ctrl_handler_free(&priv->hdl);
> return 0;
> }
--
Regards,
Sakari Ailus
sakari.ailus@linux.intel.com
prev parent reply other threads:[~2019-04-02 8:24 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-25 0:34 [PATCH 0/2] media: ov6650: Add V4L2 asynchronous subdevice support Janusz Krzysztofik
2019-03-25 0:35 ` [PATCH 1/2] media: ov6650: Move v4l2_clk_get() to ov6650_video_probe() helper Janusz Krzysztofik
2019-03-29 18:39 ` Sakari Ailus
2019-03-29 19:48 ` Janusz Krzysztofik
2019-03-29 19:51 ` Sakari Ailus
2019-03-25 0:35 ` [PATCH 2/2] media: ov6650: Register with asynchronous subdevice framework Janusz Krzysztofik
2019-03-29 20:29 ` [PATCH v2 0/2] media: ov6650: Add V4L2 asynchronous subdevice support Janusz Krzysztofik
2019-03-29 20:29 ` [PATCH v2 1/2] media: ov6650: Move v4l2_clk_get() to ov6650_video_probe() helper Janusz Krzysztofik
2019-03-29 20:29 ` [PATCH v2 2/2] media: ov6650: Register with asynchronous subdevice framework Janusz Krzysztofik
2019-03-29 22:35 ` Sakari Ailus
2019-03-30 1:06 ` [PATCH v3 0/2] media: ov6650: Add V4L2 asynchronous subdevice support Janusz Krzysztofik
2019-03-30 1:06 ` [PATCH v3 1/2] media: ov6650: Move v4l2_clk_get() to ov6650_video_probe() helper Janusz Krzysztofik
2019-03-30 1:06 ` [PATCH v3 2/2] media: ov6650: Register with asynchronous subdevice framework Janusz Krzysztofik
2019-04-02 8:24 ` Sakari Ailus [this message]
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=20190402082411.nakjtcxu2ggbb472@paasikivi.fi.intel.com \
--to=sakari.ailus@linux.intel.com \
--cc=hans.verkuil@cisco.com \
--cc=jmkrzyszt@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).