diff options
author | Angel Pons <th3fanbus@gmail.com> | 2021-04-21 12:09:42 +0200 |
---|---|---|
committer | Angel Pons <th3fanbus@gmail.com> | 2021-04-23 10:13:49 +0000 |
commit | fc44f6e529eb4bcda729ee7e4bdd6a667c4c970d (patch) | |
tree | dc10d467ea91c1cfdd24fed48c70036ae2bc2013 | |
parent | e76f15f4fdf2d2094b351a6a1a95dec1c63d017c (diff) |
option.h: Drop type-unsafe {get,set}_option() API
Change-Id: I5a9852b1fb66d609238ab7324f28a5e397c030ae
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/52566
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
-rw-r--r-- | src/include/option.h | 25 |
1 files changed, 8 insertions, 17 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) +static inline enum cb_err set_int_option(const char *name, int value) { if (CONFIG(USE_OPTION_TABLE)) - return cmos_get_option(dest, name); + return cmos_set_option(name, &value); return CB_CMOS_OTABLE_DISABLED; } -static inline enum cb_err set_int_option(const char *name, int value) -{ - return set_option(name, &value); -} - 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_ */ |