mtd: dc21285: convert to mtd_device_register()

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Tue May 24 21:59:10 EDT 2011


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=bc2ffddc46be60c12462f8ae60ed0eae2a62a17b
Commit:     bc2ffddc46be60c12462f8ae60ed0eae2a62a17b
Parent:     98b3979b92143656a2361eb5bdc14f5b50b95bce
Author:     Jamie Iles <jamie at jamieiles.com>
AuthorDate: Mon May 23 10:23:00 2011 +0100
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Wed May 25 02:21:36 2011 +0100

    mtd: dc21285: 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: Jamie Iles <jamie at jamieiles.com>
    Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy at nokia.com>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/maps/dc21285.c |   20 +++-----------------
 1 files changed, 3 insertions(+), 17 deletions(-)

diff --git a/drivers/mtd/maps/dc21285.c b/drivers/mtd/maps/dc21285.c
index b3cb3a1..7a9e198 100644
--- a/drivers/mtd/maps/dc21285.c
+++ b/drivers/mtd/maps/dc21285.c
@@ -145,17 +145,13 @@ static struct map_info dc21285_map = {
 
 
 /* Partition stuff */
-#ifdef CONFIG_MTD_PARTITIONS
 static struct mtd_partition *dc21285_parts;
 static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };
-#endif
 
 static int __init init_dc21285(void)
 {
 
-#ifdef CONFIG_MTD_PARTITIONS
 	int nrparts;
-#endif
 
 	/* Determine bankwidth */
 	switch (*CSR_SA110_CNTL & (3<<14)) {
@@ -204,13 +200,8 @@ static int __init init_dc21285(void)
 
 	dc21285_mtd->owner = THIS_MODULE;
 
-#ifdef CONFIG_MTD_PARTITIONS
 	nrparts = parse_mtd_partitions(dc21285_mtd, probes, &dc21285_parts, 0);
-	if (nrparts > 0)
-		add_mtd_partitions(dc21285_mtd, dc21285_parts, nrparts);
-	else
-#endif
-		add_mtd_device(dc21285_mtd);
+	mtd_device_register(dc21285_mtd, dc21285_parts, nrparts);
 
 	if(machine_is_ebsa285()) {
 		/*
@@ -232,14 +223,9 @@ static int __init init_dc21285(void)
 
 static void __exit cleanup_dc21285(void)
 {
-#ifdef CONFIG_MTD_PARTITIONS
-	if (dc21285_parts) {
-		del_mtd_partitions(dc21285_mtd);
+	mtd_device_unregister(dc21285_mtd);
+	if (dc21285_parts)
 		kfree(dc21285_parts);
-	} else
-#endif
-		del_mtd_device(dc21285_mtd);
-
 	map_destroy(dc21285_mtd);
 	iounmap(dc21285_map.virt);
 }



More information about the linux-mtd-cvs mailing list