[U-Boot] [PATCH 4/5] Put common autoload code into AutoLoad() function

Simon Glass sjg at chromium.org
Wed Apr 13 02:41:00 CEST 2011


On Tue, Apr 12, 2011 at 2:58 PM, Wolfgang Denk <wd at denx.de> wrote:
> Dear Simon Glass,
>
...
>>
>>       debug("got BOOTP packet (src=%d, dst=%d, len=%d want_len=%zu)\n",
>>               src, dest, len, sizeof (Bootp_t));
>> @@ -312,26 +342,7 @@ BootpHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len)
>>
>>       debug("Got good BOOTP\n");
>>
>> -     if ((s = getenv("autoload")) != NULL) {
>> -             if (*s == 'n') {
>> -                     /*
>> -                      * Just use BOOTP to configure system;
>> -                      * Do not use TFTP to load the bootfile.
>> -                      */
>> -                     NetState = NETLOOP_SUCCESS;
>> -                     return;
>> -#if defined(CONFIG_CMD_NFS)
>> -             } else if (strcmp(s, "NFS") == 0) {
>> -                     /*
>> -                      * Use NFS to load the bootfile.
>> -                      */
>> -                     NfsStart();
>> -                     return;
>> -#endif
>> -             }
>> -     }
>> -
>> -     TftpStart();
>> +     AutoLoad();
>
> Note that your change is NOT functionally equivalent - instead of
> running the code BEFORE TftpStart(), and eventually short-cutting it
> by the "return", you run it AFTER.

Can you please explain that again? I can't see what you are getting
at. My reading of it is that TftpStart() should be called:

- if autoload is not defined
- if autoload is not 'n'
- if autoload is not 'NFS'

Whether or not TftpStart() is called, the caller always returns
immediately as I understand it.

It would be nice to clean up this duplicated code so if I
misunderstand, please let me know.

Thanks,
Simon

>
>
> Best regards,
>
> Wolfgang Denk
>
> --
> DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
> The most difficult thing in the world is to know how to  do  a  thing
> and to watch someone else doing it wrong, without commenting.
>                                                        -- T.H. White
>


More information about the U-Boot mailing list