From patchwork Mon Nov 7 11:13:58 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Grinberg X-Patchwork-Id: 124050 X-Patchwork-Delegate: sbabic@denx.de 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 52BFA1007D3 for ; Mon, 7 Nov 2011 22:15:08 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 929CD28BFF; Mon, 7 Nov 2011 12:14:59 +0100 (CET) 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 emvI7HYWlMuo; Mon, 7 Nov 2011 12:14:59 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8376328B85; Mon, 7 Nov 2011 12:14:39 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 91AB328B85 for ; Mon, 7 Nov 2011 12:14:31 +0100 (CET) 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 aOvg4hcRtEuN for ; Mon, 7 Nov 2011 12:14:31 +0100 (CET) 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 softlayer.compulab.co.il (50.23.254.54-static.reverse.softlayer.com [50.23.254.54]) by theia.denx.de (Postfix) with ESMTPS id 3826A28A80 for ; Mon, 7 Nov 2011 12:14:28 +0100 (CET) Received: from [62.90.235.247] (port=48765 helo=zimbra-mta.compulab.co.il) by softlayer.compulab.co.il with esmtp (Exim 4.69) (envelope-from ) id 1RNN9m-00086Z-EC; Mon, 07 Nov 2011 13:14:26 +0200 Received: from localhost (localhost.localdomain [127.0.0.1]) by zimbra-mta.compulab.co.il (Postfix) with ESMTP id A78087E9AA1; Mon, 7 Nov 2011 13:14:25 +0200 (IST) X-Virus-Scanned: amavisd-new at compulab.co.il Received: from zimbra-mta.compulab.co.il ([127.0.0.1]) by localhost (zimbra-mta.compulab.co.il [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id t+ZK-NM9aTFP; Mon, 7 Nov 2011 13:14:24 +0200 (IST) Received: from grinberg-linux (grinberg-pc.compulab.local [10.1.1.13]) by zimbra-mta.compulab.co.il (Postfix) with SMTP id C12FF7E9A9D; Mon, 7 Nov 2011 13:14:23 +0200 (IST) Received: by grinberg-linux (sSMTP sendmail emulation); Mon, 07 Nov 2011 13:14:20 +0200 From: Igor Grinberg To: Wolfgang Denk Date: Mon, 7 Nov 2011 13:13:58 +0200 Message-Id: <1320664451-2678-5-git-send-email-grinberg@compulab.co.il> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1320664451-2678-1-git-send-email-grinberg@compulab.co.il> References: <1320664451-2678-1-git-send-email-grinberg@compulab.co.il> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - softlayer.compulab.co.il X-AntiAbuse: Original Domain - lists.denx.de X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - compulab.co.il Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH 04/17] env: move extern environment[] to environment.h 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: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Extract all extern declarations for environment out of c files into the environment.h header. Signed-off-by: Igor Grinberg --- common/env_flash.c | 4 +--- common/env_mmc.c | 3 +-- common/env_nand.c | 3 +-- common/env_onenand.c | 6 +----- include/environment.h | 4 ++++ tools/envcrc.c | 4 ++-- 6 files changed, 10 insertions(+), 14 deletions(-) diff --git a/common/env_flash.c b/common/env_flash.c index 1383f3c..a32bfcf 100644 --- a/common/env_flash.c +++ b/common/env_flash.c @@ -49,9 +49,7 @@ DECLARE_GLOBAL_DATA_PTR; char * env_name_spec = "Flash"; #ifdef ENV_IS_EMBEDDED - -extern uchar environment[]; -env_t *env_ptr = (env_t *)(&environment[0]); +env_t *env_ptr = &environment; static env_t *flash_addr = (env_t *)CONFIG_ENV_ADDR; diff --git a/common/env_mmc.c b/common/env_mmc.c index a0c0ece..cb75887 100644 --- a/common/env_mmc.c +++ b/common/env_mmc.c @@ -35,8 +35,7 @@ char *env_name_spec = "MMC"; #ifdef ENV_IS_EMBEDDED -extern uchar environment[]; -env_t *env_ptr = (env_t *)(&environment[0]); +env_t *env_ptr = &environment; #else /* ! ENV_IS_EMBEDDED */ env_t *env_ptr = NULL; #endif /* ENV_IS_EMBEDDED */ diff --git a/common/env_nand.c b/common/env_nand.c index 94d4417..d975322 100644 --- a/common/env_nand.c +++ b/common/env_nand.c @@ -59,8 +59,7 @@ char *env_name_spec = "NAND"; #if defined(ENV_IS_EMBEDDED) -extern uchar environment[]; -env_t *env_ptr = (env_t *)(&environment[0]); +env_t *env_ptr = &environment; #elif defined(CONFIG_NAND_ENV_DST) env_t *env_ptr = (env_t *)CONFIG_NAND_ENV_DST; #else /* ! ENV_IS_EMBEDDED */ diff --git a/common/env_onenand.c b/common/env_onenand.c index b1f266b..c09fdf3 100644 --- a/common/env_onenand.c +++ b/common/env_onenand.c @@ -44,10 +44,6 @@ char *env_name_spec = "OneNAND"; #define ONENAND_MAX_ENV_SIZE 4096 #define ONENAND_ENV_SIZE(mtd) (ONENAND_MAX_ENV_SIZE - ENV_HEADER_SIZE) -#ifdef ENV_IS_EMBEDDED -extern uchar environment[]; -#endif /* ENV_IS_EMBEDDED */ - DECLARE_GLOBAL_DATA_PTR; uchar env_get_char_spec(int index) @@ -64,7 +60,7 @@ void env_relocate_spec(void) int rc; size_t retlen; #ifdef ENV_IS_EMBEDDED - char *buf = (char *)&environment[0]; + char *buf = (char *)&environment; #else loff_t env_addr = CONFIG_ENV_ADDR; char onenand_env[ONENAND_MAX_ENV_SIZE]; diff --git a/include/environment.h b/include/environment.h index 20775da..951803f 100644 --- a/include/environment.h +++ b/include/environment.h @@ -154,6 +154,10 @@ typedef struct environment_s { unsigned char data[ENV_SIZE]; /* Environment data */ } env_t; +#ifdef ENV_IS_EMBEDDED +extern env_t environment; +#endif /* ENV_IS_EMBEDDED */ + extern const unsigned char default_environment[]; #ifndef DO_DEPS_ONLY diff --git a/tools/envcrc.c b/tools/envcrc.c index feebbab..12913c2 100644 --- a/tools/envcrc.c +++ b/tools/envcrc.c @@ -77,7 +77,7 @@ extern uint32_t crc32 (uint32_t, const unsigned char *, unsigned int); #ifdef CONFIG_BUILD_ENVCRC extern unsigned int env_size; -extern unsigned char environment; +extern env_t environment; #endif /* CONFIG_BUILD_ENVCRC */ int main (int argc, char **argv) @@ -85,7 +85,7 @@ int main (int argc, char **argv) #ifdef CONFIG_BUILD_ENVCRC unsigned char pad = 0x00; uint32_t crc; - unsigned char *envptr = &environment, + unsigned char *envptr = (unsigned char *)&environment, *dataptr = envptr + ENV_HEADER_SIZE; unsigned int datasize = ENV_SIZE; unsigned int eoe;