From patchwork Mon Oct 20 01:48:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 400924 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 24D9914007B for ; Mon, 20 Oct 2014 12:52:47 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 10580A7440; Mon, 20 Oct 2014 03:50:28 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id t6PpyB4NkZfY; Mon, 20 Oct 2014 03:50:27 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 952BBA7420; Mon, 20 Oct 2014 03:50:27 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3D0A24B61E for ; Mon, 20 Oct 2014 03:48:53 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id I-UIV3OLmYsK for ; Mon, 20 Oct 2014 03:48:53 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.10]) by theia.denx.de (Postfix) with ESMTPS id D8E17A73E8 for ; Mon, 20 Oct 2014 03:48:52 +0200 (CEST) Received: from mail.nefkom.net (unknown [192.168.8.184]) by mail-out.m-online.net (Postfix) with ESMTP id 3jLgqS2Qwtz3hjWt; Mon, 20 Oct 2014 03:48:52 +0200 (CEST) X-Auth-Info: z94k/NAeOx+svr1OR9ljRunYJP3D01uzXZ1pWVcoQMs= Received: from chi.lan (unknown [195.140.253.167]) by smtp-auth.mnet-online.de (Postfix) with ESMTPA id 3jLgqR71xhzvdWR; Mon, 20 Oct 2014 03:48:51 +0200 (CEST) From: Marek Vasut To: u-boot@lists.denx.de Date: Mon, 20 Oct 2014 03:48:19 +0200 Message-Id: <1413769706-8596-19-git-send-email-marex@denx.de> X-Mailer: git-send-email 2.0.0 In-Reply-To: <1413769706-8596-1-git-send-email-marex@denx.de> References: <1413769706-8596-1-git-send-email-marex@denx.de> Cc: Marek Vasut , Tom Rini Subject: [U-Boot] [PATCH 18/25] eeprom: Suck the ifdef into eeprom_init() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.13 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@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);