aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/maps
diff options
context:
space:
mode:
authorDmitry Eremin-Solenikov <dbaryshkov@gmail.com>2011-06-02 09:59:42 -0400
committerArtem Bityutskiy <artem.bityutskiy@intel.com>2011-09-11 08:02:06 -0400
commit8db2a08ee469c1fcad5354c1144a673d88434424 (patch)
tree22a86eba0b4dbf39ce4bad440cf8f0c96975a043 /drivers/mtd/maps
parent534e4928ad672a319c29b9f0c0593ad16766de53 (diff)
mtd: h720x-flash.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. 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/h720x-flash.c21
1 files changed, 2 insertions, 19 deletions
diff --git a/drivers/mtd/maps/h720x-flash.c b/drivers/mtd/maps/h720x-flash.c
index f331a2c9427..49c14187fc6 100644
--- a/drivers/mtd/maps/h720x-flash.c
+++ b/drivers/mtd/maps/h720x-flash.c
@@ -58,16 +58,11 @@ static struct mtd_partition h720x_partitions[] = {
58 58
59#define NUM_PARTITIONS ARRAY_SIZE(h720x_partitions) 59#define NUM_PARTITIONS ARRAY_SIZE(h720x_partitions)
60 60
61static int nr_mtd_parts;
62static struct mtd_partition *mtd_parts;
63/* 61/*
64 * Initialize FLASH support 62 * Initialize FLASH support
65 */ 63 */
66static int __init h720x_mtd_init(void) 64static int __init h720x_mtd_init(void)
67{ 65{
68
69 char *part_type = NULL;
70
71 h720x_map.virt = ioremap(h720x_map.phys, h720x_map.size); 66 h720x_map.virt = ioremap(h720x_map.phys, h720x_map.size);
72 67
73 if (!h720x_map.virt) { 68 if (!h720x_map.virt) {
@@ -90,16 +85,8 @@ static int __init h720x_mtd_init(void)
90 if (mymtd) { 85 if (mymtd) {
91 mymtd->owner = THIS_MODULE; 86 mymtd->owner = THIS_MODULE;
92 87
93 nr_mtd_parts = parse_mtd_partitions(mymtd, NULL, &mtd_parts, 0); 88 mtd_device_parse_register(mymtd, NULL, 0,
94 if (nr_mtd_parts > 0) 89 h720x_partitions, NUM_PARTITIONS);
95 part_type = "command line";
96 if (nr_mtd_parts <= 0) {
97 mtd_parts = h720x_partitions;
98 nr_mtd_parts = NUM_PARTITIONS;
99 part_type = "builtin";
100 }
101 printk(KERN_INFO "Using %s partition table\n", part_type);
102 mtd_device_register(mymtd, mtd_parts, nr_mtd_parts);
103 return 0; 90 return 0;
104 } 91 }
105 92
@@ -118,10 +105,6 @@ static void __exit h720x_mtd_cleanup(void)
118 map_destroy(mymtd); 105 map_destroy(mymtd);
119 } 106 }
120 107
121 /* Free partition info, if commandline partition was used */
122 if (mtd_parts && (mtd_parts != h720x_partitions))
123 kfree (mtd_parts);
124
125 if (h720x_map.virt) { 108 if (h720x_map.virt) {
126 iounmap((void *)h720x_map.virt); 109 iounmap((void *)h720x_map.virt);
127 h720x_map.virt = 0; 110 h720x_map.virt = 0;