diff mbox

[U-Boot,RFC,03/22] dm: Make sure that the root device is probed

Message ID 1400966481-14131-4-git-send-email-sjg@chromium.org
State RFC
Headers show

Commit Message

Simon Glass May 24, 2014, 9:21 p.m. UTC
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>
---

 drivers/core/root.c | 3 +++
 test/dm/core.c      | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

Comments

Marek Vasut June 1, 2014, 5:33 p.m. UTC | #1
On Saturday, May 24, 2014 at 11:21:02 PM, Simon Glass wrote:
> 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>
> ---
> 
>  drivers/core/root.c | 3 +++
>  test/dm/core.c      | 2 +-
>  2 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/core/root.c b/drivers/core/root.c
> index 4427b81..9fff164 100644
> --- a/drivers/core/root.c
> +++ b/drivers/core/root.c
> @@ -48,6 +48,9 @@ int dm_init(void)
>  	ret = device_bind_by_name(NULL, &root_info, &DM_ROOT());

Off-topic: This &DM_ROOT() above looks a little suspicious, don't you think?
[...]

Acked-by: Marek Vasut <marex@denx.de>

Best regards,
Marek Vasut
Simon Glass June 3, 2014, 1:59 a.m. UTC | #2
Hi Marek,

On 1 June 2014 11:33, Marek Vasut <marex@denx.de> wrote:
> On Saturday, May 24, 2014 at 11:21:02 PM, Simon Glass wrote:
>> 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>
>> ---
>>
>>  drivers/core/root.c | 3 +++
>>  test/dm/core.c      | 2 +-
>>  2 files changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/core/root.c b/drivers/core/root.c
>> index 4427b81..9fff164 100644
>> --- a/drivers/core/root.c
>> +++ b/drivers/core/root.c
>> @@ -48,6 +48,9 @@ int dm_init(void)
>>       ret = device_bind_by_name(NULL, &root_info, &DM_ROOT());
>
> Off-topic: This &DM_ROOT() above looks a little suspicious, don't you think?

Yes. I wonder if it should not be written as a function?

Regards,
Simon
Marek Vasut June 3, 2014, 11:25 a.m. UTC | #3
On Tuesday, June 03, 2014 at 03:59:49 AM, Simon Glass wrote:
> Hi Marek,
> 
> On 1 June 2014 11:33, Marek Vasut <marex@denx.de> wrote:
> > On Saturday, May 24, 2014 at 11:21:02 PM, Simon Glass wrote:
> >> 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>
> >> ---
> >> 
> >>  drivers/core/root.c | 3 +++
> >>  test/dm/core.c      | 2 +-
> >>  2 files changed, 4 insertions(+), 1 deletion(-)
> >> 
> >> diff --git a/drivers/core/root.c b/drivers/core/root.c
> >> index 4427b81..9fff164 100644
> >> --- a/drivers/core/root.c
> >> +++ b/drivers/core/root.c
> >> @@ -48,6 +48,9 @@ int dm_init(void)
> >> 
> >>       ret = device_bind_by_name(NULL, &root_info, &DM_ROOT());
> > 
> > Off-topic: This &DM_ROOT() above looks a little suspicious, don't you
> > think?
> 
> Yes. I wonder if it should not be written as a function?

That'd be a good start. I cannot even find it's definition anywhere :-/

Best regards,
Marek Vasut
diff mbox

Patch

diff --git a/drivers/core/root.c b/drivers/core/root.c
index 4427b81..9fff164 100644
--- a/drivers/core/root.c
+++ b/drivers/core/root.c
@@ -48,6 +48,9 @@  int dm_init(void)
 	ret = device_bind_by_name(NULL, &root_info, &DM_ROOT());
 	if (ret)
 		return ret;
+	ret = device_probe(DM_ROOT());
+	if (ret)
+		return ret;
 
 	return 0;
 }
diff --git a/test/dm/core.c b/test/dm/core.c
index 14a57c3..a889fad 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