common.h: Remove this file and all references

With all files that had included this file directly having been updated,
we can now remove this file.

Signed-off-by: Tom Rini <trini@konsulko.com>
This commit is contained in:
Tom Rini 2024-05-01 19:31:38 -06:00
parent 1227a30d00
commit 47558a4fce
7 changed files with 5 additions and 49 deletions

View file

@ -110,9 +110,8 @@ Include files
You should follow this ordering in U-Boot. In all cases, they should be listed You should follow this ordering in U-Boot. In all cases, they should be listed
in alphabetical order. First comes headers which are located directly in our in alphabetical order. First comes headers which are located directly in our
top-level include diretory. This excludes the common.h header file which is to top-level include diretory. Second are headers within subdirectories, Finally
be removed. Second are headers within subdirectories, Finally directory-local directory-local includes should be listed. See this example:
includes should be listed. See this example:
.. code-block:: C .. code-block:: C
@ -129,9 +128,6 @@ For files that need to be compiled for the host (e.g. tools), you need to use
``#ifndef USE_HOSTCC`` to avoid including U-Boot specific include files. See ``#ifndef USE_HOSTCC`` to avoid including U-Boot specific include files. See
common/image.c for an example. common/image.c for an example.
If you encounter code which still uses <common.h> a patch to remove that and
replace it with any required include files directly is much appreciated.
If your file uses driver model, include <dm.h> in the C file. Do not include If your file uses driver model, include <dm.h> in the C file. Do not include
dm.h in a header file. Try to use forward declarations (e.g. ``struct dm.h in a header file. Try to use forward declarations (e.g. ``struct
udevice``) instead. udevice``) instead.

View file

@ -281,7 +281,6 @@ new one of those, you should add a new suite.
Create a new file in test/ or a subdirectory and define a macro to register the Create a new file in test/ or a subdirectory and define a macro to register the
suite. For example:: suite. For example::
#include <common.h>
#include <console.h> #include <console.h>
#include <mapmem.h> #include <mapmem.h>
#include <dm/test.h> #include <dm/test.h>

View file

@ -1,33 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Common header file for U-Boot
*
* This file still includes quite a few headers that should be included
* individually as needed. Patches to remove things are welcome.
*
* (C) Copyright 2000-2009
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*/
#ifndef __COMMON_H_
#define __COMMON_H_ 1
#ifndef __ASSEMBLY__ /* put C only stuff in this section */
#include <config.h>
#include <errno.h>
#include <time.h>
#include <linux/types.h>
#include <linux/string.h>
#include <stdarg.h>
#include <stdio.h>
#include <linux/kernel.h>
#include <asm/u-boot.h> /* boot information for Linux kernel */
#include <vsprintf.h>
#endif /* __ASSEMBLY__ */
/* Pull in stuff for the build system */
#ifdef DO_DEPS_ONLY
# include <env_internal.h>
#endif
#endif /* __COMMON_H_ */

View file

@ -45,7 +45,7 @@ c_flags := $(KBUILD_CFLAGS) $(KBUILD_CPPFLAGS) $(PLATFORM_CPPFLAGS) \
quiet_cmd_autoconf_dep = GEN $@ quiet_cmd_autoconf_dep = GEN $@
cmd_autoconf_dep = $(CC) -x c -DDO_DEPS_ONLY -M -MP $(c_flags) \ cmd_autoconf_dep = $(CC) -x c -DDO_DEPS_ONLY -M -MP $(c_flags) \
-MQ include/config/auto.conf $(srctree)/include/common.h > $@ || { \ -MQ include/config/auto.conf include/config.h > $@ || { \
rm $@; false; \ rm $@; false; \
} }
include/autoconf.mk.dep: include/config.h FORCE include/autoconf.mk.dep: include/config.h FORCE
@ -70,7 +70,7 @@ quiet_cmd_autoconf = GEN $@
quiet_cmd_u_boot_cfg = CFG $@ quiet_cmd_u_boot_cfg = CFG $@
cmd_u_boot_cfg = \ cmd_u_boot_cfg = \
$(CPP) $(c_flags) $2 -DDO_DEPS_ONLY -dM $(srctree)/include/common.h > $@.tmp && { \ $(CPP) $(c_flags) $2 -DDO_DEPS_ONLY -dM include/config.h > $@.tmp && { \
grep 'define CONFIG_' $@.tmp | \ grep 'define CONFIG_' $@.tmp | \
sed '/define CONFIG_IS_ENABLED(/d;/define CONFIG_IF_ENABLED_INT(/d;/define CONFIG_VAL(/d;' > $@; \ sed '/define CONFIG_IS_ENABLED(/d;/define CONFIG_IF_ENABLED_INT(/d;/define CONFIG_VAL(/d;' > $@; \
rm $@.tmp; \ rm $@.tmp; \

View file

@ -10,6 +10,6 @@
set -e set -e
echo '#include <common.h>' echo '#include <linux/compiler.h>'
$@ 2>/dev/null | grep -oe '_u_boot_list_2_[a-zA-Z0-9_]*_2_[a-zA-Z0-9_]*' | \ $@ 2>/dev/null | grep -oe '_u_boot_list_2_[a-zA-Z0-9_]*_2_[a-zA-Z0-9_]*' | \
sort -u | sed -e 's/^\(.*\)/extern char \1[];\n__ADDRESSABLE(\1);/' sort -u | sed -e 's/^\(.*\)/extern char \1[];\n__ADDRESSABLE(\1);/'

View file

@ -835,7 +835,6 @@ class DtbPlatdata():
def generate_uclasses(self): def generate_uclasses(self):
self.out('\n') self.out('\n')
self.out('#include <common.h>\n')
self.out('#include <dm.h>\n') self.out('#include <dm.h>\n')
self.out('#include <dt-structs.h>\n') self.out('#include <dt-structs.h>\n')
self.out('\n') self.out('\n')
@ -1059,7 +1058,6 @@ class DtbPlatdata():
self.out('/* Allow use of U_BOOT_DRVINFO() in this file */\n') self.out('/* Allow use of U_BOOT_DRVINFO() in this file */\n')
self.out('#define DT_PLAT_C\n') self.out('#define DT_PLAT_C\n')
self.out('\n') self.out('\n')
self.out('#include <common.h>\n')
self.out('#include <dm.h>\n') self.out('#include <dm.h>\n')
self.out('#include <dt-structs.h>\n') self.out('#include <dt-structs.h>\n')
self.out('\n') self.out('\n')
@ -1092,7 +1090,6 @@ class DtbPlatdata():
See the documentation in doc/driver-model/of-plat.rst for more See the documentation in doc/driver-model/of-plat.rst for more
information. information.
""" """
self.out('#include <common.h>\n')
self.out('#include <dm.h>\n') self.out('#include <dm.h>\n')
self.out('#include <dt-structs.h>\n') self.out('#include <dt-structs.h>\n')
self.out('\n') self.out('\n')

View file

@ -63,7 +63,6 @@ C_HEADER = C_HEADER_PRE + '''
/* Allow use of U_BOOT_DRVINFO() in this file */ /* Allow use of U_BOOT_DRVINFO() in this file */
#define DT_PLAT_C #define DT_PLAT_C
#include <common.h>
#include <dm.h> #include <dm.h>
#include <dt-structs.h> #include <dt-structs.h>
''' '''
@ -417,7 +416,6 @@ U_BOOT_DRVINFO(spl_test3) = {
''' '''
uclass_text_inst = ''' uclass_text_inst = '''
#include <common.h>
#include <dm.h> #include <dm.h>
#include <dt-structs.h> #include <dt-structs.h>
@ -521,7 +519,6 @@ DM_UCLASS_INST(testfdt) = {
* This was generated by dtoc from a .dtb (device tree binary) file. * This was generated by dtoc from a .dtb (device tree binary) file.
*/ */
#include <common.h>
#include <dm.h> #include <dm.h>
#include <dt-structs.h> #include <dt-structs.h>