mtd: omap-onenand: pass device_node in platform data
authorEzequiel Garcia <ezequiel.garcia@free-electrons.com>
Fri, 25 Jan 2013 12:23:09 +0000 (09:23 -0300)
committerTony Lindgren <tony@atomide.com>
Fri, 1 Feb 2013 22:10:11 +0000 (14:10 -0800)
Pass an optional device_node pointer in the platform data,
which in turn will be put into a mtd_part_parser_data.
This way, code that sets up the platform devices can pass
along the node from DT so that the partitions can be parsed.

For non-DT boards, this change has no effect.

Acked-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
drivers/mtd/onenand/omap2.c
include/linux/platform_data/mtd-onenand-omap2.h

index 065f3fe02a2fca27b064e3c75ac4b9c2973988d7..eec2aedb4ab83767587cd4f38f28d8632632478a 100644 (file)
@@ -637,6 +637,7 @@ static int omap2_onenand_probe(struct platform_device *pdev)
        struct onenand_chip *this;
        int r;
        struct resource *res;
+       struct mtd_part_parser_data ppdata = {};
 
        pdata = pdev->dev.platform_data;
        if (pdata == NULL) {
@@ -767,7 +768,8 @@ static int omap2_onenand_probe(struct platform_device *pdev)
        if ((r = onenand_scan(&c->mtd, 1)) < 0)
                goto err_release_regulator;
 
-       r = mtd_device_parse_register(&c->mtd, NULL, NULL,
+       ppdata.of_node = pdata->of_node;
+       r = mtd_device_parse_register(&c->mtd, NULL, &ppdata,
                                      pdata ? pdata->parts : NULL,
                                      pdata ? pdata->nr_parts : 0);
        if (r)
index 685af7e8b12076d3e295f3136207e8189dc56e41..e9a9fb188f972555172349a8e0250ac237c7db5d 100644 (file)
@@ -29,5 +29,8 @@ struct omap_onenand_platform_data {
        u8                      flags;
        u8                      regulator_can_sleep;
        u8                      skip_initial_unlocking;
+
+       /* for passing the partitions */
+       struct device_node      *of_node;
 };
 #endif