From patchwork Wed Nov 28 01:31:35 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Troy Kisky X-Patchwork-Id: 202336 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 754002C0080 for ; Wed, 28 Nov 2012 12:32:21 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id EA0044A0B7; Wed, 28 Nov 2012 02:32:19 +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 Ap-vHuCeAtqP; Wed, 28 Nov 2012 02:32:19 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9BF334A094; Wed, 28 Nov 2012 02:32:02 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id EC0054A053 for ; Wed, 28 Nov 2012 02:31:56 +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 UijfwnztvjAl for ; Wed, 28 Nov 2012 02:31:54 +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 mail-pa0-f44.google.com (mail-pa0-f44.google.com [209.85.220.44]) by theia.denx.de (Postfix) with ESMTPS id 1DCB74A04E for ; Wed, 28 Nov 2012 02:31:52 +0100 (CET) Received: by mail-pa0-f44.google.com with SMTP id hz11so6994222pad.3 for ; Tue, 27 Nov 2012 17:31:50 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=aDfj5oq79/BO/peYd2yW5IDtgmVVKHTP0U6qkatiZj8=; b=aQMJAQzNdPItVuLKxpYRpH4bnYbHd9OF4pVvhVGL5QmFFNz4wkaMxiEvJssvFv+vZy QlP4FnwPkCCgSbXQ9Mo8bzbKXYlkYgBx7/09S2sk23JuOqEFZ8A2WquWNZeJjieC08PM 50ieZeuANCNaqoV5Lf7LIULd6nCtNihFMf/mlNYVrqY+JwOqVDIVF4NRV1tM4Yr21gu2 5TslH7wCGspuPtVKao2Pik72Fy9sKtsl/MmO6QuY4qeM9M6j/SSIaxzchWx5rzVXjZbs 9BCcMZGCJ1eniDToy38fXdil8473MrUr9e0GJLWnMP9cmTHLpIhZZBR2cpfZKghEHHN7 23/A== Received: by 10.68.189.233 with SMTP id gl9mr52791908pbc.166.1354066310700; Tue, 27 Nov 2012 17:31:50 -0800 (PST) Received: from officeserver-2 ([70.96.116.236]) by mx.google.com with ESMTPS id wg3sm11502372pbc.28.2012.11.27.17.31.47 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 27 Nov 2012 17:31:48 -0800 (PST) Received: from tkisky by officeserver-2 with local (Exim 4.76) (envelope-from ) id 1TdWVB-0007ks-OG; Tue, 27 Nov 2012 18:31:49 -0700 From: Troy Kisky To: sbabic@denx.de Date: Tue, 27 Nov 2012 18:31:35 -0700 Message-Id: <1354066303-29762-4-git-send-email-troy.kisky@boundarydevices.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1354066303-29762-1-git-send-email-troy.kisky@boundarydevices.com> References: <1349315254-21151-9-git-send-email-troy.kisky@boundarydevices.com> <1354066303-29762-1-git-send-email-troy.kisky@boundarydevices.com> X-Gm-Message-State: ALoCoQm5dYUwVm9TMm/gG4OpEIliLlKkt1vjFTyx4J5Bf5shrCx7icZcA3dhgKen4/rv/HcNvHD3 Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH V4 03/11] imximage: remove static imximage_version X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 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 This variable does not need to have file scope. Signed-off-by: Troy Kisky Acked-by: Jason Liu --- tools/imximage.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/tools/imximage.c b/tools/imximage.c index 8457c8e..97e5c4b 100644 --- a/tools/imximage.c +++ b/tools/imximage.c @@ -65,8 +65,6 @@ static table_entry_t imximage_versions[] = { {-1, "", " (Invalid)", }, }; -static uint32_t imximage_version; - static set_dcd_val_t set_dcd_val; static set_dcd_rst_t set_dcd_rst; static set_imx_hdr_t set_imx_hdr; @@ -254,7 +252,7 @@ static int set_imx_hdr_v2(struct imx_header *imxhdr, uint32_t dcd_len, return header_length; } -static void set_hdr_func(struct imx_header *imxhdr) +static void set_hdr_func(struct imx_header *imxhdr, uint32_t imximage_version) { switch (imximage_version) { case IMXIMAGE_V1: @@ -335,6 +333,7 @@ static void parse_cfg_cmd(struct imx_header *imxhdr, int32_t cmd, char *token, { int value; static int cmd_ver_first = ~0; + uint32_t imximage_version; switch (cmd) { case CMD_IMAGE_VERSION: @@ -346,7 +345,7 @@ static void parse_cfg_cmd(struct imx_header *imxhdr, int32_t cmd, char *token, exit(EXIT_FAILURE); } cmd_ver_first = 1; - set_hdr_func(imxhdr); + set_hdr_func(imxhdr, imximage_version); break; case CMD_BOOT_FROM: g_flash_offset = get_table_entry_id(imximage_bootops, @@ -419,6 +418,12 @@ static uint32_t parse_cfg_file(struct imx_header *imxhdr, char *name) int dcd_len = 0; int32_t cmd; + /* + * In order to not change the old imx cfg file + * by adding VERSION command into it, here need + * set up function ptr group to V1 by default. + */ + set_hdr_func(imxhdr, IMXIMAGE_V1); fd = fopen(name, "r"); if (fd == 0) { fprintf(stderr, "Error: %s - Can't open DCD file\n", name); @@ -512,16 +517,8 @@ int imximage_vrec_header(struct mkimage_params *params, fprintf(stderr, "Error: out of memory\n"); exit(EXIT_FAILURE); } - /* - * In order to not change the old imx cfg file - * by adding VERSION command into it, here need - * set up function ptr group to V1 by default. - */ - imximage_version = IMXIMAGE_V1; /* Be able to detect if the cfg file has no BOOT_FROM tag */ g_flash_offset = FLASH_OFFSET_UNDEFINED; - set_hdr_func(imxhdr); - /* Parse dcd configuration file */ dcd_len = parse_cfg_file(imxhdr, params->imagename);