From 004b5e6031f4e9fd90d565fb213b74cd06d03718 Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Fri, 30 Oct 2015 20:33:28 -0700 Subject: mtd: drop unnecessary partition parser data We should assign the MTD dev.of_node instead of the parser data field. This gets us the equivalent partition parser behavior with fewer special fields and parameter passing. Also convert several of these to mtd_device_register(), since we don't need the 2nd and 3rd parameters anymore. Signed-off-by: Brian Norris Reviewed-by: Marek Vasut Reviewed-by: Boris Brezillon --- drivers/mtd/maps/lantiq-flash.c | 5 ++--- drivers/mtd/maps/physmap_of.c | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) (limited to 'drivers/mtd/maps') diff --git a/drivers/mtd/maps/lantiq-flash.c b/drivers/mtd/maps/lantiq-flash.c index 93852054977e..c8febb326fa6 100644 --- a/drivers/mtd/maps/lantiq-flash.c +++ b/drivers/mtd/maps/lantiq-flash.c @@ -110,7 +110,6 @@ ltq_copy_to(struct map_info *map, unsigned long to, static int ltq_mtd_probe(struct platform_device *pdev) { - struct mtd_part_parser_data ppdata; struct ltq_mtd *ltq_mtd; struct cfi_private *cfi; int err; @@ -161,13 +160,13 @@ ltq_mtd_probe(struct platform_device *pdev) } ltq_mtd->mtd->dev.parent = &pdev->dev; + mtd_set_of_node(ltq_mtd->mtd, pdev->dev.of_node); cfi = ltq_mtd->map->fldrv_priv; cfi->addr_unlock1 ^= 1; cfi->addr_unlock2 ^= 1; - ppdata.of_node = pdev->dev.of_node; - err = mtd_device_parse_register(ltq_mtd->mtd, NULL, &ppdata, NULL, 0); + err = mtd_device_register(ltq_mtd->mtd, NULL, 0); if (err) { dev_err(&pdev->dev, "failed to add partitions\n"); goto err_destroy; diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c index e46b4e983666..b78265688075 100644 --- a/drivers/mtd/maps/physmap_of.c +++ b/drivers/mtd/maps/physmap_of.c @@ -166,7 +166,6 @@ static int of_flash_probe(struct platform_device *dev) int reg_tuple_size; struct mtd_info **mtd_list = NULL; resource_size_t res_size; - struct mtd_part_parser_data ppdata; bool map_indirect; const char *mtd_name = NULL; @@ -310,13 +309,13 @@ static int of_flash_probe(struct platform_device *dev) if (err) goto err_out; - ppdata.of_node = dp; + mtd_set_of_node(info->cmtd, dp); part_probe_types = of_get_probes(dp); if (!part_probe_types) { err = -ENOMEM; goto err_out; } - mtd_device_parse_register(info->cmtd, part_probe_types, &ppdata, + mtd_device_parse_register(info->cmtd, part_probe_types, NULL, NULL, 0); of_free_probes(part_probe_types); -- cgit v1.2.1 From 8361a9b8cb6a9c71b7cf884a87b2532d8367c185 Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Fri, 30 Oct 2015 20:33:30 -0700 Subject: mtd: physmap_of: assign parent for the concatenated MTD If there is more than one map region for this device, then the concatenated MTD will not have a parent device assigned to it -- only the sub-devices (which are not actually registered with the framework) will have their parents assigned. Let's assign the concatenated device correctly. Signed-off-by: Brian Norris Reviewed-by: Boris Brezillon --- drivers/mtd/maps/physmap_of.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/mtd/maps') diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c index b78265688075..70c453144f00 100644 --- a/drivers/mtd/maps/physmap_of.c +++ b/drivers/mtd/maps/physmap_of.c @@ -309,6 +309,7 @@ static int of_flash_probe(struct platform_device *dev) if (err) goto err_out; + info->cmtd->dev.parent = &dev->dev; mtd_set_of_node(info->cmtd, dp); part_probe_types = of_get_probes(dp); if (!part_probe_types) { -- cgit v1.2.1