From: Simon Glass <sjg@chromium.org>
Date: Wed, 23 Jul 2014 12:55:00 +0000 (-0600)
Subject: dm: Make sure that the root device is probed
X-Git-Tag: v2025.01-rc5-pxa1908~14982
X-Git-Url: http://git.dujemihanovic.xyz/img/html/static/gitweb.css?a=commitdiff_plain;h=7497812d47d4ad17172ec373469a33a6ab8b257e;p=u-boot.git

dm: Make sure that the root device is probed

The root device should be probed just like any other device. The effect of
this is to mark the device as activated, so that it can be removed (along
with its children) if required.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Marek Vasut <marex@denx.de>
---

diff --git a/drivers/core/root.c b/drivers/core/root.c
index 11e08796b2..ac1c1648f3 100644
--- a/drivers/core/root.c
+++ b/drivers/core/root.c
@@ -47,6 +47,9 @@ int dm_init(void)
 	INIT_LIST_HEAD(&DM_UCLASS_ROOT_NON_CONST);
 
 	ret = device_bind_by_name(NULL, &root_info, &DM_ROOT_NON_CONST);
+	if (ret)
+		return ret;
+	ret = device_probe(DM_ROOT_NON_CONST);
 	if (ret)
 		return ret;
 
diff --git a/test/dm/core.c b/test/dm/core.c
index be3646b968..8c187806ec 100644
--- a/test/dm/core.c
+++ b/test/dm/core.c
@@ -106,7 +106,7 @@ static int dm_test_autoprobe(struct dm_test_state *dms)
 	ut_asserteq(0, dm_testdrv_op_count[DM_TEST_OP_POST_PROBE]);
 
 	/* The root device should not be activated until needed */
-	ut_assert(!(dms->root->flags & DM_FLAG_ACTIVATED));
+	ut_assert(dms->root->flags & DM_FLAG_ACTIVATED);
 
 	/*
 	 * We should be able to find the three test devices, and they should