Re: [PATCH 2/3] mtd: Factor out OF partition support from the NOR driver.

3 messages, 2 authors, 2008-01-16 · open the first message on its own page

Re: [PATCH 2/3] mtd: Factor out OF partition support from the NOR driver.

From: Stephen Rothwell <hidden>
Date: 2008-01-14 06:21:21

Hi Scott,

[Corrected list address.]

On Fri, 11 Jan 2008 14:43:16 -0600 Scott Wood [off-list ref] wrote:
quoted hunk
+++ b/drivers/mtd/ofpart.c
+int __devinit of_mtd_parse_partitions(struct device *dev,
+	nr_parts = 0;
+	for (pp = node->child; pp; pp = pp->sibling)
	for_each_child_of_node(node, pp)
+		nr_parts++;
+	for (pp = of_get_next_child(node, NULL), i = 0; pp; 
+	     pp = of_get_next_child(node, pp), i++) {
	i = 0;
	for_each_child_of_node(node, pp) {
+		const u32 *reg;
+		int len;
+
+		reg = of_get_property(pp, "reg", &len);
+		if (!reg || (len != 2*sizeof(u32))) {
Spaces around '*'.
+			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];
+
+		partname = of_get_property(pp, "label", &len);
+		if (!partname)
+			partname = of_get_property(pp, "name", &len);
+		(*pparts)[i].name = (char *)partname;
+
+		if (of_get_property(pp, "read-only", &len))
+			(*pparts)[i].mask_flags = MTD_WRITEABLE;
		i++;
+	}
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

Re: [PATCH 2/3] mtd: Factor out OF partition support from the NOR driver.

From: Scott Wood <hidden>
Date: 2008-01-15 23:47:32

Stephen Rothwell wrote:
quoted
+	nr_parts = 0;
+	for (pp = node->child; pp; pp = pp->sibling)
	for_each_child_of_node(node, pp)
"for_each_child_of_node" is only in Paul's tree, but this has to go via mtd.

Plus, I'm just moving the code; it's not new.

-Scott

Re: [PATCH 2/3] mtd: Factor out OF partition support from the NOR driver.

From: Stephen Rothwell <hidden>
Date: 2008-01-16 04:41:58

On Tue, 15 Jan 2008 17:43:06 -0600 Scott Wood [off-list ref] wrote:
Stephen Rothwell wrote:
quoted
quoted
+	nr_parts = 0;
+	for (pp = node->child; pp; pp = pp->sibling)
	for_each_child_of_node(node, pp)
"for_each_child_of_node" is only in Paul's tree, but this has to go via mtd.

Plus, I'm just moving the code; it's not new.
OK, we can change it later.

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help