From fb8977c5be93f8e967df224fe0a44721d60e34dc Mon Sep 17 00:00:00 2001 From: Joe Hershberger Date: Fri, 13 Sep 2019 19:21:16 -0500 Subject: net: Always build the string_to_enetaddr() helper Part of the env cleanup moved this out of the environment code and into the net code. However, this helper is sometimes needed even when the net stack isn't included. Move the helper to lib/net_utils.c like it's similarly-purposed string_to_ip(). Also rename the moved function to similar naming. Signed-off-by: Joe Hershberger Reported-by: Ondrej Jirman --- net/eth-uclass.c | 2 +- net/eth_legacy.c | 2 +- net/net.c | 12 ------------ 3 files changed, 2 insertions(+), 14 deletions(-) (limited to 'net') diff --git a/net/eth-uclass.c b/net/eth-uclass.c index 3bd98b01ad..9fe4096120 100644 --- a/net/eth-uclass.c +++ b/net/eth-uclass.c @@ -227,7 +227,7 @@ static int on_ethaddr(const char *name, const char *value, enum env_op op, switch (op) { case env_op_create: case env_op_overwrite: - eth_parse_enetaddr(value, pdata->enetaddr); + string_to_enetaddr(value, pdata->enetaddr); eth_write_hwaddr(dev); break; case env_op_delete: diff --git a/net/eth_legacy.c b/net/eth_legacy.c index 41f5263526..5d6b0d7d7f 100644 --- a/net/eth_legacy.c +++ b/net/eth_legacy.c @@ -117,7 +117,7 @@ static int on_ethaddr(const char *name, const char *value, enum env_op op, switch (op) { case env_op_create: case env_op_overwrite: - eth_parse_enetaddr(value, dev->enetaddr); + string_to_enetaddr(value, dev->enetaddr); eth_write_hwaddr(dev, "eth", dev->index); break; case env_op_delete: diff --git a/net/net.c b/net/net.c index 0513444eb7..284ae1bd6b 100644 --- a/net/net.c +++ b/net/net.c @@ -1625,15 +1625,3 @@ 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; - } -} -- cgit