[U-Boot] DECLARE_GLOBAL_DATA_PTR : move from source to Makefile

Masahiro Yamada yamada.m at jp.panasonic.com
Fri Oct 31 08:22:11 CET 2014


Hi Kevin.


On Fri, 31 Oct 2014 13:04:38 +0800
Kevin Du Huanpeng <u74147 at gmail.com> wrote:

> Hi, all,
> I find this macro is found anywhere in the source, nearly one thousand
> in the source, looks odd sometime.

Only one thousand.
We have more than 6000 source files.

yamada at beagle:~/workspace/u-boot$ find . -name '*.[ch]' | wc
   6158    6158  198875
yamada at beagle:~/workspace/u-boot$ find . -name '*.[ch]' | xargs grep DECLARE_GLOBAL_DATA_PTR | wc
    944    1099   54674




> I have a idea about this:
> 
> 1. remove DECLARE_GLOBAL_DATA_PTR from source
>     about one thousand DECLARE_GLOBAL_DATA_PTR in the source
> 
> 2. add a file like, same as other archs.
> arch/arm/include/asm/declare_global_data_ptr.h
> - - - -
> #ifndef __DECLARE_GLOBAL_DATA_PTR_H
> #define __DECLARE_GLOBAL_DATA_PTR_H
> 
> #ifdef CONFIG_ARM64
> #define DECLARE_GLOBAL_DATA_PTR         register volatile gd_t *gd asm ("x18")
> #else
> #define DECLARE_GLOBAL_DATA_PTR         register volatile gd_t *gd asm ("r9")
> #endif
> 
> #endif
> - - - -
> 
> 3. modify top level Makefile
> - - - -
> UBOOTINCLUDE    := \
>                 -Iinclude \
>                 $(if $(KBUILD_SRC), -I$(srctree)/include) \
>                 -I$(srctree)/arch/$(ARCH)/include \
>                 -include $(srctree)/include/linux/kconfig.h \
> +              -include $(srctree)/arch/$(ARCH)/include/asm/global_data.h
> - - - -


I do not like this idea.
I think a source file should only include needed headers.



Best Regards
Masahiro Yamada



More information about the U-Boot mailing list