]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.4/media-ov6650-move-v4l2_clk_get-to-ov6650_video_probe.patch
Linux 4.9.181
[thirdparty/kernel/stable-queue.git] / queue-4.4 / media-ov6650-move-v4l2_clk_get-to-ov6650_video_probe.patch
1 From 8a16eba42e733dcf4c7a0af32aaac5bcb679e613 Mon Sep 17 00:00:00 2001
2 From: Janusz Krzysztofik <jmkrzyszt@gmail.com>
3 Date: Fri, 29 Mar 2019 21:06:09 -0400
4 Subject: media: ov6650: Move v4l2_clk_get() to ov6650_video_probe() helper
5
6 [ Upstream commit ccdd85d518d8b9320ace1d87271f0ba2175f21fa ]
7
8 In preparation for adding asynchronous subdevice support to the driver,
9 don't acquire v4l2_clk from the driver .probe() callback as that may
10 fail if the clock is provided by a bridge driver which may be not yet
11 initialized. Move the v4l2_clk_get() to ov6650_video_probe() helper
12 which is going to be converted to v4l2_subdev_internal_ops.registered()
13 callback, executed only when the bridge driver is ready.
14
15 Signed-off-by: Janusz Krzysztofik <jmkrzyszt@gmail.com>
16 Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
17 Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
18 Signed-off-by: Sasha Levin <sashal@kernel.org>
19 ---
20 drivers/media/i2c/soc_camera/ov6650.c | 25 ++++++++++++++-----------
21 1 file changed, 14 insertions(+), 11 deletions(-)
22
23 diff --git a/drivers/media/i2c/soc_camera/ov6650.c b/drivers/media/i2c/soc_camera/ov6650.c
24 index 1e9ebfda25525..4e19f5e5d8cf7 100644
25 --- a/drivers/media/i2c/soc_camera/ov6650.c
26 +++ b/drivers/media/i2c/soc_camera/ov6650.c
27 @@ -839,9 +839,16 @@ static int ov6650_video_probe(struct i2c_client *client)
28 u8 pidh, pidl, midh, midl;
29 int ret;
30
31 + priv->clk = v4l2_clk_get(&client->dev, NULL);
32 + if (IS_ERR(priv->clk)) {
33 + ret = PTR_ERR(priv->clk);
34 + dev_err(&client->dev, "v4l2_clk request err: %d\n", ret);
35 + return ret;
36 + }
37 +
38 ret = ov6650_s_power(&priv->subdev, 1);
39 if (ret < 0)
40 - return ret;
41 + goto eclkput;
42
43 msleep(20);
44
45 @@ -878,6 +885,11 @@ static int ov6650_video_probe(struct i2c_client *client)
46
47 done:
48 ov6650_s_power(&priv->subdev, 0);
49 + if (!ret)
50 + return 0;
51 +eclkput:
52 + v4l2_clk_put(priv->clk);
53 +
54 return ret;
55 }
56
57 @@ -1035,18 +1047,9 @@ static int ov6650_probe(struct i2c_client *client,
58 priv->code = MEDIA_BUS_FMT_YUYV8_2X8;
59 priv->colorspace = V4L2_COLORSPACE_JPEG;
60
61 - priv->clk = v4l2_clk_get(&client->dev, NULL);
62 - if (IS_ERR(priv->clk)) {
63 - ret = PTR_ERR(priv->clk);
64 - goto eclkget;
65 - }
66 -
67 ret = ov6650_video_probe(client);
68 - if (ret) {
69 - v4l2_clk_put(priv->clk);
70 -eclkget:
71 + if (ret)
72 v4l2_ctrl_handler_free(&priv->hdl);
73 - }
74
75 return ret;
76 }
77 --
78 2.20.1
79