Re: [PATCH v2 09/11] mtd: drop unnecessary partition parser data
On Thu, Nov 05, 2015 at 09:49:30AM +0100, Boris Brezillon wrote: > On Fri, 30 Oct 2015 20:33:28 -0700 > Brian Norris wrote: > > > --- 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 = >dev; > > + mtd_set_of_node(_mtd->mtd, pdev->dev.of_node); > > Should be: > > mtd_set_of_node(ltq_mtd->mtd, pdev->dev.of_node); > > (This error was reported by your aiaiai build test) Fixed that build error and pushed the rest of my 11 patches to l2-mtd.git/next. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 09/11] mtd: drop unnecessary partition parser data
On Thu, Nov 05, 2015 at 09:49:30AM +0100, Boris Brezillon wrote: > On Fri, 30 Oct 2015 20:33:28 -0700 > Brian Norriswrote: > > > --- 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 = >dev; > > + mtd_set_of_node(_mtd->mtd, pdev->dev.of_node); > > Should be: > > mtd_set_of_node(ltq_mtd->mtd, pdev->dev.of_node); > > (This error was reported by your aiaiai build test) Fixed that build error and pushed the rest of my 11 patches to l2-mtd.git/next. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 09/11] mtd: drop unnecessary partition parser data
On Fri, 30 Oct 2015 20:33:28 -0700 Brian Norris wrote: > --- 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 = >dev; > + mtd_set_of_node(_mtd->mtd, pdev->dev.of_node); Should be: mtd_set_of_node(ltq_mtd->mtd, pdev->dev.of_node); (This error was reported by your aiaiai build test) -- Boris Brezillon, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 09/11] mtd: drop unnecessary partition parser data
On Fri, 30 Oct 2015 20:33:28 -0700 Brian Norriswrote: > --- 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 = >dev; > + mtd_set_of_node(_mtd->mtd, pdev->dev.of_node); Should be: mtd_set_of_node(ltq_mtd->mtd, pdev->dev.of_node); (This error was reported by your aiaiai build test) -- Boris Brezillon, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 09/11] mtd: drop unnecessary partition parser data
On Sat, Oct 31, 2015 at 04:26:32PM +0100, Marek Vasut wrote: > On Saturday, October 31, 2015 at 04:33:28 AM, Brian Norris wrote: > > - mtd_device_parse_register(info->cmtd, part_probe_types, , > > + mtd_device_parse_register(info->cmtd, part_probe_types, NULL, > > Did you miss this one ? What about it? I removed the parser data (the third argument), but I can't yet drop the 2nd argument, since those parser types are different than the defaults. So I can't drop any more arguments, nor can I convert this to mtd_device_register(). (Now, I'd like to improve the device tree handling of parser types, so we don't need any more specialized handling in drivers like this.) > > NULL, 0); > > of_free_probes(part_probe_types); > > > > > This is really good, I like to see the ppdata nonsense finally going away. > > Reviewed-by: Marek Vasut Thanks for the review! I'm happy to kill off much of this nonsense too. And I think this will help in the long run on some other things too, since now we have a canonical place to put common MTD bindings. Brian -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 09/11] mtd: drop unnecessary partition parser data
On Saturday, October 31, 2015 at 04:33:28 AM, Brian Norris wrote: > 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 [...] > 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, , > + mtd_device_parse_register(info->cmtd, part_probe_types, NULL, Did you miss this one ? > NULL, 0); > of_free_probes(part_probe_types); > This is really good, I like to see the ppdata nonsense finally going away. Reviewed-by: Marek Vasut Best regards, Marek Vasut -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 09/11] mtd: drop unnecessary partition parser data
On Saturday, October 31, 2015 at 04:33:28 AM, Brian Norris wrote: > 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[...] > 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, , > + mtd_device_parse_register(info->cmtd, part_probe_types, NULL, Did you miss this one ? > NULL, 0); > of_free_probes(part_probe_types); > This is really good, I like to see the ppdata nonsense finally going away. Reviewed-by: Marek Vasut Best regards, Marek Vasut -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 09/11] mtd: drop unnecessary partition parser data
On Sat, Oct 31, 2015 at 04:26:32PM +0100, Marek Vasut wrote: > On Saturday, October 31, 2015 at 04:33:28 AM, Brian Norris wrote: > > - mtd_device_parse_register(info->cmtd, part_probe_types, , > > + mtd_device_parse_register(info->cmtd, part_probe_types, NULL, > > Did you miss this one ? What about it? I removed the parser data (the third argument), but I can't yet drop the 2nd argument, since those parser types are different than the defaults. So I can't drop any more arguments, nor can I convert this to mtd_device_register(). (Now, I'd like to improve the device tree handling of parser types, so we don't need any more specialized handling in drivers like this.) > > NULL, 0); > > of_free_probes(part_probe_types); > > > > > This is really good, I like to see the ppdata nonsense finally going away. > > Reviewed-by: Marek VasutThanks for the review! I'm happy to kill off much of this nonsense too. And I think this will help in the long run on some other things too, since now we have a canonical place to put common MTD bindings. Brian -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 09/11] 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 --- v2: use new helpers 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(-) diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c index 39666d552682..0ada3ed6c23f 100644 --- 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_device *spi, char *name, int nr_pages, { struct dataflash*priv; struct mtd_info *device; - struct mtd_part_parser_data ppdata; struct flash_platform_data *pdata = dev_get_platdata(>dev); char*otp_tag = ""; int err = 0; @@ -656,6 +655,7 @@ static int add_dataflash_otp(struct spi_device *spi, char *name, int nr_pages, device->priv = priv; device->dev.parent = >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_device *spi, char *name, int nr_pages, pagesize, otp_tag); spi_set_drvdata(spi, priv); - ppdata.of_node = spi->dev.of_node; - err = mtd_device_parse_register(device, NULL, , + err = mtd_device_register(device, pdata ? pdata->parts : NULL, pdata ? pdata->nr_parts : 0); diff --git a/drivers/mtd/devices/spear_smi.c b/drivers/mtd/devices/spear_smi.c index 64c7458344d4..dd5069876537 100644 --- 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 platform_device *pdev, 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 platform_device *pdev, flash->mtd.name = flash_devices[flash_index].name; flash->mtd.dev.parent = >dev; + mtd_set_of_node(>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 platform_device *pdev, count = flash_info->nr_partitions; } #endif - ppdata.of_node = np; - ret = mtd_device_parse_register(>mtd, NULL, , parts, - count); + ret = mtd_device_register(>mtd, parts, count); if (ret) { dev_err(>pdev->dev, "Err MTD partition=%d\n", ret); return ret; diff --git a/drivers/mtd/devices/st_spi_fsm.c b/drivers/mtd/devices/st_spi_fsm.c index 3060025c8af4..5454b4113589 100644 --- 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_device *pdev) dev_err(>dev, "No DT found\n"); return -EINVAL; } - ppdata.of_node = np; fsm = devm_kzalloc(>dev, sizeof(*fsm), GFP_KERNEL); if (!fsm) @@ -2106,6 +2104,7 @@ static int stfsm_probe(struct platform_device *pdev) fsm->mtd.name = info->name; fsm->mtd.dev.parent = >dev; + mtd_set_of_node(>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_device *pdev) (long long)fsm->mtd.size, (long long)(fsm->mtd.size >> 20), fsm->mtd.erasesize, (fsm->mtd.erasesize >> 10)); - return mtd_device_parse_register(>mtd, NULL, , NULL, 0); + return mtd_device_register(>mtd, NULL, 0); } static int stfsm_remove(struct platform_device *pdev) diff --git a/drivers/mtd/maps/lantiq-flash.c
[PATCH v2 09/11] 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--- v2: use new helpers 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(-) diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c index 39666d552682..0ada3ed6c23f 100644 --- 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_device *spi, char *name, int nr_pages, { struct dataflash*priv; struct mtd_info *device; - struct mtd_part_parser_data ppdata; struct flash_platform_data *pdata = dev_get_platdata(>dev); char*otp_tag = ""; int err = 0; @@ -656,6 +655,7 @@ static int add_dataflash_otp(struct spi_device *spi, char *name, int nr_pages, device->priv = priv; device->dev.parent = >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_device *spi, char *name, int nr_pages, pagesize, otp_tag); spi_set_drvdata(spi, priv); - ppdata.of_node = spi->dev.of_node; - err = mtd_device_parse_register(device, NULL, , + err = mtd_device_register(device, pdata ? pdata->parts : NULL, pdata ? pdata->nr_parts : 0); diff --git a/drivers/mtd/devices/spear_smi.c b/drivers/mtd/devices/spear_smi.c index 64c7458344d4..dd5069876537 100644 --- 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 platform_device *pdev, 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 platform_device *pdev, flash->mtd.name = flash_devices[flash_index].name; flash->mtd.dev.parent = >dev; + mtd_set_of_node(>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 platform_device *pdev, count = flash_info->nr_partitions; } #endif - ppdata.of_node = np; - ret = mtd_device_parse_register(>mtd, NULL, , parts, - count); + ret = mtd_device_register(>mtd, parts, count); if (ret) { dev_err(>pdev->dev, "Err MTD partition=%d\n", ret); return ret; diff --git a/drivers/mtd/devices/st_spi_fsm.c b/drivers/mtd/devices/st_spi_fsm.c index 3060025c8af4..5454b4113589 100644 --- 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_device *pdev) dev_err(>dev, "No DT found\n"); return -EINVAL; } - ppdata.of_node = np; fsm = devm_kzalloc(>dev, sizeof(*fsm), GFP_KERNEL); if (!fsm) @@ -2106,6 +2104,7 @@ static int stfsm_probe(struct platform_device *pdev) fsm->mtd.name = info->name; fsm->mtd.dev.parent = >dev; + mtd_set_of_node(>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_device *pdev) (long long)fsm->mtd.size, (long long)(fsm->mtd.size >> 20), fsm->mtd.erasesize, (fsm->mtd.erasesize >> 10)); - return mtd_device_parse_register(>mtd, NULL, , NULL, 0); + return mtd_device_register(>mtd, NULL, 0); } static int stfsm_remove(struct platform_device *pdev) diff --git