From fc44f6e529eb4bcda729ee7e4bdd6a667c4c970d Mon Sep 17 00:00:00 2001 From: Angel Pons Date: Wed, 21 Apr 2021 12:09:42 +0200 Subject: [PATCH] option.h: Drop type-unsafe {get,set}_option() API Change-Id: I5a9852b1fb66d609238ab7324f28a5e397c030ae Signed-off-by: Angel Pons Reviewed-on: https://review.coreboot.org/c/coreboot/+/52566 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Rudolph Reviewed-by: Patrick Rudolph --- src/include/option.h | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/src/include/option.h b/src/include/option.h index 26cd0d5245..4de032bd49 100644 --- a/src/include/option.h +++ b/src/include/option.h @@ -10,31 +10,22 @@ void sanitize_cmos(void); enum cb_err cmos_set_option(const char *name, void *val); enum cb_err cmos_get_option(void *dest, const char *name); -static inline enum cb_err set_option(const char *name, void *val) -{ - if (CONFIG(USE_OPTION_TABLE)) - return cmos_set_option(name, val); - - return CB_CMOS_OTABLE_DISABLED; -} - -static inline enum cb_err get_option(void *dest, const char *name) -{ - if (CONFIG(USE_OPTION_TABLE)) - return cmos_get_option(dest, name); - - return CB_CMOS_OTABLE_DISABLED; -} - static inline enum cb_err set_int_option(const char *name, int value) { - return set_option(name, &value); + if (CONFIG(USE_OPTION_TABLE)) + return cmos_set_option(name, &value); + + return CB_CMOS_OTABLE_DISABLED; } static inline int get_int_option(const char *name, const int fallback) { - int value = 0; - return get_option(&value, name) == CB_SUCCESS ? value : fallback; + if (CONFIG(USE_OPTION_TABLE)) { + int value = 0; + if (cmos_get_option(&value, name) == CB_SUCCESS) + return value; + } + return fallback; } #endif /* _OPTION_H_ */