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

media: vidtv: adapter->mdev was set too late

The media device has to be initialized and assigned to adapter->mdev
before the dvb devices are created, since that will trigger the
automatic creation of the topology.

Rework this code to achieve this.
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 08979f16
...@@ -416,6 +416,7 @@ static int vidtv_bridge_dvb_init(struct vidtv_dvb *dvb) ...@@ -416,6 +416,7 @@ static int vidtv_bridge_dvb_init(struct vidtv_dvb *dvb)
ret = vidtv_bridge_register_adap(dvb); ret = vidtv_bridge_register_adap(dvb);
if (ret < 0) if (ret < 0)
goto fail_adapter; goto fail_adapter;
dvb_register_media_controller(&dvb->adapter, &dvb->mdev);
for (i = 0; i < NUM_FE; ++i) { for (i = 0; i < NUM_FE; ++i) {
ret = vidtv_bridge_probe_demod(dvb, i); ret = vidtv_bridge_probe_demod(dvb, i);
...@@ -495,6 +496,15 @@ static int vidtv_bridge_probe(struct platform_device *pdev) ...@@ -495,6 +496,15 @@ static int vidtv_bridge_probe(struct platform_device *pdev)
dvb->pdev = pdev; dvb->pdev = pdev;
#ifdef CONFIG_MEDIA_CONTROLLER_DVB
dvb->mdev.dev = &pdev->dev;
strscpy(dvb->mdev.model, "vidtv", sizeof(dvb->mdev.model));
strscpy(dvb->mdev.bus_info, "platform:vidtv", sizeof(dvb->mdev.bus_info));
media_device_init(&dvb->mdev);
#endif
ret = vidtv_bridge_dvb_init(dvb); ret = vidtv_bridge_dvb_init(dvb);
if (ret < 0) if (ret < 0)
goto err_dvb; goto err_dvb;
...@@ -504,20 +514,12 @@ static int vidtv_bridge_probe(struct platform_device *pdev) ...@@ -504,20 +514,12 @@ static int vidtv_bridge_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, dvb); platform_set_drvdata(pdev, dvb);
#ifdef CONFIG_MEDIA_CONTROLLER_DVB #ifdef CONFIG_MEDIA_CONTROLLER_DVB
dvb->mdev.dev = &pdev->dev;
strscpy(dvb->mdev.model, "vidtv", sizeof(dvb->mdev.model));
strscpy(dvb->mdev.bus_info, "platform:vidtv", sizeof(dvb->mdev.bus_info));
media_device_init(&dvb->mdev);
ret = media_device_register(&dvb->mdev); ret = media_device_register(&dvb->mdev);
if (ret) { if (ret) {
dev_err(dvb->mdev.dev, dev_err(dvb->mdev.dev,
"media device register failed (err=%d)\n", ret); "media device register failed (err=%d)\n", ret);
goto err_media_device_register; goto err_media_device_register;
} }
dvb_register_media_controller(&dvb->adapter, &dvb->mdev);
#endif /* CONFIG_MEDIA_CONTROLLER_DVB */ #endif /* CONFIG_MEDIA_CONTROLLER_DVB */
dev_info(&pdev->dev, "Successfully initialized vidtv!\n"); dev_info(&pdev->dev, "Successfully initialized vidtv!\n");
......
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