dm: Make sure that the root device is probed
authorSimon Glass <sjg@chromium.org>
Wed, 23 Jul 2014 12:55:00 +0000 (06:55 -0600)
committerSimon Glass <sjg@chromium.org>
Wed, 23 Jul 2014 13:07:24 +0000 (14:07 +0100)
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>
drivers/core/root.c
test/dm/core.c

index 11e08796b2b0416d7cb3f29e96bfaab91f179a0f..ac1c1648f30dbdc6f6ce168290381c48020784e1 100644 (file)
@@ -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;
 
index be3646b968b5ddc38a8c01a55e407cfdbb215ea5..8c187806ec581b1a21de14436772d658b12ecccd 100644 (file)
@@ -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