summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2026-02-17 13:51:26 -0600
committerTom Rini <[email protected]>2026-02-17 13:51:26 -0600
commit9ddccb51443d4856e5ad2f06cc3552627b86b3d9 (patch)
treed42c5647f5f59098c626f8bd5d16e53b283f35f0 /net
parent54f9b6528e34f1f75c2258ed29887f496a35dd6a (diff)
parent0f90b1e715f8abe41b0875752eb184f46032ff11 (diff)
Merge patch series "treewide: Clean up usage of DECLARE_GLOBAL_DATA_PTR"
Peng Fan (OSS) <[email protected]> says: This patch set primarily removes unused DECLARE_GLOBAL_DATA_PTR instances. Many files declare DECLARE_GLOBAL_DATA_PTR and include asm/global_data.h even though gd is never used. In these cases, asm/global_data.h is effectively treated as a proxy header, which is not a good practice. Following the Include What You Use principle, files should include only the headers they actually depend on, rather than relying on global_data.h indirectly. This approach is also adopted in Linux kernel [1]. The first few patches are prepartion to avoid building break after remove the including of global_data.h. A script is for filtering the files: list=`find . -name "*.[ch]"` for source in ${list} do result=`sed -n '/DECLARE_GLOBAL_DATA_PTR/p' ${source}` if [ "${result}" == "DECLARE_GLOBAL_DATA_PTR;" ]; then echo "Found in ${source}" result=`sed -n '/\<gd\>/p' ${source}` result2=`sed -n '/\<gd_/p' ${source}` result3=`sed -n '/\<gd->/p' ${source}` if [ "${result}" == "" ] && [ "${result2}" == "" ] && [ "${result3}" == "" ];then echo "Cleanup ${source}" sed -i '/DECLARE_GLOBAL_DATA_PTR/{N;/\n[[:space:]]*$/d;s/.*\n//;}' ${source} sed -i '/DECLARE_GLOBAL_DATA_PTR/d' ${source} sed -i '/global_data.h/d' ${source} git add ${source} fi fi done [1] https://lpc.events/event/17/contributions/1620/attachments/1228/2520/Linux%20Kernel%20Header%20Optimization.pdf CI: https://github.com/u-boot/u-boot/pull/865 Link: https://lore.kernel.org/r/[email protected]
Diffstat (limited to 'net')
-rw-r--r--net/eth-uclass.c3
-rw-r--r--net/tftp.c3
-rw-r--r--net/wget.c3
3 files changed, 0 insertions, 9 deletions
diff --git a/net/eth-uclass.c b/net/eth-uclass.c
index a233912fd8e..5c437143a30 100644
--- a/net/eth-uclass.c
+++ b/net/eth-uclass.c
@@ -14,15 +14,12 @@
#include <log.h>
#include <net.h>
#include <nvmem.h>
-#include <asm/global_data.h>
#include <dm/device-internal.h>
#include <dm/uclass-internal.h>
#include <net/pcap.h>
#include "eth_internal.h"
#include <eth_phy.h>
-DECLARE_GLOBAL_DATA_PTR;
-
/**
* struct eth_device_priv - private structure for each Ethernet device
*
diff --git a/net/tftp.c b/net/tftp.c
index 5f2e0a2bc06..beb9d08f5a2 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -16,12 +16,9 @@
#include <mapmem.h>
#include <net.h>
#include <net6.h>
-#include <asm/global_data.h>
#include <net/tftp.h>
#include "bootp.h"
-DECLARE_GLOBAL_DATA_PTR;
-
/*
* We cannot use the 'tftpput' command in xPL phases. Given how the
* support is integrated in the code, this is how we disable that support
diff --git a/net/wget.c b/net/wget.c
index d3642958bf0..49bfb9fcb96 100644
--- a/net/wget.c
+++ b/net/wget.c
@@ -4,7 +4,6 @@
* Copyright Duncan Hare <[email protected]> 2017
*/
-#include <asm/global_data.h>
#include <command.h>
#include <display_options.h>
#include <env.h>
@@ -17,8 +16,6 @@
#include <net/wget.h>
#include <stdlib.h>
-DECLARE_GLOBAL_DATA_PTR;
-
/* The default, change with environment variable 'httpdstp' */
#define SERVER_PORT 80