Commit 5af3aa24 authored by Jamie Iles's avatar Jamie Iles Committed by David Woodhouse

mtd: edb7312: 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 bc2ffddc
...@@ -15,10 +15,7 @@ ...@@ -15,10 +15,7 @@
#include <asm/io.h> #include <asm/io.h>
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#include <linux/mtd/map.h> #include <linux/mtd/map.h>
#ifdef CONFIG_MTD_PARTITIONS
#include <linux/mtd/partitions.h> #include <linux/mtd/partitions.h>
#endif
#define WINDOW_ADDR 0x00000000 /* physical properties of flash */ #define WINDOW_ADDR 0x00000000 /* physical properties of flash */
#define WINDOW_SIZE 0x01000000 #define WINDOW_SIZE 0x01000000
...@@ -40,8 +37,6 @@ struct map_info edb7312nor_map = { ...@@ -40,8 +37,6 @@ struct map_info edb7312nor_map = {
.phys = WINDOW_ADDR, .phys = WINDOW_ADDR,
}; };
#ifdef CONFIG_MTD_PARTITIONS
/* /*
* MTD partitioning stuff * MTD partitioning stuff
*/ */
...@@ -66,8 +61,6 @@ static struct mtd_partition static_partitions[3] = ...@@ -66,8 +61,6 @@ static struct mtd_partition static_partitions[3] =
static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };
#endif
static int mtd_parts_nb = 0; static int mtd_parts_nb = 0;
static struct mtd_partition *mtd_parts = 0; static struct mtd_partition *mtd_parts = 0;
...@@ -96,27 +89,24 @@ static int __init init_edb7312nor(void) ...@@ -96,27 +89,24 @@ static int __init init_edb7312nor(void)
if (mymtd) { if (mymtd) {
mymtd->owner = THIS_MODULE; mymtd->owner = THIS_MODULE;
#ifdef CONFIG_MTD_PARTITIONS
mtd_parts_nb = parse_mtd_partitions(mymtd, probes, &mtd_parts, MTDID); mtd_parts_nb = parse_mtd_partitions(mymtd, probes, &mtd_parts, MTDID);
if (mtd_parts_nb > 0) if (mtd_parts_nb > 0)
part_type = "detected"; part_type = "detected";
if (mtd_parts_nb == 0) if (mtd_parts_nb == 0) {
{
mtd_parts = static_partitions; mtd_parts = static_partitions;
mtd_parts_nb = ARRAY_SIZE(static_partitions); mtd_parts_nb = ARRAY_SIZE(static_partitions);
part_type = "static"; part_type = "static";
} }
#endif
add_mtd_device(mymtd);
if (mtd_parts_nb == 0) if (mtd_parts_nb == 0)
printk(KERN_NOTICE MSG_PREFIX "no partition info available\n"); printk(KERN_NOTICE MSG_PREFIX "no partition info available\n");
else else
{
printk(KERN_NOTICE MSG_PREFIX printk(KERN_NOTICE MSG_PREFIX
"using %s partition definition\n", part_type); "using %s partition definition\n", part_type);
add_mtd_partitions(mymtd, mtd_parts, mtd_parts_nb); /* Register the whole device first. */
} mtd_device_register(mymtd, NULL, 0);
mtd_device_register(mymtd, mtd_parts, mtd_parts_nb);
return 0; return 0;
} }
...@@ -127,7 +117,7 @@ static int __init init_edb7312nor(void) ...@@ -127,7 +117,7 @@ static int __init init_edb7312nor(void)
static void __exit cleanup_edb7312nor(void) static void __exit cleanup_edb7312nor(void)
{ {
if (mymtd) { if (mymtd) {
del_mtd_device(mymtd); mtd_device_unregister(mymtd);
map_destroy(mymtd); map_destroy(mymtd);
} }
if (edb7312nor_map.virt) { if (edb7312nor_map.virt) {
......
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