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/power | |
| 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/power')
| -rw-r--r-- | drivers/power/domain/imx8m-power-domain.c | 3 | ||||
| -rw-r--r-- | drivers/power/pmic/bd71837.c | 3 | ||||
| -rw-r--r-- | drivers/power/pmic/mc34708.c | 3 | ||||
| -rw-r--r-- | drivers/power/pmic/mp5416.c | 3 | ||||
| -rw-r--r-- | drivers/power/pmic/pca9450.c | 3 | ||||
| -rw-r--r-- | drivers/power/regulator/pwm_regulator.c | 3 |
6 files changed, 0 insertions, 18 deletions
diff --git a/drivers/power/domain/imx8m-power-domain.c b/drivers/power/domain/imx8m-power-domain.c index a7e64971a2a..1c731b897cc 100644 --- a/drivers/power/domain/imx8m-power-domain.c +++ b/drivers/power/domain/imx8m-power-domain.c @@ -7,7 +7,6 @@ #include <dm.h> #include <malloc.h> #include <power-domain-uclass.h> -#include <asm/global_data.h> #include <asm/io.h> #include <asm/mach-imx/sys_proto.h> #include <dm/device-internal.h> @@ -22,8 +21,6 @@ #include <dt-bindings/power/imx8mp-power.h> #include <dt-bindings/power/imx8mq-power.h> -DECLARE_GLOBAL_DATA_PTR; - #define GPC_PGC_CPU_MAPPING 0x0ec #define IMX8MP_GPC_PGC_CPU_MAPPING 0x1cc diff --git a/drivers/power/pmic/bd71837.c b/drivers/power/pmic/bd71837.c index a5df2570fc3..13642794765 100644 --- a/drivers/power/pmic/bd71837.c +++ b/drivers/power/pmic/bd71837.c @@ -7,14 +7,11 @@ #include <dm.h> #include <i2c.h> #include <log.h> -#include <asm/global_data.h> #include <linux/printk.h> #include <power/pmic.h> #include <power/regulator.h> #include <power/bd71837.h> -DECLARE_GLOBAL_DATA_PTR; - static const struct pmic_child_info pmic_children_info[] = { /* buck */ { .prefix = "b", .driver = BD718XX_REGULATOR_DRIVER}, diff --git a/drivers/power/pmic/mc34708.c b/drivers/power/pmic/mc34708.c index 43badb5767a..0ec52e25a9e 100644 --- a/drivers/power/pmic/mc34708.c +++ b/drivers/power/pmic/mc34708.c @@ -9,11 +9,8 @@ #include <errno.h> #include <fsl_pmic.h> #include <i2c.h> -#include <asm/global_data.h> #include <power/pmic.h> -DECLARE_GLOBAL_DATA_PTR; - static int mc34708_reg_count(struct udevice *dev) { return PMIC_NUM_OF_REGS; diff --git a/drivers/power/pmic/mp5416.c b/drivers/power/pmic/mp5416.c index 9d44f0ae655..899c2beeb37 100644 --- a/drivers/power/pmic/mp5416.c +++ b/drivers/power/pmic/mp5416.c @@ -9,9 +9,6 @@ #include <power/pmic.h> #include <power/regulator.h> #include <power/mp5416.h> -#include <asm/global_data.h> - -DECLARE_GLOBAL_DATA_PTR; static const struct pmic_child_info pmic_children_info[] = { /* buck */ diff --git a/drivers/power/pmic/pca9450.c b/drivers/power/pmic/pca9450.c index e5c1f037b61..c95e6357ee8 100644 --- a/drivers/power/pmic/pca9450.c +++ b/drivers/power/pmic/pca9450.c @@ -10,7 +10,6 @@ #include <dm/lists.h> #include <i2c.h> #include <log.h> -#include <asm/global_data.h> #include <linux/delay.h> #include <linux/printk.h> #include <power/pmic.h> @@ -18,8 +17,6 @@ #include <power/pca9450.h> #include <sysreset.h> -DECLARE_GLOBAL_DATA_PTR; - static const struct pmic_child_info pmic_children_info[] = { /* buck */ { .prefix = "b", .driver = PCA9450_REGULATOR_DRIVER}, diff --git a/drivers/power/regulator/pwm_regulator.c b/drivers/power/regulator/pwm_regulator.c index ff738faadc5..adde5156c76 100644 --- a/drivers/power/regulator/pwm_regulator.c +++ b/drivers/power/regulator/pwm_regulator.c @@ -11,12 +11,9 @@ #include <errno.h> #include <log.h> #include <pwm.h> -#include <asm/global_data.h> #include <dm/device_compat.h> #include <power/regulator.h> -DECLARE_GLOBAL_DATA_PTR; - struct pwm_regulator_info { /* pwm id corresponding to the PWM driver */ int pwm_id; |
