u-boot-brain/include/linux
Masahiro Yamada 8be60f06c2 linux/kconfig.h: add CPP macros useful for per-image config options
The previous commit introduced a useful macro used in makefiles,
in order to reference to different variables (CONFIG_... or
CONFIG_SPL_...) depending on the build context.

Per-image config option control is a PITA in C sources, too.
Here are some macros useful in C/CPP expressions.

CONFIG_IS_ENABLED(FOO) can be used as a shorthand for

  (!defined(CONFIG_SPL_BUILD) && defined(CONFIG_FOO)) || \
   (defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_FOO))

For example, it is useful to describe C code as follows,

  #if CONFIG_IS_ENABLED(OF_CONTROL)
      (device tree code)
  #else
      (board file code)
  #endif

The ifdef conditional above is switched by CONFIG_OF_CONTROL during
the U-Boot proper building (CONFIG_SPL_BUILD is not defined), and by
CONFIG_SPL_OF_CONTROL during SPL building (CONFIG_SPL_BUILD is
defined).

The macro can be used in C context as well, so you can also write the
equivalent code as follows:

  if (CONFIG_IS_ENABLED(OF_CONTROL)) {
      (device tree code)
  } else {
      (board file code)
  }

Another useful macro is CONFIG_VALUE().
CONFIG_VALUE(FOO) is expanded into CONFIG_FOO if CONFIG_SPL_BUILD is
undefined, and into CONFIG_SPL_FOO if CONFIG_SPL_BUILD is defined.

You can write as follows:

  text_base = CONFIG_VALUE(TEXT_BASE);

instead of:

  #ifdef CONFIG_SPL_BUILD
      text_base = CONFIG_SPL_TEXT_BASE;
  #else
      text_base = CONFIG_TEXT_BASE;
  #endif

This commit also adds slight hacking on fixdep so that it can
output a correct list of fixed dependencies.

If the fixdep finds CONFIG_IS_ENABLED(FOO) in a source file,
we want
    $(wildcard include/config/foo.h)
in the U-boot proper building context, while we want
    $(wildcard include/config/spl/foo.h)
in the SPL build context.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2015-08-18 13:46:00 -04:00
..
byteorder
mtd mtd: fix false positive "Offset exceeds device limit" error 2015-07-10 09:38:50 -04:00
unaligned
usb include: usb: Map USB controller base addresses for LS2085A 2015-07-22 08:55:45 +02:00
apm_bios.h
bch.h
bitops.h
bitrev.h
compat.h linux_compat: handle __GFP_ZERO in kmalloc() 2015-07-22 07:30:44 -06:00
compiler-clang.h
compiler-gcc3.h
compiler-gcc4.h
compiler-gcc5.h Add linux/compiler-gcc5.h to fix builds with gcc5 2015-02-11 19:43:45 -05:00
compiler-gcc.h
compiler-intel.h
compiler.h
crc7.h
crc8.h
crc32.h
ctype.h
drm_dp_helper.h tegra124: video: Add full link training for eDP 2015-05-13 09:24:12 -07:00
edd.h
err.h
ethtool.h
fb.h
immap_qe.h QE/DeepSleep: add QE deepsleep support for mpc85xx 2015-04-21 10:19:19 -07:00
input.h
io.h include: introduce include/linux/io.h as a wrapper of asm/io.h 2015-05-28 08:18:19 -04:00
ioctl.h
ioport.h
kbuild.h
kconfig.h linux/kconfig.h: add CPP macros useful for per-image config options 2015-08-18 13:46:00 -04:00
kernel.h
linkage.h use ASM_NL instead of '; ' for assembler new line character in the macro 2015-03-05 20:49:43 -05:00
linux_string.h
list_sort.h
list.h
lzo.h
math64.h
mbus.h
mc146818rtc.h
mdio.h
mii.h
netdevice.h
poison.h
posix_types.h
rbtree_augmented.h
rbtree.h
screen_info.h
serial_reg.h
sizes.h
stat.h
stddef.h
string.h
stringify.h
time.h
types.h Bring in __aligned_u64 and friends to linux/types.h 2015-08-05 08:42:40 -06:00