1 From a61ae81a1907af1987ad4c77300508327bc48b23 Mon Sep 17 00:00:00 2001
2 From: Brian Norris <computersforpeace@gmail.com>
3 Date: Fri, 30 Oct 2015 20:33:25 -0700
4 Subject: [PATCH 06/11] mtd: nand: drop unnecessary partition parser data
6 All of these drivers set up a parser data struct just to communicate DT
7 partition data. This field has been deprecated and is instead supported
8 by telling nand_scan_ident() about the 'flash_node'.
11 * sets chip->flash_node for those drivers that didn't already (but used
13 * drops the parser data
14 * switches to the simpler mtd_device_register() where possible, now
15 that we've eliminated one of the auxiliary parameters
17 Now that we've assigned chip->flash_node for these drivers, we can
18 probably rely on nand_dt_init() to do more of the DT parsing for us, but
19 for now, I don't want to fiddle with each of these drivers. The parsing
20 is done in duplicate for now on some drivers. I don't think this should
21 break things. (Famous last words.)
23 (Rolled in some changes by Boris Brezillon)
25 Signed-off-by: Brian Norris <computersforpeace@gmail.com>
26 Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
28 drivers/mtd/nand/atmel_nand.c | 7 +++----
29 drivers/mtd/nand/brcmnand/brcmnand.c | 3 +--
30 drivers/mtd/nand/davinci_nand.c | 10 +++-------
31 drivers/mtd/nand/fsl_elbc_nand.c | 5 ++---
32 drivers/mtd/nand/fsl_ifc_nand.c | 5 ++---
33 drivers/mtd/nand/fsl_upm.c | 5 ++---
34 drivers/mtd/nand/fsmc_nand.c | 7 +++----
35 drivers/mtd/nand/gpio.c | 8 +++-----
36 drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 5 ++---
37 drivers/mtd/nand/hisi504_nand.c | 5 ++---
38 drivers/mtd/nand/lpc32xx_mlc.c | 7 +++----
39 drivers/mtd/nand/lpc32xx_slc.c | 7 +++----
40 drivers/mtd/nand/mpc5121_nfc.c | 5 ++---
41 drivers/mtd/nand/mxc_nand.c | 5 ++---
42 drivers/mtd/nand/ndfc.c | 5 ++---
43 drivers/mtd/nand/omap2.c | 6 ++----
44 drivers/mtd/nand/orion_nand.c | 6 ++----
45 drivers/mtd/nand/plat_nand.c | 5 ++---
46 drivers/mtd/nand/pxa3xx_nand.c | 10 +++++-----
47 drivers/mtd/nand/sh_flctl.c | 6 ++----
48 drivers/mtd/nand/socrates_nand.c | 5 ++---
49 drivers/mtd/nand/sunxi_nand.c | 4 +---
50 drivers/mtd/nand/vf610_nfc.c | 6 +-----
51 drivers/staging/mt29f_spinand/mt29f_spinand.c | 5 ++---
52 24 files changed, 54 insertions(+), 88 deletions(-)
54 --- a/drivers/mtd/nand/atmel_nand.c
55 +++ b/drivers/mtd/nand/atmel_nand.c
56 @@ -2093,7 +2093,6 @@ static int atmel_nand_probe(struct platf
58 struct nand_chip *nand_chip;
60 - struct mtd_part_parser_data ppdata = {};
63 /* Allocate memory for the device structure (and zero it) */
64 @@ -2117,6 +2116,7 @@ static int atmel_nand_probe(struct platf
65 nand_chip = &host->nand_chip;
66 host->dev = &pdev->dev;
67 if (IS_ENABLED(CONFIG_OF) && pdev->dev.of_node) {
68 + nand_set_flash_node(nand_chip, pdev->dev.of_node);
69 /* Only when CONFIG_OF is enabled of_node can be parsed */
70 res = atmel_of_init_port(host, pdev->dev.of_node);
72 @@ -2259,9 +2259,8 @@ static int atmel_nand_probe(struct platf
75 mtd->name = "atmel_nand";
76 - ppdata.of_node = pdev->dev.of_node;
77 - res = mtd_device_parse_register(mtd, NULL, &ppdata,
78 - host->board.parts, host->board.num_parts);
79 + res = mtd_device_register(mtd, host->board.parts,
80 + host->board.num_parts);
84 --- a/drivers/mtd/nand/brcmnand/brcmnand.c
85 +++ b/drivers/mtd/nand/brcmnand/brcmnand.c
86 @@ -1946,7 +1946,6 @@ static int brcmnand_init_cs(struct brcmn
87 struct nand_chip *chip;
90 - struct mtd_part_parser_data ppdata = { .of_node = dn };
92 ret = of_property_read_u32(dn, "reg", &host->cs);
94 @@ -2025,7 +2024,7 @@ static int brcmnand_init_cs(struct brcmn
95 if (nand_scan_tail(mtd))
98 - return mtd_device_parse_register(mtd, NULL, &ppdata, NULL, 0);
99 + return mtd_device_register(mtd, NULL, 0);
102 static void brcmnand_save_restore_cs_config(struct brcmnand_host *host,
103 --- a/drivers/mtd/nand/davinci_nand.c
104 +++ b/drivers/mtd/nand/davinci_nand.c
105 @@ -687,6 +687,7 @@ static int nand_davinci_probe(struct pla
107 info->mtd.priv = &info->chip;
108 info->mtd.dev.parent = &pdev->dev;
109 + nand_set_flash_node(&info->chip, pdev->dev.of_node);
111 info->chip.IO_ADDR_R = vaddr;
112 info->chip.IO_ADDR_W = vaddr;
113 @@ -842,13 +843,8 @@ syndrome_done:
115 ret = mtd_device_parse_register(&info->mtd, NULL, NULL,
116 pdata->parts, pdata->nr_parts);
118 - struct mtd_part_parser_data ppdata;
120 - ppdata.of_node = pdev->dev.of_node;
121 - ret = mtd_device_parse_register(&info->mtd, NULL, &ppdata,
125 + ret = mtd_device_register(&info->mtd, NULL, 0);
129 --- a/drivers/mtd/nand/fsl_elbc_nand.c
130 +++ b/drivers/mtd/nand/fsl_elbc_nand.c
131 @@ -748,6 +748,7 @@ static int fsl_elbc_chip_init(struct fsl
132 /* Fill in fsl_elbc_mtd structure */
133 priv->mtd.priv = chip;
134 priv->mtd.dev.parent = priv->dev;
135 + nand_set_flash_node(chip, priv->dev->of_node);
137 /* set timeout to maximum */
138 priv->fmr = 15 << FMR_CWTO_SHIFT;
139 @@ -823,9 +824,7 @@ static int fsl_elbc_nand_probe(struct pl
142 struct device_node *node = pdev->dev.of_node;
143 - struct mtd_part_parser_data ppdata;
145 - ppdata.of_node = pdev->dev.of_node;
146 if (!fsl_lbc_ctrl_dev || !fsl_lbc_ctrl_dev->regs)
148 lbc = fsl_lbc_ctrl_dev->regs;
149 @@ -911,7 +910,7 @@ static int fsl_elbc_nand_probe(struct pl
151 /* First look for RedBoot table or partitions on the command
152 * line, these take precedence over device tree information */
153 - mtd_device_parse_register(&priv->mtd, part_probe_types, &ppdata,
154 + mtd_device_parse_register(&priv->mtd, part_probe_types, NULL,
157 printk(KERN_INFO "eLBC NAND device at 0x%llx, bank %d\n",
158 --- a/drivers/mtd/nand/fsl_ifc_nand.c
159 +++ b/drivers/mtd/nand/fsl_ifc_nand.c
160 @@ -883,6 +883,7 @@ static int fsl_ifc_chip_init(struct fsl_
161 /* Fill in fsl_ifc_mtd structure */
162 priv->mtd.priv = chip;
163 priv->mtd.dev.parent = priv->dev;
164 + nand_set_flash_node(chip, priv->dev->of_node);
166 /* fill in nand_chip structure */
167 /* set up function call table */
168 @@ -1030,9 +1031,7 @@ static int fsl_ifc_nand_probe(struct pla
171 struct device_node *node = dev->dev.of_node;
172 - struct mtd_part_parser_data ppdata;
174 - ppdata.of_node = dev->dev.of_node;
175 if (!fsl_ifc_ctrl_dev || !fsl_ifc_ctrl_dev->regs)
177 ifc = fsl_ifc_ctrl_dev->regs;
178 @@ -1128,7 +1127,7 @@ static int fsl_ifc_nand_probe(struct pla
180 /* First look for RedBoot table or partitions on the command
181 * line, these take precedence over device tree information */
182 - mtd_device_parse_register(&priv->mtd, part_probe_types, &ppdata,
183 + mtd_device_parse_register(&priv->mtd, part_probe_types, NULL,
186 dev_info(priv->dev, "IFC NAND device at 0x%llx, bank %d\n",
187 --- a/drivers/mtd/nand/fsl_upm.c
188 +++ b/drivers/mtd/nand/fsl_upm.c
189 @@ -159,7 +159,6 @@ static int fun_chip_init(struct fsl_upm_
192 struct device_node *flash_np;
193 - struct mtd_part_parser_data ppdata;
195 fun->chip.IO_ADDR_R = fun->io_base;
196 fun->chip.IO_ADDR_W = fun->io_base;
197 @@ -182,6 +181,7 @@ static int fun_chip_init(struct fsl_upm_
201 + nand_set_flash_node(&fun->chip, flash_np);
202 fun->mtd.name = kasprintf(GFP_KERNEL, "0x%llx.%s", (u64)io_res->start,
204 if (!fun->mtd.name) {
205 @@ -193,8 +193,7 @@ static int fun_chip_init(struct fsl_upm_
209 - ppdata.of_node = flash_np;
210 - ret = mtd_device_parse_register(&fun->mtd, NULL, &ppdata, NULL, 0);
211 + ret = mtd_device_register(&fun->mtd, NULL, 0);
213 of_node_put(flash_np);
215 --- a/drivers/mtd/nand/fsmc_nand.c
216 +++ b/drivers/mtd/nand/fsmc_nand.c
217 @@ -926,7 +926,6 @@ static int __init fsmc_nand_probe(struct
219 struct fsmc_nand_platform_data *pdata = dev_get_platdata(&pdev->dev);
220 struct device_node __maybe_unused *np = pdev->dev.of_node;
221 - struct mtd_part_parser_data ppdata = {};
222 struct fsmc_nand_data *host;
223 struct mtd_info *mtd;
224 struct nand_chip *nand;
225 @@ -1016,6 +1015,7 @@ static int __init fsmc_nand_probe(struct
229 + nand_set_flash_node(nand, np);
231 host->mtd.dev.parent = &pdev->dev;
232 nand->IO_ADDR_R = host->data_va;
233 @@ -1175,9 +1175,8 @@ static int __init fsmc_nand_probe(struct
234 * Check for partition info passed
236 host->mtd.name = "nand";
237 - ppdata.of_node = np;
238 - ret = mtd_device_parse_register(&host->mtd, NULL, &ppdata,
239 - host->partitions, host->nr_partitions);
240 + ret = mtd_device_register(&host->mtd, host->partitions,
241 + host->nr_partitions);
245 --- a/drivers/mtd/nand/gpio.c
246 +++ b/drivers/mtd/nand/gpio.c
247 @@ -209,7 +209,6 @@ static int gpio_nand_probe(struct platfo
248 struct gpiomtd *gpiomtd;
249 struct nand_chip *chip;
250 struct resource *res;
251 - struct mtd_part_parser_data ppdata = {};
254 if (!pdev->dev.of_node && !dev_get_platdata(&pdev->dev))
255 @@ -268,6 +267,7 @@ static int gpio_nand_probe(struct platfo
256 chip->dev_ready = gpio_nand_devready;
259 + nand_set_flash_node(chip, pdev->dev.of_node);
260 chip->IO_ADDR_W = chip->IO_ADDR_R;
261 chip->ecc.mode = NAND_ECC_SOFT;
262 chip->options = gpiomtd->plat.options;
263 @@ -291,10 +291,8 @@ static int gpio_nand_probe(struct platfo
264 gpiomtd->plat.adjust_parts(&gpiomtd->plat,
265 gpiomtd->mtd_info.size);
267 - ppdata.of_node = pdev->dev.of_node;
268 - ret = mtd_device_parse_register(&gpiomtd->mtd_info, NULL, &ppdata,
269 - gpiomtd->plat.parts,
270 - gpiomtd->plat.num_parts);
271 + ret = mtd_device_register(&gpiomtd->mtd_info, gpiomtd->plat.parts,
272 + gpiomtd->plat.num_parts);
276 --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
277 +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
278 @@ -1888,7 +1888,6 @@ static int gpmi_nand_init(struct gpmi_na
280 struct mtd_info *mtd = &this->mtd;
281 struct nand_chip *chip = &this->nand;
282 - struct mtd_part_parser_data ppdata = {};
285 /* init current chip */
286 @@ -1901,6 +1900,7 @@ static int gpmi_nand_init(struct gpmi_na
288 /* init the nand_chip{}, we don't support a 16-bit NAND Flash bus. */
290 + nand_set_flash_node(chip, this->pdev->dev.of_node);
291 chip->select_chip = gpmi_select_chip;
292 chip->cmd_ctrl = gpmi_cmd_ctrl;
293 chip->dev_ready = gpmi_dev_ready;
294 @@ -1954,8 +1954,7 @@ static int gpmi_nand_init(struct gpmi_na
298 - ppdata.of_node = this->pdev->dev.of_node;
299 - ret = mtd_device_parse_register(mtd, NULL, &ppdata, NULL, 0);
300 + ret = mtd_device_register(mtd, NULL, 0);
304 --- a/drivers/mtd/nand/hisi504_nand.c
305 +++ b/drivers/mtd/nand/hisi504_nand.c
306 @@ -704,7 +704,6 @@ static int hisi_nfc_probe(struct platfor
307 struct mtd_info *mtd;
308 struct resource *res;
309 struct device_node *np = dev->of_node;
310 - struct mtd_part_parser_data ppdata;
312 host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL);
314 @@ -742,6 +741,7 @@ static int hisi_nfc_probe(struct platfor
315 mtd->dev.parent = &pdev->dev;
318 + nand_set_flash_node(chip, np);
319 chip->cmdfunc = hisi_nfc_cmdfunc;
320 chip->select_chip = hisi_nfc_select_chip;
321 chip->read_byte = hisi_nfc_read_byte;
322 @@ -805,8 +805,7 @@ static int hisi_nfc_probe(struct platfor
326 - ppdata.of_node = np;
327 - ret = mtd_device_parse_register(mtd, NULL, &ppdata, NULL, 0);
328 + ret = mtd_device_register(mtd, NULL, 0);
330 dev_err(dev, "Err MTD partition=%d\n", ret);
332 --- a/drivers/mtd/nand/lpc32xx_mlc.c
333 +++ b/drivers/mtd/nand/lpc32xx_mlc.c
334 @@ -647,7 +647,6 @@ static int lpc32xx_nand_probe(struct pla
335 struct nand_chip *nand_chip;
338 - struct mtd_part_parser_data ppdata = {};
340 /* Allocate memory for the device structure (and zero it) */
341 host = devm_kzalloc(&pdev->dev, sizeof(*host), GFP_KERNEL);
342 @@ -682,6 +681,7 @@ static int lpc32xx_nand_probe(struct pla
343 host->pdata = dev_get_platdata(&pdev->dev);
345 nand_chip->priv = host; /* link the private data structures */
346 + nand_set_flash_node(nand_chip, pdev->dev.of_node);
347 mtd->priv = nand_chip;
348 mtd->dev.parent = &pdev->dev;
350 @@ -786,9 +786,8 @@ static int lpc32xx_nand_probe(struct pla
352 mtd->name = DRV_NAME;
354 - ppdata.of_node = pdev->dev.of_node;
355 - res = mtd_device_parse_register(mtd, NULL, &ppdata, host->ncfg->parts,
356 - host->ncfg->num_parts);
357 + res = mtd_device_register(mtd, host->ncfg->parts,
358 + host->ncfg->num_parts);
362 --- a/drivers/mtd/nand/lpc32xx_slc.c
363 +++ b/drivers/mtd/nand/lpc32xx_slc.c
364 @@ -763,7 +763,6 @@ static int lpc32xx_nand_probe(struct pla
365 struct mtd_info *mtd;
366 struct nand_chip *chip;
368 - struct mtd_part_parser_data ppdata = {};
371 rc = platform_get_resource(pdev, IORESOURCE_MEM, 0);
372 @@ -803,6 +802,7 @@ static int lpc32xx_nand_probe(struct pla
374 chip = &host->nand_chip;
376 + nand_set_flash_node(chip, pdev->dev.of_node);
378 mtd->owner = THIS_MODULE;
379 mtd->dev.parent = &pdev->dev;
380 @@ -908,9 +908,8 @@ static int lpc32xx_nand_probe(struct pla
383 mtd->name = "nxp_lpc3220_slc";
384 - ppdata.of_node = pdev->dev.of_node;
385 - res = mtd_device_parse_register(mtd, NULL, &ppdata, host->ncfg->parts,
386 - host->ncfg->num_parts);
387 + res = mtd_device_register(mtd, host->ncfg->parts,
388 + host->ncfg->num_parts);
392 --- a/drivers/mtd/nand/mpc5121_nfc.c
393 +++ b/drivers/mtd/nand/mpc5121_nfc.c
394 @@ -639,7 +639,6 @@ static int mpc5121_nfc_probe(struct plat
398 - struct mtd_part_parser_data ppdata;
401 * Check SoC revision. This driver supports only NFC
402 @@ -661,6 +660,7 @@ static int mpc5121_nfc_probe(struct plat
404 mtd->dev.parent = dev;
406 + nand_set_flash_node(chip, dn);
409 /* Read NFC configuration from Reset Config Word */
410 @@ -703,7 +703,6 @@ static int mpc5121_nfc_probe(struct plat
413 mtd->name = "MPC5121 NAND";
414 - ppdata.of_node = dn;
415 chip->dev_ready = mpc5121_nfc_dev_ready;
416 chip->cmdfunc = mpc5121_nfc_command;
417 chip->read_byte = mpc5121_nfc_read_byte;
418 @@ -815,7 +814,7 @@ static int mpc5121_nfc_probe(struct plat
419 dev_set_drvdata(dev, mtd);
421 /* Register device in MTD */
422 - retval = mtd_device_parse_register(mtd, NULL, &ppdata, NULL, 0);
423 + retval = mtd_device_register(mtd, NULL, 0);
425 dev_err(dev, "Error adding MTD device!\n");
427 --- a/drivers/mtd/nand/mxc_nand.c
428 +++ b/drivers/mtd/nand/mxc_nand.c
429 @@ -1524,6 +1524,7 @@ static int mxcnd_probe(struct platform_d
430 this->chip_delay = 5;
433 + nand_set_flash_node(this, pdev->dev.of_node),
434 this->dev_ready = mxc_nand_dev_ready;
435 this->cmdfunc = mxc_nand_command;
436 this->read_byte = mxc_nand_read_byte;
437 @@ -1683,9 +1684,7 @@ static int mxcnd_probe(struct platform_d
439 /* Register the partitions */
440 mtd_device_parse_register(mtd, part_probes,
441 - &(struct mtd_part_parser_data){
442 - .of_node = pdev->dev.of_node,
446 host->pdata.nr_parts);
448 --- a/drivers/mtd/nand/ndfc.c
449 +++ b/drivers/mtd/nand/ndfc.c
450 @@ -147,7 +147,6 @@ static int ndfc_chip_init(struct ndfc_co
452 struct device_node *flash_np;
453 struct nand_chip *chip = &ndfc->chip;
454 - struct mtd_part_parser_data ppdata;
457 chip->IO_ADDR_R = ndfc->ndfcbase + NDFC_DATA;
458 @@ -174,8 +173,8 @@ static int ndfc_chip_init(struct ndfc_co
459 flash_np = of_get_next_child(node, NULL);
462 + nand_set_flash_node(chip, flash_np);
464 - ppdata.of_node = flash_np;
465 ndfc->mtd.name = kasprintf(GFP_KERNEL, "%s.%s",
466 dev_name(&ndfc->ofdev->dev), flash_np->name);
467 if (!ndfc->mtd.name) {
468 @@ -187,7 +186,7 @@ static int ndfc_chip_init(struct ndfc_co
472 - ret = mtd_device_parse_register(&ndfc->mtd, NULL, &ppdata, NULL, 0);
473 + ret = mtd_device_register(&ndfc->mtd, NULL, 0);
476 of_node_put(flash_np);
477 --- a/drivers/mtd/nand/omap2.c
478 +++ b/drivers/mtd/nand/omap2.c
479 @@ -1663,7 +1663,6 @@ static int omap_nand_probe(struct platfo
482 struct resource *res;
483 - struct mtd_part_parser_data ppdata = {};
485 pdata = dev_get_platdata(&pdev->dev);
487 @@ -1688,6 +1687,7 @@ static int omap_nand_probe(struct platfo
488 mtd->dev.parent = &pdev->dev;
489 nand_chip = &info->nand;
490 nand_chip->ecc.priv = NULL;
491 + nand_set_flash_node(nand_chip, pdata->of_node);
493 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
494 nand_chip->IO_ADDR_R = devm_ioremap_resource(&pdev->dev, res);
495 @@ -2037,9 +2037,7 @@ scan_tail:
499 - ppdata.of_node = pdata->of_node;
500 - mtd_device_parse_register(mtd, NULL, &ppdata, pdata->parts,
502 + mtd_device_register(mtd, pdata->parts, pdata->nr_parts);
504 platform_set_drvdata(pdev, mtd);
506 --- a/drivers/mtd/nand/orion_nand.c
507 +++ b/drivers/mtd/nand/orion_nand.c
508 @@ -76,7 +76,6 @@ static void orion_nand_read_buf(struct m
509 static int __init orion_nand_probe(struct platform_device *pdev)
511 struct mtd_info *mtd;
512 - struct mtd_part_parser_data ppdata = {};
513 struct nand_chip *nc;
514 struct orion_nand_data *board;
515 struct resource *res;
516 @@ -127,6 +126,7 @@ static int __init orion_nand_probe(struc
517 mtd->dev.parent = &pdev->dev;
520 + nand_set_flash_node(nc, pdev->dev.of_node);
521 nc->IO_ADDR_R = nc->IO_ADDR_W = io_base;
522 nc->cmd_ctrl = orion_nand_cmd_ctrl;
523 nc->read_buf = orion_nand_read_buf;
524 @@ -161,9 +161,7 @@ static int __init orion_nand_probe(struc
527 mtd->name = "orion_nand";
528 - ppdata.of_node = pdev->dev.of_node;
529 - ret = mtd_device_parse_register(mtd, NULL, &ppdata,
530 - board->parts, board->nr_parts);
531 + ret = mtd_device_register(mtd, board->parts, board->nr_parts);
535 --- a/drivers/mtd/nand/plat_nand.c
536 +++ b/drivers/mtd/nand/plat_nand.c
537 @@ -30,7 +30,6 @@ struct plat_nand_data {
538 static int plat_nand_probe(struct platform_device *pdev)
540 struct platform_nand_data *pdata = dev_get_platdata(&pdev->dev);
541 - struct mtd_part_parser_data ppdata;
542 struct plat_nand_data *data;
543 struct resource *res;
544 const char **part_types;
545 @@ -58,6 +57,7 @@ static int plat_nand_probe(struct platfo
546 return PTR_ERR(data->io_base);
548 data->chip.priv = &data;
549 + nand_set_flash_node(&data->chip, pdev->dev.of_node);
550 data->mtd.priv = &data->chip;
551 data->mtd.dev.parent = &pdev->dev;
553 @@ -105,8 +105,7 @@ static int plat_nand_probe(struct platfo
555 part_types = pdata->chip.part_probe_types;
557 - ppdata.of_node = pdev->dev.of_node;
558 - err = mtd_device_parse_register(&data->mtd, part_types, &ppdata,
559 + err = mtd_device_parse_register(&data->mtd, part_types, NULL,
560 pdata->chip.partitions,
561 pdata->chip.nr_partitions);
563 --- a/drivers/mtd/nand/pxa3xx_nand.c
564 +++ b/drivers/mtd/nand/pxa3xx_nand.c
565 @@ -1697,6 +1697,7 @@ KEEP_CONFIG:
567 static int alloc_nand_resource(struct platform_device *pdev)
569 + struct device_node *np = pdev->dev.of_node;
570 struct pxa3xx_nand_platform_data *pdata;
571 struct pxa3xx_nand_info *info;
572 struct pxa3xx_nand_host *host;
573 @@ -1725,6 +1726,8 @@ static int alloc_nand_resource(struct pl
574 host->info_data = info;
576 mtd->dev.parent = &pdev->dev;
577 + /* FIXME: all chips use the same device tree partitions */
578 + nand_set_flash_node(chip, np);
580 chip->ecc.read_page = pxa3xx_nand_read_page_hwecc;
581 chip->ecc.write_page = pxa3xx_nand_write_page_hwecc;
582 @@ -1886,7 +1889,6 @@ static int pxa3xx_nand_probe_dt(struct p
583 static int pxa3xx_nand_probe(struct platform_device *pdev)
585 struct pxa3xx_nand_platform_data *pdata;
586 - struct mtd_part_parser_data ppdata = {};
587 struct pxa3xx_nand_info *info;
588 int ret, cs, probe_success, dma_available;
590 @@ -1933,10 +1935,8 @@ static int pxa3xx_nand_probe(struct plat
594 - ppdata.of_node = pdev->dev.of_node;
595 - ret = mtd_device_parse_register(mtd, NULL,
596 - &ppdata, pdata->parts[cs],
597 - pdata->nr_parts[cs]);
598 + ret = mtd_device_register(mtd, pdata->parts[cs],
599 + pdata->nr_parts[cs]);
603 --- a/drivers/mtd/nand/sh_flctl.c
604 +++ b/drivers/mtd/nand/sh_flctl.c
605 @@ -1086,7 +1086,6 @@ static int flctl_probe(struct platform_d
606 struct sh_flctl_platform_data *pdata;
609 - struct mtd_part_parser_data ppdata = {};
611 flctl = devm_kzalloc(&pdev->dev, sizeof(struct sh_flctl), GFP_KERNEL);
613 @@ -1123,6 +1122,7 @@ static int flctl_probe(struct platform_d
614 platform_set_drvdata(pdev, flctl);
615 flctl_mtd = &flctl->mtd;
617 + nand_set_flash_node(nand, pdev->dev.of_node);
618 flctl_mtd->priv = nand;
619 flctl_mtd->dev.parent = &pdev->dev;
621 @@ -1163,9 +1163,7 @@ static int flctl_probe(struct platform_d
625 - ppdata.of_node = pdev->dev.of_node;
626 - ret = mtd_device_parse_register(flctl_mtd, NULL, &ppdata, pdata->parts,
628 + ret = mtd_device_register(flctl_mtd, pdata->parts, pdata->nr_parts);
632 --- a/drivers/mtd/nand/socrates_nand.c
633 +++ b/drivers/mtd/nand/socrates_nand.c
634 @@ -147,7 +147,6 @@ static int socrates_nand_probe(struct pl
635 struct mtd_info *mtd;
636 struct nand_chip *nand_chip;
638 - struct mtd_part_parser_data ppdata;
640 /* Allocate memory for the device structure (and zero it) */
641 host = devm_kzalloc(&ofdev->dev, sizeof(*host), GFP_KERNEL);
642 @@ -165,10 +164,10 @@ static int socrates_nand_probe(struct pl
643 host->dev = &ofdev->dev;
645 nand_chip->priv = host; /* link the private data structures */
646 + nand_set_flash_node(nand_chip, ofdev->dev.of_node);
647 mtd->priv = nand_chip;
648 mtd->name = "socrates_nand";
649 mtd->dev.parent = &ofdev->dev;
650 - ppdata.of_node = ofdev->dev.of_node;
652 /*should never be accessed directly */
653 nand_chip->IO_ADDR_R = (void *)0xdeadbeef;
654 @@ -200,7 +199,7 @@ static int socrates_nand_probe(struct pl
658 - res = mtd_device_parse_register(mtd, NULL, &ppdata, NULL, 0);
659 + res = mtd_device_register(mtd, NULL, 0);
663 --- a/drivers/mtd/nand/sunxi_nand.c
664 +++ b/drivers/mtd/nand/sunxi_nand.c
665 @@ -1232,7 +1232,6 @@ static int sunxi_nand_chip_init(struct d
667 const struct nand_sdr_timings *timings;
668 struct sunxi_nand_chip *chip;
669 - struct mtd_part_parser_data ppdata;
670 struct mtd_info *mtd;
671 struct nand_chip *nand;
673 @@ -1366,8 +1365,7 @@ static int sunxi_nand_chip_init(struct d
677 - ppdata.of_node = np;
678 - ret = mtd_device_parse_register(mtd, NULL, &ppdata, NULL, 0);
679 + ret = mtd_device_register(mtd, NULL, 0);
681 dev_err(dev, "failed to register mtd device: %d\n", ret);
683 --- a/drivers/mtd/nand/vf610_nfc.c
684 +++ b/drivers/mtd/nand/vf610_nfc.c
685 @@ -811,11 +811,7 @@ static int vf610_nfc_probe(struct platfo
686 platform_set_drvdata(pdev, mtd);
688 /* Register device in MTD */
689 - return mtd_device_parse_register(mtd, NULL,
690 - &(struct mtd_part_parser_data){
691 - .of_node = chip->flash_node,
694 + return mtd_device_register(mtd, NULL, 0);
697 of_node_put(chip->flash_node);
698 --- a/drivers/staging/mt29f_spinand/mt29f_spinand.c
699 +++ b/drivers/staging/mt29f_spinand/mt29f_spinand.c
700 @@ -850,7 +850,6 @@ static int spinand_probe(struct spi_devi
701 struct nand_chip *chip;
702 struct spinand_info *info;
703 struct spinand_state *state;
704 - struct mtd_part_parser_data ppdata;
706 info = devm_kzalloc(&spi_nand->dev, sizeof(struct spinand_info),
708 @@ -894,6 +893,7 @@ static int spinand_probe(struct spi_devi
709 pr_info("%s: disable ecc failed!\n", __func__);
712 + nand_set_flash_node(chip, spi_nand->dev.of_node);
714 chip->read_buf = spinand_read_buf;
715 chip->write_buf = spinand_write_buf;
716 @@ -916,8 +916,7 @@ static int spinand_probe(struct spi_devi
717 if (nand_scan(mtd, 1))
720 - ppdata.of_node = spi_nand->dev.of_node;
721 - return mtd_device_parse_register(mtd, NULL, &ppdata, NULL, 0);
722 + return mtd_device_register(mtd, NULL, 0);