Re: [PATCH 041/104] mtd: prepare to convert of_mtd_parse_partitions to partition parser

Artem Bityutskiy
2011-06-06T08:01:54Z

On Thu, 2011-06-02 at 18:51 +0400, Dmitry Eremin-Solenikov wrote:
> Prepare to convert of_mtd_parse_partitions() to usual partitions parser:
> 1) Register ofpart parser
> 2) Internally don't use passed device for error printing
> 3) Add device_node to mtd_info struct
> 4) Move of_mtd_parse_partitions from __devinit to common text section
> 5) add ofpart to the default list of partition parsers
>
> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>

Good idea, but

> #include <linux/mtd/mtd.h>
> #include <linux/mtd/partitions.h>
> @@ -446,6 +447,10 @@ int mtd_device_register(struct mtd_info *master,
> const struct mtd_partition *parts,
> int nr_parts)
> {
> +#ifdef CONFIG_OF
> + if (master->node)
> + of_node_get(master->node);
> +#endif

Could all the OF-specific things be done in the ofpart.c ?

> --- a/include/linux/mtd/mtd.h
> +++ b/include/linux/mtd/mtd.h
> @@ -171,6 +171,9 @@ struct mtd_info {
> // Kernel-only stuff starts here.
> const char *name;
> int index;
> +#ifdef CONFIG_OF
> + struct device_node *node;
> +#endif

And designe-wise this does not look like a good idea to have such fields
in mtd_info ... Who initializes this "node" field?

--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)