From patchwork Tue Sep 29 15:47:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Harkin X-Patchwork-Id: 54240 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by patches.linaro.org (Postfix) with ESMTPS id 5D68322EAF for ; Tue, 29 Sep 2015 15:48:49 +0000 (UTC) Received: by wicmn1 with SMTP id mn1sf7908583wic.1 for ; Tue, 29 Sep 2015 08:48:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:cc:subject:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :content-type:content-transfer-encoding:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list; bh=6bNdllzvIeEj/rzFhQ6w6spUEJYm+FWTqBPt9Zw9o0Y=; b=UXsOrPMbDVf0Kwua41uajql88Bbvdx/CrYO5idQSV4SphEPXBZEL/kwK3VWvAyugs7 oibAh5SIEpykQs/HJbN/AbWoH4EHYp71vBtchdMtzRzqVvqIee+Vrzcc3vr6ukHVxqN9 8ioXjassl5aXY8Jf9NN8RU3w5PBP1wUFzpQM/JtW0gB1C0K15PzcSG6MVzIUG2Qpeb1Q d7qYfp6wdoFVDQ/mYldjFC8cc5Tlmp3Z3uXp97j+oIUBTOA4redcCW4sigNiJHCtxFBd lrinX/ThLHWr+avqtHwJAvkTXBWQB3bQwx+9XWD4sNrKzuR2ulxZlcMDYzzgg4nvYy5/ XZEg== X-Gm-Message-State: ALoCoQnP5to1rsTs3tU+7HusqCI92n9/BcbFFLZ+DGn0QWxwr+IAI+YWl7n/ZTsNjJgnQHs2n++u X-Received: by 10.152.22.101 with SMTP id c5mr4409304laf.0.1443541728631; Tue, 29 Sep 2015 08:48:48 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.197.68 with SMTP id is4ls120165lac.41.gmail; Tue, 29 Sep 2015 08:48:48 -0700 (PDT) X-Received: by 10.25.16.35 with SMTP id f35mr4815286lfi.1.1443541728498; Tue, 29 Sep 2015 08:48:48 -0700 (PDT) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com. [209.85.215.47]) by mx.google.com with ESMTPS id a6si11196581lbs.43.2015.09.29.08.48.48 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Sep 2015 08:48:48 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by laclj5 with SMTP id lj5so13891213lac.3 for ; Tue, 29 Sep 2015 08:48:48 -0700 (PDT) X-Received: by 10.152.18.225 with SMTP id z1mr7385830lad.88.1443541728386; Tue, 29 Sep 2015 08:48:48 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp2224305lbq; Tue, 29 Sep 2015 08:48:47 -0700 (PDT) X-Received: by 10.180.103.72 with SMTP id fu8mr26242865wib.7.1443541727490; Tue, 29 Sep 2015 08:48:47 -0700 (PDT) Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id u10si8058729wjw.212.2015.09.29.08.48.47; Tue, 29 Sep 2015 08:48:47 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) client-ip=85.214.87.163; Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A7B994B910; Tue, 29 Sep 2015 17:48: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 0hrl15Q3vL5j; Tue, 29 Sep 2015 17:48:33 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 36D944B8D1; Tue, 29 Sep 2015 17:48:03 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 36ECF4B8D6 for ; Tue, 29 Sep 2015 17:47:49 +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 AM71mnoozpMP for ; Tue, 29 Sep 2015 17:47:49 +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-wi0-f177.google.com (mail-wi0-f177.google.com [209.85.212.177]) by theia.denx.de (Postfix) with ESMTPS id 0E8ED4B8DB for ; Tue, 29 Sep 2015 17:47:43 +0200 (CEST) Received: by wicgb1 with SMTP id gb1so155416636wic.1 for ; Tue, 29 Sep 2015 08:47:42 -0700 (PDT) X-Received: by 10.180.198.142 with SMTP id jc14mr27198878wic.32.1443541662888; Tue, 29 Sep 2015 08:47:42 -0700 (PDT) Received: from localhost.localdomain (82-69-54-187.dsl.in-addr.zen.co.uk. [82.69.54.187]) by smtp.gmail.com with ESMTPSA id kb9sm24555824wjb.49.2015.09.29.08.47.41 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 29 Sep 2015 08:47:42 -0700 (PDT) From: Ryan Harkin To: ryan.harkin@linaro.org, u-boot@lists.denx.de, Albert Aribaud , Tom Rini Date: Tue, 29 Sep 2015 16:47:17 +0100 Message-Id: <1443541640-7810-8-git-send-email-ryan.harkin@linaro.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1443541640-7810-1-git-send-email-ryan.harkin@linaro.org> References: <1443541640-7810-1-git-send-email-ryan.harkin@linaro.org> Cc: Steve Rae Subject: [U-Boot] [PATCH v2 07/10] 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: 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" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ryan.harkin@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 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 --- 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; }