[U-Boot] [PATCH 18/25] eeprom: Suck the ifdef into eeprom_init()

Marek Vasut marex at denx.de
Mon Oct 20 03:48:19 CEST 2014


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 <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 | 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



More information about the U-Boot mailing list