From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Cc: Marek Vasut <marex@denx.de>, Dragan Simic <dsimic@manjaro.org>,
Joe Hershberger <joe.hershberger@ni.com>,
Mattijs Korpershoek <mkorpershoek@baylibre.com>,
Quentin Schulz <quentin.schulz@cherry.de>,
Rasmus Villemoes <rasmus.villemoes@prevas.dk>,
Simon Glass <sjg@chromium.org>, Tom Rini <trini@konsulko.com>
Subject: [PATCH v3 2/2] env: mmc: Clean up env_mmc_load() ifdeffery
Date: Fri, 21 Feb 2025 19:47:24 +0100 [thread overview]
Message-ID: <20250221184732.202336-2-marex@denx.de> (raw)
In-Reply-To: <20250221184732.202336-1-marex@denx.de>
Rename the variants of env_mmc_load() for redundant and non-redundant
environment to env_mmc_load_redundant() and env_mmc_load_singular()
respectively and convert the env_mmc_load() implementation to use of
if (IS_ENABLED(...)). As a result, drop __maybe_unused from
mmc_env_is_redundant_in_both_boot_hwparts().
Signed-off-by: Marek Vasut <marex@denx.de>
---
Cc: Dragan Simic <dsimic@manjaro.org>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Cc: Quentin Schulz <quentin.schulz@cherry.de>
Cc: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: u-boot@lists.denx.de
---
V3: New patch
---
env/mmc.c | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/env/mmc.c b/env/mmc.c
index 353a7ce72fb..2ef15fb72e7 100644
--- a/env/mmc.c
+++ b/env/mmc.c
@@ -205,7 +205,7 @@ static inline s64 mmc_offset(struct mmc *mmc, int copy)
}
#endif
-static bool __maybe_unused mmc_env_is_redundant_in_both_boot_hwparts(struct mmc *mmc)
+static bool mmc_env_is_redundant_in_both_boot_hwparts(struct mmc *mmc)
{
/*
* In case the environment is redundant, stored in eMMC hardware boot
@@ -448,13 +448,7 @@ static inline int read_env(struct mmc *mmc, unsigned long size,
return (n == blk_cnt) ? 0 : -1;
}
-#if defined(ENV_IS_EMBEDDED)
-static int env_mmc_load(void)
-{
- return 0;
-}
-#elif defined(CONFIG_SYS_REDUNDAND_ENVIRONMENT)
-static int env_mmc_load(void)
+static int env_mmc_load_redundant(void)
{
struct mmc *mmc;
u32 offset1, offset2;
@@ -510,8 +504,8 @@ err:
return ret;
}
-#else /* ! CONFIG_SYS_REDUNDAND_ENVIRONMENT */
-static int env_mmc_load(void)
+
+static int env_mmc_load_singular(void)
{
ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE);
struct mmc *mmc;
@@ -556,7 +550,16 @@ err:
return ret;
}
-#endif /* CONFIG_SYS_REDUNDAND_ENVIRONMENT */
+
+static int env_mmc_load(void)
+{
+ if (IS_ENABLED(CONFIG_ENV_IS_EMBEDDED))
+ return 0;
+ else if (IS_ENABLED(CONFIG_SYS_REDUNDAND_ENVIRONMENT))
+ return env_mmc_load_redundant();
+ else
+ return env_mmc_load_singular();
+}
U_BOOT_ENV_LOCATION(mmc) = {
.location = ENVL_MMC,
--
2.47.2
next prev parent reply other threads:[~2025-02-21 18:48 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-21 18:47 [PATCH v3 1/2] env: mmc: Make redundant env in both eMMC boot partitions consider DT properties Marek Vasut
2025-02-21 18:47 ` Marek Vasut [this message]
2025-02-24 9:48 ` [PATCH v3 2/2] env: mmc: Clean up env_mmc_load() ifdeffery Quentin Schulz
2025-02-24 17:50 ` Marek Vasut
2025-02-25 16:34 ` Mattijs Korpershoek
2025-02-24 10:01 ` [PATCH v3 1/2] env: mmc: Make redundant env in both eMMC boot partitions consider DT properties Quentin Schulz
2025-02-24 17:49 ` Marek Vasut
2025-02-25 9:58 ` Quentin Schulz
2025-02-25 16:30 ` Mattijs Korpershoek
2025-02-28 20:23 ` Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250221184732.202336-2-marex@denx.de \
--to=marex@denx.de \
--cc=dsimic@manjaro.org \
--cc=joe.hershberger@ni.com \
--cc=mkorpershoek@baylibre.com \
--cc=quentin.schulz@cherry.de \
--cc=rasmus.villemoes@prevas.dk \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.