All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/7] Removing CONFIG_MTD_PARTITIONS
@ 2011-05-12 13:26 Jamie Iles
  2011-05-12 13:26 ` [RFC PATCH 1/7] mtd: always build partitioning support Jamie Iles
                   ` (7 more replies)
  0 siblings, 8 replies; 12+ messages in thread
From: Jamie Iles @ 2011-05-12 13:26 UTC (permalink / raw)
  To: linux-mtd; +Cc: Jamie Iles, dwmw2, dedekind1

This patch series is an RFC for the removal of CONFIG_MTD_PARTITIONS.
Partitioning is still supported, but is always compiled in if CONFIG_MTD is
selected.  To transition, two new symbols are introduced -
mtd_device_{,un}register() that replace add_mtd_device(), add_mtd_partitions()
and their counterparts.  The series converts a number of drivers over to use
these new interfaces and the final patch removes the old symbols.

Note that this patch does not transition all of the drivers so is incomplete
(and not signed off!).  If this approach is suitable then I'll convert all of
the other drivers over.

Jamie Iles (7):
  mtd: always build partitioning support
  mtd: introduce mtd_device_(un)register()
  mtd/physmap: convert to mtd_device_register()
  mtd/nand: convert to mtd_device_unregister()
  nand/gpio: convert to mtd_device_register()
  mtd/plat_nand: convert to mtd_device_register()
  mtd: remove add_mtd_partitions, add_mtd_device and friends

 drivers/mtd/Kconfig            |   18 +-----------------
 drivers/mtd/Makefile           |    3 +--
 drivers/mtd/maps/physmap.c     |   31 +++++--------------------------
 drivers/mtd/mtdcore.c          |   30 +++++++++++++++++++++++++++---
 drivers/mtd/mtdcore.h          |    6 ++++++
 drivers/mtd/mtdpart.c          |    4 ++--
 drivers/mtd/nand/gpio.c        |    5 ++---
 drivers/mtd/nand/nand_base.c   |    7 +------
 drivers/mtd/nand/plat_nand.c   |   14 +++-----------
 include/linux/mtd/mtd.h        |   15 +++++----------
 include/linux/mtd/partitions.h |   11 +----------
 include/linux/mtd/physmap.h    |    4 ----
 12 files changed, 54 insertions(+), 94 deletions(-)

-- 
1.7.4.4

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [RFC PATCH 1/7] mtd: always build partitioning support
  2011-05-12 13:26 [RFC PATCH 0/7] Removing CONFIG_MTD_PARTITIONS Jamie Iles
@ 2011-05-12 13:26 ` Jamie Iles
  2011-05-12 13:26 ` [RFC PATCH 2/7] mtd: introduce mtd_device_(un)register() Jamie Iles
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Jamie Iles @ 2011-05-12 13:26 UTC (permalink / raw)
  To: linux-mtd; +Cc: Jamie Iles, dwmw2, dedekind1

There are very few situations where MTD partitioning is not required,
and the benefit in code size reduction by making this configurable does
not warrant the level of ifdeffery needed.
---
 drivers/mtd/Kconfig     |   17 ++---------------
 drivers/mtd/Makefile    |    3 +--
 include/linux/mtd/mtd.h |    8 --------
 3 files changed, 3 insertions(+), 25 deletions(-)

diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig
index b4567c3..7df4eec 100644
--- a/drivers/mtd/Kconfig
+++ b/drivers/mtd/Kconfig
@@ -34,18 +34,7 @@ config MTD_TESTS
 	  various checks and verifications when loaded.
 
 config MTD_PARTITIONS
-	bool "MTD partitioning support"
-	help
-	  If you have a device which needs to divide its flash chip(s) up
-	  into multiple 'partitions', each of which appears to the user as
-	  a separate MTD device, you require this option to be enabled. If
-	  unsure, say 'Y'.
-
-	  Note, however, that you don't need this option for the DiskOnChip
-	  devices. Partitioning on NFTL 'devices' is a different - that's the
-	  'normal' form of partitioning used on a block device.
-
-if MTD_PARTITIONS
+	bool
 
 config MTD_REDBOOT_PARTS
 	tristate "RedBoot partition table parsing"
@@ -99,7 +88,7 @@ endif # MTD_REDBOOT_PARTS
 
 config MTD_CMDLINE_PARTS
 	bool "Command line partition table parsing"
-	depends on MTD_PARTITIONS = "y" && MTD = "y"
+	depends on MTD = "y"
 	---help---
 	  Allow generic configuration of the MTD partition tables via the kernel
 	  command line. Multiple flash resources are supported for hardware where
@@ -164,8 +153,6 @@ config MTD_AR7_PARTS
 	---help---
 	  TI AR7 partitioning support
 
-endif # MTD_PARTITIONS
-
 comment "User Modules And Translation Layers"
 
 config MTD_CHAR
diff --git a/drivers/mtd/Makefile b/drivers/mtd/Makefile
index d578095..39664c4 100644
--- a/drivers/mtd/Makefile
+++ b/drivers/mtd/Makefile
@@ -4,8 +4,7 @@
 
 # Core functionality.
 obj-$(CONFIG_MTD)		+= mtd.o
-mtd-y				:= mtdcore.o mtdsuper.o mtdconcat.o
-mtd-$(CONFIG_MTD_PARTITIONS)	+= mtdpart.o
+mtd-y				:= mtdcore.o mtdsuper.o mtdconcat.o mtdpart.o
 mtd-$(CONFIG_MTD_OF_PARTS)	+= ofpart.o
 
 obj-$(CONFIG_MTD_REDBOOT_PARTS) += redboot.o
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 9d5306b..7a74942 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -348,15 +348,7 @@ int default_mtd_writev(struct mtd_info *mtd, const struct kvec *vecs,
 int default_mtd_readv(struct mtd_info *mtd, struct kvec *vecs,
 		      unsigned long count, loff_t from, size_t *retlen);
 
-#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
 
 /*
  * Debugging macro and defines
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [RFC PATCH 2/7] mtd: introduce mtd_device_(un)register()
  2011-05-12 13:26 [RFC PATCH 0/7] Removing CONFIG_MTD_PARTITIONS Jamie Iles
  2011-05-12 13:26 ` [RFC PATCH 1/7] mtd: always build partitioning support Jamie Iles
@ 2011-05-12 13:26 ` Jamie Iles
  2011-05-12 13:26 ` [RFC PATCH 3/7] mtd/physmap: convert to mtd_device_register() Jamie Iles
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Jamie Iles @ 2011-05-12 13:26 UTC (permalink / raw)
  To: linux-mtd; +Cc: Jamie Iles, dwmw2, dedekind1

To prepare for the removal of add_mtd_device and add_mtd_partitions(),
introduce mtd_device_register().  This will create partitions if they
are supplied or register the whole device if there are no partitions.

Once all drivers are converted to use mtd_device_register(),
add_mtd_device() and add_mtd_partitions() will be made internal only.
---
 drivers/mtd/mtdcore.c          |   26 ++++++++++++++++++++++++++
 include/linux/mtd/mtd.h        |    6 ++++++
 include/linux/mtd/partitions.h |    2 +-
 3 files changed, 33 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index da69bc8..8e9cf21 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -37,6 +37,7 @@
 #include <linux/gfp.h>
 
 #include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
 
 #include "mtdcore.h"
 /*
@@ -426,6 +427,31 @@ out_error:
 	return ret;
 }
 
+int mtd_device_register(struct mtd_info *master,
+			const struct mtd_partition *parts,
+			int nr_parts)
+{
+	if ((parts && nr_parts <= 0) ||
+	    (!parts && nr_parts >= 0))
+		return -EINVAL;
+
+	return parts ? add_mtd_partitions(master, parts, nr_parts) :
+		add_mtd_device(master);
+}
+EXPORT_SYMBOL_GPL(mtd_device_register);
+
+int mtd_device_unregister(struct mtd_info *master)
+{
+	int err;
+
+	err = del_mtd_partitions(master);
+	if (err)
+		return err;
+
+	return del_mtd_device(master);
+}
+EXPORT_SYMBOL_GPL(mtd_device_unregister);
+
 /**
  *	register_mtd_user - register a 'user' of MTD devices.
  *	@new: pointer to notifier info structure
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 7a74942..8c524a7 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -325,6 +325,12 @@ static inline uint32_t mtd_mod_by_ws(uint64_t sz, struct mtd_info *mtd)
 extern int add_mtd_device(struct mtd_info *mtd);
 extern int del_mtd_device (struct mtd_info *mtd);
 
+struct mtd_partition;
+extern int mtd_device_register(struct mtd_info *master,
+			       const struct mtd_partition *parts,
+			       int nr_parts);
+extern int mtd_device_unregister(struct mtd_info *master);
+
 extern struct mtd_info *get_mtd_device(struct mtd_info *mtd, int num);
 extern int __get_mtd_device(struct mtd_info *mtd);
 extern void __put_mtd_device(struct mtd_info *mtd);
diff --git a/include/linux/mtd/partitions.h b/include/linux/mtd/partitions.h
index 4a0a8ba..998a6cf 100644
--- a/include/linux/mtd/partitions.h
+++ b/include/linux/mtd/partitions.h
@@ -16,7 +16,7 @@
  * Partition definition structure:
  *
  * An array of struct partition is passed along with a MTD object to
- * add_mtd_partitions() to create them.
+ * mtd_device_register() to create them.
  *
  * For each partition, these fields are available:
  * name: string that will be used to label the partition's MTD device.
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [RFC PATCH 3/7] mtd/physmap: convert to mtd_device_register()
  2011-05-12 13:26 [RFC PATCH 0/7] Removing CONFIG_MTD_PARTITIONS Jamie Iles
  2011-05-12 13:26 ` [RFC PATCH 1/7] mtd: always build partitioning support Jamie Iles
  2011-05-12 13:26 ` [RFC PATCH 2/7] mtd: introduce mtd_device_(un)register() Jamie Iles
@ 2011-05-12 13:26 ` Jamie Iles
  2011-05-12 13:26 ` [RFC PATCH 4/7] mtd/nand: convert to mtd_device_unregister() Jamie Iles
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Jamie Iles @ 2011-05-12 13:26 UTC (permalink / raw)
  To: linux-mtd; +Cc: Jamie Iles, dwmw2, dedekind1

---
 drivers/mtd/maps/physmap.c  |   31 +++++--------------------------
 include/linux/mtd/physmap.h |    4 ----
 2 files changed, 5 insertions(+), 30 deletions(-)

diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c
index 7522df4..95d4f85 100644
--- a/drivers/mtd/maps/physmap.c
+++ b/drivers/mtd/maps/physmap.c
@@ -27,10 +27,8 @@ struct physmap_flash_info {
 	struct mtd_info		*mtd[MAX_RESOURCES];
 	struct mtd_info		*cmtd;
 	struct map_info		map[MAX_RESOURCES];
-#ifdef CONFIG_MTD_PARTITIONS
 	int			nr_parts;
 	struct mtd_partition	*parts;
-#endif
 };
 
 static int physmap_flash_remove(struct platform_device *dev)
@@ -47,18 +45,11 @@ static int physmap_flash_remove(struct platform_device *dev)
 	physmap_data = dev->dev.platform_data;
 
 	if (info->cmtd) {
-#ifdef CONFIG_MTD_PARTITIONS
+		mtd_device_unregister(info->cmtd);
 		if (info->nr_parts || physmap_data->nr_parts) {
-			del_mtd_partitions(info->cmtd);
-
 			if (info->nr_parts)
 				kfree(info->parts);
-		} else {
-			del_mtd_device(info->cmtd);
 		}
-#else
-		del_mtd_device(info->cmtd);
-#endif
 		if (info->cmtd != info->mtd[0])
 			mtd_concat_destroy(info->cmtd);
 	}
@@ -76,9 +67,7 @@ static const char *rom_probe_types[] = {
 					"qinfo_probe",
 					"map_rom",
 					NULL };
-#ifdef CONFIG_MTD_PARTITIONS
 static const char *part_probe_types[] = { "cmdlinepart", "RedBoot", NULL };
-#endif
 
 static int physmap_flash_probe(struct platform_device *dev)
 {
@@ -164,24 +153,16 @@ static int physmap_flash_probe(struct platform_device *dev)
 	if (err)
 		goto err_out;
 
-#ifdef CONFIG_MTD_PARTITIONS
 	err = parse_mtd_partitions(info->cmtd, part_probe_types,
-				&info->parts, 0);
+				   &info->parts, 0);
 	if (err > 0) {
-		add_mtd_partitions(info->cmtd, info->parts, err);
+		mtd_device_register(info->cmtd, info->parts, err);
 		info->nr_parts = err;
 		return 0;
 	}
 
-	if (physmap_data->nr_parts) {
-		printk(KERN_NOTICE "Using physmap partition information\n");
-		add_mtd_partitions(info->cmtd, physmap_data->parts,
-				   physmap_data->nr_parts);
-		return 0;
-	}
-#endif
-
-	add_mtd_device(info->cmtd);
+	mtd_device_register(info->cmtd, physmap_data->parts,
+			    physmap_data->nr_parts);
 	return 0;
 
 err_out:
@@ -245,14 +226,12 @@ void physmap_configure(unsigned long addr, unsigned long size,
 	physmap_flash_data.set_vpp = set_vpp;
 }
 
-#ifdef CONFIG_MTD_PARTITIONS
 void physmap_set_partitions(struct mtd_partition *parts, int num_parts)
 {
 	physmap_flash_data.nr_parts = num_parts;
 	physmap_flash_data.parts = parts;
 }
 #endif
-#endif
 
 static int __init physmap_init(void)
 {
diff --git a/include/linux/mtd/physmap.h b/include/linux/mtd/physmap.h
index bcfd9f7..e963b86 100644
--- a/include/linux/mtd/physmap.h
+++ b/include/linux/mtd/physmap.h
@@ -35,8 +35,6 @@ struct physmap_flash_data {
 void physmap_configure(unsigned long addr, unsigned long size,
 		int bankwidth, void (*set_vpp)(struct map_info *, int) );
 
-#ifdef CONFIG_MTD_PARTITIONS
-
 /*
  * Machines that wish to do flash partition may want to call this function in
  * their setup routine.
@@ -48,6 +46,4 @@ void physmap_configure(unsigned long addr, unsigned long size,
  */
 void physmap_set_partitions(struct mtd_partition *parts, int num_parts);
 
-#endif /* defined(CONFIG_MTD_PARTITIONS) */
-
 #endif /* __LINUX_MTD_PHYSMAP__ */
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [RFC PATCH 4/7] mtd/nand: convert to mtd_device_unregister()
  2011-05-12 13:26 [RFC PATCH 0/7] Removing CONFIG_MTD_PARTITIONS Jamie Iles
                   ` (2 preceding siblings ...)
  2011-05-12 13:26 ` [RFC PATCH 3/7] mtd/physmap: convert to mtd_device_register() Jamie Iles
@ 2011-05-12 13:26 ` Jamie Iles
  2011-05-12 13:26 ` [RFC PATCH 5/7] nand/gpio: convert to mtd_device_register() Jamie Iles
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Jamie Iles @ 2011-05-12 13:26 UTC (permalink / raw)
  To: linux-mtd; +Cc: Jamie Iles, dwmw2, dedekind1

---
 drivers/mtd/nand/nand_base.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index c54a4cb..46be430 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -3539,12 +3539,7 @@ void nand_release(struct mtd_info *mtd)
 	if (chip->ecc.mode == NAND_ECC_SOFT_BCH)
 		nand_bch_free((struct nand_bch_control *)chip->ecc.priv);
 
-#ifdef CONFIG_MTD_PARTITIONS
-	/* Deregister partitions */
-	del_mtd_partitions(mtd);
-#endif
-	/* Deregister the device */
-	del_mtd_device(mtd);
+	mtd_device_unregister(mtd);
 
 	/* Free bad block table memory */
 	kfree(chip->bbt);
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [RFC PATCH 5/7] nand/gpio: convert to mtd_device_register()
  2011-05-12 13:26 [RFC PATCH 0/7] Removing CONFIG_MTD_PARTITIONS Jamie Iles
                   ` (3 preceding siblings ...)
  2011-05-12 13:26 ` [RFC PATCH 4/7] mtd/nand: convert to mtd_device_unregister() Jamie Iles
@ 2011-05-12 13:26 ` Jamie Iles
  2011-05-12 13:26 ` [RFC PATCH 6/7] mtd/plat_nand: " Jamie Iles
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Jamie Iles @ 2011-05-12 13:26 UTC (permalink / raw)
  To: linux-mtd; +Cc: Jamie Iles, dwmw2, dedekind1

---
 drivers/mtd/nand/gpio.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/nand/gpio.c b/drivers/mtd/nand/gpio.c
index 0cde618..914fe56 100644
--- a/drivers/mtd/nand/gpio.c
+++ b/drivers/mtd/nand/gpio.c
@@ -25,7 +25,6 @@
 #include <linux/io.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/nand.h>
-#include <linux/mtd/partitions.h>
 #include <linux/mtd/nand-gpio.h>
 
 struct gpiomtd {
@@ -316,8 +315,8 @@ static int __devinit gpio_nand_probe(struct platform_device *dev)
 		gpiomtd->plat.adjust_parts(&gpiomtd->plat,
 					   gpiomtd->mtd_info.size);
 
-	add_mtd_partitions(&gpiomtd->mtd_info, gpiomtd->plat.parts,
-			   gpiomtd->plat.num_parts);
+	mtd_device_register(&gpiomtd->mtd_info, gpiomtd->plat.parts,
+			    gpiomtd->plat.num_parts);
 	platform_set_drvdata(dev, gpiomtd);
 
 	return 0;
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [RFC PATCH 6/7] mtd/plat_nand: convert to mtd_device_register()
  2011-05-12 13:26 [RFC PATCH 0/7] Removing CONFIG_MTD_PARTITIONS Jamie Iles
                   ` (4 preceding siblings ...)
  2011-05-12 13:26 ` [RFC PATCH 5/7] nand/gpio: convert to mtd_device_register() Jamie Iles
@ 2011-05-12 13:26 ` Jamie Iles
  2011-05-12 13:26 ` [RFC PATCH 7/7] mtd: remove add_mtd_partitions, add_mtd_device and friends Jamie Iles
  2011-05-16 13:04 ` [RFC PATCH 0/7] Removing CONFIG_MTD_PARTITIONS Artem Bityutskiy
  7 siblings, 0 replies; 12+ messages in thread
From: Jamie Iles @ 2011-05-12 13:26 UTC (permalink / raw)
  To: linux-mtd; +Cc: Jamie Iles, dwmw2, dedekind1

---
 drivers/mtd/nand/plat_nand.c |   14 +++-----------
 1 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/drivers/mtd/nand/plat_nand.c b/drivers/mtd/nand/plat_nand.c
index caf5a73..e28bd03 100644
--- a/drivers/mtd/nand/plat_nand.c
+++ b/drivers/mtd/nand/plat_nand.c
@@ -21,10 +21,8 @@ struct plat_nand_data {
 	struct nand_chip	chip;
 	struct mtd_info		mtd;
 	void __iomem		*io_base;
-#ifdef CONFIG_MTD_PARTITIONS
 	int			nr_parts;
 	struct mtd_partition	*parts;
-#endif
 };
 
 /*
@@ -101,7 +99,6 @@ static int __devinit plat_nand_probe(struct platform_device *pdev)
 		goto out;
 	}
 
-#ifdef CONFIG_MTD_PARTITIONS
 	if (pdata->chip.part_probe_types) {
 		err = parse_mtd_partitions(&data->mtd,
 					pdata->chip.part_probe_types,
@@ -113,14 +110,11 @@ static int __devinit plat_nand_probe(struct platform_device *pdev)
 	}
 	if (pdata->chip.set_parts)
 		pdata->chip.set_parts(data->mtd.size, &pdata->chip);
-	if (pdata->chip.partitions) {
+	if (pdata->chip.partitions)
 		data->parts = pdata->chip.partitions;
-		err = add_mtd_partitions(&data->mtd, data->parts,
-			pdata->chip.nr_partitions);
-	} else
-#endif
-	err = add_mtd_device(&data->mtd);
 
+	err = mtd_device_register(&data->mtd, data->parts,
+				  pdata->chip.nr_partitions);
 	if (!err)
 		return err;
 
@@ -149,10 +143,8 @@ static int __devexit plat_nand_remove(struct platform_device *pdev)
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 
 	nand_release(&data->mtd);
-#ifdef CONFIG_MTD_PARTITIONS
 	if (data->parts && data->parts != pdata->chip.partitions)
 		kfree(data->parts);
-#endif
 	if (pdata->ctrl.remove)
 		pdata->ctrl.remove(pdev);
 	iounmap(data->io_base);
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [RFC PATCH 7/7] mtd: remove add_mtd_partitions, add_mtd_device and friends
  2011-05-12 13:26 [RFC PATCH 0/7] Removing CONFIG_MTD_PARTITIONS Jamie Iles
                   ` (5 preceding siblings ...)
  2011-05-12 13:26 ` [RFC PATCH 6/7] mtd/plat_nand: " Jamie Iles
@ 2011-05-12 13:26 ` Jamie Iles
  2011-05-16 13:04 ` [RFC PATCH 0/7] Removing CONFIG_MTD_PARTITIONS Artem Bityutskiy
  7 siblings, 0 replies; 12+ messages in thread
From: Jamie Iles @ 2011-05-12 13:26 UTC (permalink / raw)
  To: linux-mtd; +Cc: Jamie Iles, dwmw2, dedekind1

These symbols are replaced with mtd_device_register() (and removal with
mtd_device_unregister()) for public registration.

Now that we are completely converted over we can also remove
CONFIG_MTD_PARTITIONS.
---
 drivers/mtd/Kconfig            |    3 ---
 drivers/mtd/mtdcore.c          |    4 +---
 drivers/mtd/mtdcore.h          |    6 ++++++
 drivers/mtd/mtdpart.c          |    4 ++--
 include/linux/mtd/mtd.h        |    3 ---
 include/linux/mtd/partitions.h |    9 ---------
 6 files changed, 9 insertions(+), 20 deletions(-)

diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig
index 7df4eec..62b4fdb 100644
--- a/drivers/mtd/Kconfig
+++ b/drivers/mtd/Kconfig
@@ -33,9 +33,6 @@ config MTD_TESTS
 	  should normally be compiled as kernel modules. The modules perform
 	  various checks and verifications when loaded.
 
-config MTD_PARTITIONS
-	bool
-
 config MTD_REDBOOT_PARTS
 	tristate "RedBoot partition table parsing"
 	---help---
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index 8e9cf21..37f7dc1 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -392,7 +392,7 @@ fail_locked:
  *	if the requested device does not appear to be present in the list.
  */
 
-int del_mtd_device (struct mtd_info *mtd)
+int del_mtd_device(struct mtd_info *mtd)
 {
 	int ret;
 	struct mtd_notifier *not;
@@ -664,8 +664,6 @@ int default_mtd_writev(struct mtd_info *mtd, const struct kvec *vecs,
 	return ret;
 }
 
-EXPORT_SYMBOL_GPL(add_mtd_device);
-EXPORT_SYMBOL_GPL(del_mtd_device);
 EXPORT_SYMBOL_GPL(get_mtd_device);
 EXPORT_SYMBOL_GPL(get_mtd_device_nm);
 EXPORT_SYMBOL_GPL(__get_mtd_device);
diff --git a/drivers/mtd/mtdcore.h b/drivers/mtd/mtdcore.h
index 6a64fde..0ed6126 100644
--- a/drivers/mtd/mtdcore.h
+++ b/drivers/mtd/mtdcore.h
@@ -10,6 +10,12 @@
 extern struct mutex mtd_table_mutex;
 extern struct mtd_info *__mtd_next_device(int i);
 
+extern int add_mtd_device(struct mtd_info *mtd);
+extern int del_mtd_device(struct mtd_info *mtd);
+extern int add_mtd_partitions(struct mtd_info *, const struct mtd_partition *,
+			      int);
+extern int del_mtd_partitions(struct mtd_info *);
+
 #define mtd_for_each_device(mtd)			\
 	for ((mtd) = __mtd_next_device(0);		\
 	     (mtd) != NULL;				\
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index 0a47601..3d2bcf4 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -31,6 +31,8 @@
 #include <linux/mtd/partitions.h>
 #include <linux/err.h>
 
+#include "mtdcore.h"
+
 /* Our partition linked list */
 static LIST_HEAD(mtd_partitions);
 static DEFINE_MUTEX(mtd_partitions_mutex);
@@ -376,7 +378,6 @@ int del_mtd_partitions(struct mtd_info *master)
 
 	return err;
 }
-EXPORT_SYMBOL(del_mtd_partitions);
 
 static struct mtd_part *allocate_partition(struct mtd_info *master,
 			const struct mtd_partition *part, int partno,
@@ -671,7 +672,6 @@ int add_mtd_partitions(struct mtd_info *master,
 
 	return 0;
 }
-EXPORT_SYMBOL(add_mtd_partitions);
 
 static DEFINE_SPINLOCK(part_parser_lock);
 static LIST_HEAD(part_parsers);
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 8c524a7..e1706c1 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -322,9 +322,6 @@ static inline uint32_t mtd_mod_by_ws(uint64_t sz, struct mtd_info *mtd)
 
 	/* Kernel-side ioctl definitions */
 
-extern int add_mtd_device(struct mtd_info *mtd);
-extern int del_mtd_device (struct mtd_info *mtd);
-
 struct mtd_partition;
 extern int mtd_device_register(struct mtd_info *master,
 			       const struct mtd_partition *parts,
diff --git a/include/linux/mtd/partitions.h b/include/linux/mtd/partitions.h
index 998a6cf..724c4aa 100644
--- a/include/linux/mtd/partitions.h
+++ b/include/linux/mtd/partitions.h
@@ -49,9 +49,6 @@ struct mtd_partition {
 
 struct mtd_info;
 
-int add_mtd_partitions(struct mtd_info *, const struct mtd_partition *, int);
-int del_mtd_partitions(struct mtd_info *);
-
 /*
  * Functions dealing with the various ways of partitioning the space
  */
@@ -77,12 +74,6 @@ int __devinit of_mtd_parse_partitions(struct device *dev,
                                       struct device_node *node,
                                       struct mtd_partition **pparts);
 
-#ifdef CONFIG_MTD_PARTITIONS
-static inline int mtd_has_partitions(void) { return 1; }
-#else
-static inline int mtd_has_partitions(void) { return 0; }
-#endif
-
 #ifdef CONFIG_MTD_CMDLINE_PARTS
 static inline int mtd_has_cmdlinepart(void) { return 1; }
 #else
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [RFC PATCH 0/7] Removing CONFIG_MTD_PARTITIONS
  2011-05-12 13:26 [RFC PATCH 0/7] Removing CONFIG_MTD_PARTITIONS Jamie Iles
                   ` (6 preceding siblings ...)
  2011-05-12 13:26 ` [RFC PATCH 7/7] mtd: remove add_mtd_partitions, add_mtd_device and friends Jamie Iles
@ 2011-05-16 13:04 ` Artem Bityutskiy
  2011-05-16 14:37   ` Jamie Iles
  7 siblings, 1 reply; 12+ messages in thread
From: Artem Bityutskiy @ 2011-05-16 13:04 UTC (permalink / raw)
  To: Jamie Iles; +Cc: dwmw2, linux-mtd

On Thu, 2011-05-12 at 14:26 +0100, Jamie Iles wrote:
> This patch series is an RFC for the removal of CONFIG_MTD_PARTITIONS.
> Partitioning is still supported, but is always compiled in if CONFIG_MTD is
> selected.  To transition, two new symbols are introduced -
> mtd_device_{,un}register() that replace add_mtd_device(), add_mtd_partitions()
> and their counterparts.  The series converts a number of drivers over to use
> these new interfaces and the final patch removes the old symbols.
> 
> Note that this patch does not transition all of the drivers so is incomplete
> (and not signed off!).  If this approach is suitable then I'll convert all of
> the other drivers over.

Jamie, looks very good at the first glance, thanks a lot!

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [RFC PATCH 0/7] Removing CONFIG_MTD_PARTITIONS
  2011-05-16 13:04 ` [RFC PATCH 0/7] Removing CONFIG_MTD_PARTITIONS Artem Bityutskiy
@ 2011-05-16 14:37   ` Jamie Iles
  2011-05-19  5:44     ` Jamie Iles
  0 siblings, 1 reply; 12+ messages in thread
From: Jamie Iles @ 2011-05-16 14:37 UTC (permalink / raw)
  To: Artem Bityutskiy; +Cc: Jamie Iles, linux-mtd, dwmw2

On Mon, May 16, 2011 at 04:04:20PM +0300, Artem Bityutskiy wrote:
> On Thu, 2011-05-12 at 14:26 +0100, Jamie Iles wrote:
> > This patch series is an RFC for the removal of CONFIG_MTD_PARTITIONS.
> > Partitioning is still supported, but is always compiled in if CONFIG_MTD is
> > selected.  To transition, two new symbols are introduced -
> > mtd_device_{,un}register() that replace add_mtd_device(), add_mtd_partitions()
> > and their counterparts.  The series converts a number of drivers over to use
> > these new interfaces and the final patch removes the old symbols.
> > 
> > Note that this patch does not transition all of the drivers so is incomplete
> > (and not signed off!).  If this approach is suitable then I'll convert all of
> > the other drivers over.
> 
> Jamie, looks very good at the first glance, thanks a lot!

Great!  I'm travelling at the moment so can't complete the series, but 
I'll aim to do the full series over the next few weeks and repost.  
Thanks for taking the time to look at it.

Jamie

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [RFC PATCH 0/7] Removing CONFIG_MTD_PARTITIONS
  2011-05-16 14:37   ` Jamie Iles
@ 2011-05-19  5:44     ` Jamie Iles
  2011-05-20  5:50       ` Artem Bityutskiy
  0 siblings, 1 reply; 12+ messages in thread
From: Jamie Iles @ 2011-05-19  5:44 UTC (permalink / raw)
  To: Artem Bityutskiy; +Cc: dwmw2, linux-mtd

On Mon, May 16, 2011 at 03:37:10PM +0100, Jamie Iles wrote:
> On Mon, May 16, 2011 at 04:04:20PM +0300, Artem Bityutskiy wrote:
> > On Thu, 2011-05-12 at 14:26 +0100, Jamie Iles wrote:
> > > This patch series is an RFC for the removal of CONFIG_MTD_PARTITIONS.
> > > Partitioning is still supported, but is always compiled in if CONFIG_MTD is
> > > selected.  To transition, two new symbols are introduced -
> > > mtd_device_{,un}register() that replace add_mtd_device(), add_mtd_partitions()
> > > and their counterparts.  The series converts a number of drivers over to use
> > > these new interfaces and the final patch removes the old symbols.
> > > 
> > > Note that this patch does not transition all of the drivers so is incomplete
> > > (and not signed off!).  If this approach is suitable then I'll convert all of
> > > the other drivers over.
> > 
> > Jamie, looks very good at the first glance, thanks a lot!
> 
> Great!  I'm travelling at the moment so can't complete the series, but 
> I'll aim to do the full series over the next few weeks and repost.  
> Thanks for taking the time to look at it.

Artem, with regards to submitting a series for this, how would you 
prefer it?  I imagined a few patches for the core MTD stuff then one per 
driver to remove the CONFIG_MTD_PARTITIONS preprocessor and convert to 
mtd_device_register().

There are other drivers that don't use CONFIG_MTD_PARTITIONS but use 
add_mtd_device()/add_mtd_partitions() etc so these just need a 
substitution for mtd_device_register().  Are these last ones OK as one 
patch or one per driver?

Jamie

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [RFC PATCH 0/7] Removing CONFIG_MTD_PARTITIONS
  2011-05-19  5:44     ` Jamie Iles
@ 2011-05-20  5:50       ` Artem Bityutskiy
  0 siblings, 0 replies; 12+ messages in thread
From: Artem Bityutskiy @ 2011-05-20  5:50 UTC (permalink / raw)
  To: Jamie Iles; +Cc: dwmw2, linux-mtd

On Thu, 2011-05-19 at 06:44 +0100, Jamie Iles wrote:
> On Mon, May 16, 2011 at 03:37:10PM +0100, Jamie Iles wrote:
> > On Mon, May 16, 2011 at 04:04:20PM +0300, Artem Bityutskiy wrote:
> > > On Thu, 2011-05-12 at 14:26 +0100, Jamie Iles wrote:
> > > > This patch series is an RFC for the removal of CONFIG_MTD_PARTITIONS.
> > > > Partitioning is still supported, but is always compiled in if CONFIG_MTD is
> > > > selected.  To transition, two new symbols are introduced -
> > > > mtd_device_{,un}register() that replace add_mtd_device(), add_mtd_partitions()
> > > > and their counterparts.  The series converts a number of drivers over to use
> > > > these new interfaces and the final patch removes the old symbols.
> > > > 
> > > > Note that this patch does not transition all of the drivers so is incomplete
> > > > (and not signed off!).  If this approach is suitable then I'll convert all of
> > > > the other drivers over.
> > > 
> > > Jamie, looks very good at the first glance, thanks a lot!
> > 
> > Great!  I'm travelling at the moment so can't complete the series, but 
> > I'll aim to do the full series over the next few weeks and repost.  
> > Thanks for taking the time to look at it.
> 
> Artem, with regards to submitting a series for this, how would you 
> prefer it?  I imagined a few patches for the core MTD stuff then one per 
> driver to remove the CONFIG_MTD_PARTITIONS preprocessor and convert to 
> mtd_device_register().

Yes.

> There are other drivers that don't use CONFIG_MTD_PARTITIONS but use 
> add_mtd_device()/add_mtd_partitions() etc so these just need a 
> substitution for mtd_device_register().  Are these last ones OK as one 
> patch or one per driver?

If the patch is about mechanical substitution I think one patch for all
is better.

Sorry for long response, I suggest you to just send patches as you
think, if people do not like something - you'll get a response. I takes
too much time to wait for my response. We still have chances to get into
2.6.40 with these changes if you are fast.

Please, base your patches on top of my l2 tree:
git://git.infradead.org/users/dedekind/l2-mtd-2.6.git

Also, try to take a look at linux-next - at least Russel's arm tree
should have changes which will conflict with yours. 

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2011-05-20  5:54 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-12 13:26 [RFC PATCH 0/7] Removing CONFIG_MTD_PARTITIONS Jamie Iles
2011-05-12 13:26 ` [RFC PATCH 1/7] mtd: always build partitioning support Jamie Iles
2011-05-12 13:26 ` [RFC PATCH 2/7] mtd: introduce mtd_device_(un)register() Jamie Iles
2011-05-12 13:26 ` [RFC PATCH 3/7] mtd/physmap: convert to mtd_device_register() Jamie Iles
2011-05-12 13:26 ` [RFC PATCH 4/7] mtd/nand: convert to mtd_device_unregister() Jamie Iles
2011-05-12 13:26 ` [RFC PATCH 5/7] nand/gpio: convert to mtd_device_register() Jamie Iles
2011-05-12 13:26 ` [RFC PATCH 6/7] mtd/plat_nand: " Jamie Iles
2011-05-12 13:26 ` [RFC PATCH 7/7] mtd: remove add_mtd_partitions, add_mtd_device and friends Jamie Iles
2011-05-16 13:04 ` [RFC PATCH 0/7] Removing CONFIG_MTD_PARTITIONS Artem Bityutskiy
2011-05-16 14:37   ` Jamie Iles
2011-05-19  5:44     ` Jamie Iles
2011-05-20  5:50       ` Artem Bityutskiy

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.