diff options
author | Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 2011-06-02 09:59:47 -0400 |
---|---|---|
committer | Artem Bityutskiy <artem.bityutskiy@intel.com> | 2011-09-11 08:02:06 -0400 |
commit | bc413f11ddf2c692cc533f474d28a154abe4541f (patch) | |
tree | 1916e2b13dd2f03fb375e701c9370d777ae5e061 | |
parent | 200b8777ce270b491affb2bd81192f78f2d46213 (diff) |
mtd: ixp4xx.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>
-rw-r--r-- | drivers/mtd/maps/ixp4xx.c | 29 |
1 files changed, 4 insertions, 25 deletions
diff --git a/drivers/mtd/maps/ixp4xx.c b/drivers/mtd/maps/ixp4xx.c index 155b21942f47..30409015a3de 100644 --- a/drivers/mtd/maps/ixp4xx.c +++ b/drivers/mtd/maps/ixp4xx.c | |||
@@ -145,7 +145,6 @@ static void ixp4xx_write16(struct map_info *map, map_word d, unsigned long adr) | |||
145 | struct ixp4xx_flash_info { | 145 | struct ixp4xx_flash_info { |
146 | struct mtd_info *mtd; | 146 | struct mtd_info *mtd; |
147 | struct map_info map; | 147 | struct map_info map; |
148 | struct mtd_partition *partitions; | ||
149 | struct resource *res; | 148 | struct resource *res; |
150 | }; | 149 | }; |
151 | 150 | ||
@@ -168,8 +167,6 @@ static int ixp4xx_flash_remove(struct platform_device *dev) | |||
168 | if (info->map.virt) | 167 | if (info->map.virt) |
169 | iounmap(info->map.virt); | 168 | iounmap(info->map.virt); |
170 | 169 | ||
171 | kfree(info->partitions); | ||
172 | |||
173 | if (info->res) { | 170 | if (info->res) { |
174 | release_resource(info->res); | 171 | release_resource(info->res); |
175 | kfree(info->res); | 172 | kfree(info->res); |
@@ -185,8 +182,6 @@ static int ixp4xx_flash_probe(struct platform_device *dev) | |||
185 | { | 182 | { |
186 | struct flash_platform_data *plat = dev->dev.platform_data; | 183 | struct flash_platform_data *plat = dev->dev.platform_data; |
187 | struct ixp4xx_flash_info *info; | 184 | struct ixp4xx_flash_info *info; |
188 | const char *part_type = NULL; | ||
189 | int nr_parts = 0; | ||
190 | int err = -1; | 185 | int err = -1; |
191 | 186 | ||
192 | if (!plat) | 187 | if (!plat) |
@@ -252,28 +247,12 @@ static int ixp4xx_flash_probe(struct platform_device *dev) | |||
252 | /* Use the fast version */ | 247 | /* Use the fast version */ |
253 | info->map.write = ixp4xx_write16; | 248 | info->map.write = ixp4xx_write16; |
254 | 249 | ||
255 | nr_parts = parse_mtd_partitions(info->mtd, probes, &info->partitions, | 250 | err = mtd_device_parse_register(info->mtd, probes, dev->resource->start, |
256 | dev->resource->start); | 251 | plat->parts, plat->nr_parts); |
257 | if (nr_parts > 0) { | 252 | if (err) { |
258 | part_type = "dynamic"; | ||
259 | } else { | ||
260 | info->partitions = plat->parts; | ||
261 | nr_parts = plat->nr_parts; | ||
262 | part_type = "static"; | ||
263 | } | ||
264 | if (nr_parts == 0) | ||
265 | printk(KERN_NOTICE "IXP4xx flash: no partition info " | ||
266 | "available, registering whole flash\n"); | ||
267 | else | ||
268 | printk(KERN_NOTICE "IXP4xx flash: using %s partition " | ||
269 | "definition\n", part_type); | ||
270 | |||
271 | err = mtd_device_register(info->mtd, info->partitions, nr_parts); | ||
272 | if (err) | ||
273 | printk(KERN_ERR "Could not parse partitions\n"); | 253 | printk(KERN_ERR "Could not parse partitions\n"); |
274 | |||
275 | if (err) | ||
276 | goto Error; | 254 | goto Error; |
255 | } | ||
277 | 256 | ||
278 | return 0; | 257 | return 0; |
279 | 258 | ||