From b5669ba57937f48ffe201395c3e3b1527c14d1fa Mon Sep 17 00:00:00 2001 From: Alexandru Gagniuc Date: Fri, 30 Jan 2015 00:07:12 -0600 Subject: drivers/pc80/mc146818rtc: Reduce superfluous preprocessor use MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit cmos_init() had layers of preprocessor directives, which resulted in a complete mess. Refactor it to make use of the IS_ENABLED() macro. This improves readability significantly. One of the changes is to remove in inline stub declaration of (get|set)_option. Although that provided the ability for the compiler to optimize out code when USE_OPTION_TABLE is not selected, there is no evidence that such savings are measureable. Change-Id: I07f00084d809adbb55031b2079f71136ade3028e Signed-off-by: Alexandru Gagniuc Reviewed-on: http://review.coreboot.org/8306 Tested-by: build bot (Jenkins) Reviewed-by: Kyösti Mälkki --- src/include/pc80/mc146818rtc.h | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'src/include/pc80') diff --git a/src/include/pc80/mc146818rtc.h b/src/include/pc80/mc146818rtc.h index 90ae7ae1d7..c74af66d81 100644 --- a/src/include/pc80/mc146818rtc.h +++ b/src/include/pc80/mc146818rtc.h @@ -169,21 +169,13 @@ static inline void cmos_write32(u8 offset, u32 value) #endif #if !defined(__ROMCC__) -void cmos_init(int invalid); +void cmos_init(bool invalid); void cmos_check_update_date(void); -#if CONFIG_USE_OPTION_TABLE + enum cb_err set_option(const char *name, void *val); enum cb_err get_option(void *dest, const char *name); unsigned read_option_lowlevel(unsigned start, unsigned size, unsigned def); -#else -static inline enum cb_err set_option(const char *name __attribute__((unused)), - void *val __attribute__((unused))) - { return CB_CMOS_OTABLE_DISABLED; }; -static inline enum cb_err get_option(void *dest __attribute__((unused)), - const char *name __attribute__((unused))) - { return CB_CMOS_OTABLE_DISABLED; } -#define read_option_lowlevel(start, size, def) def -#endif + #else /* defined(__ROMCC__) */ #include #endif /* !defined(__ROMCC__) */ -- cgit v1.2.3