linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
To: linux-mtd@lists.infradead.org
Cc: David Woodhouse <dwmw2@infradead.org>,
	Russell King <linux@arm.linux.org.uk>,
	dedekind1@gmail.com
Subject: [PATCH 34/43] mtd: plat_nand.c: use mtd_device_parse_register
Date: Wed,  8 Jun 2011 20:05:43 +0400	[thread overview]
Message-ID: <1307549152-7085-35-git-send-email-dbaryshkov@gmail.com> (raw)
In-Reply-To: <1307549152-7085-1-git-send-email-dbaryshkov@gmail.com>

Replace custom invocations of parse_mtd_partitions and mtd_device_register
with common mtd_device_parse_register call. This would bring: standard
handling of all errors, fallback to default partitions, etc.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
---
 drivers/mtd/nand/plat_nand.c |   22 +++-------------------
 1 files changed, 3 insertions(+), 19 deletions(-)

diff --git a/drivers/mtd/nand/plat_nand.c b/drivers/mtd/nand/plat_nand.c
index 1339fa8..e62468b 100644
--- a/drivers/mtd/nand/plat_nand.c
+++ b/drivers/mtd/nand/plat_nand.c
@@ -21,8 +21,6 @@ struct plat_nand_data {
 	struct nand_chip	chip;
 	struct mtd_info		mtd;
 	void __iomem		*io_base;
-	int			nr_parts;
-	struct mtd_partition	*parts;
 };
 
 /*
@@ -99,21 +97,9 @@ static int __devinit plat_nand_probe(struct platform_device *pdev)
 		goto out;
 	}
 
-	if (pdata->chip.part_probe_types) {
-		err = parse_mtd_partitions(&data->mtd,
-					pdata->chip.part_probe_types,
-					&data->parts, 0);
-		if (err > 0) {
-			mtd_device_register(&data->mtd, data->parts, err);
-			return 0;
-		}
-	}
-	if (pdata->chip.partitions) {
-		data->parts = pdata->chip.partitions;
-		err = mtd_device_register(&data->mtd, data->parts,
-			pdata->chip.nr_partitions);
-	} else
-		err = mtd_device_register(&data->mtd, NULL, 0);
+	err = mtd_device_parse_register(&data->mtd,
+			pdata->chip.part_probe_types, 0,
+			pdata->chip.partitions, pdata->chip.nr_partitions);
 
 	if (!err)
 		return err;
@@ -143,8 +129,6 @@ static int __devexit plat_nand_remove(struct platform_device *pdev)
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 
 	nand_release(&data->mtd);
-	if (data->parts && data->parts != pdata->chip.partitions)
-		kfree(data->parts);
 	if (pdata->ctrl.remove)
 		pdata->ctrl.remove(pdev);
 	iounmap(data->io_base);
-- 
1.7.4.4

  parent reply	other threads:[~2011-06-08 16:06 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-08 16:05 [PATCH 0/43 V2] mtd: simplify mtd partitions handling Dmitry Eremin-Solenikov
2011-06-08 16:05 ` [PATCH 01/43] mtd: add new API for handling MTD registration Dmitry Eremin-Solenikov
2011-06-09  7:20   ` Artem Bityutskiy
2011-06-08 16:05 ` [PATCH 02/43] mtd: mtd_dataflash.c: use mtd_device_parse_register Dmitry Eremin-Solenikov
2011-06-08 16:05 ` [PATCH 03/43] mtd: sst25l.c: " Dmitry Eremin-Solenikov
2011-06-08 16:05 ` [PATCH 04/43] mtd: bfin-async-flash.c: " Dmitry Eremin-Solenikov
2011-06-08 16:05 ` [PATCH 05/43] mtd: dc21285.c: " Dmitry Eremin-Solenikov
2011-06-08 16:05 ` [PATCH 06/43] mtd: gpio-addr-flash.c: " Dmitry Eremin-Solenikov
2011-06-08 16:05 ` [PATCH 07/43] mtd: h720x-flash.c: " Dmitry Eremin-Solenikov
2011-06-08 16:05 ` [PATCH 08/43] mtd: impa7.c: " Dmitry Eremin-Solenikov
2011-06-09  7:24   ` Artem Bityutskiy
2011-06-08 16:05 ` [PATCH 09/43] mtd: intel_vr_nor.c: " Dmitry Eremin-Solenikov
2011-06-08 16:05 ` [PATCH 10/43] mtd: ixp2000.c: " Dmitry Eremin-Solenikov
2011-06-08 16:05 ` [PATCH 11/43] mtd: ixp4xx.c: " Dmitry Eremin-Solenikov
2011-06-08 16:05 ` [PATCH 12/43] mtd: lantiq-flash.c: " Dmitry Eremin-Solenikov
2011-06-08 16:05 ` [PATCH 13/43] mtd: latch-addr-flash.c: " Dmitry Eremin-Solenikov
2011-06-08 16:05 ` [PATCH 14/43] mtd: physmap.c: " Dmitry Eremin-Solenikov
2011-06-09  7:32   ` Artem Bityutskiy
2011-06-08 16:05 ` [PATCH 15/43] mtd: plat-ram.c: " Dmitry Eremin-Solenikov
2011-06-08 16:05 ` [PATCH 16/43] mtd: pxa2xx-flash.c: " Dmitry Eremin-Solenikov
2011-06-08 16:05 ` [PATCH 17/43] mtd: rbtx4939-flash.c: " Dmitry Eremin-Solenikov
2011-06-08 16:05 ` [PATCH 18/43] mtd: sa1100-flash.c: " Dmitry Eremin-Solenikov
2011-06-08 16:05 ` [PATCH 19/43] mtd: solutionengine.c: " Dmitry Eremin-Solenikov
2011-06-08 16:05 ` [PATCH 20/43] mtd: wr_sbc82xx_flash.c: " Dmitry Eremin-Solenikov
2011-06-08 16:05 ` [PATCH 21/43] mtd: atmel_nand.c: " Dmitry Eremin-Solenikov
2011-06-08 16:05 ` [PATCH 22/43] mtd: bcm_umi_nand.c: " Dmitry Eremin-Solenikov
2011-06-08 16:05 ` [PATCH 23/43] mtd: cafe_nand.c: " Dmitry Eremin-Solenikov
2011-06-08 16:05 ` [PATCH 24/43] mtd: cmx270_nand.c: " Dmitry Eremin-Solenikov
2011-06-08 16:05 ` [PATCH 25/43] mtd: cs553x_nand.c: " Dmitry Eremin-Solenikov
2011-06-08 16:05 ` [PATCH 26/43] mtd: davinci_nand.c: " Dmitry Eremin-Solenikov
2011-06-08 16:05 ` [PATCH 27/43] mtd: edb7312.c: " Dmitry Eremin-Solenikov
2011-06-08 16:05 ` [PATCH 28/43] mtd: fsmc_nand.c: " Dmitry Eremin-Solenikov
2011-06-08 16:05 ` [PATCH 29/43] mtd: h1910.c: " Dmitry Eremin-Solenikov
2011-06-08 16:05 ` [PATCH 30/43] mtd: jz4740_nand.c: " Dmitry Eremin-Solenikov
2011-06-08 16:05 ` [PATCH 31/43] mtd: mxc_nand.c: " Dmitry Eremin-Solenikov
2011-06-08 16:05 ` [PATCH 32/43] mtd: omap2.c: " Dmitry Eremin-Solenikov
2011-06-08 16:05 ` [PATCH 33/43] mtd: orion_nand.c: " Dmitry Eremin-Solenikov
2011-06-08 16:05 ` Dmitry Eremin-Solenikov [this message]
2011-06-08 16:05 ` [PATCH 35/43] mtd: ppchameleonevb.c: " Dmitry Eremin-Solenikov
2011-06-08 16:05 ` [PATCH 36/43] mtd: pxa3xx_nand.c: " Dmitry Eremin-Solenikov
2011-06-08 16:05 ` [PATCH 37/43] mtd: s3c2410.c: " Dmitry Eremin-Solenikov
2011-06-08 16:05 ` [PATCH 38/43] mtd: sharpsl.c: " Dmitry Eremin-Solenikov
2011-06-08 16:05 ` [PATCH 39/43] mtd: tmio_nand.c: " Dmitry Eremin-Solenikov
2011-06-08 16:05 ` [PATCH 40/43] mtd: txx9ndfmc.c: " Dmitry Eremin-Solenikov
2011-06-08 16:05 ` [PATCH 41/43] mtd: onenand/generic.c: " Dmitry Eremin-Solenikov
2011-06-08 16:05 ` [PATCH 42/43] mtd: onenand/omap2.c: " Dmitry Eremin-Solenikov
2011-06-08 16:05 ` [PATCH 43/43] mtd: onenand/samsung.c: " Dmitry Eremin-Solenikov
2011-06-09  7:56 ` [PATCH 0/43 V2] mtd: simplify mtd partitions handling Artem Bityutskiy
2011-06-09  8:23   ` Dmitry Eremin-Solenikov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1307549152-7085-35-git-send-email-dbaryshkov@gmail.com \
    --to=dbaryshkov@gmail.com \
    --cc=dedekind1@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux@arm.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).