From patchwork Sun Jul 28 14:03:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1138007 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="efMQfkDA"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45xQ7561Fdz9s4Y for ; Mon, 29 Jul 2019 00:24:17 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 85E9EC21DA6; Sun, 28 Jul 2019 14:14:39 +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=T_DKIM_INVALID 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 31C62C21E16; Sun, 28 Jul 2019 14:09:31 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id EECC0C21DA1; Sun, 28 Jul 2019 14:06:55 +0000 (UTC) Received: from mail-io1-f65.google.com (mail-io1-f65.google.com [209.85.166.65]) by lists.denx.de (Postfix) with ESMTPS id 288C7C21DC1 for ; Sun, 28 Jul 2019 14:06:53 +0000 (UTC) Received: by mail-io1-f65.google.com with SMTP id z3so4808020iog.0 for ; Sun, 28 Jul 2019 07:06:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wKxg8jGBRGTXVXw9MnmgUgNMxPR8unGtIRhD93vAx5o=; b=efMQfkDABQz5/BYy0AIO/pC9upbt4D0n6ki85xkQ8QrmzpQipMvEmkJVlAg/brWtG9 16UZJrNcmQLM0jkWuzVdcmyeRULvoJ3cQC2QJyQrJAlmMCT1hDU/grI0f2cNMIFbH7i1 fF1LIswOfrKWeUzvLHYCSEgM8mFBR7bbYkDG4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wKxg8jGBRGTXVXw9MnmgUgNMxPR8unGtIRhD93vAx5o=; b=inr26iTcbFHXKY2X64dsd/z8XvTZV6iiq1tM4hAIzYkwRjOzoPxy3YBld9MPuqDsEo oi0n3AAI239Pvc3uBrBgDmKErzOuZ5H3FIb5KTluVb/D7FOHrBDh5uK7y092ATQv2gdO 18QZBt29Qo7fWLboy5hzZikqMPxXdpu61AM7aRG1aiXZTm4i0nYapjpGylAUvurKFlDT fKwfyEK2adRHSy4XgAS7xzQFJk4p9Y3K6904273vYhoal8z2SjDowkAV7fy5MWOoQ0UE mbz2YL7Kfew9dCn8FKNd7stYZvXDMHAXa1Sc7KXAF8Ajf3tggl3lDvXtkTIYCXlQM1L9 bZ/Q== X-Gm-Message-State: APjAAAW8E2WaLHdtTzIxaXINtw9M9qPluV/nq/WSoElX5DKXT2pECTQq l7oQJfOHBViESKFOSm3IqeCmj0/zcYA= X-Google-Smtp-Source: APXvYqzuYSfdHrgYQDOKdHp0k/Gz7skL4NxBBjjdwilbtei0e6P2sHtjW4bEPMlMellGzBSl685AcA== X-Received: by 2002:a6b:ef06:: with SMTP id k6mr24813071ioh.70.1564322811988; Sun, 28 Jul 2019 07:06:51 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id t5sm46782450iol.55.2019.07.28.07.06.51 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 28 Jul 2019 07:06:51 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Sun, 28 Jul 2019 08:03:46 -0600 Message-Id: <20190728140357.137295-30-sjg@chromium.org> X-Mailer: git-send-email 2.22.0.709.g102302147b-goog In-Reply-To: <20190728140357.137295-1-sjg@chromium.org> References: <20190728140357.137295-1-sjg@chromium.org> MIME-Version: 1.0 Cc: Joe Hershberger , Tom Rini Subject: [U-Boot] [PATCH 29/39] env: Move callback definitions to env.h 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" These definitions are effectively part of the 'public' API of the environment implementation since they do not require access to any internal variables. Move them to the env.h header. Signed-off-by: Simon Glass Acked-by: Joe Hershberger --- include/env.h | 34 ++++++++++++++++++++++++++++++++++ include/env_callback.h | 23 ----------------------- include/search.h | 6 ------ 3 files changed, 34 insertions(+), 29 deletions(-) diff --git a/include/env.h b/include/env.h index 93a4c3ed6b..3dbdf276cd 100644 --- a/include/env.h +++ b/include/env.h @@ -21,6 +21,40 @@ enum env_valid { ENV_REDUND, /* Redundant environment is valid */ }; +/** enum env_op - environment callback operation */ +enum env_op { + env_op_create, + env_op_delete, + env_op_overwrite, +}; + +/** struct env_clbk_tbl - declares a new callback */ +struct env_clbk_tbl { + const char *name; /* Callback name */ + int (*callback)(const char *name, const char *value, enum env_op op, + int flags); +}; + +/* + * Define a callback that can be associated with variables. + * when associated through the ".callbacks" environment variable, the callback + * will be executed any time the variable is inserted, overwritten, or deleted. + * + * For SPL these are silently dropped to reduce code size, since environment + * callbacks are not supported with SPL. + */ +#ifdef CONFIG_SPL_BUILD +#define U_BOOT_ENV_CALLBACK(name, callback) \ + static inline __maybe_unused void _u_boot_env_noop_##name(void) \ + { \ + (void)callback; \ + } +#else +#define U_BOOT_ENV_CALLBACK(name, callback) \ + ll_entry_declare(struct env_clbk_tbl, name, env_clbk) = \ + {#name, callback} +#endif + /** * env_get_id() - Gets a sequence number for the environment * diff --git a/include/env_callback.h b/include/env_callback.h index 507a52e13c..3d30a33f5b 100644 --- a/include/env_callback.h +++ b/include/env_callback.h @@ -72,29 +72,6 @@ "serial#:serialno," \ CONFIG_ENV_CALLBACK_LIST_STATIC -struct env_clbk_tbl { - const char *name; /* Callback name */ - int (*callback)(const char *name, const char *value, enum env_op op, - int flags); -}; - void env_callback_init(ENTRY *var_entry); -/* - * Define a callback that can be associated with variables. - * when associated through the ".callbacks" environment variable, the callback - * will be executed any time the variable is inserted, overwritten, or deleted. - */ -#ifdef CONFIG_SPL_BUILD -#define U_BOOT_ENV_CALLBACK(name, callback) \ - static inline __maybe_unused void _u_boot_env_noop_##name(void) \ - { \ - (void)callback; \ - } -#else -#define U_BOOT_ENV_CALLBACK(name, callback) \ - ll_entry_declare(struct env_clbk_tbl, name, env_clbk) = \ - {#name, callback} -#endif - #endif /* __ENV_CALLBACK_H__ */ diff --git a/include/search.h b/include/search.h index 9750336b5e..f9fb29fdf9 100644 --- a/include/search.h +++ b/include/search.h @@ -19,12 +19,6 @@ #define __set_errno(val) do { errno = val; } while (0) -enum env_op { - env_op_create, - env_op_delete, - env_op_overwrite, -}; - /* Action which shall be performed in the call to hsearch. */ typedef enum { FIND,