linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] MTD ofpart: Check availability of reg property instead of name property
@ 2009-08-25 13:52 Benjamin Krill
  2009-08-25 13:55 ` Kumar Gala
  0 siblings, 1 reply; 2+ messages in thread
From: Benjamin Krill @ 2009-08-25 13:52 UTC (permalink / raw)
  To: Kumar Gala, David Woodhouse, linux-mtd, linuxppc-dev

The previous implementation breaks the dts binding "mtd-physmap.txt". This
implementation fixes the issue by checking the availability of the reg
property instead of the name property.

Signed-off-by: Benjamin Krill <ben@codiert.org>
---
 drivers/mtd/ofpart.c |   21 ++++++++++-----------
 1 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/mtd/ofpart.c b/drivers/mtd/ofpart.c
index 3e164f0..62d6a78 100644
--- a/drivers/mtd/ofpart.c
+++ b/drivers/mtd/ofpart.c
@@ -46,21 +46,12 @@ int __devinit of_mtd_parse_partitions(struct device *dev,
 		const u32 *reg;
 		int len;
 
-		/* check if this is a partition node */
-		partname = of_get_property(pp, "name", &len);
-		if (strcmp(partname, "partition") != 0) {
+		reg = of_get_property(pp, "reg", &len);
+		if (!reg) {
 			nr_parts--;
 			continue;
 		}
 
-		reg = of_get_property(pp, "reg", &len);
-		if (!reg || (len != 2 * sizeof(u32))) {
-			of_node_put(pp);
-			dev_err(dev, "Invalid 'reg' on %s\n", node->full_name);
-			kfree(*pparts);
-			*pparts = NULL;
-			return -EINVAL;
-		}
 		(*pparts)[i].offset = reg[0];
 		(*pparts)[i].size = reg[1];
 
@@ -75,6 +66,14 @@ int __devinit of_mtd_parse_partitions(struct device *dev,
 		i++;
 	}
 
+	if (!i) {
+		of_node_put(pp);
+		dev_err(dev, "No valid partition found on %s\n", node->full_name);
+		kfree(*pparts);
+		*pparts = NULL;
+		return -EINVAL;
+	}
+
 	return nr_parts;
 }
 EXPORT_SYMBOL(of_mtd_parse_partitions);
-- 
1.5.4.5

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

* Re: [PATCH] MTD ofpart: Check availability of reg property instead of name property
  2009-08-25 13:52 [PATCH] MTD ofpart: Check availability of reg property instead of name property Benjamin Krill
@ 2009-08-25 13:55 ` Kumar Gala
  0 siblings, 0 replies; 2+ messages in thread
From: Kumar Gala @ 2009-08-25 13:55 UTC (permalink / raw)
  To: David Woodhouse; +Cc: linuxppc-dev list, linux-mtd


On Aug 25, 2009, at 8:52 AM, Benjamin Krill wrote:

> The previous implementation breaks the dts binding "mtd- 
> physmap.txt". This
> implementation fixes the issue by checking the availability of the reg
> property instead of the name property.
>
> Signed-off-by: Benjamin Krill <ben@codiert.org>
> ---
> drivers/mtd/ofpart.c |   21 ++++++++++-----------
> 1 files changed, 10 insertions(+), 11 deletions(-)

David,

Can you look at pushing this for .31 if possible.  We have a # of  
device trees in the kernel which have "broken" functionality because  
of this.

- k

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

end of thread, other threads:[~2009-08-25 13:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-25 13:52 [PATCH] MTD ofpart: Check availability of reg property instead of name property Benjamin Krill
2009-08-25 13:55 ` Kumar Gala

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).