From patchwork Wed Oct 25 12:25:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 117112 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp787320qgn; Wed, 25 Oct 2017 05:28:22 -0700 (PDT) X-Google-Smtp-Source: ABhQp+RP7FkJVnvL1Sz9wm2HKTbEXV+fEkd25tQK/v/vCoMtL7yQORx/qQ1a2POVzobOf6M+rfYh X-Received: by 10.80.135.157 with SMTP id a29mr23434078eda.79.1508934502630; Wed, 25 Oct 2017 05:28:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508934502; cv=none; d=google.com; s=arc-20160816; b=h38VpzA3l4I2Zr9lbpgmT3T+8gBPOz/eC0aJhYEzJOWj6f7KUM79UV0uyUgI2mh89v 1mKXr2rFR/MKD16lXUUnH/Uzybc5RLmGpZLqK2D2D3vGySmRrXTAcVOknvLx0j99ZVMj /B29ZoGXxdMTeK5585KGKuVznnsE9LWeraLPcuzOVSTF6LGrtcv9dvbwHU/e2Pxd464R ZKO39E9BivMy1x1v/6nVYQ5tzbtiS3FYNgQK9BTSUeV5SWE+17MtQLS45VKSHN5Vqpg9 TOpC/zTyIxeDp30KfsQObeom+u5ESLA2eMwiJscTyDRPHkzquhK+3O8M8EecND5lQE6R OCdg== 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:message-id :date:to:from:arc-authentication-results; bh=HZMbgzAdA5Dg+9jgt1juBUWhMKXFEINt24/hn6wzVKY=; b=tdgtUskLF3jMR7PCwOBAw3CkxK5MrEqUnozmv05Iu8Qnw1fBY6ob7Pfe+b8GbfnxSb MvaM+/zdDu7GSWnNV4ZSAhIohHfqNA5t2Aup+No/kYcQsASUo8yReJvt7Pa6Z33cOV6b jo15MQIYHdaKNLjpXyKKETEbl+nw/szcKgCb+5YDMr/Kksc23cbKRm9eyNBKSYR+McOI yuNk0jAvI79N1NsMecZRIr8JuwhX4AIvOn3I7/2yexgF2B/lAPyqde+fnyWFx19AJN44 DpQevyvGEXGks/3sjPjsPAprvqps3C7+7YDMtLG6TmjtWB3C+9vnoKlMBF+EGW0WxQA+ vayw== 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 m13si1545522edi.490.2017.10.25.05.28.22; Wed, 25 Oct 2017 05:28:22 -0700 (PDT) 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 2DC44C21DF4; Wed, 25 Oct 2017 12:27:00 +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 E30BCC21DC1; Wed, 25 Oct 2017 12:26:40 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 5A177C21D99; Wed, 25 Oct 2017 12:26:15 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id 1D971C21DD9 for ; Wed, 25 Oct 2017 12:26:12 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 7296F20848; Wed, 25 Oct 2017 14:26:10 +0200 (CEST) Received: from localhost (unknown [185.94.189.189]) by mail.free-electrons.com (Postfix) with ESMTPSA id BF3F0206D8; Wed, 25 Oct 2017 14:26:09 +0200 (CEST) From: Maxime Ripard To: Tom Rini Date: Wed, 25 Oct 2017 14:25:59 +0200 Message-Id: <20171025122601.28224-3-maxime.ripard@free-electrons.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171025122601.28224-1-maxime.ripard@free-electrons.com> References: <20171025122601.28224-1-maxime.ripard@free-electrons.com> Cc: Andre Przywara , agraf@suse.de, u-boot@lists.denx.de, Maxime Ripard , Jagan Teki Subject: [U-Boot] [RFC 2/4] env; fat: Allow the fat environment to be embedded by another one 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" The fat environment is currently only buildable as the primary environment, but other environment methods might need to use it as a secondary environment (for example to implement fallback mechanisms). Make sure the environment can be compiled and that the functions are not static when the configuration option is not enabled, and that we will register it only when it is our primary environment method. Signed-off-by: Maxime Ripard --- env/fat.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/env/fat.c b/env/fat.c index ec49c3905369..acdea664dd2c 100644 --- a/env/fat.c +++ b/env/fat.c @@ -34,7 +34,10 @@ DECLARE_GLOBAL_DATA_PTR; #ifdef CMD_SAVEENV -static int env_fat_save(void) +#ifdef CONFIG_ENV_IS_IN_FAT +static +#endif +int env_fat_save(void) { env_t env_new; struct blk_desc *dev_desc = NULL; @@ -74,7 +77,10 @@ static int env_fat_save(void) #endif /* CMD_SAVEENV */ #ifdef LOADENV -static int env_fat_load(void) +#ifdef CONFIG_ENV_IS_IN_FAT +static +#endif +int env_fat_load(void) { ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE); struct blk_desc *dev_desc = NULL; @@ -112,6 +118,7 @@ err_env_relocate: } #endif /* LOADENV */ +#ifdef CONFIG_ENV_IS_IN_FAT U_BOOT_ENV_LOCATION(fat) = { .location = ENVL_FAT, ENV_NAME("FAT") @@ -122,3 +129,4 @@ U_BOOT_ENV_LOCATION(fat) = { .save = env_save_ptr(env_fat_save), #endif }; +#endif