From: Marek Vasut Date: Mon, 20 Oct 2014 03:48:19 +0200 Subject: [U-Boot] [PATCH 18/25] eeprom: Suck the ifdef into eeprom_init() In-Reply-To: <1413769706-8596-1-git-send-email-marex@denx.de> References: <1413769706-8596-1-git-send-email-marex@denx.de> Message-ID: <1413769706-8596-19-git-send-email-marex@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 Cc: Simon Glass Cc: Tom Rini Cc: Heiko Schocher --- 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