From patchwork Wed May 15 16:23:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 244134 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 3C9D12C00A8 for ; Thu, 16 May 2013 02:25:18 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2F25B4A047; Wed, 15 May 2013 18:25:11 +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 wqVauR+3ELzv; Wed, 15 May 2013 18:25:10 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A27314A040; Wed, 15 May 2013 18:24:51 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9F72C4A032 for ; Wed, 15 May 2013 18:24:41 +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 Tsyhd-xCyB42 for ; Wed, 15 May 2013 18:24:39 +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-gh0-f201.google.com (mail-gh0-f201.google.com [209.85.160.201]) by theia.denx.de (Postfix) with ESMTPS id 496364A03B for ; Wed, 15 May 2013 18:24:28 +0200 (CEST) Received: by mail-gh0-f201.google.com with SMTP id r14so199083ghr.2 for ; Wed, 15 May 2013 09:24:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=keBgRYCWWdvdgFutjHxNKiOFl9zSbKF1Mhr3QowOArA=; b=ZnPSZEYwkWbGaDYMBmNwVM3r3gVDcF8V7atGO91/jYtEnXP8TJk6KAOql0nVWlGL3i urr4rvEIJYKFGu3nPst3RZb0EzDdyTE2hP2u+wcS6wGVgwJzywQ8TTXVbJ7Q/41eH8Ya USzmXHxMUrsRapSGxjLFI7RiSA1INSeNT/xXB/3+G4YUFRcJ00V4AxzpOuqUVUUs3Buu Ovkhke35zmeIAC7cFCrFvuufgNOzUEafubErHoj1fi8/hAK5WJLoO0fkd5A9gDNPbfpK Yv+w2j6g5dwTDUt3ecPKUlF7KCTVkBRwAFy+DxOL1lZQbbLsD8IGqL8g/thmtWPCIa64 zXAg== X-Received: by 10.236.84.177 with SMTP id s37mr18278004yhe.37.1368635067376; Wed, 15 May 2013 09:24:27 -0700 (PDT) Received: from corp2gmr1-2.hot.corp.google.com (corp2gmr1-2.hot.corp.google.com [172.24.189.93]) by gmr-mx.google.com with ESMTPS id n78si197156yhh.1.2013.05.15.09.24.27 for (version=TLSv1.1 cipher=AES128-SHA bits=128/128); Wed, 15 May 2013 09:24:27 -0700 (PDT) Received: from kaka.mtv.corp.google.com (kaka.mtv.corp.google.com [172.22.83.1]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id 3D0635A420E; Wed, 15 May 2013 09:24:27 -0700 (PDT) Received: by kaka.mtv.corp.google.com (Postfix, from userid 121222) id E6F2D1605FB; Wed, 15 May 2013 09:24:26 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Wed, 15 May 2013 09:23:57 -0700 Message-Id: <1368635041-27638-5-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1368635041-27638-1-git-send-email-sjg@chromium.org> References: <1368635041-27638-1-git-send-email-sjg@chromium.org> X-Gm-Message-State: ALoCoQm1354721sFmQKNs60ouOGbYV6wiz2ssJ12RaMboTtZywwF3iNzZa5swnpetXJsQB6X8irlsQ+xSbNaFK9seCgFkJz+7hsJn2YTIQWDbc2CgKr0UJl4+1tmR/U/eatCRPWLRQhZrQzZ3fTLSyfsCwumVgTe9TjJyxxiLWITNkFgb9vH57CWdACBXQV+ZKr/prInk1SE Cc: Tom Rini , Joe Hershberger , u-boot-review@google.com Subject: [U-Boot] [PATCH v4 5/9] main: Use get/setenv_ulong() 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 These functions are now available, so use them to avoid extra code here. Signed-off-by: Simon Glass Reviewed-by: Joe Hershberger --- Changes in v4: None Changes in v3: None common/main.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/common/main.c b/common/main.c index 159b8e1..38fadac 100644 --- a/common/main.c +++ b/common/main.c @@ -352,18 +352,14 @@ static void process_boot_delay(void) #ifdef CONFIG_BOOTCOUNT_LIMIT unsigned long bootcount = 0; unsigned long bootlimit = 0; - char *bcs; - char bcs_set[16]; #endif /* CONFIG_BOOTCOUNT_LIMIT */ #ifdef CONFIG_BOOTCOUNT_LIMIT bootcount = bootcount_load(); bootcount++; bootcount_store (bootcount); - sprintf (bcs_set, "%lu", bootcount); - setenv ("bootcount", bcs_set); - bcs = getenv ("bootlimit"); - bootlimit = bcs ? simple_strtoul (bcs, NULL, 10) : 0; + setenv_ulong("bootcount", bootcount); + bootlimit = getenv_ulong("bootlimit", 10, 0); #endif /* CONFIG_BOOTCOUNT_LIMIT */ s = getenv ("bootdelay");