From patchwork Thu Oct 4 01:47:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Troy Kisky X-Patchwork-Id: 188997 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 04E412C037B for ; Thu, 4 Oct 2012 11:50:25 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 310AC282A5; Thu, 4 Oct 2012 03:49:36 +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 nC1whKSPoVN7; Thu, 4 Oct 2012 03:49:35 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 20206282A9; Thu, 4 Oct 2012 03:48:07 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C6A4828232 for ; Thu, 4 Oct 2012 03:47:47 +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 iR0tHqsF3WWe for ; Thu, 4 Oct 2012 03:47:47 +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-da0-f44.google.com (mail-da0-f44.google.com [209.85.210.44]) by theia.denx.de (Postfix) with ESMTPS id 274FD281DE for ; Thu, 4 Oct 2012 03:47:37 +0200 (CEST) Received: by danh15 with SMTP id h15so2684575dan.3 for ; Wed, 03 Oct 2012 18:47:36 -0700 (PDT) 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=uG3Ypvys8NFr/+yekdDUG39WDZpVwcL0x7HyblHZe3E=; b=phBi/ZMqRn+EZI7XhajMkKKwq2XWKOn7wzLOdGfD9x9LOCml0DS3PUyFRya6WPzl2B CsznvOcnaz04KX1LbPOYR5lClqHv/9hBfmjEh54jscK18o+mv1bYhnmVN+ieY0p3aWrF bNg9EpxA29v5sJEKfINjbDHJ+RCqfthU0/tOZyok/PF4Du8sDcc7BaFDZP/q14fPGiRz uxfskCoV8atHMBpGqhvyfzkHMLFPOVaCGy6e8GTn0M/gJsBV8cIWretPrVlzHo2n51jQ 6NBTuN3r49mq12FbRDuMwzREPNRHG/pc08/LMPufqmudDwBj3FQ5eU+v2EKlBILRa3yR xHPA== Received: by 10.66.81.202 with SMTP id c10mr9400466pay.31.1349315256416; Wed, 03 Oct 2012 18:47:36 -0700 (PDT) Received: from officeserver-2 ([70.96.116.236]) by mx.google.com with ESMTPS id ty1sm3455957pbc.76.2012.10.03.18.47.32 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 03 Oct 2012 18:47:35 -0700 (PDT) Received: from tkisky by officeserver-2 with local (Exim 4.76) (envelope-from ) id 1TJaXc-0005WX-Jy; Wed, 03 Oct 2012 18:47:56 -0700 From: Troy Kisky To: sbabic@denx.de Date: Wed, 3 Oct 2012 18:47:11 -0700 Message-Id: <1349315254-21151-10-git-send-email-troy.kisky@boundarydevices.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1349315254-21151-1-git-send-email-troy.kisky@boundarydevices.com> References: <1348281558-19520-1-git-send-email-troy.kisky@boundarydevices.com> <1349315254-21151-1-git-send-email-troy.kisky@boundarydevices.com> X-Gm-Message-State: ALoCoQmfmnzE7jfExzPxVXAUhsZAVH3IWDR+NoxXIf1Ud8SLr5PJVXV+yEWpyEVdukI3jP8EZNUq Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH V3 09/32] 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 --- tools/imximage.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/tools/imximage.c b/tools/imximage.c index 1365b1e..10ccfa9 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);