Just suck the ugly ifdef around eeprom_init() call into eeprom_init()
function itself. This puts all of the ifdef mess into one place.

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 | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/common/cmd_eeprom.c b/common/cmd_eeprom.c
index 918def4..97747de 100644
--- a/common/cmd_eeprom.c
+++ b/common/cmd_eeprom.c
@@ -55,6 +55,8 @@ __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 ();
@@ -69,6 +71,8 @@ void eeprom_init(void)
        i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
 #endif
 #endif
+
+# endif /* !CONFIG_SPI */
 }
 
 static int eeprom_addr(unsigned dev_addr, unsigned offset, uchar *addr)
@@ -248,9 +252,7 @@ static int do_eeprom(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
        off = simple_strtoul(*args++, NULL, 16);
        cnt = simple_strtoul(*args++, NULL, 16);
 
-# if !defined(CONFIG_SPI) || defined(CONFIG_ENV_EEPROM_IS_ON_I2C)
-       eeprom_init ();
-# endif /* !CONFIG_SPI */
+       eeprom_init();
 
        if (strcmp (argv[1], "read") == 0) {
                printf(fmt, dev_addr, argv[1], addr, off, cnt);
-- 
2.1.1

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

Reply via email to