This function requires access to env.h but it is a lot to include just
for the env_get() function. It eventually pulls in linux/byteorder which
causes a conflict with exfat which has its own byteorder functions.

Move the function to a C file instead.

Signed-off-by: Simon Glass <s...@chromium.org>
---

 include/net-common.h | 6 +-----
 net/net-common.c     | 6 ++++++
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/include/net-common.h b/include/net-common.h
index f2613a41ad8..64b475b7292 100644
--- a/include/net-common.h
+++ b/include/net-common.h
@@ -4,7 +4,6 @@
 #define __NET_COMMON_H__
 
 #include <asm/cache.h>
-#include <env.h>
 #include <hexdump.h>
 #include <linux/if_ether.h>
 #include <linux/sizes.h>
@@ -464,10 +463,7 @@ int update_tftp(ulong addr, char *interface, char 
*devstring);
  *     0 to 255
  * Return: IP address, or 0 if invalid
  */
-static inline struct in_addr env_get_ip(char *var)
-{
-       return string_to_ip(env_get(var));
-}
+struct in_addr env_get_ip(char *var);
 
 int net_init(void);
 
diff --git a/net/net-common.c b/net/net-common.c
index 45288fe5f80..9ff06b165df 100644
--- a/net/net-common.c
+++ b/net/net-common.c
@@ -1,4 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
+#include <env.h>
 #include <net-common.h>
 
 void copy_filename(char *dst, const char *src, int size)
@@ -25,3 +26,8 @@ int wget_request(ulong dst_addr, char *uri, struct 
wget_http_info *info)
        wget_info = info ? info : &default_wget_info;
        return wget_with_dns(dst_addr, uri);
 }
+
+struct in_addr env_get_ip(char *var)
+{
+       return string_to_ip(env_get(var));
+}
-- 
2.43.0

base-commit: b5d6220dd2f4612912989f3c2b5a710f2248cb36
branch: fix-net

Reply via email to