diff options
| author | Tom Rini <[email protected]> | 2026-02-17 13:51:26 -0600 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2026-02-17 13:51:26 -0600 |
| commit | 9ddccb51443d4856e5ad2f06cc3552627b86b3d9 (patch) | |
| tree | d42c5647f5f59098c626f8bd5d16e53b283f35f0 /cmd | |
| parent | 54f9b6528e34f1f75c2258ed29887f496a35dd6a (diff) | |
| parent | 0f90b1e715f8abe41b0875752eb184f46032ff11 (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 'cmd')
| -rw-r--r-- | cmd/bloblist.c | 3 | ||||
| -rw-r--r-- | cmd/bootefi.c | 3 | ||||
| -rw-r--r-- | cmd/bootm.c | 3 | ||||
| -rw-r--r-- | cmd/date.c | 3 | ||||
| -rw-r--r-- | cmd/mem.c | 4 | ||||
| -rw-r--r-- | cmd/sound.c | 3 | ||||
| -rw-r--r-- | cmd/spl.c | 3 |
7 files changed, 1 insertions, 21 deletions
diff --git a/cmd/bloblist.c b/cmd/bloblist.c index 333ae558142..318a1af0220 100644 --- a/cmd/bloblist.c +++ b/cmd/bloblist.c @@ -8,9 +8,6 @@ #include <bloblist.h> #include <command.h> -#include <asm/global_data.h> - -DECLARE_GLOBAL_DATA_PTR; static int do_bloblist_info(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) diff --git a/cmd/bootefi.c b/cmd/bootefi.c index b8f5bb35950..85f41c3b0a0 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -17,11 +17,8 @@ #include <mapmem.h> #include <vsprintf.h> #include <asm-generic/sections.h> -#include <asm/global_data.h> #include <linux/string.h> -DECLARE_GLOBAL_DATA_PTR; - static struct efi_device_path *test_image_path; static struct efi_device_path *test_device_path; diff --git a/cmd/bootm.c b/cmd/bootm.c index 2c5aea26d98..ca7cec91fad 100644 --- a/cmd/bootm.c +++ b/cmd/bootm.c @@ -15,14 +15,11 @@ #include <malloc.h> #include <nand.h> #include <asm/byteorder.h> -#include <asm/global_data.h> #include <linux/ctype.h> #include <linux/err.h> #include <u-boot/zlib.h> #include <mapmem.h> -DECLARE_GLOBAL_DATA_PTR; - #if defined(CONFIG_CMD_IMI) static int image_info(unsigned long addr); #endif diff --git a/cmd/date.c b/cmd/date.c index 8614f022761..d047872289c 100644 --- a/cmd/date.c +++ b/cmd/date.c @@ -11,9 +11,6 @@ #include <dm.h> #include <rtc.h> #include <i2c.h> -#include <asm/global_data.h> - -DECLARE_GLOBAL_DATA_PTR; static const char * const weekdays[] = { "Sun", "Mon", "Tues", "Wednes", "Thurs", "Fri", "Satur", diff --git a/cmd/mem.c b/cmd/mem.c index d5d7ca2790b..68eb6989b94 100644 --- a/cmd/mem.c +++ b/cmd/mem.c @@ -26,16 +26,14 @@ #include <mapmem.h> #include <rand.h> #include <time.h> +#include <vsprintf.h> #include <watchdog.h> -#include <asm/global_data.h> #include <asm/io.h> #include <linux/bitops.h> #include <linux/compiler.h> #include <linux/ctype.h> #include <linux/delay.h> -DECLARE_GLOBAL_DATA_PTR; - /* Create a compile-time value */ #if MEM_SUPPORT_64BIT_DATA #define HELP_Q ", .q" diff --git a/cmd/sound.c b/cmd/sound.c index 8f67cbd96e1..7546059022f 100644 --- a/cmd/sound.c +++ b/cmd/sound.c @@ -8,9 +8,6 @@ #include <dm.h> #include <fdtdec.h> #include <sound.h> -#include <asm/global_data.h> - -DECLARE_GLOBAL_DATA_PTR; /* Initilaise sound subsystem */ static int do_init(struct cmd_tbl *cmdtp, int flag, int argc, diff --git a/cmd/spl.c b/cmd/spl.c index f591dc07fb6..ddbbd4a8172 100644 --- a/cmd/spl.c +++ b/cmd/spl.c @@ -9,11 +9,8 @@ #include <env.h> #include <image.h> #include <log.h> -#include <asm/global_data.h> #include <linux/libfdt.h> -DECLARE_GLOBAL_DATA_PTR; - static const char **subcmd_list[] = { [SPL_EXPORT_FDT] = (const char * []) { |
