aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/maps
diff options
context:
space:
mode:
authorDmitry Eremin-Solenikov <dbaryshkov@gmail.com>2011-06-02 09:59:44 -0400
committerArtem Bityutskiy <artem.bityutskiy@intel.com>2011-09-11 08:02:06 -0400
commit5003403b87283a5e304e0248918ef678dbd24d59 (patch)
treeee4f098919f4c9ba3b7731b5954ab1bc085b1f99 /drivers/mtd/maps
parent8db2a08ee469c1fcad5354c1144a673d88434424 (diff)
mtd: impa7.c: use mtd_device_parse_register
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. Artem: rename static_partitions to make lines shorter and align the way this driver prefers. Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd/maps')
-rw-r--r--drivers/mtd/maps/impa7.c27
1 files changed, 4 insertions, 23 deletions
diff --git a/drivers/mtd/maps/impa7.c b/drivers/mtd/maps/impa7.c
index 2d45a489622e..f47aedb24366 100644
--- a/drivers/mtd/maps/impa7.c
+++ b/drivers/mtd/maps/impa7.c
@@ -49,7 +49,7 @@ static struct map_info impa7_map[NUM_FLASHBANKS] = {
49/* 49/*
50 * MTD partitioning stuff 50 * MTD partitioning stuff
51 */ 51 */
52static struct mtd_partition static_partitions[] = 52static struct mtd_partition partitions[] =
53{ 53{
54 { 54 {
55 .name = "FileSystem", 55 .name = "FileSystem",
@@ -58,15 +58,10 @@ static struct mtd_partition static_partitions[] =
58 }, 58 },
59}; 59};
60 60
61static int mtd_parts_nb[NUM_FLASHBANKS];
62static struct mtd_partition *mtd_parts[NUM_FLASHBANKS];
63
64
65static int __init init_impa7(void) 61static int __init init_impa7(void)
66{ 62{
67 static const char *rom_probe_types[] = PROBETYPES; 63 static const char *rom_probe_types[] = PROBETYPES;
68 const char **type; 64 const char **type;
69 const char *part_type = 0;
70 int i; 65 int i;
71 static struct { u_long addr; u_long size; } pt[NUM_FLASHBANKS] = { 66 static struct { u_long addr; u_long size; } pt[NUM_FLASHBANKS] = {
72 { WINDOW_ADDR0, WINDOW_SIZE0 }, 67 { WINDOW_ADDR0, WINDOW_SIZE0 },
@@ -96,23 +91,9 @@ static int __init init_impa7(void)
96 if (impa7_mtd[i]) { 91 if (impa7_mtd[i]) {
97 impa7_mtd[i]->owner = THIS_MODULE; 92 impa7_mtd[i]->owner = THIS_MODULE;
98 devicesfound++; 93 devicesfound++;
99 mtd_parts_nb[i] = parse_mtd_partitions(impa7_mtd[i], 94 mtd_device_parse_register(impa7_mtd[i], NULL, 0,
100 NULL, 95 partitions,
101 &mtd_parts[i], 96 ARRAY_SIZE(partitions));
102 0);
103 if (mtd_parts_nb[i] > 0) {
104 part_type = "command line";
105 } else {
106 mtd_parts[i] = static_partitions;
107 mtd_parts_nb[i] = ARRAY_SIZE(static_partitions);
108 part_type = "static";
109 }
110
111 printk(KERN_NOTICE MSG_PREFIX
112 "using %s partition definition\n",
113 part_type);
114 mtd_device_register(impa7_mtd[i],
115 mtd_parts[i], mtd_parts_nb[i]);
116 } 97 }
117 else 98 else
118 iounmap((void *)impa7_map[i].virt); 99 iounmap((void *)impa7_map[i].virt);