mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] of: of_probe: create board's machine device at the earliest
Date: Mon,  5 Sep 2022 09:02:08 +0200	[thread overview]
Message-ID: <20220905070208.538012-1-a.fatoum@pengutronix.de> (raw)

We currently create devices for matching reserved memory entries and
firmware before creating the machine device. In a deep probe system, the
machine driver would be probed directly at registration and as such
needs to be probed before other devices are created, so it can disable
other devices if needed. Move the machine device registration to the
top, so board drivers can disabled reserved memory entries and firmware
if they need to.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/of/base.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 52e6a9294e11..6a51dd71793d 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -2503,6 +2503,12 @@ int of_probe(void)
 	if(!root_node)
 		return -ENODEV;
 
+	/*
+	 * We do this first thing, so board drivers can patch the device
+	 * tree prior to device creation if needed.
+	 */
+	of_platform_device_create_root(root_node);
+
 	/*
 	 * Handle certain compatibles explicitly, since we don't want to create
 	 * platform_devices for every node in /reserved-memory with a
@@ -2515,8 +2521,6 @@ int of_probe(void)
 	if (node)
 		of_platform_populate(node, NULL, NULL);
 
-	of_platform_device_create_root(root_node);
-
 	of_platform_populate(root_node, of_default_bus_match_table, NULL);
 
 	return 0;
-- 
2.30.2




             reply	other threads:[~2022-09-05  7:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-05  7:02 Ahmad Fatoum [this message]
2022-09-13  8:27 ` Sascha Hauer

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=20220905070208.538012-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox