From patchwork Tue Oct 25 09:40:57 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 121561 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 23360B6F82 for ; Tue, 25 Oct 2011 20:47:30 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 049B2294AF; Tue, 25 Oct 2011 11:47:28 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 L8Q+-MoFqGp1; Tue, 25 Oct 2011 11:47:27 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4B900294CF; Tue, 25 Oct 2011 11:44:35 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 79F62294F1 for ; Tue, 25 Oct 2011 11:44:27 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 ATk6DJrnrwQX for ; Tue, 25 Oct 2011 11:44:27 +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-bw0-f44.google.com (mail-bw0-f44.google.com [209.85.214.44]) by theia.denx.de (Postfix) with ESMTPS id 499F32933E for ; Tue, 25 Oct 2011 11:41:16 +0200 (CEST) Received: by mail-bw0-f44.google.com with SMTP id s6so242852bka.3 for ; Tue, 25 Oct 2011 02:41:16 -0700 (PDT) Received: by 10.204.139.87 with SMTP id d23mr19958229bku.67.1319535676083; Tue, 25 Oct 2011 02:41:16 -0700 (PDT) Received: from mashiro.lan (cst-prg-176-30.cust.vodafone.cz. [46.135.176.30]) by mx.google.com with ESMTPS id k6sm26915762bkv.8.2011.10.25.02.41.14 (version=SSLv3 cipher=OTHER); Tue, 25 Oct 2011 02:41:15 -0700 (PDT) From: Marek Vasut To: u-boot@lists.denx.de Date: Tue, 25 Oct 2011 11:40:57 +0200 Message-Id: <1319535660-20881-2-git-send-email-marek.vasut@gmail.com> X-Mailer: git-send-email 1.7.6.3 In-Reply-To: <1319535660-20881-1-git-send-email-marek.vasut@gmail.com> References: <1319535660-20881-1-git-send-email-marek.vasut@gmail.com> MIME-Version: 1.0 Subject: [U-Boot] [PATCH 1/4] GCC4.6: Squash warning in cmd_date.c X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de cmd_date.c: In function ‘do_date’: cmd_date.c:50:6: warning: variable ‘old_bus’ set but not used [-Wunused-but-set-variable] Signed-off-by: Marek Vasut Cc: Wolfgang Denk Cc: Simon Glass Cc: Mike Frysinger --- include/i2c.h | 32 +++++++++++++++++++++++--------- 1 files changed, 23 insertions(+), 9 deletions(-) diff --git a/include/i2c.h b/include/i2c.h index 8ceb4c8..ee31034 100644 --- a/include/i2c.h +++ b/include/i2c.h @@ -46,16 +46,16 @@ */ #define I2C_RXTX_LEN 128 /* maximum tx/rx buffer length */ -#if defined(CONFIG_I2C_MULTI_BUS) -#if !defined(CONFIG_SYS_MAX_I2C_BUS) -#define CONFIG_SYS_MAX_I2C_BUS 2 -#endif -#define I2C_GET_BUS() i2c_get_bus_num() -#define I2C_SET_BUS(a) i2c_set_bus_num(a) +#ifdef CONFIG_I2C_MULTI_BUS +#define MAX_I2C_BUS 2 +#define I2C_MULTI_BUS 1 #else -#define CONFIG_SYS_MAX_I2C_BUS 1 -#define I2C_GET_BUS() 0 -#define I2C_SET_BUS(a) +#define MAX_I2C_BUS 1 +#define I2C_MULTI_BUS 0 +#endif + +#if !defined(CONFIG_SYS_MAX_I2C_BUS) +#define CONFIG_SYS_MAX_I2C_BUS MAX_I2C_BUS #endif /* define the I2C bus number for RTC and DTT if not already done */ @@ -236,4 +236,18 @@ int i2c_set_bus_speed(unsigned int); unsigned int i2c_get_bus_speed(void); +/* NOTE: These two functions MUST be always_inline to avoid code growth! */ +static inline unsigned int I2C_GET_BUS(void) __attribute__((always_inline)); +static inline unsigned int I2C_GET_BUS(void) +{ + return I2C_MULTI_BUS ? i2c_get_bus_num() : 0; +} + +static inline void I2C_SET_BUS(unsigned int bus) __attribute__((always_inline)); +static inline void I2C_SET_BUS(unsigned int bus) +{ + if (I2C_MULTI_BUS) + i2c_set_bus_num(bus); +} + #endif /* _I2C_H_ */