linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [MTD] ofpart: Partitions at same address cannot have the same name v3
@ 2009-04-24 14:01 Ricardo Ribalda Delgado
  2009-04-27  7:09 ` Benjamin Krill
  2009-04-29  0:45 ` Segher Boessenkool
  0 siblings, 2 replies; 6+ messages in thread
From: Ricardo Ribalda Delgado @ 2009-04-24 14:01 UTC (permalink / raw)
  To: Scott Wood, linuxppc-dev, David.Woodhouse, ben; +Cc: Ricardo Ribalda Delgado

Sometimes, an special partition is included in the device tree including all the
partitions. Like in:

partition@ff000000 {
       reg = < 0x000000 0x800000 >;
       label = "Root File System";
};
partition@ff800000 {
       reg = < 0x800000 0x1a0000 >;
       label = "Bitstream";
};
...
full@ff000000 {
       compatible = "partition";
       reg = < 0x000000 0x1000000 >;
       label = "Full FLASH";
};

Because two nodes of a device tree cannot have the same name, but all the
partitions must be named "partition", this special partition is invalid.

This patch makes ofpart.c accept spetial partitions compatible with
"partition" but not named partition.

These spetial partitions are very useful for flashing the full firmware
of a device from linux
---
This v3 includes feedback from Scott Wood, Peter Korsgaard & Benjamin Kril

v3: Use the compatible propierty
v2: buggy implementation, strlen-1 instead of strlen
v1: Just check the firt part of the name


 drivers/mtd/ofpart.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/ofpart.c b/drivers/mtd/ofpart.c
index 3e164f0..59c1e4a 100644
--- a/drivers/mtd/ofpart.c
+++ b/drivers/mtd/ofpart.c
@@ -48,7 +48,9 @@ int __devinit of_mtd_parse_partitions(struct device *dev,
 
 		/* check if this is a partition node */
 		partname = of_get_property(pp, "name", &len);
-		if (strcmp(partname, "partition") != 0) {
+		if ((strcmp(partname, "partition") != 0) &&
+			(of_device_is_compatible(pp, "partition") != 1))
+		{
 			nr_parts--;
 			continue;
 		}
-- 
1.6.2.4

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

end of thread, other threads:[~2009-04-30  8:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-24 14:01 [PATCH] [MTD] ofpart: Partitions at same address cannot have the same name v3 Ricardo Ribalda Delgado
2009-04-27  7:09 ` Benjamin Krill
2009-04-29  0:45 ` Segher Boessenkool
2009-04-29  7:41   ` [PATCH] [MTD] ofpart: Partitions at same address cannot have thesame " Ricardo Ribalda Delgado
2009-04-29 13:56     ` Segher Boessenkool
2009-04-30  8:26       ` Ricardo Ribalda Delgado

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).