[PATCH 1/2] mmc: remove duplicate mmc_get_env_dev() implementations

David Woodhouse dwmw2 at infradead.org
Tue Aug 4 11:05:46 CEST 2020


Since it's so trivial I could just about tolerate this when there were only
two copies of it. But now there are about to be three.

Signed-off-by: David Woodhouse <dwmw2 at infradead.org>
---
 drivers/mmc/mmc.c | 9 +++++++++
 env/fat.c         | 9 ---------
 env/mmc.c         | 9 ---------
 3 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index d79cdef62e..11ce110df3 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -3111,3 +3111,12 @@ int mmc_set_bkops_enable(struct mmc *mmc)
 	return 0;
 }
 #endif
+
+__weak int mmc_get_env_dev(void)
+{
+#ifdef CONFIG_SYS_MMC_ENV_DEV
+	return CONFIG_SYS_MMC_ENV_DEV;
+#else
+	return 0;
+#endif
+}
diff --git a/env/fat.c b/env/fat.c
index 71bf8bfa18..653a38fd93 100644
--- a/env/fat.c
+++ b/env/fat.c
@@ -29,15 +29,6 @@
 # define LOADENV
 #endif
 
-__weak int mmc_get_env_dev(void)
-{
-#ifdef CONFIG_SYS_MMC_ENV_DEV
-	return CONFIG_SYS_MMC_ENV_DEV;
-#else
-	return 0;
-#endif
-}
-
 static char *env_fat_device_and_part(void)
 {
 #ifdef CONFIG_MMC
diff --git a/env/mmc.c b/env/mmc.c
index af7e5fbac3..4e67180b23 100644
--- a/env/mmc.c
+++ b/env/mmc.c
@@ -24,15 +24,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#if !defined(CONFIG_SYS_MMC_ENV_DEV)
-#define CONFIG_SYS_MMC_ENV_DEV 0
-#endif
-
-__weak int mmc_get_env_dev(void)
-{
-	return CONFIG_SYS_MMC_ENV_DEV;
-}
-
 #if CONFIG_IS_ENABLED(OF_CONTROL)
 static inline int mmc_offset_try_partition(const char *str, int copy, s64 *val)
 {
-- 
2.26.2



More information about the U-Boot mailing list