From patchwork Fri Dec 22 21:13:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Schulz X-Patchwork-Id: 122664 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2745979qgn; Fri, 22 Dec 2017 13:18:06 -0800 (PST) X-Google-Smtp-Source: ACJfBovJN8/O+exUgBwXbhlubGvOS2RODk++34faYrUxSVrfpOgpYlm0tJwdc/ptisOYO2cAyR+d X-Received: by 10.80.158.15 with SMTP id z15mr16329132ede.262.1513977486372; Fri, 22 Dec 2017 13:18:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513977486; cv=none; d=google.com; s=arc-20160816; b=MMjEo+YEXkx6X+PFgmr3hVi//1/DbTrwIQf/wMhG5GsuAsesr85POMQ94Pz69q7HgS YKEUNxakwOfN5S+5+7WACsLf4EcQSpLscSTKepL6SBjj4Ox5jQHjUwL6Fo9wGeqgOgCQ NDu3SwWgIXG/mjvnlVauYG962PYknWRe9ltez7irhcvh508JPKMnY5ynvXqMB36UQAkw nXL/eFjiygTR/dR91xRRTqtrblMIJ6TKZj/LC5+hjsXq0rZIo26j2lehf97hsVDrRcyN 8dzKXDfcuqgFdguCeP4RCEhviZIDtVXGjBEcDM2ZWhiNI4KApVl872KOZz5FxoY4dWXk dV8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:references :in-reply-to:message-id:date:to:from:arc-authentication-results; bh=N5E7nbf330d+DC0gwscHQQqJzlevVRWXGHhSJG52ZiM=; b=l0lpg0kJK3JjA3qZfs81Vl/Al0TNBYUzeJ4y2egeT08o0OEPjWSJaRXNsbrb9fmGxk ttmsJvth+YGTom/L/xVwS5mi6OQtJa7fC2yNm7ozScAw0xSJUvTg74DbY/6dbQVDTjxn 7xMVZ/BvS2BiMsU+kv6bsoe3rzRtm5V4clb3H0U9UOV76D15P37HHQuXQwNRRT+tIVij Be6q+/54l3gOccrhiulRBrj4bt6NVOUWhpp3uDxaLhmcbvK67VckLmWg/Bt+VnkFIQXa surIifbpbyjEPaYUS0VsJ3ru/40RE0T4CI1NeuoHledBKD1BBnYJ4g0oHpz38REkQPY6 5RmA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id m25si2623143edm.209.2017.12.22.13.18.06; Fri, 22 Dec 2017 13:18:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id E6628C21FA9; Fri, 22 Dec 2017 21:16:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 4F879C2220D; Fri, 22 Dec 2017 21:14:45 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id A4E39C21F40; Fri, 22 Dec 2017 21:14:22 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id 452EFC21FBE for ; Fri, 22 Dec 2017 21:14:17 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 6DAE120748; Fri, 22 Dec 2017 22:14:16 +0100 (CET) Received: from localhost.localdomain (unknown [80.12.41.248]) by mail.free-electrons.com (Postfix) with ESMTPSA id CA79620733; Fri, 22 Dec 2017 22:14:15 +0100 (CET) From: Quentin Schulz To: jagan@openedev.com, maxime.ripard@free-electrons.com, hdegoede@redhat.com, sjg@chromium.org, wd@denx.de, andre.przywara@arm.com, lukma@denx.de Date: Fri, 22 Dec 2017 22:13:41 +0100 Message-Id: X-Mailer: git-send-email 2.14.1 In-Reply-To: References: In-Reply-To: References: Cc: thomas.petazzoni@free-electrons.com, u-boot@lists.denx.de Subject: [U-Boot] [PATCH 07/11] env: gd flags without ENV_READY is enough to discriminate in X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" env_get_default To prepare the removal of env_valid in an upcoming patch, and since the ENV_READY flag in gd is enough to discriminate in env_get_char, let's update env_get_char to return the variable in the default environment when ENV_READY flag is not set and remove env_valid setting and getting from env_get_default. Signed-off-by: Quentin Schulz --- env/common.c | 3 --- env/env.c | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/env/common.c b/env/common.c index c8d8993..75b8334 100644 --- a/env/common.c +++ b/env/common.c @@ -47,14 +47,11 @@ int env_get_yesno(const char *var) char *env_get_default(const char *name) { char *ret_val; - unsigned long really_valid = gd->env_valid; unsigned long real_gd_flags = gd->flags; /* Pretend that the image is bad. */ gd->flags &= ~GD_FLG_ENV_READY; - gd->env_valid = ENV_INVALID; ret_val = env_get(name); - gd->env_valid = really_valid; gd->flags = real_gd_flags; return ret_val; } diff --git a/env/env.c b/env/env.c index 7c98083..2565e7a 100644 --- a/env/env.c +++ b/env/env.c @@ -141,7 +141,7 @@ int env_get_char(int index) struct env_driver *drv; int prio; - if (gd->env_valid == ENV_INVALID) + if (!(gd->flags & GD_FLG_ENV_READY)) return default_environment[index]; for (prio = 0; (drv = env_driver_lookup(ENVO_GET_CHAR, prio)); prio++) {