[U-Boot] [PATCH v1 5/5] net: Avoid build fail on am335x when NET is disabled

Alex Kiernan alex.kiernan at gmail.com
Thu Mar 29 16:30:11 UTC 2018


On Thu, Mar 29, 2018 at 4:53 PM, Joe Hershberger <joe.hershberger at ni.com> wrote:
> On Thu, Mar 29, 2018 at 10:17 AM, Alex Kiernan <alex.kiernan at gmail.com> wrote:
>> Commit f411b5cca48f ("board: am335x: Always set eth/eth1addr environment
>> variable") adds support for Ethernet in Linux, but not U-Boot.
>>
>> Ensure that we can do this even when U-Boot is compiled without
>> network support.
>
> Please improve this commit log. It should have a subject that says
> what it does (Move enetaddr env access code to env config instead of
> net config) Then talk about why you are doing it in the body (i.e. the
> current subject).
>
>>
>> Signed-off-by: Alex Kiernan <alex.kiernan at gmail.com>
>> ---
>>
>>  cmd/nvedit.c     | 30 ++++++++++++++++++++++++++++++
>>  include/common.h |  4 ++++
>>  include/net.h    |  3 ---
>>  net/eth_common.c | 30 ------------------------------
>>  4 files changed, 34 insertions(+), 33 deletions(-)
>>
>> diff --git a/cmd/nvedit.c b/cmd/nvedit.c
>> index 4cb25b8..4008de1 100644
>> --- a/cmd/nvedit.c
>> +++ b/cmd/nvedit.c
>> @@ -341,6 +341,36 @@ ulong env_get_hex(const char *varname, ulong default_val)
>>         return value;
>>  }
>>
>> +void eth_parse_enetaddr(const char *addr, uchar *enetaddr)
>> +{
>> +       char *end;
>> +       int i;
>> +
>> +       for (i = 0; i < 6; ++i) {
>> +               enetaddr[i] = addr ? simple_strtoul(addr, &end, 16) : 0;
>> +               if (addr)
>> +                       addr = (*end) ? end + 1 : end;
>> +       }
>> +}
>> +
>> +int eth_env_get_enetaddr(const char *name, uchar *enetaddr)
>> +{
>> +       eth_parse_enetaddr(env_get(name), enetaddr);
>> +       return is_valid_ethaddr(enetaddr);
>> +}
>> +
>> +int eth_env_set_enetaddr(const char *name, const uchar *enetaddr)
>> +{
>> +       char buf[ARP_HLEN_ASCII + 1];
>> +
>> +       if (eth_env_get_enetaddr(name, (uchar *)buf))
>> +               return -EEXIST;
>> +
>> +       sprintf(buf, "%pM", enetaddr);
>> +
>> +       return env_set(name, buf);
>> +}
>> +
>>  #ifndef CONFIG_SPL_BUILD
>>  static int do_env_set(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>>  {
>> diff --git a/include/common.h b/include/common.h
>> index 3087505..b7280eb 100644
>> --- a/include/common.h
>> +++ b/include/common.h
>> @@ -243,6 +243,10 @@ static inline int env_set_addr(const char *varname, const void *addr)
>>         return env_set_hex(varname, (ulong)addr);
>>  }
>>
>> +void eth_parse_enetaddr(const char *addr, uchar *enetaddr);
>> +int eth_env_get_enetaddr(const char *name, uchar *enetaddr);
>> +int eth_env_set_enetaddr(const char *name, const uchar *enetaddr);
>
> Please move this to include/environment.h
>

Will do, thanks for the feedback.

-- 
Alex Kiernan


More information about the U-Boot mailing list