]>
Commit | Line | Data |
---|---|---|
b7ca0ba0 SL |
1 | From c30cc09293e1041dde8e823db36f68020e9b9ac5 Mon Sep 17 00:00:00 2001 |
2 | From: Sasha Levin <sashal@kernel.org> | |
3 | Date: Tue, 9 Jan 2024 17:09:09 +0900 | |
4 | Subject: media: staging: ipu3-imgu: Set fields before media_entity_pads_init() | |
5 | ||
6 | From: Hidenori Kobayashi <hidenorik@chromium.org> | |
7 | ||
8 | [ Upstream commit 87318b7092670d4086bfec115a0280a60c51c2dd ] | |
9 | ||
10 | The imgu driver fails to probe with the following message because it | |
11 | does 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 | ||
18 | Fix the initialization order so that the driver probe succeeds. The ops | |
19 | initialization is also moved together for readability. | |
20 | ||
21 | Fixes: a0ca1627b450 ("media: staging/intel-ipu3: Add v4l2 driver based on media framework") | |
22 | Cc: <stable@vger.kernel.org> # 6.7 | |
23 | Cc: Dan Carpenter <dan.carpenter@linaro.org> | |
24 | Signed-off-by: Hidenori Kobayashi <hidenorik@chromium.org> | |
25 | Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> | |
26 | Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> | |
27 | Signed-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 | ||
32 | diff --git a/drivers/staging/media/ipu3/ipu3-v4l2.c b/drivers/staging/media/ipu3/ipu3-v4l2.c | |
33 | index 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 | -- | |
80 | 2.43.0 | |
81 |