summaryrefslogtreecommitdiffstats
path: root/src/lib/hardwaremain.c
diff options
context:
space:
mode:
authorAngel Pons <th3fanbus@gmail.com>2021-06-10 13:57:35 +0200
committerWerner Zeh <werner.zeh@siemens.com>2021-06-14 05:20:05 +0000
commit83156682d6e027dd5ef49be55b676c401ca9f1b8 (patch)
treee1891ab4a8e71131f146c433de3f2d8068a6ab2d /src/lib/hardwaremain.c
parent444c24a635d1b30811dee8ac37046fa125d373f6 (diff)
downloadcoreboot-83156682d6e027dd5ef49be55b676c401ca9f1b8.tar.gz
coreboot-83156682d6e027dd5ef49be55b676c401ca9f1b8.tar.bz2
coreboot-83156682d6e027dd5ef49be55b676c401ca9f1b8.zip
lib/hardwaremain.c: Hide preprocessor guards in header
The `location` member of `struct boot_state_callback` is conditionally guarded depending on `CONFIG(DEBUG_BOOT_STATE)` using preprocessor. It is probably intended to save some space when the `location` strings do not get printed. However, directly using the `location` member without any guards will cause a compile-time error. Plus, preprocessor-guarded code gets nasty really quickly. In order to minimise preprocessor usage, introduce the `bscb_location` inline helper function, which transforms the compile-time error into a link-time error. It is then possible to substitute preprocessor guards with an ordinary C `if` statement. Change-Id: I40b7f29f96ea96a5977b55760f0fcebf3a0df733 Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/55386 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-by: Raul Rangel <rrangel@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'src/lib/hardwaremain.c')
-rw-r--r--src/lib/hardwaremain.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/hardwaremain.c b/src/lib/hardwaremain.c
index cd4a57e96e69..7ab2ade9126c 100644
--- a/src/lib/hardwaremain.c
+++ b/src/lib/hardwaremain.c
@@ -274,10 +274,10 @@ static void bs_call_callbacks(struct boot_state *state,
phase->callbacks = bscb->next;
bscb->next = NULL;
-#if CONFIG(DEBUG_BOOT_STATE)
- printk(BIOS_DEBUG, "BS: callback (%p) @ %s.\n",
- bscb, bscb->location);
-#endif
+ if (CONFIG(DEBUG_BOOT_STATE)) {
+ printk(BIOS_DEBUG, "BS: callback (%p) @ %s.\n",
+ bscb, bscb_location(bscb));
+ }
bscb->callback(bscb->arg);
continue;
}