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 /drivers/firmware | |
| 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 'drivers/firmware')
| -rw-r--r-- | drivers/firmware/arm-ffa/arm-ffa-uclass.c | 3 | ||||
| -rw-r--r-- | drivers/firmware/arm-ffa/arm-ffa.c | 3 | ||||
| -rw-r--r-- | drivers/firmware/arm-ffa/ffa-emul-uclass.c | 3 | ||||
| -rw-r--r-- | drivers/firmware/arm-ffa/sandbox_ffa.c | 3 |
4 files changed, 0 insertions, 12 deletions
diff --git a/drivers/firmware/arm-ffa/arm-ffa-uclass.c b/drivers/firmware/arm-ffa/arm-ffa-uclass.c index 96c64964bb7..76a8775e911 100644 --- a/drivers/firmware/arm-ffa/arm-ffa-uclass.c +++ b/drivers/firmware/arm-ffa/arm-ffa-uclass.c @@ -12,15 +12,12 @@ #include <malloc.h> #include <string.h> #include <u-boot/uuid.h> -#include <asm/global_data.h> #include <dm/device-internal.h> #include <dm/devres.h> #include <dm/root.h> #include <linux/errno.h> #include <linux/sizes.h> -DECLARE_GLOBAL_DATA_PTR; - /* Error mapping declarations */ int ffa_to_std_errmap[MAX_NUMBER_FFA_ERR] = { diff --git a/drivers/firmware/arm-ffa/arm-ffa.c b/drivers/firmware/arm-ffa/arm-ffa.c index 94e6105cb38..9e6b5dcc542 100644 --- a/drivers/firmware/arm-ffa/arm-ffa.c +++ b/drivers/firmware/arm-ffa/arm-ffa.c @@ -10,12 +10,9 @@ #include <arm_ffa_priv.h> #include <dm.h> #include <log.h> -#include <asm/global_data.h> #include <dm/device-internal.h> #include <linux/errno.h> -DECLARE_GLOBAL_DATA_PTR; - /** * invoke_ffa_fn() - SMC wrapper * @args: FF-A ABI arguments to be copied to Xn registers diff --git a/drivers/firmware/arm-ffa/ffa-emul-uclass.c b/drivers/firmware/arm-ffa/ffa-emul-uclass.c index 1521d9b66ac..6198d687354 100644 --- a/drivers/firmware/arm-ffa/ffa-emul-uclass.c +++ b/drivers/firmware/arm-ffa/ffa-emul-uclass.c @@ -8,7 +8,6 @@ #include <dm.h> #include <mapmem.h> #include <string.h> -#include <asm/global_data.h> #include <asm/sandbox_arm_ffa.h> #include <asm/sandbox_arm_ffa_priv.h> #include <dm/device-internal.h> @@ -17,8 +16,6 @@ #include <linux/errno.h> #include <linux/sizes.h> -DECLARE_GLOBAL_DATA_PTR; - /* The partitions (SPs) table */ static struct ffa_partition_desc sandbox_partitions[SANDBOX_PARTITIONS_CNT] = { { diff --git a/drivers/firmware/arm-ffa/sandbox_ffa.c b/drivers/firmware/arm-ffa/sandbox_ffa.c index 44b32a829dd..f1e8de4bf0d 100644 --- a/drivers/firmware/arm-ffa/sandbox_ffa.c +++ b/drivers/firmware/arm-ffa/sandbox_ffa.c @@ -8,13 +8,10 @@ #include <arm_ffa.h> #include <dm.h> #include <log.h> -#include <asm/global_data.h> #include <asm/sandbox_arm_ffa_priv.h> #include <dm/device-internal.h> #include <linux/errno.h> -DECLARE_GLOBAL_DATA_PTR; - /** * sandbox_ffa_discover() - perform sandbox FF-A discovery * @dev: The sandbox FF-A bus device |
