* [PATCH v3] media: staging: ipu3-imgu: Set fields before media_entity_pads_init()
@ 2024-01-09 8:09 Hidenori Kobayashi
2024-01-09 8:12 ` Dan Carpenter
0 siblings, 1 reply; 2+ messages in thread
From: Hidenori Kobayashi @ 2024-01-09 8:09 UTC (permalink / raw)
To: Sakari Ailus, Bingbu Cao, Tianshu Qiu, Mauro Carvalho Chehab,
Greg Kroah-Hartman, Yong Zhi
Cc: Hidenori Kobayashi, stable, Dan Carpenter, Mauro Carvalho Chehab,
linux-media, linux-staging, linux-kernel
The imgu driver fails to probe with the following message because it
does not set the pad's flags before calling media_entity_pads_init().
[ 14.596315] ipu3-imgu 0000:00:05.0: failed initialize subdev media entity (-22)
[ 14.596322] ipu3-imgu 0000:00:05.0: failed to register subdev0 ret (-22)
[ 14.596327] ipu3-imgu 0000:00:05.0: failed to register pipes (-22)
[ 14.596331] ipu3-imgu 0000:00:05.0: failed to create V4L2 devices (-22)
Fix the initialization order so that the driver probe succeeds. The ops
initialization is also moved together for readability.
Fixes: a0ca1627b450 ("media: staging/intel-ipu3: Add v4l2 driver based on media framework")
Cc: <stable@vger.kernel.org> # 6.7
Cc: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Hidenori Kobayashi <hidenorik@chromium.org>
---
Changes in v3:
- Add error output to commit message (Thanks again Dan!)
- Link to v2: https://lore.kernel.org/lkml/20240109041500.2790754-1-hidenorik@chromium.org
Changes in v2:
- Add Fixes tag and revise commit message (Thanks Dan!)
- Link to v1: https://lore.kernel.org/lkml/20231228093926.748001-1-hidenorik@chromium.org
---
drivers/staging/media/ipu3/ipu3-v4l2.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/staging/media/ipu3/ipu3-v4l2.c b/drivers/staging/media/ipu3/ipu3-v4l2.c
index a66f034380c0..3df58eb3e882 100644
--- a/drivers/staging/media/ipu3/ipu3-v4l2.c
+++ b/drivers/staging/media/ipu3/ipu3-v4l2.c
@@ -1069,6 +1069,11 @@ static int imgu_v4l2_subdev_register(struct imgu_device *imgu,
struct imgu_media_pipe *imgu_pipe = &imgu->imgu_pipe[pipe];
/* Initialize subdev media entity */
+ imgu_sd->subdev.entity.ops = &imgu_media_ops;
+ for (i = 0; i < IMGU_NODE_NUM; i++) {
+ imgu_sd->subdev_pads[i].flags = imgu_pipe->nodes[i].output ?
+ MEDIA_PAD_FL_SINK : MEDIA_PAD_FL_SOURCE;
+ }
r = media_entity_pads_init(&imgu_sd->subdev.entity, IMGU_NODE_NUM,
imgu_sd->subdev_pads);
if (r) {
@@ -1076,11 +1081,6 @@ static int imgu_v4l2_subdev_register(struct imgu_device *imgu,
"failed initialize subdev media entity (%d)\n", r);
return r;
}
- imgu_sd->subdev.entity.ops = &imgu_media_ops;
- for (i = 0; i < IMGU_NODE_NUM; i++) {
- imgu_sd->subdev_pads[i].flags = imgu_pipe->nodes[i].output ?
- MEDIA_PAD_FL_SINK : MEDIA_PAD_FL_SOURCE;
- }
/* Initialize subdev */
v4l2_subdev_init(&imgu_sd->subdev, &imgu_subdev_ops);
@@ -1177,15 +1177,15 @@ static int imgu_v4l2_node_setup(struct imgu_device *imgu, unsigned int pipe,
}
/* Initialize media entities */
+ node->vdev_pad.flags = node->output ?
+ MEDIA_PAD_FL_SOURCE : MEDIA_PAD_FL_SINK;
+ vdev->entity.ops = NULL;
r = media_entity_pads_init(&vdev->entity, 1, &node->vdev_pad);
if (r) {
dev_err(dev, "failed initialize media entity (%d)\n", r);
mutex_destroy(&node->lock);
return r;
}
- node->vdev_pad.flags = node->output ?
- MEDIA_PAD_FL_SOURCE : MEDIA_PAD_FL_SINK;
- vdev->entity.ops = NULL;
/* Initialize vbq */
vbq->type = node->vdev_fmt.type;
--
2.43.0.472.g3155946c3a-goog
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH v3] media: staging: ipu3-imgu: Set fields before media_entity_pads_init()
2024-01-09 8:09 [PATCH v3] media: staging: ipu3-imgu: Set fields before media_entity_pads_init() Hidenori Kobayashi
@ 2024-01-09 8:12 ` Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2024-01-09 8:12 UTC (permalink / raw)
To: Hidenori Kobayashi
Cc: Sakari Ailus, Bingbu Cao, Tianshu Qiu, Mauro Carvalho Chehab,
Greg Kroah-Hartman, Yong Zhi, stable, Mauro Carvalho Chehab,
linux-media, linux-staging, linux-kernel
On Tue, Jan 09, 2024 at 05:09:09PM +0900, Hidenori Kobayashi wrote:
> The imgu driver fails to probe with the following message because it
> does not set the pad's flags before calling media_entity_pads_init().
>
> [ 14.596315] ipu3-imgu 0000:00:05.0: failed initialize subdev media entity (-22)
> [ 14.596322] ipu3-imgu 0000:00:05.0: failed to register subdev0 ret (-22)
> [ 14.596327] ipu3-imgu 0000:00:05.0: failed to register pipes (-22)
> [ 14.596331] ipu3-imgu 0000:00:05.0: failed to create V4L2 devices (-22)
>
> Fix the initialization order so that the driver probe succeeds. The ops
> initialization is also moved together for readability.
>
> Fixes: a0ca1627b450 ("media: staging/intel-ipu3: Add v4l2 driver based on media framework")
> Cc: <stable@vger.kernel.org> # 6.7
> Cc: Dan Carpenter <dan.carpenter@linaro.org>
> Signed-off-by: Hidenori Kobayashi <hidenorik@chromium.org>
> ---
Thanks so much!
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-01-09 8:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-09 8:09 [PATCH v3] media: staging: ipu3-imgu: Set fields before media_entity_pads_init() Hidenori Kobayashi
2024-01-09 8:12 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®