* [PATCH] MTD: small physmap_of partition parsing fixes
@ 2007-10-29 20:29 Valentine Barshak
2007-10-30 0:10 ` David Gibson
0 siblings, 1 reply; 2+ messages in thread
From: Valentine Barshak @ 2007-10-29 20:29 UTC (permalink / raw)
To: linuxppc-dev; +Cc: linux-mtd
Use of_get_next_child for proper ref counting as suggested by Stephen Rothwell
and remove add_mtd_partitions from parse_partitions to avoid duplicate
mtd device registration for RedBoot partitions.
Signed-off-by: Valentine Barshak <vbarshak@ru.mvista.com>
---
drivers/mtd/maps/physmap_of.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff -pruN linux-2.6.orig/drivers/mtd/maps/physmap_of.c linux-2.6/drivers/mtd/maps/physmap_of.c
--- linux-2.6.orig/drivers/mtd/maps/physmap_of.c 2007-10-29 16:02:37.000000000 +0300
+++ linux-2.6/drivers/mtd/maps/physmap_of.c 2007-10-29 22:41:08.000000000 +0300
@@ -94,14 +94,13 @@ static int __devinit parse_partitions(st
* line, these take precedence over device tree information */
nr_parts = parse_mtd_partitions(info->mtd, part_probe_types,
&info->parts, 0);
- if (nr_parts > 0) {
- add_mtd_partitions(info->mtd, info->parts, nr_parts);
- return 0;
- }
+ if (nr_parts > 0)
+ return nr_parts;
/* First count the subnodes */
nr_parts = 0;
- for (pp = dp->child; pp; pp = pp->sibling)
+ for (pp = of_get_next_child(dp, NULL); pp;
+ pp = of_get_next_child(dp, pp))
nr_parts++;
if (nr_parts == 0)
@@ -112,12 +111,14 @@ static int __devinit parse_partitions(st
if (!info->parts)
return -ENOMEM;
- for (pp = dp->child, i = 0; pp; pp = pp->sibling, i++) {
+ for (pp = of_get_next_child(dp, NULL), i = 0; pp;
+ pp = of_get_next_child(dp, pp), i++) {
const u32 *reg;
int len;
reg = of_get_property(pp, "reg", &len);
if (!reg || (len != 2*sizeof(u32))) {
+ of_node_put(pp);
dev_err(&dev->dev, "Invalid 'reg' on %s\n",
dp->full_name);
kfree(info->parts);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] MTD: small physmap_of partition parsing fixes
2007-10-29 20:29 [PATCH] MTD: small physmap_of partition parsing fixes Valentine Barshak
@ 2007-10-30 0:10 ` David Gibson
0 siblings, 0 replies; 2+ messages in thread
From: David Gibson @ 2007-10-30 0:10 UTC (permalink / raw)
To: Valentine Barshak; +Cc: linuxppc-dev, linux-mtd
On Mon, Oct 29, 2007 at 11:29:02PM +0300, Valentine Barshak wrote:
> Use of_get_next_child for proper ref counting as suggested by Stephen Rothwell
> and remove add_mtd_partitions from parse_partitions to avoid duplicate
> mtd device registration for RedBoot partitions.
>
> Signed-off-by: Valentine Barshak <vbarshak@ru.mvista.com>
Oops, yes. I think the extra add_mtd_partitions() was left over from
an earlier version which always did the add_mtd_partitions() from
within the probe function.
Acked-by: David Gibson <david@gibson.dropbear.id.au>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-10-30 0:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-29 20:29 [PATCH] MTD: small physmap_of partition parsing fixes Valentine Barshak
2007-10-30 0:10 ` David Gibson
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).