Skip to content

Commit

Permalink
mtd: latch-addr-flash.c: use mtd_device_parse_register
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dmitry Eremin-Solenikov authored and Artem Bityutskiy committed Sep 11, 2011
1 parent ca97dec commit 6e6e44c
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions drivers/mtd/maps/latch-addr-flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ struct latch_addr_flash_info {
/* cache; could be found out of res */
unsigned long win_mask;

int nr_parts;
struct mtd_partition *parts;

spinlock_t lock;
};

Expand Down Expand Up @@ -110,8 +107,6 @@ static int latch_addr_flash_remove(struct platform_device *dev)
latch_addr_data = dev->dev.platform_data;

if (info->mtd != NULL) {
if (info->nr_parts)
kfree(info->parts);
mtd_device_unregister(info->mtd);
map_destroy(info->mtd);
}
Expand Down Expand Up @@ -204,20 +199,8 @@ static int __devinit latch_addr_flash_probe(struct platform_device *dev)
}
info->mtd->owner = THIS_MODULE;

err = parse_mtd_partitions(info->mtd, NULL, &info->parts, 0);
if (err > 0) {
mtd_device_register(info->mtd, info->parts, err);
return 0;
}
if (latch_addr_data->nr_parts) {
pr_notice("Using latch-addr-flash partition information\n");
mtd_device_register(info->mtd,
latch_addr_data->parts,
latch_addr_data->nr_parts);
return 0;
}

mtd_device_register(info->mtd, NULL, 0);
mtd_device_parse_register(info->mtd, NULL, 0,
latch_addr_data->parts, latch_addr_data->nr_parts);
return 0;

iounmap:
Expand Down

0 comments on commit 6e6e44c

Please sign in to comment.