Message ID | 1240387541-16594-1-git-send-email-ricardo.ribalda@uam.es (mailing list archive) |
---|---|
State | Superseded, archived |
Headers | show |
>>>>> "Ricardo" == Ricardo Ribalda Delgado <ricardo.ribalda@uam.es> writes:
Hi,
Ricardo> Sometimes, an special partition is included in the device
Ricardo> tree including all the partitions. Like in:
Ricardo> drivers/mtd/ofpart.c | 3 ++-
Ricardo> 1 files changed, 2 insertions(+), 1 deletions(-)
Ricardo> diff --git a/drivers/mtd/ofpart.c b/drivers/mtd/ofpart.c
Ricardo> index 3e164f0..0af3b07 100644
Ricardo> --- a/drivers/mtd/ofpart.c
Ricardo> +++ b/drivers/mtd/ofpart.c
Ricardo> @@ -48,7 +48,8 @@ int __devinit of_mtd_parse_partitions(struct device *dev,
Ricardo> /* check if this is a partition node */
Ricardo> partname = of_get_property(pp, "name", &len);
Ricardo> - if (strcmp(partname, "partition") != 0) {
Ricardo> + if (strncmp(partname, "partition", strlen("partition")-1)
Why strlen() - 1 ?
Hello You are right, remove the -1. I thought that strlen gives the #of chars + 1 ('\0'). Thanks On Wed, Apr 22, 2009 at 11:24, Peter Korsgaard <jacmet@sunsite.dk> wrote: >>>>>> "Ricardo" == Ricardo Ribalda Delgado <ricardo.ribalda@uam.es> writes: > > Hi, > > Ricardo> Sometimes, an special partition is included in the device > Ricardo> tree including all the partitions. Like in: > > Ricardo> drivers/mtd/ofpart.c | 3 ++- > Ricardo> 1 files changed, 2 insertions(+), 1 deletions(-) > > Ricardo> diff --git a/drivers/mtd/ofpart.c b/drivers/mtd/ofpart.c > Ricardo> index 3e164f0..0af3b07 100644 > Ricardo> --- a/drivers/mtd/ofpart.c > Ricardo> +++ b/drivers/mtd/ofpart.c > Ricardo> @@ -48,7 +48,8 @@ int __devinit of_mtd_parse_partitions(struct device *dev, > > Ricardo> /* check if this is a partition node */ > Ricardo> partname = of_get_property(pp, "name", &len); > Ricardo> - if (strcmp(partname, "partition") != 0) { > Ricardo> + if (strncmp(partname, "partition", strlen("partition")-1) > > Why strlen() - 1 ? > > -- > Bye, Peter Korsgaard >
On Wed, 2009-04-22 at 10:05 +0200, Ricardo Ribalda Delgado wrote: > 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"; > }; > ... > partitionAll@ff000000 { > 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 only check for the firt part of the name, and > ignore the rest, allowing this special partition. I fail to see the point of this "special" partition in the first place... Things would make more sense if you had a full flash device whose child nodes are the partitions. Ben.
On Thu, 2009-04-30 at 04:19 +0100, Benjamin Herrenschmidt wrote: > > I fail to see the point of this "special" partition in the first > place... > > Things would make more sense if you had a full flash device > whose child nodes are the partitions. That's the model I think I want to move to, and which I was toying with in http://git.infradead.org/users/dwmw2/mtd-sysfs.git (I haven't done it yet, but it's logically the next step after what I've already done).
diff --git a/drivers/mtd/ofpart.c b/drivers/mtd/ofpart.c index 3e164f0..0af3b07 100644 --- a/drivers/mtd/ofpart.c +++ b/drivers/mtd/ofpart.c @@ -48,7 +48,8 @@ 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 (strncmp(partname, "partition", strlen("partition")-1) + != 0) { nr_parts--; continue; }