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

Stephen Rothwell sfr at canb.auug.org.au
Mon Jan 14 01:21:16 EST 2008


Hi Scott,

[Corrected list address.]

On Fri, 11 Jan 2008 14:43:16 -0600 Scott Wood <scottwood at freescale.com> wrote:
>
> +++ 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 at canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.infradead.org/pipermail/linux-mtd/attachments/20080114/4087527b/attachment.bin 


More information about the linux-mtd mailing list