diff mbox series

[v4,01/10] env: nowhere: set default enviroment

Message ID 20200122040005.7573-2-j-keerthy@ti.com
State Superseded
Headers show
Series Add support for loading main_r5fss0_core0 | expand

Commit Message

J, KEERTHY Jan. 22, 2020, 3:59 a.m. UTC
Set default enviroment so that set_env calls succeed when only
ENV_IS_NOWHERE set.

Signed-off-by: Keerthy <j-keerthy at ti.com>
---

Changes in v4:

  * Reworded commit log

 env/nowhere.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Tom Rini Jan. 24, 2020, 2:52 p.m. UTC | #1
On Wed, Jan 22, 2020 at 09:29:56AM +0530, Keerthy wrote:

> Set default enviroment so that set_env calls succeed when only
> ENV_IS_NOWHERE set.
> 
> Signed-off-by: Keerthy <j-keerthy at ti.com>
> ---
> 
> Changes in v4:
> 
>   * Reworded commit log
> 
>  env/nowhere.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/env/nowhere.c b/env/nowhere.c
> index f5b0a17652..70c3b3e011 100644
> --- a/env/nowhere.c
> +++ b/env/nowhere.c
> @@ -23,6 +23,7 @@ static int env_nowhere_init(void)
>  {
>  	gd->env_addr	= (ulong)&default_environment[0];
>  	gd->env_valid	= ENV_INVALID;
> +	env_set_default(NULL, 0);
>  
>  	return 0;
>  }

What exactly do you mean by this?  Can you give an example or two (code
and/or shell) where things didn't work before but do now?  And please
CC Joe/Wolfgang in the future on env patches, thanks.
J, KEERTHY Jan. 27, 2020, 4:28 a.m. UTC | #2
On 24/01/20 8:22 pm, Tom Rini wrote:
> On Wed, Jan 22, 2020 at 09:29:56AM +0530, Keerthy wrote:
> 
>> Set default enviroment so that set_env calls succeed when only
>> ENV_IS_NOWHERE set.
>>
>> Signed-off-by: Keerthy <j-keerthy at ti.com>
>> ---
>>
>> Changes in v4:
>>
>>    * Reworded commit log
>>
>>   env/nowhere.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/env/nowhere.c b/env/nowhere.c
>> index f5b0a17652..70c3b3e011 100644
>> --- a/env/nowhere.c
>> +++ b/env/nowhere.c
>> @@ -23,6 +23,7 @@ static int env_nowhere_init(void)
>>   {
>>   	gd->env_addr	= (ulong)&default_environment[0];
>>   	gd->env_valid	= ENV_INVALID;
>> +	(NULL, 0);
>>   
>>   	return 0;
>>   }
> 
> What exactly do you mean by this?  Can you give an example or two (code
> and/or shell) where things didn't work before but do now?  And please
> CC Joe/Wolfgang in the future on env patches, thanks.

Tom,

I have a case where only ENV_IS_NOWHERE is set in SPL without any of the 
memory based env configs like ENV_IS_IN_FAT or ENV_IS_IN_MMC. With that 
if i try to use env_set it does not work.

env_set checks for (gd->flags & GD_FLG_ENV_READY) which never is true 
for the nowhere case and hence env_set returns 1.

If any of the memory based ENV config is set i see that env_set_default 
is called hence env_set works nicely. So we need to have env_set_default
in the case of nowhere configuration as well.

Best Regards,
Keerthy

>
Wolfgang Denk Jan. 27, 2020, 1:34 p.m. UTC | #3
Dear Keerthy,

In message <f93caaca-f041-a6fb-2a09-d588451d854c at ti.com> you wrote:
> 
> >> Set default enviroment so that set_env calls succeed when only
> >> ENV_IS_NOWHERE set.
> >>
> >> Signed-off-by: Keerthy <j-keerthy at ti.com>
> >> ---
> >>
> >> Changes in v4:
> >>
> >>    * Reworded commit log
> >>
> >>   env/nowhere.c | 1 +
> >>   1 file changed, 1 insertion(+)
> >>
> >> diff --git a/env/nowhere.c b/env/nowhere.c
> >> index f5b0a17652..70c3b3e011 100644
> >> --- a/env/nowhere.c
> >> +++ b/env/nowhere.c
> >> @@ -23,6 +23,7 @@ static int env_nowhere_init(void)
> >>   {
> >>   	gd->env_addr	= (ulong)&default_environment[0];
> >>   	gd->env_valid	= ENV_INVALID;
> >> +	(NULL, 0);

^^^^^^^^^^^^^^^^^^^^^^
You are inserting this line of "C code" only.

> >>   	return 0;
> >>   }
> > 
> > What exactly do you mean by this?  Can you give an example or two (code
> > and/or shell) where things didn't work before but do now?  And please
> > CC Joe/Wolfgang in the future on env patches, thanks.
>
> Tom,
>
> I have a case where only ENV_IS_NOWHERE is set in SPL without any of the 
> memory based env configs like ENV_IS_IN_FAT or ENV_IS_IN_MMC. With that 
> if i try to use env_set it does not work.
>
> env_set checks for (gd->flags & GD_FLG_ENV_READY) which never is true 
> for the nowhere case and hence env_set returns 1.
>
> If any of the memory based ENV config is set i see that env_set_default 
> is called hence env_set works nicely. So we need to have env_set_default
> in the case of nowhere configuration as well.

And in which way does inserting this single line of "code" change
the behaviour?

Best regards,

Wolfgang Denk
Tom Rini Jan. 27, 2020, 2:12 p.m. UTC | #4
On Mon, Jan 27, 2020 at 02:34:17PM +0100, Wolfgang Denk wrote:
> Dear Keerthy,
> 
> In message <f93caaca-f041-a6fb-2a09-d588451d854c at ti.com> you wrote:
> > 
> > >> Set default enviroment so that set_env calls succeed when only
> > >> ENV_IS_NOWHERE set.
> > >>
> > >> Signed-off-by: Keerthy <j-keerthy at ti.com>
> > >> ---
> > >>
> > >> Changes in v4:
> > >>
> > >>    * Reworded commit log
> > >>
> > >>   env/nowhere.c | 1 +
> > >>   1 file changed, 1 insertion(+)
> > >>
> > >> diff --git a/env/nowhere.c b/env/nowhere.c
> > >> index f5b0a17652..70c3b3e011 100644
> > >> --- a/env/nowhere.c
> > >> +++ b/env/nowhere.c
> > >> @@ -23,6 +23,7 @@ static int env_nowhere_init(void)
> > >>   {
> > >>   	gd->env_addr	= (ulong)&default_environment[0];
> > >>   	gd->env_valid	= ENV_INVALID;
> > >> +	(NULL, 0);
> 
> ^^^^^^^^^^^^^^^^^^^^^^
> You are inserting this line of "C code" only.

I think something got ate along the way.  The patch is at
http://patchwork.ozlabs.org/patch/1226946/
and the full line is:
+	env_set_default(NULL, 0);
J, KEERTHY Jan. 27, 2020, 4:26 p.m. UTC | #5
On 27/01/20 7:42 pm, Tom Rini wrote:
> On Mon, Jan 27, 2020 at 02:34:17PM +0100, Wolfgang Denk wrote:
>> Dear Keerthy,
>>
>> In message <f93caaca-f041-a6fb-2a09-d588451d854c at ti.com> you wrote:
>>>
>>>>> Set default enviroment so that set_env calls succeed when only
>>>>> ENV_IS_NOWHERE set.
>>>>>
>>>>> Signed-off-by: Keerthy <j-keerthy at ti.com>
>>>>> ---
>>>>>
>>>>> Changes in v4:
>>>>>
>>>>>     * Reworded commit log
>>>>>
>>>>>    env/nowhere.c | 1 +
>>>>>    1 file changed, 1 insertion(+)
>>>>>
>>>>> diff --git a/env/nowhere.c b/env/nowhere.c
>>>>> index f5b0a17652..70c3b3e011 100644
>>>>> --- a/env/nowhere.c
>>>>> +++ b/env/nowhere.c
>>>>> @@ -23,6 +23,7 @@ static int env_nowhere_init(void)
>>>>>    {
>>>>>    	gd->env_addr	= (ulong)&default_environment[0];
>>>>>    	gd->env_valid	= ENV_INVALID;
>>>>> +	(NULL, 0);
>>
>> ^^^^^^^^^^^^^^^^^^^^^^
>> You are inserting this line of "C code" only.
> 
> I think something got ate along the way.  The patch is at
> http://patchwork.ozlabs.org/patch/1226946/
> and the full line is:
> +	env_set_default(NULL, 0);

Thanks Tom.

Wolfgang,

env_set_default(NULL, 0); sets the required flag for us in the nowhere 
path as well.

That enabled set_env.

Thanks,
Keerthy

> 
>
Wolfgang Denk Jan. 28, 2020, 1:53 p.m. UTC | #6
Dear Keerthy,

In message <927f859e-9c93-2731-c69e-e491219a818a at ti.com> you wrote:
> 
> >>>>> --- a/env/nowhere.c
> >>>>> +++ b/env/nowhere.c
> >>>>> @@ -23,6 +23,7 @@ static int env_nowhere_init(void)
> >>>>>    {
> >>>>>    	gd->env_addr	= (ulong)&default_environment[0];
> >>>>>    	gd->env_valid	= ENV_INVALID;
> >>>>> +	(NULL, 0);
> >>
> >> ^^^^^^^^^^^^^^^^^^^^^^
> >> You are inserting this line of "C code" only.
> > 
> > I think something got ate along the way.  The patch is at
> > http://patchwork.ozlabs.org/patch/1226946/
> > and the full line is:
> > +	env_set_default(NULL, 0);
>
> env_set_default(NULL, 0); sets the required flag for us in the nowhere 
> path as well.

I see. Sorry, I didn't read the original patch.  As you see in the
quote above, the "env_set_default" somehow got lost, and this was
what triggered my comment.

Feel free to ignore it.

Best regards,

Wolfgang Denk
diff mbox series

Patch

diff --git a/env/nowhere.c b/env/nowhere.c
index f5b0a17652..70c3b3e011 100644
--- a/env/nowhere.c
+++ b/env/nowhere.c
@@ -23,6 +23,7 @@  static int env_nowhere_init(void)
 {
 	gd->env_addr	= (ulong)&default_environment[0];
 	gd->env_valid	= ENV_INVALID;
+	env_set_default(NULL, 0);
 
 	return 0;
 }