All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: Linux Media Mailing List <linux-media@vger.kernel.org>
Cc: "Daniel W. S. Almeida" <dwlsalmeida@gmail.com>
Subject: [PATCH resend] vidtv: adapter->mdev was set too late
Date: Mon, 1 Feb 2021 09:37:40 +0100	[thread overview]
Message-ID: <4a1c4640-e566-026c-5920-e1da17e73bd8@xs4all.nl> (raw)

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: Hans Verkuil <hverkuil-cisco@xs4all.nl>
---
(resend again, looks like the previous three attempts never reached the ML)
---
 .../media/test-drivers/vidtv/vidtv_bridge.c    | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/media/test-drivers/vidtv/vidtv_bridge.c b/drivers/media/test-drivers/vidtv/vidtv_bridge.c
index 6ab17a83bced..75617709c8ce 100644
--- a/drivers/media/test-drivers/vidtv/vidtv_bridge.c
+++ b/drivers/media/test-drivers/vidtv/vidtv_bridge.c
@@ -416,6 +416,7 @@ static int vidtv_bridge_dvb_init(struct vidtv_dvb *dvb)
 	ret = vidtv_bridge_register_adap(dvb);
 	if (ret < 0)
 		goto fail_adapter;
+	dvb_register_media_controller(&dvb->adapter, &dvb->mdev);

 	for (i = 0; i < NUM_FE; ++i) {
 		ret = vidtv_bridge_probe_demod(dvb, i);
@@ -495,6 +496,15 @@ static int vidtv_bridge_probe(struct platform_device *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);
 	if (ret < 0)
 		goto err_dvb;
@@ -504,20 +514,12 @@ static int vidtv_bridge_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, 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);
 	if (ret) {
 		dev_err(dvb->mdev.dev,
 			"media device register failed (err=%d)\n", ret);
 		goto err_media_device_register;
 	}
-
-	dvb_register_media_controller(&dvb->adapter, &dvb->mdev);
 #endif /* CONFIG_MEDIA_CONTROLLER_DVB */

 	dev_info(&pdev->dev, "Successfully initialized vidtv!\n");
-- 
2.29.2


                 reply	other threads:[~2021-02-01  8:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4a1c4640-e566-026c-5920-e1da17e73bd8@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=dwlsalmeida@gmail.com \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.