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 /boot | |
| 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 'boot')
| -rw-r--r-- | boot/bootmeth-uclass.c | 2 | ||||
| -rw-r--r-- | boot/fdt_simplefb.c | 3 | ||||
| -rw-r--r-- | boot/image-sig.c | 2 | ||||
| -rw-r--r-- | boot/image.c | 3 |
4 files changed, 0 insertions, 10 deletions
diff --git a/boot/bootmeth-uclass.c b/boot/bootmeth-uclass.c index a9709465f6e..c841dd0d6d4 100644 --- a/boot/bootmeth-uclass.c +++ b/boot/bootmeth-uclass.c @@ -19,8 +19,6 @@ #include <mapmem.h> #include <dm/uclass-internal.h> -DECLARE_GLOBAL_DATA_PTR; - int bootmeth_get_state_desc(struct udevice *dev, char *buf, int maxsize) { const struct bootmeth_ops *ops = bootmeth_get_ops(dev); diff --git a/boot/fdt_simplefb.c b/boot/fdt_simplefb.c index 5822131767d..69c7c2e24c0 100644 --- a/boot/fdt_simplefb.c +++ b/boot/fdt_simplefb.c @@ -8,14 +8,11 @@ #include <dm.h> #include <fdt_support.h> -#include <asm/global_data.h> #include <linux/libfdt.h> #include <video.h> #include <spl.h> #include <bloblist.h> -DECLARE_GLOBAL_DATA_PTR; - static int fdt_simplefb_configure_node(void *blob, int off) { int xsize, ysize; diff --git a/boot/image-sig.c b/boot/image-sig.c index 6bc74866eae..4eab017bc2d 100644 --- a/boot/image-sig.c +++ b/boot/image-sig.c @@ -5,8 +5,6 @@ #include <log.h> #include <malloc.h> -#include <asm/global_data.h> -DECLARE_GLOBAL_DATA_PTR; #include <image.h> #include <relocate.h> #include <u-boot/ecdsa.h> diff --git a/boot/image.c b/boot/image.c index dd96f712b6f..3f745254763 100644 --- a/boot/image.c +++ b/boot/image.c @@ -24,12 +24,9 @@ #include <fdt_support.h> #endif -#include <asm/global_data.h> #include <linux/errno.h> #include <asm/io.h> -DECLARE_GLOBAL_DATA_PTR; - /* Set this if we have less than 4 MB of malloc() space */ #if CONFIG_SYS_MALLOC_LEN < (4096 * 1024) #define CONSERVE_MEMORY true |
