diff options
Diffstat (limited to 'drivers/mtd/nand/ndfc.c')
| -rw-r--r-- | drivers/mtd/nand/ndfc.c | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/drivers/mtd/nand/ndfc.c b/drivers/mtd/nand/ndfc.c index ea2dea8a9c88..ee1713907b92 100644 --- a/drivers/mtd/nand/ndfc.c +++ b/drivers/mtd/nand/ndfc.c | |||
| @@ -42,7 +42,6 @@ struct ndfc_controller { | |||
| 42 | struct nand_chip chip; | 42 | struct nand_chip chip; |
| 43 | int chip_select; | 43 | int chip_select; |
| 44 | struct nand_hw_control ndfc_control; | 44 | struct nand_hw_control ndfc_control; |
| 45 | struct mtd_partition *parts; | ||
| 46 | }; | 45 | }; |
| 47 | 46 | ||
| 48 | static struct ndfc_controller ndfc_ctrl[NDFC_MAX_CS]; | 47 | static struct ndfc_controller ndfc_ctrl[NDFC_MAX_CS]; |
| @@ -159,13 +158,9 @@ static int ndfc_verify_buf(struct mtd_info *mtd, const uint8_t *buf, int len) | |||
| 159 | static int ndfc_chip_init(struct ndfc_controller *ndfc, | 158 | static int ndfc_chip_init(struct ndfc_controller *ndfc, |
| 160 | struct device_node *node) | 159 | struct device_node *node) |
| 161 | { | 160 | { |
| 162 | #ifdef CONFIG_MTD_CMDLINE_PARTS | ||
| 163 | static const char *part_types[] = { "cmdlinepart", NULL }; | ||
| 164 | #else | ||
| 165 | static const char *part_types[] = { NULL }; | ||
| 166 | #endif | ||
| 167 | struct device_node *flash_np; | 161 | struct device_node *flash_np; |
| 168 | struct nand_chip *chip = &ndfc->chip; | 162 | struct nand_chip *chip = &ndfc->chip; |
| 163 | struct mtd_part_parser_data ppdata; | ||
| 169 | int ret; | 164 | int ret; |
| 170 | 165 | ||
| 171 | chip->IO_ADDR_R = ndfc->ndfcbase + NDFC_DATA; | 166 | chip->IO_ADDR_R = ndfc->ndfcbase + NDFC_DATA; |
| @@ -193,6 +188,7 @@ static int ndfc_chip_init(struct ndfc_controller *ndfc, | |||
| 193 | if (!flash_np) | 188 | if (!flash_np) |
| 194 | return -ENODEV; | 189 | return -ENODEV; |
| 195 | 190 | ||
| 191 | ppdata->of_node = flash_np; | ||
| 196 | ndfc->mtd.name = kasprintf(GFP_KERNEL, "%s.%s", | 192 | ndfc->mtd.name = kasprintf(GFP_KERNEL, "%s.%s", |
| 197 | dev_name(&ndfc->ofdev->dev), flash_np->name); | 193 | dev_name(&ndfc->ofdev->dev), flash_np->name); |
| 198 | if (!ndfc->mtd.name) { | 194 | if (!ndfc->mtd.name) { |
| @@ -204,18 +200,7 @@ static int ndfc_chip_init(struct ndfc_controller *ndfc, | |||
| 204 | if (ret) | 200 | if (ret) |
| 205 | goto err; | 201 | goto err; |
| 206 | 202 | ||
| 207 | ret = parse_mtd_partitions(&ndfc->mtd, part_types, &ndfc->parts, 0); | 203 | ret = mtd_device_parse_register(&ndfc->mtd, NULL, &ppdata, NULL, 0); |
| 208 | if (ret < 0) | ||
| 209 | goto err; | ||
| 210 | |||
| 211 | if (ret == 0) { | ||
| 212 | ret = of_mtd_parse_partitions(&ndfc->ofdev->dev, flash_np, | ||
| 213 | &ndfc->parts); | ||
| 214 | if (ret < 0) | ||
| 215 | goto err; | ||
| 216 | } | ||
| 217 | |||
| 218 | ret = mtd_device_register(&ndfc->mtd, ndfc->parts, ret); | ||
| 219 | 204 | ||
| 220 | err: | 205 | err: |
| 221 | of_node_put(flash_np); | 206 | of_node_put(flash_np); |
| @@ -288,6 +273,7 @@ static int __devexit ndfc_remove(struct platform_device *ofdev) | |||
| 288 | struct ndfc_controller *ndfc = dev_get_drvdata(&ofdev->dev); | 273 | struct ndfc_controller *ndfc = dev_get_drvdata(&ofdev->dev); |
| 289 | 274 | ||
| 290 | nand_release(&ndfc->mtd); | 275 | nand_release(&ndfc->mtd); |
| 276 | kfree(ndfc->mtd.name); | ||
| 291 | 277 | ||
| 292 | return 0; | 278 | return 0; |
| 293 | } | 279 | } |
