From 3d8256b2a1ef1195aed86bef7378e83d0a61a91b Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Sun, 25 Dec 2016 23:36:24 +0900 Subject: Use #ifdef for IMAGE_BL* instead of #if One nasty part of ATF is some of boolean macros are always defined as 1 or 0, and the rest of them are only defined under certain conditions. For the former group, "#if FOO" or "#if !FOO" must be used because "#ifdef FOO" is always true. (Options passed by $(call add_define,) are the cases.) For the latter, "#ifdef FOO" or "#ifndef FOO" should be used because checking the value of an undefined macro is strange. Here, IMAGE_BL* is handled by make_helpers/build_macro.mk like follows: $(eval IMAGE := IMAGE_BL$(call uppercase,$(3))) $(OBJ): $(2) @echo " CC $$<" $$(Q)$$(CC) $$(TF_CFLAGS) $$(CFLAGS) -D$(IMAGE) -c $$< -o $$@ This means, IMAGE_BL* is defined when building the corresponding image, but *undefined* for the other images. So, IMAGE_BL* belongs to the latter group where we should use #ifdef or #ifndef. Signed-off-by: Masahiro Yamada --- drivers/arm/ccn/ccn.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/arm/ccn/ccn.c') diff --git a/drivers/arm/ccn/ccn.c b/drivers/arm/ccn/ccn.c index 060acdd20..d739c6bf3 100644 --- a/drivers/arm/ccn/ccn.c +++ b/drivers/arm/ccn/ccn.c @@ -38,7 +38,7 @@ #include "ccn_private.h" static const ccn_desc_t *ccn_plat_desc; -#if IMAGE_BL31 +#ifdef IMAGE_BL31 DEFINE_BAKERY_LOCK(ccn_lock); #endif @@ -285,7 +285,7 @@ static void ccn_snoop_dvm_do_op(unsigned long long rn_id_map, assert(ccn_plat_desc); assert(ccn_plat_desc->periphbase); -#if IMAGE_BL31 +#ifdef IMAGE_BL31 bakery_lock_get(&ccn_lock); #endif start_region_id = region_id; @@ -305,7 +305,7 @@ static void ccn_snoop_dvm_do_op(unsigned long long rn_id_map, rn_id_map); } -#if IMAGE_BL31 +#ifdef IMAGE_BL31 bakery_lock_release(&ccn_lock); #endif } -- cgit v1.2.3