diff options
author | Joe Hershberger <joe.hershberger@ni.com> | 2015-04-08 01:41:01 -0500 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2015-04-18 11:11:32 -0600 |
commit | 049a95a7759c0e384c1fc7b8575d968d56a33997 (patch) | |
tree | c3d30763163e2e67324ebc8f54d6d84d1d8f9c8a /lib | |
parent | 2ea4cfdef64a690ced0af005fd7a581751a3e581 (diff) | |
download | u-boot-imx-049a95a7759c0e384c1fc7b8575d968d56a33997.zip u-boot-imx-049a95a7759c0e384c1fc7b8575d968d56a33997.tar.gz u-boot-imx-049a95a7759c0e384c1fc7b8575d968d56a33997.tar.bz2 |
net: cosmetic: Change IPaddr_t to struct in_addr
This patch is simply clean-up to make the IPv4 type that is used match
what Linux uses. It also attempts to move all variables that are IP
addresses use good naming instead of CamelCase. No functional change.
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/net_utils.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/net_utils.c b/lib/net_utils.c index 8d66163..cfae842 100644 --- a/lib/net_utils.c +++ b/lib/net_utils.c @@ -12,23 +12,25 @@ #include <common.h> -IPaddr_t string_to_ip(const char *s) +struct in_addr string_to_ip(const char *s) { - IPaddr_t addr; + struct in_addr addr; char *e; int i; + addr.s_addr = 0; if (s == NULL) - return(0); + return addr; - for (addr=0, i=0; i<4; ++i) { + for (addr.s_addr = 0, i = 0; i < 4; ++i) { ulong val = s ? simple_strtoul(s, &e, 10) : 0; - addr <<= 8; - addr |= (val & 0xFF); + addr.s_addr <<= 8; + addr.s_addr |= (val & 0xFF); if (s) { s = (*e) ? e+1 : e; } } - return (htonl(addr)); + addr.s_addr = htonl(addr.s_addr); + return addr; } |