From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMvQh-0008C4-0i for barebox@lists.infradead.org; Mon, 28 Sep 2020 15:51:12 +0000 Received: from dude02.hi.pengutronix.de ([2001:67c:670:100:1d::28]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kMvQf-0000ZD-Sn for barebox@lists.infradead.org; Mon, 28 Sep 2020 17:51:05 +0200 Received: from mfe by dude02.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1kMvQe-0000Jz-MX for barebox@lists.infradead.org; Mon, 28 Sep 2020 17:51:04 +0200 From: Marco Felsch Date: Mon, 28 Sep 2020 17:50:35 +0200 Message-Id: <20200928155041.32649-13-m.felsch@pengutronix.de> In-Reply-To: <20200928155041.32649-1-m.felsch@pengutronix.de> References: <20200928155041.32649-1-m.felsch@pengutronix.de> MIME-Version: 1.0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH 12/18] of: base: move memory init from DT to initcall To: barebox@lists.infradead.org From: Lucas Stach Instead of calling it from of_probe, convert it to a initcall at the appropriate level. This allows to move of_probe to later in the init sequence while keeping the memory init at the same place, which is important as many other drivers need the valid memory area to be set up properly. Signed-off-by: Lucas Stach Signed-off-by: Marco Felsch --- drivers/of/base.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/of/base.c b/drivers/of/base.c index 6e2fb8b281..4f08c45e40 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -2144,10 +2144,13 @@ const struct of_device_id of_default_bus_match_table[] = { } }; -static void of_probe_memory(void) +static int of_probe_memory(void) { struct device_node *memory = root_node; + if (!IS_ENABLED(CONFIG_OFDEVICE)) + return 0; + /* Parse all available node with "memory" device_type */ while (1) { memory = of_find_node_by_type(memory, "memory"); @@ -2156,7 +2159,10 @@ static void of_probe_memory(void) of_add_memory(memory, false); } + + return 0; } +mem_initcall(of_probe_memory); static void of_platform_device_create_root(struct device_node *np) { @@ -2186,8 +2192,6 @@ int of_probe(void) if (of_model) barebox_set_model(of_model); - of_probe_memory(); - firmware = of_find_node_by_path("/firmware"); if (firmware) of_platform_populate(firmware, NULL, NULL); -- 2.20.1 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox