* [U-Boot] abbreviating header files with CONFIG_IS_ENABLED()?
@ 2016-05-20 11:38 Robert P. J. Day
0 siblings, 0 replies; only message in thread
From: Robert P. J. Day @ 2016-05-20 11:38 UTC (permalink / raw)
To: u-boot
just want to make sure i'm interpreting the use of this macro
correctly in that, if i look in include/image.h, i see (abbreviated
snippet):
#if IMAGE_ENABLE_FIT
# ifdef CONFIG_SPL_BUILD
# ifdef CONFIG_SPL_CRC32_SUPPORT
# define IMAGE_ENABLE_CRC32 1
# endif
# ifdef CONFIG_SPL_MD5_SUPPORT
# define IMAGE_ENABLE_MD5 1
# endif
# ifdef CONFIG_SPL_SHA1_SUPPORT
# define IMAGE_ENABLE_SHA1 1
# endif
# ifdef CONFIG_SPL_SHA256_SUPPORT
# define IMAGE_ENABLE_SHA256 1
# endif
# else
# define CONFIG_CRC32 /* FIT images need CRC32 support */
# define CONFIG_MD5 /* and MD5 */
# define CONFIG_SHA1 /* and SHA1 */
# define CONFIG_SHA256 /* and SHA256 */
# define IMAGE_ENABLE_CRC32 1
# define IMAGE_ENABLE_MD5 1
# define IMAGE_ENABLE_SHA1 1
# define IMAGE_ENABLE_SHA256 1
# endif
...
#ifndef IMAGE_ENABLE_CRC32
#define IMAGE_ENABLE_CRC32 0
#endif
... snip ...
which i *assume* could be written with more brevity as:
#if IMAGE_ENABLE_FIT
# ifdef CONFIG_SPL_BUILD
# define IMAGE_ENABLE_CRC32 CONFIG_IS_ENABLED(SPL_CRC32_SUPPORT)
# define IMAGE_ENABLE_MD5 CONFIG_IS_ENABLED(SPL_MD5_SUPPORT)
# define IMAGE_ENABLE_SHA1 CONFIG_IS_ENABLED(SPL_SHA1_SUPPORT)
# define IMAGE_ENABLE_SHA256 CONFIG_IS_ENABLED(SPL_SHA256_SUPPORT)
# else
... snip ...
that sort of thing. if i'm reading that correctly, i can do a bit of
cleanup this weekend and submit a patch for whatever looks obvious.
rday
p.s. i mentioned this before in that i have one nitpick with some of
the usage of this in that, in the above, *i* would have used:
#ifdef CONFIG_FIT
rather than:
#define IMAGE_ENABLE_FIT CONFIG_IS_ENABLED(FIT)
...
#if IMAGE_ENABLE_FIT
that is, i would use the CONFIG_* checks for preprocessor work, and
reserve the IMAGE_ENABLE_* conditionals exclusively for run-time
testing, just for consistency. but that's just me.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-05-20 11:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-20 11:38 [U-Boot] abbreviating header files with CONFIG_IS_ENABLED()? Robert P. J. Day
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox