diff options
author | Simon Glass | 2016-01-17 14:51:58 -0700 |
---|---|---|
committer | Joe Hershberger | 2016-01-28 12:32:46 -0600 |
commit | 9987ecdd36da79535c4229ecc5693533aaa8d17b (patch) | |
tree | eb71eb6e57b439f75f0bbb7b6e51c6df73869853 /net/eth.c | |
parent | 818f91eb5778781083e33ce3291bba76a3f1601c (diff) |
net: Move environment functions to the common file
Move the functions which set ethernet environment variables to the common
file.
Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Diffstat (limited to 'net/eth.c')
-rw-r--r-- | net/eth.c | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/net/eth.c b/net/eth.c index 602925d20f6..af8fcaea904 100644 --- a/net/eth.c +++ b/net/eth.c @@ -20,49 +20,6 @@ DECLARE_GLOBAL_DATA_PTR; -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_getenv_enetaddr(const char *name, uchar *enetaddr) -{ - eth_parse_enetaddr(getenv(name), enetaddr); - return is_valid_ethaddr(enetaddr); -} - -int eth_setenv_enetaddr(const char *name, const uchar *enetaddr) -{ - char buf[20]; - - sprintf(buf, "%pM", enetaddr); - - return setenv(name, buf); -} - -int eth_getenv_enetaddr_by_index(const char *base_name, int index, - uchar *enetaddr) -{ - char enetvar[32]; - sprintf(enetvar, index ? "%s%daddr" : "%saddr", base_name, index); - return eth_getenv_enetaddr(enetvar, enetaddr); -} - -static inline int eth_setenv_enetaddr_by_index(const char *base_name, int index, - uchar *enetaddr) -{ - char enetvar[32]; - sprintf(enetvar, index ? "%s%daddr" : "%saddr", base_name, index); - return eth_setenv_enetaddr(enetvar, enetaddr); -} - static int eth_mac_skip(int index) { char enetvar[15]; |