Skip to contentSkip to conversation

physmap: fix mtdconcat support if physmap/mtdconcat were compiled as modules

PATCH In review Dmitry Eremin-Solenikov 3 participants 3 messages Jan 5, 2011 – Jan 10, 2011 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 physmap: fix mtdconcat support if physmap/mtdconcat were compiled as modules

physmap/physmap_of contained compile-time check for mtd concatenation. However thos modules did not consider that mtd concatenation can be built as modules. Fix physmap/physmap_of to also support CONFIG_MTD_CONCAT=m

---
 drivers/mtd/maps/physmap.c    |    4 ++--
 drivers/mtd/maps/physmap_of.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/mtd/maps/physmap.c +2 -2
index 4c18b98..a224afc 100644
@@ -59,7 +59,7 @@ static int physmap_flash_remove(struct platform_device *dev)
 #else
 		del_mtd_device(info->cmtd);
 #endif
-#ifdef CONFIG_MTD_CONCAT
+#if defined(CONFIG_MTD_CONCAT) || (defined(CONFIG_MTD_CONCAT_MODULE) && defined(CONFIG_MTD_PHYSMAP_MODULE))
 		if (info->cmtd != info->mtd[0])
 			mtd_concat_destroy(info->cmtd);
 #endif
@@ -159,7 +159,7 @@ static int physmap_flash_probe(struct platform_device *dev)
 		/*
 		 * We detected multiple devices. Concatenate them together.
 		 */
-#ifdef CONFIG_MTD_CONCAT
+#if defined(CONFIG_MTD_CONCAT) || (defined(CONFIG_MTD_CONCAT_MODULE) && defined(CONFIG_MTD_PHYSMAP_MODULE))
 		info->cmtd = mtd_concat_create(info->mtd, devices_found, dev_name(&dev->dev));
 		if (info->cmtd == NULL)
 			err = -ENXIO;
drivers/mtd/maps/physmap_of.c +2 -2
index 9861814..ffa93e5 100644
@@ -104,7 +104,7 @@ static int of_flash_remove(struct platform_device *dev)
 		return 0;
 	dev_set_drvdata(&dev->dev, NULL);
 
-#ifdef CONFIG_MTD_CONCAT
+#if defined(CONFIG_MTD_CONCAT) || (defined(CONFIG_MTD_CONCAT_MODULE) && defined(CONFIG_MTD_PHYSMAP_OF_MODULE))
 	if (info->cmtd != info->list[0].mtd) {
 		del_mtd_device(info->cmtd);
 		mtd_concat_destroy(info->cmtd);
@@ -336,7 +336,7 @@ static int __devinit of_flash_probe(struct platform_device *dev,
 		/*
 		 * We detected multiple devices. Concatenate them together.
 		 */
-#ifdef CONFIG_MTD_CONCAT
+#if defined(CONFIG_MTD_CONCAT) || (defined(CONFIG_MTD_CONCAT_MODULE) && defined(CONFIG_MTD_PHYSMAP_OF_MODULE))
 		info->cmtd = mtd_concat_create(mtd_list, info->list_size,
 					       dev_name(&dev->dev));
 		if (info->cmtd == NULL)
Signature · 1 line
1.7.2.3
#1 lore raw
Quoted 26 lines · Dmitry Eremin-Solenikov

physmap/physmap_of contained compile-time check for mtd concatenation. However thos modules did not consider that mtd concatenation can be built as modules. Fix physmap/physmap_of to also support CONFIG_MTD_CONCAT=m

---
 drivers/mtd/maps/physmap.c    |    4 ++--
 drivers/mtd/maps/physmap_of.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/mtd/maps/physmap.c +1 -1
index 4c18b98..a224afc 100644
@@ -59,7 +59,7 @@ static int physmap_flash_remove(struct platform_device *dev)
 #else
 		del_mtd_device(info->cmtd);
 #endif
-#ifdef CONFIG_MTD_CONCAT
+#if defined(CONFIG_MTD_CONCAT) || (defined(CONFIG_MTD_CONCAT_MODULE) && defined(CONFIG_MTD_PHYSMAP_MODULE))
 		if (info->cmtd != info->mtd[0])
 			mtd_concat_destroy(info->cmtd);
 #endif

drivers/mtd/maps/physmap.c static int physmap_flash_probe(struct platform_device *dev) · line 162

Quoted 5 lines
drivers/mtd/maps/physmap.c +1 -1
@@ -159,7 +159,7 @@ static int physmap_flash_probe(struct platform_device *dev)
 		/*
 		 * We detected multiple devices. Concatenate them together.
 		 */
-#ifdef CONFIG_MTD_CONCAT
+#if defined(CONFIG_MTD_CONCAT) || (defined(CONFIG_MTD_CONCAT_MODULE) && defined(CONFIG_MTD_PHYSMAP_MODULE))

Can we do something else to avoid these complex ifdefs? I'd vote for making mtdconcat integral part of mtd core and just always have it built-in - remove the Kconfig option and all the ifdefs all over the place. Indeed, this is tiny piece of code, I believe this micro-modules make little sense nowadays.

The same for mtdparts - but this is a different story.

Signature · 2 lines
Best Regards,
Artem Bityutskiy (Битюцкий Артём)
#2 lore raw
Quoted 5 lines · On Wednesday 05 January 2011 10:07:53 Artem Bityutskiy wrote:
Quoted 4 lines · Dmitry Eremin-Solenikov

physmap/physmap_of contained compile-time check for mtd concatenation. However thos modules did not consider that mtd concatenation can be built as modules. Fix physmap/physmap_of to also support CONFIG_MTD_CONCAT=m

<snip>

Quoted 5 lines

Can we do something else to avoid these complex ifdefs? I'd vote for making mtdconcat integral part of mtd core and just always have it built-in - remove the Kconfig option and all the ifdefs all over the place. Indeed, this is tiny piece of code, I believe this micro-modules make little sense nowadays.

Yes, I like this suggestion.

Dmitry, can you cook up such a patch? Otherwise I'll put it on my to-do list...

Quoted 1 line

The same for mtdparts - but this is a different story.

Yep.

Cheers,
Stefan