Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9d7948c5 authored by Dmitry Eremin-Solenikov's avatar Dmitry Eremin-Solenikov Committed by Artem Bityutskiy
Browse files

mtd: ndfc: use ofpart through generic parsing



Convert the driver to use ofpart partitions parsing through the generic
parse_mtd_partitions().

Signed-off-by: default avatarDmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: default avatarArtem Bityutskiy <dedekind1@gmail.com>
parent b3702ea4
Loading
Loading
Loading
Loading
+3 −8
Original line number Diff line number Diff line
@@ -161,6 +161,7 @@ static int ndfc_chip_init(struct ndfc_controller *ndfc,
{
	struct device_node *flash_np;
	struct nand_chip *chip = &ndfc->chip;
	struct mtd_part_parser_data ppdata;
	int ret;

	chip->IO_ADDR_R = ndfc->ndfcbase + NDFC_DATA;
@@ -188,6 +189,7 @@ static int ndfc_chip_init(struct ndfc_controller *ndfc,
	if (!flash_np)
		return -ENODEV;

	ppdata->of_node = flash_np;
	ndfc->mtd.name = kasprintf(GFP_KERNEL, "%s.%s",
			dev_name(&ndfc->ofdev->dev), flash_np->name);
	if (!ndfc->mtd.name) {
@@ -199,17 +201,10 @@ static int ndfc_chip_init(struct ndfc_controller *ndfc,
	if (ret)
		goto err;

	ret = parse_mtd_partitions(&ndfc->mtd, NULL, &ndfc->parts, 0);
	ret = parse_mtd_partitions(&ndfc->mtd, NULL, &ndfc->parts, &ppdata);
	if (ret < 0)
		goto err;

	if (ret == 0) {
		ret = of_mtd_parse_partitions(&ndfc->ofdev->dev, flash_np,
					      &ndfc->parts);
		if (ret < 0)
			goto err;
	}

	ret = mtd_device_register(&ndfc->mtd, ndfc->parts, ret);

err: