u-boot/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 include/linux/byteorder: Always defines __fswab64, __swab64p and __swab64s 2012-11-30 07:15:04 -07:00
mtd mtd: fix false positive "Offset exceeds device limit" error 2015-07-10 09:38:50 -04:00
unaligned include/linux/unaligned/generic.h: fix warning: preprocessor token __force redefined 2012-11-04 11:00:34 -07:00
usb include: usb: Map USB controller base addresses for LS2085A 2015-07-22 08:55:45 +02:00
apm_bios.h Add GPL-2.0+ SPDX-License-Identifier to source files 2013-07-24 09:44:38 -04:00
bch.h nand: Merge BCH code from Linux nand driver 2012-01-26 16:09:02 -06:00
bitops.h Correct ffs/fls regression for PowerPC etc 2009-09-17 22:45:31 +02:00
bitrev.h Add GPL-2.0+ SPDX-License-Identifier to source files 2013-07-24 09:44:38 -04:00
compat.h linux_compat: handle __GFP_ZERO in kmalloc() 2015-07-22 07:30:44 -06:00
compiler-clang.h compiler*.h: sync include/linux/compiler*.h with Linux 3.16 2014-09-16 12:23:57 -04:00
compiler-gcc.h compiler_gcc: prevent redefining attributes 2014-09-24 18:30:29 -04:00
compiler-gcc3.h compiler*.h: sync include/linux/compiler*.h with Linux 3.16 2014-09-16 12:23:57 -04:00
compiler-gcc4.h compiler*.h: sync include/linux/compiler*.h with Linux 3.16 2014-09-16 12:23:57 -04:00
compiler-gcc5.h Add linux/compiler-gcc5.h to fix builds with gcc5 2015-02-11 19:43:45 -05:00
compiler-intel.h compiler*.h: sync include/linux/compiler*.h with Linux 3.16 2014-09-16 12:23:57 -04:00
compiler.h compiler*.h: sync include/linux/compiler*.h with Linux 3.16 2014-09-16 12:23:57 -04:00
crc7.h lib: add crc7 from Linux 2011-01-18 23:38:08 +01:00
crc8.h Add crc8 routine 2014-01-08 17:20:34 -07:00
crc32.h Coding style cleanup, update CHANGELOG. 2008-12-16 01:02:17 +01:00
ctype.h Add isblank 2011-10-17 22:25:34 +02:00
drm_dp_helper.h tegra124: video: Add full link training for eDP 2015-05-13 09:24:12 -07:00
edd.h x86: Fix support for booting bzImage 2010-05-06 00:17:01 +02:00
err.h linux include: add ERR_CAST 2014-08-25 17:02:33 -04:00
ethtool.h add support for Xilinx 1000BASE-X phy (GTX) 2013-06-24 19:11:13 -05:00
fb.h fb: Add a prototype for board_video_skip() 2014-03-05 12:23:48 +01:00
immap_qe.h QE/DeepSleep: add QE deepsleep support for mpc85xx 2015-04-21 10:19:19 -07:00
input.h input: Add linux/input.h for key code support 2012-05-15 08:31:39 +02:00
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 x86: Fix support for booting bzImage 2010-05-06 00:17:01 +02:00
ioport.h x86: Fix support for booting bzImage 2010-05-06 00:17:01 +02:00
kbuild.h clang: workaround for generated constants 2014-09-09 13:51:54 +02:00
kconfig.h linux/kconfig.h: add CPP macros useful for per-image config options 2015-08-18 13:46:00 -04:00
kernel.h Fix SIZE_MAX compiler warning when using stdint.h 2014-11-25 06:33:58 -07:00
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 Make linux kernel string funcs available to tools 2012-12-13 11:46:07 -07:00
list.h Coding style cleanup, update CHANGELOG 2008-09-13 02:23:05 +02:00
list_sort.h lib, list_sort: add list_sort from linux 3.14 2014-08-25 17:02:33 -04:00
lzo.h add lzop decompression support 2009-12-05 01:30:23 +01:00
math64.h UBIFS: Implement read-only UBIFS support in U-Boot 2009-03-20 22:39:15 +01:00
mbus.h arm: mvebu: Add common mbus functions to use on Marvell SoCs 2014-10-23 09:59:20 -04:00
mc146818rtc.h Replace BCD2BIN and BIN2BCD macros with inline functions 2009-08-25 12:57:55 +02:00
mdio.h Minor coding style cleanup. 2011-09-11 21:24:09 +02:00
mii.h add support for Xilinx 1000BASE-X phy (GTX) 2013-06-24 19:11:13 -05:00
netdevice.h Add GPL-2.0+ SPDX-License-Identifier to source files 2013-07-24 09:44:38 -04:00
poison.h update linux/list 2008-08-31 04:24:51 +02:00
posix_types.h Initial revision 2001-04-28 17:59:11 +00:00
rbtree.h kbuild: force to define __UBOOT__ in all the C sources 2014-09-16 12:23:56 -04:00
rbtree_augmented.h lib, rbtree: resync with Linux-3.14 2014-08-25 17:02:33 -04:00
screen_info.h x86: Fix support for booting bzImage 2010-05-06 00:17:01 +02:00
serial_reg.h arm: debug: replace license blocks with SPDX 2014-10-26 22:22:09 +01:00
sizes.h sizes.h - consolidate for all architectures 2014-03-04 12:15:01 -05:00
stat.h nios2: add struct stat support in linux/stat.h 2010-04-02 12:28:40 -04:00
stddef.h include/linux/stddef.h: avoid 'warning: preprocessor token offsetof redefined' 2012-11-04 11:00:34 -07:00
string.h lib: string: move strlcpy() to a common place 2014-12-11 13:18:41 -07:00
stringify.h COMMON: Add __stringify() function 2012-10-15 11:53:47 -07:00
time.h Initial revision 2002-03-08 21:31:05 +00:00
types.h Bring in __aligned_u64 and friends to linux/types.h 2015-08-05 08:42:40 -06:00