diff options
author | Jamie Iles <jamie@jamieiles.com> | 2011-05-23 05:23:06 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2011-05-24 21:21:59 -0400 |
commit | 902766bfdfdacc01deb6857bada61cd1e5dc40b0 (patch) | |
tree | 58220a5cfc2473cd2db8a0a34758a4fb0270caf6 /drivers/mtd | |
parent | 95bf224f6c26e5dc4f411f95bb2efa5487ed57bd (diff) |
mtd: latch-addr-flash: 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@jamieiles.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/maps/latch-addr-flash.c | 45 |
1 files changed, 17 insertions, 28 deletions
diff --git a/drivers/mtd/maps/latch-addr-flash.c b/drivers/mtd/maps/latch-addr-flash.c index ee2548085334..5936c466e901 100644 --- a/drivers/mtd/maps/latch-addr-flash.c +++ b/drivers/mtd/maps/latch-addr-flash.c | |||
@@ -112,18 +112,9 @@ static int latch_addr_flash_remove(struct platform_device *dev) | |||
112 | latch_addr_data = dev->dev.platform_data; | 112 | latch_addr_data = dev->dev.platform_data; |
113 | 113 | ||
114 | if (info->mtd != NULL) { | 114 | if (info->mtd != NULL) { |
115 | if (mtd_has_partitions()) { | 115 | if (info->nr_parts) |
116 | if (info->nr_parts) { | 116 | kfree(info->parts); |
117 | del_mtd_partitions(info->mtd); | 117 | mtd_device_unregister(info->mtd); |
118 | kfree(info->parts); | ||
119 | } else if (latch_addr_data->nr_parts) { | ||
120 | del_mtd_partitions(info->mtd); | ||
121 | } else { | ||
122 | del_mtd_device(info->mtd); | ||
123 | } | ||
124 | } else { | ||
125 | del_mtd_device(info->mtd); | ||
126 | } | ||
127 | map_destroy(info->mtd); | 118 | map_destroy(info->mtd); |
128 | } | 119 | } |
129 | 120 | ||
@@ -215,23 +206,21 @@ static int __devinit latch_addr_flash_probe(struct platform_device *dev) | |||
215 | } | 206 | } |
216 | info->mtd->owner = THIS_MODULE; | 207 | info->mtd->owner = THIS_MODULE; |
217 | 208 | ||
218 | if (mtd_has_partitions()) { | 209 | err = parse_mtd_partitions(info->mtd, (const char **)part_probe_types, |
219 | 210 | &info->parts, 0); | |
220 | err = parse_mtd_partitions(info->mtd, | 211 | if (err > 0) { |
221 | (const char **)part_probe_types, | 212 | mtd_device_register(info->mtd, info->parts, err); |
222 | &info->parts, 0); | 213 | return 0; |
223 | if (err > 0) { | 214 | } |
224 | add_mtd_partitions(info->mtd, info->parts, err); | 215 | if (latch_addr_data->nr_parts) { |
225 | return 0; | 216 | pr_notice("Using latch-addr-flash partition information\n"); |
226 | } | 217 | mtd_device_register(info->mtd, |
227 | if (latch_addr_data->nr_parts) { | 218 | latch_addr_data->parts, |
228 | pr_notice("Using latch-addr-flash partition information\n"); | 219 | latch_addr_data->nr_parts); |
229 | add_mtd_partitions(info->mtd, latch_addr_data->parts, | 220 | return 0; |
230 | latch_addr_data->nr_parts); | ||
231 | return 0; | ||
232 | } | ||
233 | } | 221 | } |
234 | add_mtd_device(info->mtd); | 222 | |
223 | mtd_device_register(info->mtd, NULL, 0); | ||
235 | return 0; | 224 | return 0; |
236 | 225 | ||
237 | iounmap: | 226 | iounmap: |