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 <ma...@denx.de>
Cc: Simon Glass <s...@chromium.org>
Cc: Tom Rini <tr...@ti.com>
Cc: Heiko Schocher <h...@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

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to