Commit 1a28dce2 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

media: vim2m: initialize the media device earlier

Before the video device node is registered, the v4l2_dev.mdev
pointer must be set in order to correctly associate the video
device with the media device. Move the initialization of the
media device up.
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent e6a7d7c3
...@@ -1339,12 +1339,6 @@ static int vim2m_probe(struct platform_device *pdev) ...@@ -1339,12 +1339,6 @@ static int vim2m_probe(struct platform_device *pdev)
goto error_dev; goto error_dev;
} }
ret = video_register_device(vfd, VFL_TYPE_VIDEO, 0);
if (ret) {
v4l2_err(&dev->v4l2_dev, "Failed to register video device\n");
goto error_m2m;
}
#ifdef CONFIG_MEDIA_CONTROLLER #ifdef CONFIG_MEDIA_CONTROLLER
dev->mdev.dev = &pdev->dev; dev->mdev.dev = &pdev->dev;
strscpy(dev->mdev.model, "vim2m", sizeof(dev->mdev.model)); strscpy(dev->mdev.model, "vim2m", sizeof(dev->mdev.model));
...@@ -1353,7 +1347,15 @@ static int vim2m_probe(struct platform_device *pdev) ...@@ -1353,7 +1347,15 @@ static int vim2m_probe(struct platform_device *pdev)
media_device_init(&dev->mdev); media_device_init(&dev->mdev);
dev->mdev.ops = &m2m_media_ops; dev->mdev.ops = &m2m_media_ops;
dev->v4l2_dev.mdev = &dev->mdev; dev->v4l2_dev.mdev = &dev->mdev;
#endif
ret = video_register_device(vfd, VFL_TYPE_VIDEO, 0);
if (ret) {
v4l2_err(&dev->v4l2_dev, "Failed to register video device\n");
goto error_m2m;
}
#ifdef CONFIG_MEDIA_CONTROLLER
ret = v4l2_m2m_register_media_controller(dev->m2m_dev, vfd, ret = v4l2_m2m_register_media_controller(dev->m2m_dev, vfd,
MEDIA_ENT_F_PROC_VIDEO_SCALER); MEDIA_ENT_F_PROC_VIDEO_SCALER);
if (ret) { if (ret) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment