mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-02 09:46:37 +03:00
Merge patch series "treewide: Clean up usage of DECLARE_GLOBAL_DATA_PTR"
Peng Fan (OSS) <peng.fan@oss.nxp.com> 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/20260209-cleanup-v2-0-73a3a84ddbdb@nxp.com
This commit is contained in:
@@ -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
|
||||
*
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
* Copyright Duncan Hare <dh@synoia.com> 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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user