Skip to contentSkip to conversation

mtd/maps: uclinux: fix building when partition support is disabled

PATCH NAK Mike Frysinger 6 participants 22 messages May 26, 2009 – Jun 10, 2009 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 mtd/maps: uclinux: fix building when partition support is disabled

From: Timofei Bondarenko <[email protected]>

The uClinux map driver doesn't even use partitions, so we shouldn't require it in order to work properly.

---
 drivers/mtd/maps/uclinux.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
drivers/mtd/maps/uclinux.c +8 -0
index 81756e3..57699c2 100644
@@ -87,7 +87,11 @@ static int __init uclinux_mtd_init(void)
 	mtd->priv = mapp;
 
 	uclinux_ram_mtdinfo = mtd;
+#ifdef CONFIG_MTD_PARTITIONS
 	add_mtd_partitions(mtd, uclinux_romfs, NUM_PARTITIONS);
+#else
+	add_mtd_device(mtd);
+#endif
 
 	return(0);
 }
@@ -97,7 +101,11 @@ static int __init uclinux_mtd_init(void)
 static void __exit uclinux_mtd_cleanup(void)
 {
 	if (uclinux_ram_mtdinfo) {
+#ifdef CONFIG_MTD_PARTITIONS
 		del_mtd_partitions(uclinux_ram_mtdinfo);
+#else
+		del_mtd_device(uclinux_ram_mtdinfo);
+#endif
 		map_destroy(uclinux_ram_mtdinfo);
 		uclinux_ram_mtdinfo = NULL;
 	}
Signature · 1 line
1.6.3.1
#1 lore raw

PATCH 2/2 mtd/maps: uclinux: support Blackfin systems

Due to a processor anomaly (05000263 to be exact), most Blackfin parts cannot keep the embedded filesystem image directly after the kernel in RAM. Instead, the filesystem needs to be relocated to the end of memory. As such, we need to tweak the initial filesystem address for Blackfin systems.

---
 drivers/mtd/maps/uclinux.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/mtd/maps/uclinux.c +5 -0
index 57699c2..dcb552f 100644
@@ -55,8 +55,13 @@ static int __init uclinux_mtd_init(void)
 {
 	struct mtd_info *mtd;
 	struct map_info *mapp;
+#ifdef CONFIG_BLACKFIN
+	extern unsigned long memory_mtd_start;
+	unsigned long addr = (unsigned long) memory_mtd_start;
+#else
 	extern char _ebss;
 	unsigned long addr = (unsigned long) &_ebss;
+#endif
 
 	mapp = &uclinux_ram_map;
 	mapp->phys = addr;
Signature · 1 line
1.6.3.1
#2 lore raw

Re: [PATCH 2/2] mtd/maps: uclinux: support Blackfin systems

Quoted 8 lines · Mike Frysinger
drivers/mtd/maps/uclinux.c +0 -0
index 57699c2..dcb552f 100644
@@ -55,8 +55,13 @@ static int __init uclinux_mtd_init(void)
 {
 	struct mtd_info *mtd;
 	struct map_info *mapp;

drivers/mtd/maps/uclinux.c static int __init uclinux_mtd_init(void) · line 67

Quoted 10 lines
drivers/mtd/maps/uclinux.c +5 -0
+#ifdef CONFIG_BLACKFIN
+	extern unsigned long memory_mtd_start;
+	unsigned long addr = (unsigned long) memory_mtd_start;
+#else
 	extern char _ebss;
 	unsigned long addr = (unsigned long) &_ebss;
+#endif
 
 	mapp = &uclinux_ram_map;
 	mapp->phys = addr;

NAK.

I know there's no accounting for taste, but it would be nice to at least see some minimal amount of effort going in to fixing these things sanely rather than just lazily shoving ifdefs in wherever possible.

In this case you should just kill all of that crap off, and have the platforms that use this set uclinux_ram_map up themselves, it's already a global. Of course you can use _ebss as a default value for uclinux_ram_map.phys and just override it in your platform.

#3 lore raw

Re: [PATCH 2/2] mtd/maps: uclinux: support Blackfin systems

Quoted 22 lines · Paul Mundt
Quoted 8 lines · Mike Frysinger
drivers/mtd/maps/uclinux.c +0 -0
index 57699c2..dcb552f 100644
@@ -55,8 +55,13 @@ static int __init uclinux_mtd_init(void)
  {
       struct mtd_info *mtd;
       struct map_info *mapp;

drivers/mtd/maps/uclinux.c static int __init uclinux_mtd_init(void) · line 67

Quoted 10 lines
drivers/mtd/maps/uclinux.c +5 -0
+#ifdef CONFIG_BLACKFIN
+     extern unsigned long memory_mtd_start;
+     unsigned long addr = (unsigned long) memory_mtd_start;
+#else
       extern char _ebss;
       unsigned long addr = (unsigned long) &_ebss;
+#endif
 
       mapp = &uclinux_ram_map;
       mapp->phys = addr;

NAK.

Quoted 8 lines

I know there's no accounting for taste, but it would be nice to at least see some minimal amount of effort going in to fixing these things sanely rather than just lazily shoving ifdefs in wherever possible.

In this case you should just kill all of that crap off, and have the platforms that use this set uclinux_ram_map up themselves, it's already a global. Of course you can use _ebss as a default value for uclinux_ram_map.phys and just override it in your platform.

i would agree if it were a board-specific issue, but it's an arch issue, so pushing it to the boards level is wrong. i can however replace the addr with a global weak and add a symbol into the Blackfin arch code to override it.

the structs being global in this file is simply wrong from what i can tell ... everything in there should be static. i'll send a patch for that later on.
-mike

#4 lore raw

Re: [PATCH 2/2] mtd/maps: uclinux: support Blackfin systems

Quoted 32 lines · Mike Frysinger
Quoted 22 lines · Paul Mundt
Quoted 8 lines · Mike Frysinger
drivers/mtd/maps/uclinux.c +0 -0
index 57699c2..dcb552f 100644
@@ -55,8 +55,13 @@ static int __init uclinux_mtd_init(void)
 ??{
 ?? ?? ?? struct mtd_info *mtd;
 ?? ?? ?? struct map_info *mapp;

drivers/mtd/maps/uclinux.c static int __init uclinux_mtd_init(void) · line 67

Quoted 10 lines
drivers/mtd/maps/uclinux.c +5 -0
+#ifdef CONFIG_BLACKFIN
+ ?? ?? extern unsigned long memory_mtd_start;
+ ?? ?? unsigned long addr = (unsigned long) memory_mtd_start;
+#else
 ?? ?? ?? extern char _ebss;
 ?? ?? ?? unsigned long addr = (unsigned long) &_ebss;
+#endif
 
 ?? ?? ?? mapp = &uclinux_ram_map;
 ?? ?? ?? mapp->phys = addr;

NAK.

Quoted 8 lines

I know there's no accounting for taste, but it would be nice to at least see some minimal amount of effort going in to fixing these things sanely rather than just lazily shoving ifdefs in wherever possible.

In this case you should just kill all of that crap off, and have the platforms that use this set uclinux_ram_map up themselves, it's already a global. Of course you can use _ebss as a default value for uclinux_ram_map.phys and just override it in your platform.

Quoted 5 lines

i would agree if it were a board-specific issue, but it's an arch issue, so pushing it to the boards level is wrong. i can however replace the addr with a global weak and add a symbol into the Blackfin arch code to override it.

I obviously meant architectures setting up the address, not the board code, as this has nothing at all to do with boards. There are already plenty of cases in setup_arch() for filling in uclinux mtd data, one more isn't going to make a difference.

I don't see anything wrong with keeping uclinux_ram_map as a global however, particularly since platforms that need to special case the mapping can easily do this under the existing ifdef. Adding weak symbols for something like this just seems silly.

#5 lore raw

Re: [PATCH 2/2] mtd/maps: uclinux: support Blackfin systems

Quoted 43 lines · Paul Mundt
Quoted 32 lines · Mike Frysinger
Quoted 22 lines · Paul Mundt
Quoted 8 lines · Mike Frysinger
drivers/mtd/maps/uclinux.c +0 -0
index 57699c2..dcb552f 100644
@@ -55,8 +55,13 @@ static int __init uclinux_mtd_init(void)
 ??{
 ?? ?? ?? struct mtd_info *mtd;
 ?? ?? ?? struct map_info *mapp;

drivers/mtd/maps/uclinux.c static int __init uclinux_mtd_init(void) · line 67

Quoted 10 lines
drivers/mtd/maps/uclinux.c +5 -0
+#ifdef CONFIG_BLACKFIN
+ ?? ?? extern unsigned long memory_mtd_start;
+ ?? ?? unsigned long addr = (unsigned long) memory_mtd_start;
+#else
 ?? ?? ?? extern char _ebss;
 ?? ?? ?? unsigned long addr = (unsigned long) &_ebss;
+#endif
 
 ?? ?? ?? mapp = &uclinux_ram_map;
 ?? ?? ?? mapp->phys = addr;

NAK.

Quoted 8 lines

I know there's no accounting for taste, but it would be nice to at least see some minimal amount of effort going in to fixing these things sanely rather than just lazily shoving ifdefs in wherever possible.

In this case you should just kill all of that crap off, and have the platforms that use this set uclinux_ram_map up themselves, it's already a global. Of course you can use _ebss as a default value for uclinux_ram_map.phys and just override it in your platform.

Quoted 5 lines

i would agree if it were a board-specific issue, but it's an arch issue, so pushing it to the boards level is wrong.  i can however replace the addr with a global weak and add a symbol into the Blackfin arch code to override it.

I obviously meant architectures setting up the address, not the board code, as this has nothing at all to do with boards. There are already plenty of cases in setup_arch() for filling in uclinux mtd data, one more isn't going to make a difference.

Quoted 4 lines

I don't see anything wrong with keeping uclinux_ram_map as a global however, particularly since platforms that need to special case the mapping can easily do this under the existing ifdef. Adding weak symbols for something like this just seems silly.

the point of the weak symbol was so that the map could provide a sane default that works for most everyone out there without having to copy & paste the same code to every arch, and to make new arch porters worry about what needs to be done to use this very trivial map -mike

#6 lore raw

Re: [PATCH 2/2] mtd/maps: uclinux: support Blackfin systems

Quoted 22 lines · Mike Frysinger
Quoted 16 lines · Paul Mundt
Quoted 10 lines · Mike Frysinger
Quoted 4 lines

In this case you should just kill all of that crap off, and have the platforms that use this set uclinux_ram_map up themselves, it's already a global. Of course you can use _ebss as a default value for uclinux_ram_map.phys and just override it in your platform.

i would agree if it were a board-specific issue, but it's an arch issue, so pushing it to the boards level is wrong. ??i can however replace the addr with a global weak and add a symbol into the Blackfin arch code to override it.

I obviously meant architectures setting up the address, not the board code, as this has nothing at all to do with boards. There are already plenty of cases in setup_arch() for filling in uclinux mtd data, one more isn't going to make a difference.

Quoted 4 lines

I don't see anything wrong with keeping uclinux_ram_map as a global however, particularly since platforms that need to special case the mapping can easily do this under the existing ifdef. Adding weak symbols for something like this just seems silly.

Quoted 4 lines

the point of the weak symbol was so that the map could provide a sane default that works for most everyone out there without having to copy & paste the same code to every arch, and to make new arch porters worry about what needs to be done to use this very trivial map

Did you purposely only read the parts of my email that you felt like? Note the original quoted part that mentions using _ebss as a default and simply overriding it in your platform.

Use the attached, and then just set uclinux_ram_map.phys = your_address_here in your setup_arch(). Having weak symbols in drivers that are supposed to be overriden by the architecture code is just way too backwards for words. Globals suffice fine for this sort of thing, if you are not going to go to the effort to pass this information to the driver directly that is.

---

drivers/mtd/maps/uclinux.c +4 -4
index 81756e3..12f822d 100644
@@ -22,8 +22,11 @@
 
 /****************************************************************************/
 
+extern char _ebss;
+
 struct map_info uclinux_ram_map = {
 	.name = "RAM",
+	.phys = (unsigned long)&_ebss,
 };
 
 struct mtd_info *uclinux_ram_mtdinfo;
@@ -55,12 +58,9 @@ static int __init uclinux_mtd_init(void)
 {
 	struct mtd_info *mtd;
 	struct map_info *mapp;
-	extern char _ebss;
-	unsigned long addr = (unsigned long) &_ebss;
 
 	mapp = &uclinux_ram_map;
-	mapp->phys = addr;
-	mapp->size = PAGE_ALIGN(ntohl(*((unsigned long *)(addr + 8))));
+	mapp->size = PAGE_ALIGN(ntohl(*((unsigned long *)(mapp->phys + 8))));
 	mapp->bankwidth = 4;
 
 	printk("uclinux[mtd]: RAM probe address=0x%x size=0x%x\n",
#7 lore raw

Re: [PATCH 2/2] mtd/maps: uclinux: support Blackfin systems

Quoted 23 lines · Paul Mundt
Quoted 22 lines · Mike Frysinger
Quoted 20 lines · Paul Mundt
Quoted 10 lines · Mike Frysinger
Quoted 4 lines

In this case you should just kill all of that crap off, and have the platforms that use this set uclinux_ram_map up themselves, it's already a global. Of course you can use _ebss as a default value for uclinux_ram_map.phys and just override it in your platform.

i would agree if it were a board-specific issue, but it's an arch issue, so pushing it to the boards level is wrong. ??i can however replace the addr with a global weak and add a symbol into the Blackfin arch code to override it.

I obviously meant architectures setting up the address, not the board code, as this has nothing at all to do with boards. There are already plenty of cases in setup_arch() for filling in uclinux mtd data, one more isn't going to make a difference.

I don't see anything wrong with keeping uclinux_ram_map as a global however, particularly since platforms that need to special case the mapping can easily do this under the existing ifdef. Adding weak symbols for something like this just seems silly.

Quoted 8 lines
Quoted 4 lines

the point of the weak symbol was so that the map could provide a sane default that works for most everyone out there without having to copy & paste the same code to every arch, and to make new arch porters worry about what needs to be done to use this very trivial map

Did you purposely only read the parts of my email that you felt like? Note the original quoted part that mentions using _ebss as a default and simply overriding it in your platform.

if i wanted to piss you off, i imagine that would be what i was doing.
but considering my purpose is to get merged, there's a more logical
conclusion. we envisioned different solutions, so having the ideas in our minds not line up isnt terribly surprising.

Quoted 6 lines

Use the attached, and then just set uclinux_ram_map.phys = your_address_here in your setup_arch(). Having weak symbols in drivers that are supposed to be overriden by the architecture code is just way too backwards for words. Globals suffice fine for this sort of thing, if you are not going to go to the effort to pass this information to the driver directly that is.

i was thinking something else, but obviously this is nicer than what i was thinking
-mike

#8 lore raw

Re: [PATCH 2/2] mtd/maps: uclinux: support Blackfin systems

Quoted 10 lines · Mike Frysinger
Quoted 6 lines · Paul Mundt

Use the attached, and then just set uclinux_ram_map.phys = your_address_here in your setup_arch(). Having weak symbols in drivers that are supposed to be overriden by the architecture code is just way too backwards for words. Globals suffice fine for this sort of thing, if you are not going to go to the effort to pass this information to the driver directly that is.

i was thinking something else, but obviously this is nicer than what i was thinking

Unfortunately there is the problem that the map driver itself is a tristate, so if this is built as a module, the symbol will not be available to you. On the other hand, if it doesn't need to ever really be a module, converting it to a bool ought to be workable. There are no in-tree users that enable this as a module anyways.

#9 lore raw

Re: [PATCH 2/2] mtd/maps: uclinux: support Blackfin systems

Quoted 9 lines · Paul Mundt
Quoted 8 lines · Mike Frysinger
Quoted 6 lines · Paul Mundt

Use the attached, and then just set uclinux_ram_map.phys = your_address_here in your setup_arch(). Having weak symbols in drivers that are supposed to be overriden by the architecture code is just way too backwards for words. Globals suffice fine for this sort of thing, if you are not going to go to the effort to pass this information to the driver directly that is.

Quoted 8 lines
Quoted 2 lines

i was thinking something else, but obviously this is nicer than what i was thinking

Unfortunately there is the problem that the map driver itself is a tristate, so if this is built as a module, the symbol will not be available to you. On the other hand, if it doesn't need to ever really be a module, converting it to a bool ought to be workable. There are no in-tree users that enable this as a module anyways.

weaks would address that, but there is no real point as you say. it isnt like the rootfs image gets loaded as part of the module loading. i'll send a patch for that too. the Blackfin code all depends on CONFIG_MTD_UCLINUX, so the rootfs area wouldnt be setup anyways if it were built as a module ...
-mike

#10 lore raw

Re: [uClinux-dev] Re: [PATCH 2/2] mtd/maps: uclinux: support Blackfin systems

In reply to Paul Mundt

Jivin Paul Mundt lays it down ...

Quoted 9 lines · Mike Frysinger
Quoted 8 lines · Paul Mundt
Quoted 6 lines

Use the attached, and then just set uclinux_ram_map.phys = your_address_here in your setup_arch(). Having weak symbols in drivers that are supposed to be overriden by the architecture code is just way too backwards for words. Globals suffice fine for this sort of thing, if you are not going to go to the effort to pass this information to the driver directly that is.

Quoted 8 lines
Quoted 2 lines

i was thinking something else, but obviously this is nicer than what i was thinking

Unfortunately there is the problem that the map driver itself is a tristate, so if this is built as a module, the symbol will not be available to you. On the other hand, if it doesn't need to ever really be a module, converting it to a bool ought to be workable. There are no in-tree users that enable this as a module anyways.

Based on how it relocates the rootfs, I don't believe a module can ever be work, so a boolean would be a better choice IMO,

Cheers,
Davidm

Signature · 2 lines
David McCullough,  [email protected],  Ph:+61 734352815
McAfee - SnapGear  http://www.snapgear.com                http://www.uCdot.org
#11 lore raw

PATCH 1/3 mtd/maps: uclinux: allow systems to override map addr/size

In reply to Paul Mundt

Due to a processor anomaly (05000263 to be exact), most Blackfin parts cannot keep the embedded filesystem image directly after the kernel in RAM. Instead, the filesystem needs to be relocated to the end of memory. As such, we need to tweak the map addr/size during boot for Blackfin systems. This can be done in any early arch/board init code.

---
 drivers/mtd/maps/uclinux.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
drivers/mtd/maps/uclinux.c +6 -4
index 81756e3..61d4087 100644
@@ -22,8 +22,12 @@
 
 /****************************************************************************/
 
+extern char _ebss;
+
 struct map_info uclinux_ram_map = {
 	.name = "RAM",
+	.phys = (unsigned long)&_ebss,
+	.size = 0,
 };
 
 struct mtd_info *uclinux_ram_mtdinfo;
@@ -55,12 +59,10 @@ static int __init uclinux_mtd_init(void)
 {
 	struct mtd_info *mtd;
 	struct map_info *mapp;
-	extern char _ebss;
-	unsigned long addr = (unsigned long) &_ebss;
 
 	mapp = &uclinux_ram_map;
-	mapp->phys = addr;
-	mapp->size = PAGE_ALIGN(ntohl(*((unsigned long *)(addr + 8))));
+	if (!mapp->size)
+		mapp->size = PAGE_ALIGN(ntohl(*((unsigned long *)(mapp->phys + 8))));
 	mapp->bankwidth = 4;
 
 	printk("uclinux[mtd]: RAM probe address=0x%x size=0x%x\n",
Signature · 1 line
1.6.3.1
#12 lore raw

Re: [PATCH 1/3] mtd/maps: uclinux: allow systems to override map addr/size

Quoted 11 lines · Mike Frysinger

Due to a processor anomaly (05000263 to be exact), most Blackfin parts cannot keep the embedded filesystem image directly after the kernel in RAM. Instead, the filesystem needs to be relocated to the end of memory. As such, we need to tweak the map addr/size during boot for Blackfin systems. This can be done in any early arch/board init code.

#13 lore raw

Re: [PATCH 1/3] mtd/maps: uclinux: allow systems to override map addr/size

In reply to Mike Frysinger

drivers/mtd/maps/uclinux.c line 26

Quoted 2 lines · Mike Frysinger
drivers/mtd/maps/uclinux.c +2 -0
+extern char _ebss;
+

Also, it would be nice if the remaining architectures that define _ebss could shove this in their asm/sections.h so we can kill this off from the driver itself.

#14 lore raw

Re: [PATCH 1/3] mtd/maps: uclinux: allow systems to override map addr/size

Quoted 7 lines · On Tuesday 26 May 2009 19:46:16 Paul Mundt wrote:

drivers/mtd/maps/uclinux.c line 26

Quoted 2 lines · Mike Frysinger
drivers/mtd/maps/uclinux.c +2 -0
+extern char _ebss;
+

Also, it would be nice if the remaining architectures that define _ebss could shove this in their asm/sections.h so we can kill this off from the driver itself.

well, everyone would still have to define the _ebss symbol otherwise they'd get an undefined error due to how the map is initialized.
-mike

#15 lore raw

Re: [PATCH 1/3] mtd/maps: uclinux: allow systems to override map addr/size

Quoted 11 lines · Mike Frysinger
Quoted 7 lines · On Tuesday 26 May 2009 19:46:16 Paul Mundt wrote:

drivers/mtd/maps/uclinux.c line 26

Quoted 2 lines · Mike Frysinger
drivers/mtd/maps/uclinux.c +2 -0
+extern char _ebss;
+

Also, it would be nice if the remaining architectures that define _ebss could shove this in their asm/sections.h so we can kill this off from the driver itself.

well, everyone would still have to define the _ebss symbol otherwise they'd get an undefined error due to how the map is initialized.

Yes, but that is not the issue. The issue is that the section extern has no place in a driver, this is precisely what asm/sections.h is for. Only microblaze and sh define it there today, and there is already inconsistency. Having the others define it for themselves and agreeing on a type would permit us to kill it off from the driver.

#16 lore raw

Re: [PATCH 1/3] mtd/maps: uclinux: allow systems to override map addr/size

In reply to Mike Frysinger
Quoted 6 lines · Mike Frysinger

Due to a processor anomaly (05000263 to be exact), most Blackfin parts cannot keep the embedded filesystem image directly after the kernel in RAM. Instead, the filesystem needs to be relocated to the end of memory. As such, we need to tweak the map addr/size during boot for Blackfin systems. This can be done in any early arch/board init code.

Quoted 8 lines
---
 drivers/mtd/maps/uclinux.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

I've added your patches to my tree.

Signature · 2 lines
Best regards,
Artem Bityutskiy (Битюцкий Артём)
#17 lore raw

PATCH 2/3 mtd/maps: uclinux: mark local stuff static

In reply to Paul Mundt

The uclinux_ram_mtdinfo, uclinux_romfs, and uclinux_point symbols do not need to be visible outside of this module, so mark them static.

---
 drivers/mtd/maps/uclinux.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/mtd/maps/uclinux.c +3 -3
index 61d4087..d4314fb 100644
@@ -30,11 +30,11 @@ struct map_info uclinux_ram_map = {
 	.size = 0,
 };
 
-struct mtd_info *uclinux_ram_mtdinfo;
+static struct mtd_info *uclinux_ram_mtdinfo;
 
 /****************************************************************************/
 
-struct mtd_partition uclinux_romfs[] = {
+static struct mtd_partition uclinux_romfs[] = {
 	{ .name = "ROMfs" }
 };
 
@@ -42,7 +42,7 @@ struct mtd_partition uclinux_romfs[] = {
 
 /****************************************************************************/
 
-int uclinux_point(struct mtd_info *mtd, loff_t from, size_t len,
+static int uclinux_point(struct mtd_info *mtd, loff_t from, size_t len,
 	size_t *retlen, void **virt, resource_size_t *phys)
 {
 	struct map_info *map = mtd->priv;
Signature · 1 line
1.6.3.1
Acked-by on v1 2/3
#18 lore raw

Re: [PATCH 2/3] mtd/maps: uclinux: mark local stuff static

Quoted 5 lines · Mike Frysinger

The uclinux_ram_mtdinfo, uclinux_romfs, and uclinux_point symbols do not need to be visible outside of this module, so mark them static.

Quoted 33 lines
---
 drivers/mtd/maps/uclinux.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/mtd/maps/uclinux.c +3 -3
index 61d4087..d4314fb 100644
@@ -30,11 +30,11 @@ struct map_info uclinux_ram_map = {
 	.size = 0,
 };
 
-struct mtd_info *uclinux_ram_mtdinfo;
+static struct mtd_info *uclinux_ram_mtdinfo;
 
 /****************************************************************************/
 
-struct mtd_partition uclinux_romfs[] = {
+static struct mtd_partition uclinux_romfs[] = {
 	{ .name = "ROMfs" }
 };
 
@@ -42,7 +42,7 @@ struct mtd_partition uclinux_romfs[] = {
 
 /****************************************************************************/
 
-int uclinux_point(struct mtd_info *mtd, loff_t from, size_t len,
+static int uclinux_point(struct mtd_info *mtd, loff_t from, size_t len,
 	size_t *retlen, void **virt, resource_size_t *phys)
 {
 	struct map_info *map = mtd->priv;
Signature · 5 lines
------------------------------------------------------------------------
Greg Ungerer  --  Principal Engineer        EMAIL:     [email protected]
SnapGear Group, McAfee                      PHONE:       +61 7 3435 2888
825 Stanley St,                             FAX:         +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia         WEB: http://www.SnapGear.com
#19 lore raw

PATCH 3/3 mtd/maps: uclinux: do not allow to be built as a module

In reply to Paul Mundt

There isn't any benefit to building the uClinux MTD map as a module as the rootfs it requires in order to actually be usable is appended to the kernel image, not the module. No known system builds it this way either, so change the option to "bool".

---
 drivers/mtd/maps/Kconfig |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mtd/maps/Kconfig +1 -1
index 82923bd..907873b 100644
@@ -501,7 +501,7 @@ config MTD_BFIN_ASYNC
 	  If compiled as a module, it will be called bfin-async-flash.
 
 config MTD_UCLINUX
-	tristate "Generic uClinux RAM/ROM filesystem support"
+	bool "Generic uClinux RAM/ROM filesystem support"
 	depends on MTD_PARTITIONS && MTD_RAM && !MMU
 	help
 	  Map driver to support image based filesystems for uClinux.
Signature · 1 line
1.6.3.1
Acked-by on v1 3/3
#20 lore raw

Re: [uClinux-dev] [PATCH 3/3] mtd/maps: uclinux: do not allow to be built as a module

Quoted 8 lines · Mike Frysinger

There isn't any benefit to building the uClinux MTD map as a module as the rootfs it requires in order to actually be usable is appended to the kernel image, not the module. No known system builds it this way either, so change the option to "bool".

CC Paul Mundt <[email protected]>
CC Greg Ungerer <[email protected]>
Quoted 19 lines
---
 drivers/mtd/maps/Kconfig |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mtd/maps/Kconfig +1 -1
index 82923bd..907873b 100644
@@ -501,7 +501,7 @@ config MTD_BFIN_ASYNC
 	  If compiled as a module, it will be called bfin-async-flash.
 
 config MTD_UCLINUX
-	tristate "Generic uClinux RAM/ROM filesystem support"
+	bool "Generic uClinux RAM/ROM filesystem support"
 	depends on MTD_PARTITIONS && MTD_RAM && !MMU
 	help
 	  Map driver to support image based filesystems for uClinux.
Signature · 5 lines
------------------------------------------------------------------------
Greg Ungerer  --  Principal Engineer        EMAIL:     [email protected]
SnapGear Group, McAfee                      PHONE:       +61 7 3435 2888
825 Stanley St,                             FAX:         +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia         WEB: http://www.SnapGear.com
Acked-by on v1 1/2
#21 lore raw
In reply to Mike Frysinger
Quoted 9 lines · Mike Frysinger

From: Timofei Bondarenko <[email protected]>

The uClinux map driver doesn't even use partitions, so we shouldn't require it in order to work properly.

Quoted 34 lines
---
 drivers/mtd/maps/uclinux.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
drivers/mtd/maps/uclinux.c +8 -0
index 81756e3..57699c2 100644
@@ -87,7 +87,11 @@ static int __init uclinux_mtd_init(void)
 	mtd->priv = mapp;
 
 	uclinux_ram_mtdinfo = mtd;
+#ifdef CONFIG_MTD_PARTITIONS
 	add_mtd_partitions(mtd, uclinux_romfs, NUM_PARTITIONS);
+#else
+	add_mtd_device(mtd);
+#endif
 
 	return(0);
 }
@@ -97,7 +101,11 @@ static int __init uclinux_mtd_init(void)
 static void __exit uclinux_mtd_cleanup(void)
 {
 	if (uclinux_ram_mtdinfo) {
+#ifdef CONFIG_MTD_PARTITIONS
 		del_mtd_partitions(uclinux_ram_mtdinfo);
+#else
+		del_mtd_device(uclinux_ram_mtdinfo);
+#endif
 		map_destroy(uclinux_ram_mtdinfo);
 		uclinux_ram_mtdinfo = NULL;
 	}
Signature · 5 lines
------------------------------------------------------------------------
Greg Ungerer  --  Principal Engineer        EMAIL:     [email protected]
SnapGear Group, McAfee                      PHONE:       +61 7 3435 2888
825 Stanley St,                             FAX:         +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia         WEB: http://www.SnapGear.com