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>
This commit is contained in:
Angel Pons 2021-04-21 12:09:42 +02:00
parent e76f15f4fd
commit fc44f6e529
1 changed files with 10 additions and 19 deletions

View File

@ -10,31 +10,22 @@ void sanitize_cmos(void);
enum cb_err cmos_set_option(const char *name, void *val); enum cb_err cmos_set_option(const char *name, void *val);
enum cb_err cmos_get_option(void *dest, const char *name); 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) 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) static inline int get_int_option(const char *name, const int fallback)
{ {
int value = 0; if (CONFIG(USE_OPTION_TABLE)) {
return get_option(&value, name) == CB_SUCCESS ? value : fallback; int value = 0;
if (cmos_get_option(&value, name) == CB_SUCCESS)
return value;
}
return fallback;
} }
#endif /* _OPTION_H_ */ #endif /* _OPTION_H_ */