[U-Boot] [PATCH v2 19/40] env: net: Move eth_parse_enetaddr() to net.c/h

Ondřej Jirman megous at megous.com
Thu Sep 12 16:59:47 UTC 2019


Hello,

On Thu, Aug 01, 2019 at 09:46:54AM -0600, Simon Glass wrote:
> This function fits better with the network subsystem, so move it.

Unfortunately, this breaks builds without CONFIG_NET. Reverting it
fixes the issue.

  LD      u-boot
cmd/built-in.o: In function `eth_env_get_enetaddr':
u-boot-v2019.10/cmd/nvedit.c:363: undefined reference to `eth_parse_enetaddr'
make[1]: *** [u-boot-v2019.10/Makefile:1594: u-boot] Error 1
make[1]: Leaving directory 'builds/.tmp/u-pc-5.4'
make: *** [Makefile:148: sub-make] Error 2

regards,
	o.

> Signed-off-by: Simon Glass <sjg at chromium.org>
> Suggested-by: Joe Hershberger <joe.hershberger at ni.com>
> ---
> 
> Changes in v2:
> - Add new patch to move eth_parse_enetaddr() to net.c/h
> 
>  cmd/nvedit.c          | 12 ------------
>  include/environment.h |  2 --
>  include/net.h         | 11 +++++++++++
>  net/net.c             | 12 ++++++++++++
>  4 files changed, 23 insertions(+), 14 deletions(-)
> 
> diff --git a/cmd/nvedit.c b/cmd/nvedit.c
> index 751b77d0e9..01110e9b3a 100644
> --- a/cmd/nvedit.c
> +++ b/cmd/nvedit.c
> @@ -358,18 +358,6 @@ ulong env_get_hex(const char *varname, ulong default_val)
>  	return value;
>  }
>  
> -void eth_parse_enetaddr(const char *addr, uint8_t *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, uint8_t *enetaddr)
>  {
>  	eth_parse_enetaddr(env_get(name), enetaddr);
> diff --git a/include/environment.h b/include/environment.h
> index 77915f459e..0de9d3fc60 100644
> --- a/include/environment.h
> +++ b/include/environment.h
> @@ -325,8 +325,6 @@ int env_erase(void);
>   */
>  void env_fix_drivers(void);
>  
> -void eth_parse_enetaddr(const char *addr, uint8_t *enetaddr);
> -
>  #endif /* DO_DEPS_ONLY */
>  
>  #endif /* _ENVIRONMENT_H_ */
> diff --git a/include/net.h b/include/net.h
> index 0262175c81..a54d5eeac5 100644
> --- a/include/net.h
> +++ b/include/net.h
> @@ -875,4 +875,15 @@ int update_tftp(ulong addr, char *interface, char *devstring);
>  
>  /**********************************************************************/
>  
> +/**
> + * eth_parse_enetaddr() - Parse a MAC address
> + *
> + * Convert a string MAC address
> + *
> + * @addr: MAC address in aa:bb:cc:dd:ee:ff format, where each part is a 2-digit
> + *	hex value
> + * @enetaddr: Place to put MAC address (6 bytes)
> + */
> +void eth_parse_enetaddr(const char *addr, uint8_t *enetaddr);
> +
>  #endif /* __NET_H__ */
> diff --git a/net/net.c b/net/net.c
> index 1a175c4597..f0a3996cd6 100644
> --- a/net/net.c
> +++ b/net/net.c
> @@ -1614,3 +1614,15 @@ ushort env_get_vlan(char *var)
>  {
>  	return string_to_vlan(env_get(var));
>  }
> +
> +void eth_parse_enetaddr(const char *addr, uint8_t *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;
> +	}
> +}
> -- 
> 2.22.0.709.g102302147b-goog
> 
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot


More information about the U-Boot mailing list