From patchwork Tue Jan 16 09:16:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 124639 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp948178lje; Tue, 16 Jan 2018 01:23:06 -0800 (PST) X-Google-Smtp-Source: ACJfBovvqFKu3HRQrnTUvxnQto4sNsIQhh9ZqHplm6Aw8AXwIyGXhu0w04lqZP67i79qUpXhkSPx X-Received: by 10.80.144.233 with SMTP id d38mr17468239eda.291.1516094586502; Tue, 16 Jan 2018 01:23:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516094586; cv=none; d=google.com; s=arc-20160816; b=XR8doI/FDKx2z6cZGJs54wkFAE3La61kXu/l1qowphN7EbFebBLY1myof1kE5XHbco 7WduQEtPugrctBWLWOQCZwoQgYFX5f642/CWW+ca1KGnMQSGG42/EKZYf+S3R8VSQsFT JpgGC8u3OQD6tme9CG0Qpg+fyau1CmaQk9MjR1KIkBoMyKyRT+fJ5Kn2PQW6dqrJNT3e RWQge1iPSF8kGJnspRNaXc7vd0iRum9mHonUBxJc2UvHI3D4hAno++1e2v1Paf66H2HD lUs0Rmf2aD7TVZm3xxV7Kg0LeAYEAN3y+XBBX4ibGW7Xix+JGi0ejkCpQl1Mh+leMocT NwXA== 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=T7eUVOM9gzltrbPDPoivD5KkFupNAa6370EQWhHJE2k=; b=BKiSrPvb3WapRU+pYgqcUJ+HgME3+lMsax20W8N38Yxv+IlwIuFRR0uZ7RxDc7MCfp UKnuKNpxrk4hZtp/qfkApivs73QcNjzbuE4+ILN8TQA07DPJxxcLj1y4Eb4ymAwEyYqD JXA7dyNEWokwdnCdCXnrJ4qi084h5TfYXVDEhA4xkMitppuJlZRuiV0Dn6Qe91Lj2C9j JREhTWszchlaNR8lbLYHu3xouoG78aXUbaed6REbZyx8yIcmQMyKejSiJSDu0fu4WJIA ijaVRxtdaWc1ulMRpG+7zSTtAn0RjwdW0n9LYFGZ7YG/qH/1wblIQIZeKQsPEtCfcC+s mVxg== 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 5si1838746edy.276.2018.01.16.01.23.06; Tue, 16 Jan 2018 01:23: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 19380C21E57; Tue, 16 Jan 2018 09:21:15 +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 4D90BC21E9C; Tue, 16 Jan 2018 09:17:45 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 48B46C21E31; Tue, 16 Jan 2018 09:17:04 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id 140DBC21E0F for ; Tue, 16 Jan 2018 09:16:59 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id E0C11208B7; Tue, 16 Jan 2018 10:16:57 +0100 (CET) Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id B3B1420725; Tue, 16 Jan 2018 10:16:57 +0100 (CET) From: Maxime Ripard To: Tom Rini Date: Tue, 16 Jan 2018 10:16:49 +0100 Message-Id: X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: Cc: Andre Przywara , agraf@suse.de, u-boot@lists.denx.de, Maxime Ripard , Jagan Teki Subject: [U-Boot] [PATCH v2 13/15] env: Mark env_get_location as weak 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" Allow boards and architectures to override the default environment lookup code by overriding env_get_location. Reviewed-by: Andre Przywara Reviewed-by: Lukasz Majewski Signed-off-by: Maxime Ripard Reviewed-by: Simon Glass --- env/env.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/env/env.c b/env/env.c index 75da2b921804..6d0ab8ebe1a4 100644 --- a/env/env.c +++ b/env/env.c @@ -79,7 +79,25 @@ static void env_set_inited(enum env_location location) static enum env_location env_load_location; -static enum env_location env_get_location(enum env_operation op, int prio) +/** + * env_get_location() - Returns the best env location for a board + * @op: operations performed on the environment + * @prio: priority between the multiple environments, 0 being the + * highest priority + * + * This will return the preferred environment for the given + * priority. This is overridable by boards if they need to. + * + * All implementations are free to use the operation, the priority and + * any other data relevant to their choice, but must take into account + * the fact that the lowest prority (0) is the most important location + * in the system. The following locations should be returned by order + * of descending priorities, from the highest to the lowest priority. + * + * Returns: + * an enum env_location value on success, a negative error code otherwise + */ +__weak enum env_location env_get_location(enum env_operation op, int prio) { switch (op) { case ENVOP_GET_CHAR: