From patchwork Wed Oct 20 11:17:55 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 71906 X-Patchwork-Delegate: wd@denx.de Return-Path: X-Original-To: wd@gemini.denx.de Delivered-To: wd@gemini.denx.de Received: from diddl.denx.de (diddl.denx.de [10.0.0.6]) by gemini.denx.de (Postfix) with ESMTP id 7870C136320 for ; Wed, 20 Oct 2010 13:22:04 +0200 (CEST) Received: from diddl.denx.de (localhost.localdomain [127.0.0.1]) by diddl.denx.de (Postfix) with ESMTP id 5336E348C9D1 for ; Wed, 20 Oct 2010 13:22:04 +0200 (CEST) Received: from pop.mnet-online.de by diddl.denx.de with POP3 (fetchmail-6.3.17) for (single-drop); Wed, 20 Oct 2010 13:22:04 +0200 (CEST) Received: from murder ([192.168.8.180]) by backend2 (Cyrus v2.2.12) with LMTPA; Wed, 20 Oct 2010 13:19:04 +0200 X-Sieve: CMU Sieve 2.2 Received: from mail.m-online.net (localhost [127.0.0.1]) by frontend1.mail.m-online.net (Cyrus v2.2.12) with LMTPA; Wed, 20 Oct 2010 13:19:04 +0200 Received: from scanner-3.m-online.net (unknown [192.168.6.168]) by mail.m-online.net (Postfix) with ESMTP id 192BB1C00106; Wed, 20 Oct 2010 13:19:04 +0200 (CEST) Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by mxin-2.m-online.net (Postfix) with ESMTP id D676946C0BF; Wed, 20 Oct 2010 13:19:01 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D1F4F28372; Wed, 20 Oct 2010 13:18:32 +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 ztxHyj+q9hDL; Wed, 20 Oct 2010 13:18:31 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5C4002838F; Wed, 20 Oct 2010 13:18:28 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 828C428374 for ; Wed, 20 Oct 2010 13:18:23 +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 ztCcD+qD0GtK for ; Wed, 20 Oct 2010 13:18:23 +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 smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by theia.denx.de (Postfix) with ESMTPS id 007B428378 for ; Wed, 20 Oct 2010 13:18:19 +0200 (CEST) Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 381AC1B4247 for ; Wed, 20 Oct 2010 11:18:16 +0000 (UTC) From: Mike Frysinger To: u-boot@lists.denx.de Date: Wed, 20 Oct 2010 07:17:55 -0400 Message-Id: <1287573475-6737-1-git-send-email-vapier@gentoo.org> X-Mailer: git-send-email 1.7.3.1 Subject: [U-Boot] [PATCH] boot cmds: convert to getenv_yesno() with autostart X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 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 X-Virus-Scanned: by amavisd-new at m-online.net Use the new helper func to clean up duplicate logic handling of the autostart env var. Signed-off-by: Mike Frysinger --- common/cmd_fdc.c | 3 +-- common/cmd_fdos.c | 2 +- common/cmd_ide.c | 2 +- common/cmd_nand.c | 4 ++-- common/cmd_net.c | 2 +- common/cmd_scsi.c | 2 +- common/cmd_usb.c | 2 +- 7 files changed, 8 insertions(+), 9 deletions(-) diff --git a/common/cmd_fdc.c b/common/cmd_fdc.c index 831a07f..1655bdc 100644 --- a/common/cmd_fdc.c +++ b/common/cmd_fdc.c @@ -721,7 +721,6 @@ int do_fdcboot (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) image_header_t *hdr; /* used for fdc boot */ unsigned char boot_drive; int i,nrofblk; - char *ep; int rcode = 0; #if defined(CONFIG_FIT) const void *fit_hdr = NULL; @@ -824,7 +823,7 @@ int do_fdcboot (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) load_addr = addr; /* Check if we should attempt an auto-start */ - if (((ep = getenv("autostart")) != NULL) && (strcmp(ep,"yes") == 0)) { + if (getenv_yesno("autostart")) { char *local_args[2]; extern int do_bootm (cmd_tbl_t *, int, int, char *[]); diff --git a/common/cmd_fdos.c b/common/cmd_fdos.c index a8822d9..5bb5c64 100644 --- a/common/cmd_fdos.c +++ b/common/cmd_fdos.c @@ -99,7 +99,7 @@ int do_fdosboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) size, load_addr); /* Check if we should attempt an auto-start */ - if (((ep = getenv("autostart")) != NULL) && (strcmp(ep,"yes") == 0)) { + if (getenv_yesno("autostart")) { char *local_args[2]; extern int do_bootm (cmd_tbl_t *, int, int, char *[]); local_args[0] = argv[0]; diff --git a/common/cmd_ide.c b/common/cmd_ide.c index ea0f4a7..f684e78 100644 --- a/common/cmd_ide.c +++ b/common/cmd_ide.c @@ -496,7 +496,7 @@ int do_diskboot (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) load_addr = addr; /* Check if we should attempt an auto-start */ - if (((ep = getenv("autostart")) != NULL) && (strcmp(ep,"yes") == 0)) { + if (getenv_yesno("autostart")) { char *local_args[2]; extern int do_bootm (cmd_tbl_t *, int, int, char *[]); diff --git a/common/cmd_nand.c b/common/cmd_nand.c index 634d036..f79bd6d 100644 --- a/common/cmd_nand.c +++ b/common/cmd_nand.c @@ -711,7 +711,7 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand, ulong offset, ulong addr, char *cmd) { int r; - char *ep, *s; + char *s; size_t cnt; image_header_t *hdr; #if defined(CONFIG_FIT) @@ -787,7 +787,7 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand, load_addr = addr; /* Check if we should attempt an auto-start */ - if (((ep = getenv("autostart")) != NULL) && (strcmp(ep, "yes") == 0)) { + if (getenv_yesno("autostart")) { char *local_args[2]; extern int do_bootm(cmd_tbl_t *, int, int, char *[]); diff --git a/common/cmd_net.c b/common/cmd_net.c index 44d17db..3320104 100644 --- a/common/cmd_net.c +++ b/common/cmd_net.c @@ -213,7 +213,7 @@ netboot_common (proto_t proto, cmd_tbl_t *cmdtp, int argc, char * const argv[]) flush_cache(load_addr, size); /* Loading ok, check if we should attempt an auto-start */ - if (((s = getenv("autostart")) != NULL) && (strcmp(s,"yes") == 0)) { + if (getenv_yesno("autostart")) { char *local_args[2]; local_args[0] = argv[0]; local_args[1] = NULL; diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c index 6b937f9..0a3dd07 100644 --- a/common/cmd_scsi.c +++ b/common/cmd_scsi.c @@ -327,7 +327,7 @@ int do_scsiboot (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) flush_cache (addr, (cnt+1)*info.blksz); /* Check if we should attempt an auto-start */ - if (((ep = getenv("autostart")) != NULL) && (strcmp(ep,"yes") == 0)) { + if (getenv_yesno("autostart")) { char *local_args[2]; extern int do_bootm (cmd_tbl_t *, int, int, char *[]); local_args[0] = argv[0]; diff --git a/common/cmd_usb.c b/common/cmd_usb.c index 226ea0d..a7cffa5 100644 --- a/common/cmd_usb.c +++ b/common/cmd_usb.c @@ -488,7 +488,7 @@ int do_usbboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) flush_cache(addr, (cnt+1)*info.blksz); /* Check if we should attempt an auto-start */ - if (((ep = getenv("autostart")) != NULL) && (strcmp(ep, "yes") == 0)) { + if (getenv_yesno("autostart")) { char *local_args[2]; extern int do_bootm(cmd_tbl_t *, int, int, char *[]); local_args[0] = argv[0];