diff mbox

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

Message ID 1413769706-8596-19-git-send-email-marex@denx.de
State Superseded
Delegated to: Tom Rini
Headers show

Commit Message

Marek Vasut Oct. 20, 2014, 1:48 a.m. UTC
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@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@ti.com>
Cc: Heiko Schocher <hs@denx.de>
---
 common/cmd_eeprom.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
diff mbox

Patch

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