* [MTD] ofpart: Partitions at same address cannot have the same name
@ 2009-04-22 8:05 Ricardo Ribalda Delgado
2009-04-22 9:24 ` Peter Korsgaard
2009-04-30 3:19 ` [MTD] " Benjamin Herrenschmidt
0 siblings, 2 replies; 13+ messages in thread
From: Ricardo Ribalda Delgado @ 2009-04-22 8:05 UTC (permalink / raw)
To: linuxppc-dev, ben, David.Woodhouse, linuxppc-embedded
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";
};
...
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.
---
The extra partition is quite useful while formating the full firmware from linux
drivers/mtd/ofpart.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
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;
}
--
1.6.2.4
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [MTD] ofpart: Partitions at same address cannot have the same name
2009-04-22 8:05 [MTD] ofpart: Partitions at same address cannot have the same name Ricardo Ribalda Delgado
@ 2009-04-22 9:24 ` Peter Korsgaard
2009-04-22 15:34 ` Ricardo Ribalda Delgado
2009-04-22 15:52 ` Ricardo Ribalda Delgado
2009-04-30 3:19 ` [MTD] " Benjamin Herrenschmidt
1 sibling, 2 replies; 13+ messages in thread
From: Peter Korsgaard @ 2009-04-22 9:24 UTC (permalink / raw)
To: Ricardo Ribalda Delgado; +Cc: linuxppc-dev, David.Woodhouse, linuxppc-embedded
>>>>> "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
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [MTD] ofpart: Partitions at same address cannot have the same name
2009-04-22 9:24 ` Peter Korsgaard
@ 2009-04-22 15:34 ` Ricardo Ribalda Delgado
2009-04-22 15:52 ` Ricardo Ribalda Delgado
1 sibling, 0 replies; 13+ messages in thread
From: Ricardo Ribalda Delgado @ 2009-04-22 15:34 UTC (permalink / raw)
To: Peter Korsgaard; +Cc: linuxppc-dev, David.Woodhouse, linuxppc-embedded
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" =3D=3D Ricardo Ribalda Delgado <ricardo.ribalda@uam.es> wr=
ites:
>
> Hi,
>
> =A0Ricardo> Sometimes, an special partition is included in the device
> =A0Ricardo> tree including all the partitions. Like in:
>
> =A0Ricardo> =A0drivers/mtd/ofpart.c | =A0 =A03 ++-
> =A0Ricardo> =A01 files changed, 2 insertions(+), 1 deletions(-)
>
> =A0Ricardo> diff --git a/drivers/mtd/ofpart.c b/drivers/mtd/ofpart.c
> =A0Ricardo> index 3e164f0..0af3b07 100644
> =A0Ricardo> --- a/drivers/mtd/ofpart.c
> =A0Ricardo> +++ b/drivers/mtd/ofpart.c
> =A0Ricardo> @@ -48,7 +48,8 @@ int __devinit of_mtd_parse_partitions(struc=
t device *dev,
>
> =A0Ricardo> =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* check if this is a partition n=
ode */
> =A0Ricardo> =A0 =A0 =A0 =A0 =A0 =A0 =A0 partname =3D of_get_property(pp, =
"name", &len);
> =A0Ricardo> - =A0 =A0 =A0 =A0 =A0 =A0 if (strcmp(partname, "partition") !=
=3D 0) {
> =A0Ricardo> + =A0 =A0 =A0 =A0 =A0 =A0 if (strncmp(partname, "partition", =
strlen("partition")-1)
>
> Why strlen() - 1 ?
>
> --
> Bye, Peter Korsgaard
>
--=20
Ricardo Ribalda
http://www.eps.uam.es/~rribalda/
^ permalink raw reply [flat|nested] 13+ messages in thread* ofpart: Partitions at same address cannot have the same name
2009-04-22 9:24 ` Peter Korsgaard
2009-04-22 15:34 ` Ricardo Ribalda Delgado
@ 2009-04-22 15:52 ` Ricardo Ribalda Delgado
2009-04-22 17:10 ` Benjamin Krill
1 sibling, 1 reply; 13+ messages in thread
From: Ricardo Ribalda Delgado @ 2009-04-22 15:52 UTC (permalink / raw)
To: Peter Korsgaard, linuxppc-dev, ben, David.Woodhouse
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";
};
...
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.
---
The extra partition is quite useful while formating the full firmware from linux
v2, removes the -1 <Peter Korsgaard>
drivers/mtd/ofpart.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
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,7 @@ 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") != 0) {
nr_parts--;
continue;
}
--
1.6.2.4
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: ofpart: Partitions at same address cannot have the same name
2009-04-22 15:52 ` Ricardo Ribalda Delgado
@ 2009-04-22 17:10 ` Benjamin Krill
2009-04-22 17:27 ` Scott Wood
2009-04-22 17:59 ` Ricardo Ribalda Delgado
0 siblings, 2 replies; 13+ messages in thread
From: Benjamin Krill @ 2009-04-22 17:10 UTC (permalink / raw)
To: Ricardo Ribalda Delgado; +Cc: David.Woodhouse, linuxppc-dev
>--- a/drivers/mtd/ofpart.c
>+++ b/drivers/mtd/ofpart.c
>@@ -48,7 +48,7 @@ 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") != 0) {
Hi Recardo,
I would suggest to do:
if (strcmp(partname, "partition") <= 0) {
cheers
ben
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: ofpart: Partitions at same address cannot have the same name
2009-04-22 17:10 ` Benjamin Krill
@ 2009-04-22 17:27 ` Scott Wood
2009-04-22 17:56 ` Ricardo Ribalda Delgado
2009-04-22 17:59 ` Ricardo Ribalda Delgado
1 sibling, 1 reply; 13+ messages in thread
From: Scott Wood @ 2009-04-22 17:27 UTC (permalink / raw)
To: Benjamin Krill; +Cc: Ricardo Ribalda Delgado, linuxppc-dev, David.Woodhouse
Benjamin Krill wrote:
>> --- a/drivers/mtd/ofpart.c
>> +++ b/drivers/mtd/ofpart.c
>> @@ -48,7 +48,7 @@ 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") != 0) {
Perhaps "compatible" should be used instead?
> Hi Recardo,
>
> I would suggest to do:
>
> if (strcmp(partname, "partition") <= 0) {
Check whether it sorts alphabetically before "partition"? Why?
-Scott
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: ofpart: Partitions at same address cannot have the same name
2009-04-22 17:27 ` Scott Wood
@ 2009-04-22 17:56 ` Ricardo Ribalda Delgado
2009-04-22 18:11 ` Scott Wood
0 siblings, 1 reply; 13+ messages in thread
From: Ricardo Ribalda Delgado @ 2009-04-22 17:56 UTC (permalink / raw)
To: Scott Wood; +Cc: linuxppc-dev, David.Woodhouse
Hi Scott
> Perhaps "compatible" should be used instead?
What do you mean?
if (strcmp(partname, "partition") || strcmp(partname, "compatible") )
I can't see the advantages.
>
>> Hi Recardo,
>>
>> I would suggest to do:
>>
>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (strcmp(partname, "partition") <=3D 0)=
{
>
> Check whether it sorts alphabetically before "partition"? =A0Why?
>
> -Scott
>
--=20
Ricardo Ribalda
http://www.eps.uam.es/~rribalda/
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: ofpart: Partitions at same address cannot have the same name
2009-04-22 17:56 ` Ricardo Ribalda Delgado
@ 2009-04-22 18:11 ` Scott Wood
2009-04-22 18:58 ` Ricardo Ribalda Delgado
0 siblings, 1 reply; 13+ messages in thread
From: Scott Wood @ 2009-04-22 18:11 UTC (permalink / raw)
To: Ricardo Ribalda Delgado; +Cc: linuxppc-dev, David.Woodhouse
Ricardo Ribalda Delgado wrote:
> Hi Scott
>
>> Perhaps "compatible" should be used instead?
>
> What do you mean?
>
> if (strcmp(partname, "partition") || strcmp(partname, "compatible") )
>
> I can't see the advantages.
No, I mean:
foo {
compatible = "partition";
...
};
-Scott
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: ofpart: Partitions at same address cannot have the same name
2009-04-22 18:11 ` Scott Wood
@ 2009-04-22 18:58 ` Ricardo Ribalda Delgado
0 siblings, 0 replies; 13+ messages in thread
From: Ricardo Ribalda Delgado @ 2009-04-22 18:58 UTC (permalink / raw)
To: Scott Wood; +Cc: linuxppc-dev, David.Woodhouse
Hello Scott
It is definitively more elegant...
Let me send tomorrow a patch
On Wed, Apr 22, 2009 at 20:11, Scott Wood <scottwood@freescale.com> wrote:
> Ricardo Ribalda Delgado wrote:
>>
>> Hi Scott
>>
>>> Perhaps "compatible" should be used instead?
>>
>> What do you mean?
>>
>> if (strcmp(partname, "partition") || strcmp(partname, "compatible") )
>>
>> I can't see the advantages.
>
> No, I mean:
>
> foo {
> =A0 =A0 =A0 =A0compatible =3D "partition";
> =A0 =A0 =A0 =A0...
> };
>
> -Scott
>
--=20
Ricardo Ribalda
http://www.eps.uam.es/~rribalda/
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: ofpart: Partitions at same address cannot have the same name
2009-04-22 17:10 ` Benjamin Krill
2009-04-22 17:27 ` Scott Wood
@ 2009-04-22 17:59 ` Ricardo Ribalda Delgado
2009-04-22 18:33 ` Benjamin Krill
1 sibling, 1 reply; 13+ messages in thread
From: Ricardo Ribalda Delgado @ 2009-04-22 17:59 UTC (permalink / raw)
To: Benjamin Krill; +Cc: David.Woodhouse, linuxppc-dev
Hello Benjamin
> Hi Recardo,
>
> I would suggest to do:
>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (strcmp(partname, "partition") <=3D 0) =
{
Anything alfabetically higher than partition (like "zzzzz" will pass
the test :S)
Regards
>
> cheers
> =A0ben
>
>
--=20
Ricardo Ribalda
http://www.eps.uam.es/~rribalda/
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [MTD] ofpart: Partitions at same address cannot have the same name
2009-04-22 8:05 [MTD] ofpart: Partitions at same address cannot have the same name Ricardo Ribalda Delgado
2009-04-22 9:24 ` Peter Korsgaard
@ 2009-04-30 3:19 ` Benjamin Herrenschmidt
2009-04-30 5:32 ` David Woodhouse
1 sibling, 1 reply; 13+ messages in thread
From: Benjamin Herrenschmidt @ 2009-04-30 3:19 UTC (permalink / raw)
To: Ricardo Ribalda Delgado; +Cc: linuxppc-dev, David.Woodhouse, linuxppc-embedded
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.
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [MTD] ofpart: Partitions at same address cannot have the same name
2009-04-30 3:19 ` [MTD] " Benjamin Herrenschmidt
@ 2009-04-30 5:32 ` David Woodhouse
0 siblings, 0 replies; 13+ messages in thread
From: David Woodhouse @ 2009-04-30 5:32 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: Ricardo Ribalda Delgado, linuxppc-dev@ozlabs.org,
linuxppc-embedded@ozlabs.org
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).
--
David Woodhouse Open Source Technology Centre
David.Woodhouse@intel.com Intel Corporation
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2009-04-30 5:32 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-22 8:05 [MTD] ofpart: Partitions at same address cannot have the same name Ricardo Ribalda Delgado
2009-04-22 9:24 ` Peter Korsgaard
2009-04-22 15:34 ` Ricardo Ribalda Delgado
2009-04-22 15:52 ` Ricardo Ribalda Delgado
2009-04-22 17:10 ` Benjamin Krill
2009-04-22 17:27 ` Scott Wood
2009-04-22 17:56 ` Ricardo Ribalda Delgado
2009-04-22 18:11 ` Scott Wood
2009-04-22 18:58 ` Ricardo Ribalda Delgado
2009-04-22 17:59 ` Ricardo Ribalda Delgado
2009-04-22 18:33 ` Benjamin Krill
2009-04-30 3:19 ` [MTD] " Benjamin Herrenschmidt
2009-04-30 5:32 ` David Woodhouse
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).