From patchwork Wed Sep 23 17:25:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Harkin X-Patchwork-Id: 521788 X-Patchwork-Delegate: trini@ti.com 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 A3D2F1401DE for ; Thu, 24 Sep 2015 03:27:37 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5E1ED4B6D1; Wed, 23 Sep 2015 19:27:33 +0200 (CEST) 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 SNrzM4WfronG; Wed, 23 Sep 2015 19:27:33 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 74F224B95C; Wed, 23 Sep 2015 19:27:26 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8C3CB4B78D for ; Wed, 23 Sep 2015 19:27:18 +0200 (CEST) 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 cPUW6Rlt581c for ; Wed, 23 Sep 2015 19:27:18 +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-pa0-f46.google.com (mail-pa0-f46.google.com [209.85.220.46]) by theia.denx.de (Postfix) with ESMTPS id 2168B4B943 for ; Wed, 23 Sep 2015 19:27:14 +0200 (CEST) Received: by pacfv12 with SMTP id fv12so46733769pac.2 for ; Wed, 23 Sep 2015 10:27:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ZzDBTW9xXNZlEcxiqI8wOYQNuzY1Q5RPpA4ZKDx2rXI=; b=TjcRO11PL+ZzrUwDTOD1NDgfBK2mQSU+S++3z0F3DgiOx1vv3BlasodkoRIbcFDzb2 6xunMr+NNsJ1V73Kr0sq7zvAI9SXnOKgI7iFd4nqUI7jLRwuNu93SuzwSI731jpyjrRD qFWzJ78DfMPy5Omsqm6hNMsWY611NCuOxH27bGyKROinh2Q+gBlcRDLpdFlE8wUk6rXG UZ11SFqxHVcSw2cKdIu607FWsd4loCWZlDT38mqDBnI2ogM44dzfZxokehVZ9+bRHngT AN8X3mdImAB828Yjx0aqWZQvq6qleb6Fb9HaCUFY45TSUDpj0zgvRWsazM6LwpEtN8Rh U3Hg== X-Gm-Message-State: ALoCoQn6J9gJblVPALjV8uQj/9Lv52Xuzb7jk03rfBJAiwdRXOqTgbUmejPPKoLMEX1iAL/r3nYI X-Received: by 10.68.57.197 with SMTP id k5mr38470687pbq.142.1443029233503; Wed, 23 Sep 2015 10:27:13 -0700 (PDT) Received: from localhost.localdomain ([70.35.39.2]) by smtp.gmail.com with ESMTPSA id fm5sm9061765pab.24.2015.09.23.10.27.10 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 23 Sep 2015 10:27:13 -0700 (PDT) From: Ryan Harkin To: ryan.harkin@linaro.org, u-boot@lists.denx.de, Albert Aribaud , Tom Rini Date: Wed, 23 Sep 2015 10:25:40 -0700 Message-Id: <1443029143-22313-9-git-send-email-ryan.harkin@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1443029143-22313-1-git-send-email-ryan.harkin@linaro.org> References: <1443029143-22313-1-git-send-email-ryan.harkin@linaro.org> Cc: Steve Rae Subject: [U-Boot] [PATCH 08/11] common/armflash: load_image returns success or failure X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Change the load_image so that it returns success or failure of the command (using CMD_RET_SUCCESS or CMD_RET_FAILURE). This way, hush scripts can optionally load different files depending upon the system configuration. A simple example: if afs load ${kernel_name} ${kernel_addr}; then echo loaded; else echo \ not loaded; fi Signed-off-by: Ryan Harkin Reviewed-by: Linus Walleij CC: Linus Walleij --- common/cmd_armflash.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/common/cmd_armflash.c b/common/cmd_armflash.c index a37f5c4..02b7fee 100644 --- a/common/cmd_armflash.c +++ b/common/cmd_armflash.c @@ -175,7 +175,7 @@ static void parse_flash(void) parse_bank(bank); } -static void load_image(const char * const name, const ulong address) +static int load_image(const char * const name, const ulong address) { struct afs_image *afi = NULL; int i; @@ -191,7 +191,7 @@ static void load_image(const char * const name, const ulong address) } if (!afi) { printf("image \"%s\" not found in flash\n", name); - return; + return CMD_RET_FAILURE; } for (i = 0; i < afi->region_count; i++) { @@ -215,6 +215,7 @@ static void load_image(const char * const name, const ulong address) to, afi->regions[i].size); } + return CMD_RET_SUCCESS; } static void print_images(void) @@ -274,12 +275,12 @@ static int do_afs(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } else if (argc == 3 && !strcmp(argv[1], "exists")) { ret = exists(argv[2]); } else if (argc == 3 && !strcmp(argv[1], "load")) { - load_image(argv[2], 0x0); + ret = load_image(argv[2], 0x0); } else if (argc == 4 && !strcmp(argv[1], "load")) { ulong load_addr; load_addr = simple_strtoul(argv[3], NULL, 16); - load_image(argv[2], load_addr); + ret = load_image(argv[2], load_addr); } else { return CMD_RET_USAGE; }