]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - queue-5.10/media-staging-ipu3-imgu-set-fields-before-media_enti.patch
Fixes for 5.10
[thirdparty/kernel/stable-queue.git] / queue-5.10 / media-staging-ipu3-imgu-set-fields-before-media_enti.patch
CommitLineData
b7ca0ba0
SL
1From c30cc09293e1041dde8e823db36f68020e9b9ac5 Mon Sep 17 00:00:00 2001
2From: Sasha Levin <sashal@kernel.org>
3Date: Tue, 9 Jan 2024 17:09:09 +0900
4Subject: media: staging: ipu3-imgu: Set fields before media_entity_pads_init()
5
6From: Hidenori Kobayashi <hidenorik@chromium.org>
7
8[ Upstream commit 87318b7092670d4086bfec115a0280a60c51c2dd ]
9
10The imgu driver fails to probe with the following message because it
11does not set the pad's flags before calling media_entity_pads_init().
12
13[ 14.596315] ipu3-imgu 0000:00:05.0: failed initialize subdev media entity (-22)
14[ 14.596322] ipu3-imgu 0000:00:05.0: failed to register subdev0 ret (-22)
15[ 14.596327] ipu3-imgu 0000:00:05.0: failed to register pipes (-22)
16[ 14.596331] ipu3-imgu 0000:00:05.0: failed to create V4L2 devices (-22)
17
18Fix the initialization order so that the driver probe succeeds. The ops
19initialization is also moved together for readability.
20
21Fixes: a0ca1627b450 ("media: staging/intel-ipu3: Add v4l2 driver based on media framework")
22Cc: <stable@vger.kernel.org> # 6.7
23Cc: Dan Carpenter <dan.carpenter@linaro.org>
24Signed-off-by: Hidenori Kobayashi <hidenorik@chromium.org>
25Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
26Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
27Signed-off-by: Sasha Levin <sashal@kernel.org>
28---
29 drivers/staging/media/ipu3/ipu3-v4l2.c | 16 ++++++++--------
30 1 file changed, 8 insertions(+), 8 deletions(-)
31
32diff --git a/drivers/staging/media/ipu3/ipu3-v4l2.c b/drivers/staging/media/ipu3/ipu3-v4l2.c
33index 103f84466f6fc..371117b511e21 100644
34--- a/drivers/staging/media/ipu3/ipu3-v4l2.c
35+++ b/drivers/staging/media/ipu3/ipu3-v4l2.c
36@@ -1063,6 +1063,11 @@ static int imgu_v4l2_subdev_register(struct imgu_device *imgu,
37 struct imgu_media_pipe *imgu_pipe = &imgu->imgu_pipe[pipe];
38
39 /* Initialize subdev media entity */
40+ imgu_sd->subdev.entity.ops = &imgu_media_ops;
41+ for (i = 0; i < IMGU_NODE_NUM; i++) {
42+ imgu_sd->subdev_pads[i].flags = imgu_pipe->nodes[i].output ?
43+ MEDIA_PAD_FL_SINK : MEDIA_PAD_FL_SOURCE;
44+ }
45 r = media_entity_pads_init(&imgu_sd->subdev.entity, IMGU_NODE_NUM,
46 imgu_sd->subdev_pads);
47 if (r) {
48@@ -1070,11 +1075,6 @@ static int imgu_v4l2_subdev_register(struct imgu_device *imgu,
49 "failed initialize subdev media entity (%d)\n", r);
50 return r;
51 }
52- imgu_sd->subdev.entity.ops = &imgu_media_ops;
53- for (i = 0; i < IMGU_NODE_NUM; i++) {
54- imgu_sd->subdev_pads[i].flags = imgu_pipe->nodes[i].output ?
55- MEDIA_PAD_FL_SINK : MEDIA_PAD_FL_SOURCE;
56- }
57
58 /* Initialize subdev */
59 v4l2_subdev_init(&imgu_sd->subdev, &imgu_subdev_ops);
60@@ -1169,15 +1169,15 @@ static int imgu_v4l2_node_setup(struct imgu_device *imgu, unsigned int pipe,
61 }
62
63 /* Initialize media entities */
64+ node->vdev_pad.flags = node->output ?
65+ MEDIA_PAD_FL_SOURCE : MEDIA_PAD_FL_SINK;
66+ vdev->entity.ops = NULL;
67 r = media_entity_pads_init(&vdev->entity, 1, &node->vdev_pad);
68 if (r) {
69 dev_err(dev, "failed initialize media entity (%d)\n", r);
70 mutex_destroy(&node->lock);
71 return r;
72 }
73- node->vdev_pad.flags = node->output ?
74- MEDIA_PAD_FL_SOURCE : MEDIA_PAD_FL_SINK;
75- vdev->entity.ops = NULL;
76
77 /* Initialize vbq */
78 vbq->type = node->vdev_fmt.type;
79--
802.43.0
81