[U-Boot] [PATCH v2 24/24] mtd: drop CONFIG_MTD_PARTITIONS

Miquel Raynal miquel.raynal at bootlin.com
Wed Nov 28 23:08:00 UTC 2018


There is no point in compiling mtdparts.c only in certain
circumstances. Whether MTD is needed and it will be built, or MTD is
not needed and the file will be ignored.

Signed-off-by: Miquel Raynal <miquel.raynal at bootlin.com>
---
 cmd/Kconfig                               |  3 ---
 drivers/mtd/Kconfig                       |  3 ---
 drivers/mtd/Makefile                      |  3 +--
 drivers/mtd/mtd_uboot.c                   |  9 ---------
 drivers/mtd/nand/raw/nand_base.c          |  2 --
 drivers/mtd/ubi/Kconfig                   |  1 -
 include/configs/microblaze-generic.h      |  6 ------
 include/configs/mvebu_armada-37xx.h       |  1 -
 include/configs/socfpga_stratix10_socdk.h |  1 -
 include/linux/mtd/mtd.h                   |  8 --------
 include/linux/mtd/partitions.h            | 17 -----------------
 11 files changed, 1 insertion(+), 53 deletions(-)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 717e814c56..08a2c27ac2 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -869,7 +869,6 @@ config CMD_MMC_SWRITE
 config CMD_MTD
 	bool "mtd"
 	depends on MTD
-	select MTD_PARTITIONS
 	help
 	  MTD commands support.
 
@@ -1749,14 +1748,12 @@ config CMD_MTDPARTS
 
 config MTDIDS_DEFAULT
 	string "Default MTD IDs"
-	depends on MTD_PARTITIONS || CMD_MTDPARTS || CMD_NAND || CMD_FLASH
 	help
 	  Defines a default MTD IDs list for use with MTD partitions in the
 	  Linux MTD command line partitions format.
 
 config MTDPARTS_DEFAULT
 	string "Default MTD partition scheme"
-	depends on MTD_PARTITIONS || CMD_MTDPARTS || CMD_NAND || CMD_FLASH
 	help
 	  Defines a default MTD partitioning scheme in the Linux MTD command
 	  line partitions format
diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig
index 0832f5b411..c4b17f87fe 100644
--- a/drivers/mtd/Kconfig
+++ b/drivers/mtd/Kconfig
@@ -1,8 +1,5 @@
 menu "MTD Support"
 
-config MTD_PARTITIONS
-	bool
-
 config MTD
 	bool "Enable MTD layer"
 	help
diff --git a/drivers/mtd/Makefile b/drivers/mtd/Makefile
index fc4c7e0d1f..7574084f36 100644
--- a/drivers/mtd/Makefile
+++ b/drivers/mtd/Makefile
@@ -3,9 +3,8 @@
 # (C) Copyright 2000-2007
 # Wolfgang Denk, DENX Software Engineering, wd at denx.de.
 
-obj-$(CONFIG_MTD) += mtdcore.o mtd_uboot.o
+obj-$(CONFIG_MTD) += mtdcore.o mtdpart.o mtd_uboot.o
 obj-$(CONFIG_DM_MTD) += mtd-uclass.o
-obj-$(CONFIG_MTD_PARTITIONS) += mtdpart.o
 obj-$(CONFIG_MTD_CONCAT) += mtdconcat.o
 obj-$(CONFIG_ALTERA_QSPI) += altera_qspi.o
 obj-$(CONFIG_FLASH_CFI_DRIVER) += cfi_flash.o
diff --git a/drivers/mtd/mtd_uboot.c b/drivers/mtd/mtd_uboot.c
index cce162461b..9c8325546d 100644
--- a/drivers/mtd/mtd_uboot.c
+++ b/drivers/mtd/mtd_uboot.c
@@ -91,7 +91,6 @@ static void mtd_probe_uclass_mtd_devs(void)
 static void mtd_probe_uclass_mtd_devs(void) { }
 #endif
 
-#if defined(CONFIG_MTD_PARTITIONS)
 extern void board_mtdparts_default(const char **mtdids,
 				   const char **mtdparts);
 
@@ -283,14 +282,6 @@ int mtd_probe_devices(void)
 
 	return 0;
 }
-#else
-int mtd_probe_devices(void)
-{
-	mtd_probe_uclass_mtd_devs();
-
-	return 0;
-}
-#endif /* defined(CONFIG_MTD_PARTITIONS) */
 
 /* Legacy */
 
diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
index 92daebe120..0d56dc7b3b 100644
--- a/drivers/mtd/nand/raw/nand_base.c
+++ b/drivers/mtd/nand/raw/nand_base.c
@@ -40,9 +40,7 @@
 #include <linux/mtd/rawnand.h>
 #include <linux/mtd/nand_ecc.h>
 #include <linux/mtd/nand_bch.h>
-#ifdef CONFIG_MTD_PARTITIONS
 #include <linux/mtd/partitions.h>
-#endif
 #include <asm/io.h>
 #include <linux/errno.h>
 
diff --git a/drivers/mtd/ubi/Kconfig b/drivers/mtd/ubi/Kconfig
index cf84783356..db1409c9d4 100644
--- a/drivers/mtd/ubi/Kconfig
+++ b/drivers/mtd/ubi/Kconfig
@@ -11,7 +11,6 @@ config MTD_UBI
 	bool "Enable UBI - Unsorted block images"
 	select CRC32
 	select RBTREE
-	select MTD_PARTITIONS
 	help
 	  UBI is a software layer above MTD layer which admits of LVM-like
 	  logical volumes on top of MTD devices, hides some complexities of
diff --git a/include/configs/microblaze-generic.h b/include/configs/microblaze-generic.h
index ba0952c73c..18c9bf15f9 100644
--- a/include/configs/microblaze-generic.h
+++ b/include/configs/microblaze-generic.h
@@ -128,12 +128,6 @@
  */
 #define CONFIG_BOOTP_BOOTFILESIZE
 
-#if defined(CONFIG_MTD_PARTITIONS)
-/* MTD partitions */
-
-/* default mtd partition table */
-#endif
-
 /* size of console buffer */
 #define	CONFIG_SYS_CBSIZE	512
 /* max number of command args */
diff --git a/include/configs/mvebu_armada-37xx.h b/include/configs/mvebu_armada-37xx.h
index 640267c9c2..04083f4404 100644
--- a/include/configs/mvebu_armada-37xx.h
+++ b/include/configs/mvebu_armada-37xx.h
@@ -64,7 +64,6 @@
 #define CONFIG_SF_DEFAULT_SPEED		1000000
 #define CONFIG_SF_DEFAULT_MODE		SPI_MODE_0
 #define CONFIG_ENV_SPI_MODE		CONFIG_SF_DEFAULT_MODE
-#define CONFIG_MTD_PARTITIONS		/* required for UBI partition support */
 
 /* Environment in SPI NOR flash */
 #define CONFIG_ENV_OFFSET		0x180000 /* as Marvell U-Boot version */
diff --git a/include/configs/socfpga_stratix10_socdk.h b/include/configs/socfpga_stratix10_socdk.h
index 967784e379..bc1fe0ede6 100644
--- a/include/configs/socfpga_stratix10_socdk.h
+++ b/include/configs/socfpga_stratix10_socdk.h
@@ -76,7 +76,6 @@
 #endif /* CONFIG_ENV_IS_IN_SPI_FLASH */
 
 #ifndef CONFIG_SPL_BUILD
-#define CONFIG_MTD_PARTITIONS
 #define MTDIDS_DEFAULT			"nor0=ff705000.spi.0"
 #endif /* CONFIG_SPL_BUILD */
 
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 68e5915324..993dc102c0 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -534,15 +534,7 @@ extern int unregister_mtd_user (struct mtd_notifier *old);
 #endif
 void *mtd_kmalloc_up_to(const struct mtd_info *mtd, size_t *size);
 
-#ifdef CONFIG_MTD_PARTITIONS
 void mtd_erase_callback(struct erase_info *instr);
-#else
-static inline void mtd_erase_callback(struct erase_info *instr)
-{
-	if (instr->callback)
-		instr->callback(instr);
-}
-#endif
 
 static inline int mtd_is_bitflip(int err) {
 	return err == -EUCLEAN;
diff --git a/include/linux/mtd/partitions.h b/include/linux/mtd/partitions.h
index 3822237f2a..e44cf77666 100644
--- a/include/linux/mtd/partitions.h
+++ b/include/linux/mtd/partitions.h
@@ -85,26 +85,9 @@ int mtd_add_partition(struct mtd_info *master, const char *name,
 		      long long offset, long long length);
 int mtd_del_partition(struct mtd_info *master, int partno);
 uint64_t mtd_get_device_size(const struct mtd_info *mtd);
-
-#if defined(CONFIG_MTD_PARTITIONS)
 int mtd_parse_partitions(struct mtd_info *parent, const char **_mtdparts,
 			 struct mtd_partition **_parts, int *_nparts);
 void mtd_free_parsed_partitions(struct mtd_partition *parts,
 				unsigned int nparts);
-#else
-static inline int
-mtd_parse_partitions(struct mtd_info *parent, const char **_mtdparts,
-		     struct mtd_partition **_parts, int *_nparts)
-{
-	*_nparts = 0;
-
-	return 0;
-}
-static inline void
-mtd_free_parsed_partitions(struct mtd_partition *parts, unsigned int nparts)
-{
-	return;
-}
-#endif /* defined(MTD_PARTITIONS) */
 
 #endif
-- 
2.19.1



More information about the U-Boot mailing list