public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Ben Dooks <ben-linux@fluff.org>
To: linux-mtd@lists.infradead.org
Cc: Andy Green <andy@warmcat.com>, Andy Green <andy@warcat.com>,
	Ben Dooks <ben-linux@fluff.org>,
	Nelson Castillo <arhuaco@freaks-unidos.net>
Subject: [MTD] [NAND] S3C2410: Allow commandline partition processing
Date: Sat, 30 May 2009 18:41:34 +0100	[thread overview]
Message-ID: <1243705298-21814-8-git-send-email-ben-linux@fluff.org> (raw)
In-Reply-To: <1243705298-21814-7-git-send-email-ben-linux@fluff.org>

From: Andy Green <andy@warmcat.com>

This patch allows commandline partition processing to
work with the s3c2410 NAND platform driver.

Signed-off-by: Andy Green <andy@warcat.com>
Signed-off-by: Nelson Castillo <arhuaco@freaks-unidos.net>
[ben-linux@fluff.org: Change andy@openmoko.com to andy@warmcat.com]
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
---
 drivers/mtd/nand/s3c2410.c |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
index 87c40de..ef56652 100644
--- a/drivers/mtd/nand/s3c2410.c
+++ b/drivers/mtd/nand/s3c2410.c
@@ -699,17 +699,31 @@ static int s3c24xx_nand_remove(struct platform_device *pdev)
 }
 
 #ifdef CONFIG_MTD_PARTITIONS
+const char *part_probes[] = { "cmdlinepart", NULL };
 static int s3c2410_nand_add_partition(struct s3c2410_nand_info *info,
 				      struct s3c2410_nand_mtd *mtd,
 				      struct s3c2410_nand_set *set)
 {
+	struct mtd_partition *part_info;
+	int nr_part = 0;
+
 	if (set == NULL)
 		return add_mtd_device(&mtd->mtd);
 
-	if (set->nr_partitions > 0 && set->partitions != NULL) {
-		return add_mtd_partitions(&mtd->mtd, set->partitions, set->nr_partitions);
+	if (set->nr_partitions == 0) {
+		mtd->mtd.name = set->name;
+		nr_part = parse_mtd_partitions(&mtd->mtd, part_probes,
+						&part_info, 0);
+	} else {
+		if (set->nr_partitions > 0 && set->partitions != NULL) {
+			nr_part = set->nr_partitions;
+			part_info = set->partitions;
+		}
 	}
 
+	if (nr_part > 0 && part_info)
+		return add_mtd_partitions(&mtd->mtd, part_info, nr_part);
+
 	return add_mtd_device(&mtd->mtd);
 }
 #else
-- 
1.5.6.5

  reply	other threads:[~2009-05-30 18:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-30 17:41 S3C2410 NAND controller updates Ben Dooks
2009-05-30 17:41 ` [MTD] [NAND] S3C2410: Move to using platform device table Ben Dooks
2009-05-30 17:41   ` [MTD] [NAND] S3C2410: Basic kerneldoc comment updates Ben Dooks
2009-05-30 17:41     ` [MTD] [NAND] S3C2410: NAND ECC by chip rather than global Ben Dooks
2009-05-30 17:41       ` [MTD] [NAND] S3C2410: Small colon cleanup Ben Dooks
2009-05-30 17:41         ` [MTD] [NAND] S3C2410: Uninitialised variable cleanup Ben Dooks
2009-05-30 17:41           ` [MTD] [NAND] S3C2410: Fix CFG debug order Ben Dooks
2009-05-30 17:41             ` Ben Dooks [this message]
2009-05-30 17:41               ` [MTD] [NAND] S3C2410: Added a kerneldoc for s3c2410_nand_set Ben Dooks
2009-05-30 17:41                 ` [MTD] [NAND] S3C2410: Allow the machine code to get the BBT table from NAND Ben Dooks
2009-05-30 17:41                   ` [MTD] [NAND] S3C2410: Deal with unaligned lengths in S3C2440 buffer read/write Ben Dooks
2009-05-30 17:41                     ` [MTD] [NAND] S3C2410: Use DIV_ROUND_UP Ben Dooks
2009-06-02 19:36                 ` [MTD] [NAND] S3C2410: Added a kerneldoc for s3c2410_nand_set Peter Korsgaard
2009-06-02 22:55                   ` Ben Dooks
2009-06-01  5:47   ` [MTD] [NAND] S3C2410: Move to using platform device table Eric Miao

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=1243705298-21814-8-git-send-email-ben-linux@fluff.org \
    --to=ben-linux@fluff.org \
    --cc=andy@warcat.com \
    --cc=andy@warmcat.com \
    --cc=arhuaco@freaks-unidos.net \
    --cc=linux-mtd@lists.infradead.org \
    /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