From mboxrd@z Thu Jan 1 00:00:00 1970 From: Troy Kisky Date: Tue, 27 Nov 2012 18:31:35 -0700 Subject: [U-Boot] [PATCH V4 03/11] imximage: remove static imximage_version 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> Message-ID: <1354066303-29762-4-git-send-email-troy.kisky@boundarydevices.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@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 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); -- 1.7.9.5