Commit 5667bc8a authored by Jamie Iles's avatar Jamie Iles Committed by David Woodhouse

mtd: socrates_nand: 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 6baed700
...@@ -155,9 +155,7 @@ static int socrates_nand_device_ready(struct mtd_info *mtd) ...@@ -155,9 +155,7 @@ static int socrates_nand_device_ready(struct mtd_info *mtd)
return 1; return 1;
} }
#ifdef CONFIG_MTD_PARTITIONS
static const char *part_probes[] = { "cmdlinepart", NULL }; static const char *part_probes[] = { "cmdlinepart", NULL };
#endif
/* /*
* Probe for the NAND device. * Probe for the NAND device.
...@@ -168,11 +166,8 @@ static int __devinit socrates_nand_probe(struct platform_device *ofdev) ...@@ -168,11 +166,8 @@ static int __devinit socrates_nand_probe(struct platform_device *ofdev)
struct mtd_info *mtd; struct mtd_info *mtd;
struct nand_chip *nand_chip; struct nand_chip *nand_chip;
int res; int res;
#ifdef CONFIG_MTD_PARTITIONS
struct mtd_partition *partitions = NULL; struct mtd_partition *partitions = NULL;
int num_partitions = 0; int num_partitions = 0;
#endif
/* Allocate memory for the device structure (and zero it) */ /* Allocate memory for the device structure (and zero it) */
host = kzalloc(sizeof(struct socrates_nand_host), GFP_KERNEL); host = kzalloc(sizeof(struct socrates_nand_host), GFP_KERNEL);
...@@ -230,7 +225,6 @@ static int __devinit socrates_nand_probe(struct platform_device *ofdev) ...@@ -230,7 +225,6 @@ static int __devinit socrates_nand_probe(struct platform_device *ofdev)
goto out; goto out;
} }
#ifdef CONFIG_MTD_PARTITIONS
#ifdef CONFIG_MTD_CMDLINE_PARTS #ifdef CONFIG_MTD_CMDLINE_PARTS
num_partitions = parse_mtd_partitions(mtd, part_probes, num_partitions = parse_mtd_partitions(mtd, part_probes,
&partitions, 0); &partitions, 0);
...@@ -240,7 +234,6 @@ static int __devinit socrates_nand_probe(struct platform_device *ofdev) ...@@ -240,7 +234,6 @@ static int __devinit socrates_nand_probe(struct platform_device *ofdev)
} }
#endif #endif
#ifdef CONFIG_MTD_OF_PARTS
if (num_partitions == 0) { if (num_partitions == 0) {
num_partitions = of_mtd_parse_partitions(&ofdev->dev, num_partitions = of_mtd_parse_partitions(&ofdev->dev,
ofdev->dev.of_node, ofdev->dev.of_node,
...@@ -250,19 +243,12 @@ static int __devinit socrates_nand_probe(struct platform_device *ofdev) ...@@ -250,19 +243,12 @@ static int __devinit socrates_nand_probe(struct platform_device *ofdev)
goto release; goto release;
} }
} }
#endif
if (partitions && (num_partitions > 0))
res = add_mtd_partitions(mtd, partitions, num_partitions);
else
#endif
res = add_mtd_device(mtd);
res = mtd_device_register(mtd, partitions, num_partitions);
if (!res) if (!res)
return res; return res;
#ifdef CONFIG_MTD_PARTITIONS
release: release:
#endif
nand_release(mtd); nand_release(mtd);
out: out:
......
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