Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1259919 > unrolled thread
| Started by | Brian Norris <computersforpeace@gmail.com> |
|---|---|
| First post | 2015-10-31 04:40 +0100 |
| Last post | 2015-11-12 00:50 +0100 |
| Articles | 5 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH v2 09/11] mtd: drop unnecessary partition parser data Brian Norris <computersforpeace@gmail.com> - 2015-10-31 04:40 +0100
Re: [PATCH v2 09/11] mtd: drop unnecessary partition parser data Marek Vasut <marex@denx.de> - 2015-10-31 16:30 +0100
Re: [PATCH v2 09/11] mtd: drop unnecessary partition parser data Brian Norris <computersforpeace@gmail.com> - 2015-11-01 01:20 +0100
Re: [PATCH v2 09/11] mtd: drop unnecessary partition parser data Boris Brezillon <boris.brezillon@free-electrons.com> - 2015-11-05 10:00 +0100
Re: [PATCH v2 09/11] mtd: drop unnecessary partition parser data Brian Norris <computersforpeace@gmail.com> - 2015-11-12 00:50 +0100
| From | Brian Norris <computersforpeace@gmail.com> |
|---|---|
| Date | 2015-10-31 04:40 +0100 |
| Subject | [PATCH v2 09/11] mtd: drop unnecessary partition parser data |
| Message-ID | <qpvbj-69C-11@gated-at.bofh.it> |
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>
---
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(&spi->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 = &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_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, &ppdata,
+ 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 = &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 platform_device *pdev,
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;
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(&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_device *pdev)
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_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(&fsm->mtd, NULL, &ppdata, NULL, 0);
+ return mtd_device_register(&fsm->mtd, NULL, 0);
}
static int stfsm_remove(struct platform_device *pdev)
diff --git a/drivers/mtd/maps/lantiq-flash.c b/drivers/mtd/maps/lantiq-flash.c
index 93852054977e..33840f957269 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(<q_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);
diff --git a/drivers/mtd/onenand/omap2.c b/drivers/mtd/onenand/omap2.c
index 3e0285696227..0aacf125938b 100644
--- a/drivers/mtd/onenand/omap2.c
+++ b/drivers/mtd/onenand/omap2.c
@@ -614,7 +614,6 @@ 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 = dev_get_platdata(&pdev->dev);
if (pdata == NULL) {
@@ -713,6 +712,7 @@ static int omap2_onenand_probe(struct platform_device *pdev)
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 platform_device *pdev)
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;
--
2.6.0.rc2.230.g3dd15c0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Marek Vasut <marex@denx.de> |
|---|---|
| Date | 2015-10-31 16:30 +0100 |
| Message-ID | <qpGgq-4vl-13@gated-at.bofh.it> |
| In reply to | #1259919 |
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 <computersforpeace@gmail.com>
[...]
> 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,
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 <marex@denx.de>
Best regards,
Marek Vasut
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Brian Norris <computersforpeace@gmail.com> |
|---|---|
| Date | 2015-11-01 01:20 +0100 |
| Message-ID | <qpOxj-1cB-3@gated-at.bofh.it> |
| In reply to | #1260009 |
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, &ppdata, > > + 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 <marex@denx.de> 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 majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Boris Brezillon <boris.brezillon@free-electrons.com> |
|---|---|
| Date | 2015-11-05 10:00 +0100 |
| Message-ID | <qroyL-4iE-31@gated-at.bofh.it> |
| In reply to | #1259919 |
On Fri, 30 Oct 2015 20:33:28 -0700
Brian Norris <computersforpeace@gmail.com> 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 = &pdev->dev;
> + mtd_set_of_node(<q_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 majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Brian Norris <computersforpeace@gmail.com> |
|---|---|
| Date | 2015-11-12 00:50 +0100 |
| Message-ID | <qtNjj-19f-1@gated-at.bofh.it> |
| In reply to | #1263027 |
On Thu, Nov 05, 2015 at 09:49:30AM +0100, Boris Brezillon wrote:
> On Fri, 30 Oct 2015 20:33:28 -0700
> Brian Norris <computersforpeace@gmail.com> 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 = &pdev->dev;
> > + mtd_set_of_node(<q_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 majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web