Commit 1f3a7c62 authored by Jamie Iles's avatar Jamie Iles Committed by David Woodhouse

mtd: ndfc: convert to mtd_device_register()

Convert to mtd_device_register() and remove the CONFIG_MTD_PARTITIONS
preprocessor conditionals as partitioning is always available.
Signed-off-by: default avatarJamie Iles <jamie@jamieiles.com>
Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 759f1d32
...@@ -42,9 +42,7 @@ struct ndfc_controller { ...@@ -42,9 +42,7 @@ struct ndfc_controller {
struct nand_chip chip; struct nand_chip chip;
int chip_select; int chip_select;
struct nand_hw_control ndfc_control; struct nand_hw_control ndfc_control;
#ifdef CONFIG_MTD_PARTITIONS
struct mtd_partition *parts; struct mtd_partition *parts;
#endif
}; };
static struct ndfc_controller ndfc_ctrl[NDFC_MAX_CS]; static struct ndfc_controller ndfc_ctrl[NDFC_MAX_CS];
...@@ -161,12 +159,10 @@ static int ndfc_verify_buf(struct mtd_info *mtd, const uint8_t *buf, int len) ...@@ -161,12 +159,10 @@ static int ndfc_verify_buf(struct mtd_info *mtd, const uint8_t *buf, int len)
static int ndfc_chip_init(struct ndfc_controller *ndfc, static int ndfc_chip_init(struct ndfc_controller *ndfc,
struct device_node *node) struct device_node *node)
{ {
#ifdef CONFIG_MTD_PARTITIONS
#ifdef CONFIG_MTD_CMDLINE_PARTS #ifdef CONFIG_MTD_CMDLINE_PARTS
static const char *part_types[] = { "cmdlinepart", NULL }; static const char *part_types[] = { "cmdlinepart", NULL };
#else #else
static const char *part_types[] = { NULL }; static const char *part_types[] = { NULL };
#endif
#endif #endif
struct device_node *flash_np; struct device_node *flash_np;
struct nand_chip *chip = &ndfc->chip; struct nand_chip *chip = &ndfc->chip;
...@@ -208,25 +204,18 @@ static int ndfc_chip_init(struct ndfc_controller *ndfc, ...@@ -208,25 +204,18 @@ static int ndfc_chip_init(struct ndfc_controller *ndfc,
if (ret) if (ret)
goto err; goto err;
#ifdef CONFIG_MTD_PARTITIONS
ret = parse_mtd_partitions(&ndfc->mtd, part_types, &ndfc->parts, 0); ret = parse_mtd_partitions(&ndfc->mtd, part_types, &ndfc->parts, 0);
if (ret < 0) if (ret < 0)
goto err; goto err;
#ifdef CONFIG_MTD_OF_PARTS
if (ret == 0) { if (ret == 0) {
ret = of_mtd_parse_partitions(&ndfc->ofdev->dev, flash_np, ret = of_mtd_parse_partitions(&ndfc->ofdev->dev, flash_np,
&ndfc->parts); &ndfc->parts);
if (ret < 0) if (ret < 0)
goto err; goto err;
} }
#endif
if (ret > 0) ret = mtd_device_register(&ndfc->mtd, ndfc->parts, ret);
ret = add_mtd_partitions(&ndfc->mtd, ndfc->parts, ret);
else
#endif
ret = add_mtd_device(&ndfc->mtd);
err: err:
of_node_put(flash_np); of_node_put(flash_np);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment