[U-Boot] [PATCH 22/25] eeprom: Cultivate the ifdef mess
Marek Vasut
marex at denx.de
Mon Oct 20 03:48:23 CEST 2014
Just squash the ad-hoc ifdef chaos into single #else statement.
It's not worth having so many checks in place, since this only
leads to complicated code and if the first test for SPI && not
env in I2C EEPROM fails, then we're dealing with I2C EEPROM.
Signed-off-by: Marek Vasut <marex at denx.de>
Cc: Simon Glass <sjg at chromium.org>
Cc: Tom Rini <trini at ti.com>
Cc: Heiko Schocher <hs at denx.de>
---
common/cmd_eeprom.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/common/cmd_eeprom.c b/common/cmd_eeprom.c
index 6a02496..5bc836f 100644
--- a/common/cmd_eeprom.c
+++ b/common/cmd_eeprom.c
@@ -62,24 +62,18 @@ __weak int eeprom_write_enable(unsigned dev_addr, int state)
void eeprom_init(void)
{
-# if !defined(CONFIG_SPI) || defined(CONFIG_ENV_EEPROM_IS_ON_I2C)
-
/* SPI EEPROM */
#if defined(CONFIG_SPI) && !defined(CONFIG_ENV_EEPROM_IS_ON_I2C)
- spi_init_f ();
-#endif
-
+ spi_init_f();
+#else
/* I2C EEPROM */
-#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C_SOFT) || \
- defined(CONFIG_SYS_I2C)
#ifdef CONFIG_SYS_I2C
i2c_init_all();
#else
i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
#endif
-#endif
-# endif /* !CONFIG_SPI */
+#endif
}
static int eeprom_addr(unsigned dev_addr, unsigned offset, uchar *addr)
--
2.1.1
More information about the U-Boot
mailing list