mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-24 21:54:01 +00:00
env: net: Move eth_parse_enetaddr() to net.c/h
This function fits better with the network subsystem, so move it. Signed-off-by: Simon Glass <sjg@chromium.org> Suggested-by: Joe Hershberger <joe.hershberger@ni.com>
This commit is contained in:
parent
b79cf1af0d
commit
36c8b143c0
4 changed files with 23 additions and 14 deletions
12
cmd/nvedit.c
12
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);
|
||||
|
|
|
@ -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_ */
|
||||
|
|
|
@ -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__ */
|
||||
|
|
12
net/net.c
12
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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue