diff options
Diffstat (limited to 'target/linux/brcm63xx/patches-4.4/000-4.5-05-mtd-drop-unnecessary-partition-parser-data.patch')
-rw-r--r-- | target/linux/brcm63xx/patches-4.4/000-4.5-05-mtd-drop-unnecessary-partition-parser-data.patch | 195 |
1 files changed, 195 insertions, 0 deletions
diff --git a/target/linux/brcm63xx/patches-4.4/000-4.5-05-mtd-drop-unnecessary-partition-parser-data.patch b/target/linux/brcm63xx/patches-4.4/000-4.5-05-mtd-drop-unnecessary-partition-parser-data.patch new file mode 100644 index 0000000000..5bd6c8c57a --- /dev/null +++ b/target/linux/brcm63xx/patches-4.4/000-4.5-05-mtd-drop-unnecessary-partition-parser-data.patch @@ -0,0 +1,195 @@ +From 004b5e6031f4e9fd90d565fb213b74cd06d03718 Mon Sep 17 00:00:00 2001 +From: Brian Norris <computersforpeace@gmail.com> +Date: Fri, 30 Oct 2015 20:33:28 -0700 +Subject: [PATCH] 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 <computersforpeace@gmail.com> +Reviewed-by: Marek Vasut <marex@denx.de> +Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com> +--- + drivers/mtd/devices/mtd_dataflash.c | 5 ++--- + drivers/mtd/devices/spear_smi.c | 6 ++---- + drivers/mtd/devices/st_spi_fsm.c | 5 ++--- + drivers/mtd/maps/lantiq-flash.c | 5 ++--- + drivers/mtd/maps/physmap_of.c | 5 ++--- + drivers/mtd/onenand/omap2.c | 8 +++----- + 6 files changed, 13 insertions(+), 21 deletions(-) + +--- a/drivers/mtd/devices/mtd_dataflash.c ++++ b/drivers/mtd/devices/mtd_dataflash.c +@@ -624,7 +624,6 @@ static int add_dataflash_otp(struct spi_ + { + struct dataflash *priv; + struct mtd_info *device; +- struct mtd_part_parser_data ppdata; + struct flash_platform_data *pdata = dev_get_platdata(&spi->dev); + char *otp_tag = ""; + int err = 0; +@@ -656,6 +655,7 @@ static int add_dataflash_otp(struct spi_ + device->priv = priv; + + device->dev.parent = &spi->dev; ++ mtd_set_of_node(device, spi->dev.of_node); + + if (revision >= 'c') + otp_tag = otp_setup(device, revision); +@@ -665,8 +665,7 @@ static int add_dataflash_otp(struct spi_ + pagesize, otp_tag); + spi_set_drvdata(spi, priv); + +- ppdata.of_node = spi->dev.of_node; +- err = mtd_device_parse_register(device, NULL, &ppdata, ++ err = mtd_device_register(device, + pdata ? pdata->parts : NULL, + pdata ? pdata->nr_parts : 0); + +--- a/drivers/mtd/devices/spear_smi.c ++++ b/drivers/mtd/devices/spear_smi.c +@@ -810,7 +810,6 @@ static int spear_smi_setup_banks(struct + u32 bank, struct device_node *np) + { + struct spear_smi *dev = platform_get_drvdata(pdev); +- struct mtd_part_parser_data ppdata = {}; + struct spear_smi_flash_info *flash_info; + struct spear_smi_plat_data *pdata; + struct spear_snor_flash *flash; +@@ -855,6 +854,7 @@ static int spear_smi_setup_banks(struct + flash->mtd.name = flash_devices[flash_index].name; + + flash->mtd.dev.parent = &pdev->dev; ++ mtd_set_of_node(&flash->mtd, np); + flash->mtd.type = MTD_NORFLASH; + flash->mtd.writesize = 1; + flash->mtd.flags = MTD_CAP_NORFLASH; +@@ -881,10 +881,8 @@ static int spear_smi_setup_banks(struct + count = flash_info->nr_partitions; + } + #endif +- ppdata.of_node = np; + +- ret = mtd_device_parse_register(&flash->mtd, NULL, &ppdata, parts, +- count); ++ ret = mtd_device_register(&flash->mtd, parts, count); + if (ret) { + dev_err(&dev->pdev->dev, "Err MTD partition=%d\n", ret); + return ret; +--- a/drivers/mtd/devices/st_spi_fsm.c ++++ b/drivers/mtd/devices/st_spi_fsm.c +@@ -2025,7 +2025,6 @@ boot_device_fail: + static int stfsm_probe(struct platform_device *pdev) + { + struct device_node *np = pdev->dev.of_node; +- struct mtd_part_parser_data ppdata; + struct flash_info *info; + struct resource *res; + struct stfsm *fsm; +@@ -2035,7 +2034,6 @@ static int stfsm_probe(struct platform_d + dev_err(&pdev->dev, "No DT found\n"); + return -EINVAL; + } +- ppdata.of_node = np; + + fsm = devm_kzalloc(&pdev->dev, sizeof(*fsm), GFP_KERNEL); + if (!fsm) +@@ -2106,6 +2104,7 @@ static int stfsm_probe(struct platform_d + + fsm->mtd.name = info->name; + fsm->mtd.dev.parent = &pdev->dev; ++ mtd_set_of_node(&fsm->mtd, np); + fsm->mtd.type = MTD_NORFLASH; + fsm->mtd.writesize = 4; + fsm->mtd.writebufsize = fsm->mtd.writesize; +@@ -2124,7 +2123,7 @@ static int stfsm_probe(struct platform_d + (long long)fsm->mtd.size, (long long)(fsm->mtd.size >> 20), + fsm->mtd.erasesize, (fsm->mtd.erasesize >> 10)); + +- return mtd_device_parse_register(&fsm->mtd, NULL, &ppdata, NULL, 0); ++ return mtd_device_register(&fsm->mtd, NULL, 0); + } + + static int stfsm_remove(struct platform_device *pdev) +--- 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, unsign + 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 *pd + } + + 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; +--- a/drivers/mtd/maps/physmap_of.c ++++ b/drivers/mtd/maps/physmap_of.c +@@ -128,7 +128,6 @@ static int of_flash_probe(struct platfor + 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; + +@@ -272,8 +271,8 @@ static int of_flash_probe(struct platfor + if (err) + goto err_out; + +- ppdata.of_node = dp; +- mtd_device_parse_register(info->cmtd, part_probe_types_def, &ppdata, ++ mtd_set_of_node(info->cmtd, dp); ++ mtd_device_parse_register(info->cmtd, part_probe_types_def, NULL, + NULL, 0); + + kfree(mtd_list); +--- a/drivers/mtd/onenand/omap2.c ++++ b/drivers/mtd/onenand/omap2.c +@@ -614,7 +614,6 @@ static int omap2_onenand_probe(struct pl + struct onenand_chip *this; + int r; + struct resource *res; +- struct mtd_part_parser_data ppdata = {}; + + pdata = dev_get_platdata(&pdev->dev); + if (pdata == NULL) { +@@ -713,6 +712,7 @@ static int omap2_onenand_probe(struct pl + c->mtd.priv = &c->onenand; + + c->mtd.dev.parent = &pdev->dev; ++ mtd_set_of_node(&c->mtd, pdata->of_node); + + this = &c->onenand; + if (c->dma_channel >= 0) { +@@ -743,10 +743,8 @@ static int omap2_onenand_probe(struct pl + if ((r = onenand_scan(&c->mtd, 1)) < 0) + goto err_release_regulator; + +- ppdata.of_node = pdata->of_node; +- r = mtd_device_parse_register(&c->mtd, NULL, &ppdata, +- pdata ? pdata->parts : NULL, +- pdata ? pdata->nr_parts : 0); ++ r = mtd_device_register(&c->mtd, pdata ? pdata->parts : NULL, ++ pdata ? pdata->nr_parts : 0); + if (r) + goto err_release_onenand; + |