diff options
| author | Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 2011-06-02 10:00:03 -0400 |
|---|---|---|
| committer | Artem Bityutskiy <artem.bityutskiy@intel.com> | 2011-09-11 08:02:07 -0400 |
| commit | 6fcdc92fce81eadcee262a7a66bf3207314fab87 (patch) | |
| tree | 7385f3cec4a7418d9374a6aa66718f6c86f48489 /drivers/mtd/maps | |
| parent | 74fb3ab9330ee4dd1a3ddf19cd0f3ef1202376d9 (diff) | |
mtd: pxa2xx-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/pxa2xx-flash.c | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/drivers/mtd/maps/pxa2xx-flash.c b/drivers/mtd/maps/pxa2xx-flash.c index 7ae137d4b998..411a17df9fc1 100644 --- a/drivers/mtd/maps/pxa2xx-flash.c +++ b/drivers/mtd/maps/pxa2xx-flash.c | |||
| @@ -41,8 +41,6 @@ static void pxa2xx_map_inval_cache(struct map_info *map, unsigned long from, | |||
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | struct pxa2xx_flash_info { | 43 | struct pxa2xx_flash_info { |
| 44 | struct mtd_partition *parts; | ||
| 45 | int nr_parts; | ||
| 46 | struct mtd_info *mtd; | 44 | struct mtd_info *mtd; |
| 47 | struct map_info map; | 45 | struct map_info map; |
| 48 | }; | 46 | }; |
| @@ -55,9 +53,7 @@ static int __devinit pxa2xx_flash_probe(struct platform_device *pdev) | |||
| 55 | { | 53 | { |
| 56 | struct flash_platform_data *flash = pdev->dev.platform_data; | 54 | struct flash_platform_data *flash = pdev->dev.platform_data; |
| 57 | struct pxa2xx_flash_info *info; | 55 | struct pxa2xx_flash_info *info; |
| 58 | struct mtd_partition *parts; | ||
| 59 | struct resource *res; | 56 | struct resource *res; |
| 60 | int ret = 0; | ||
| 61 | 57 | ||
| 62 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 58 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 63 | if (!res) | 59 | if (!res) |
| @@ -71,8 +67,6 @@ static int __devinit pxa2xx_flash_probe(struct platform_device *pdev) | |||
| 71 | info->map.bankwidth = flash->width; | 67 | info->map.bankwidth = flash->width; |
| 72 | info->map.phys = res->start; | 68 | info->map.phys = res->start; |
| 73 | info->map.size = resource_size(res); | 69 | info->map.size = resource_size(res); |
| 74 | info->parts = flash->parts; | ||
| 75 | info->nr_parts = flash->nr_parts; | ||
| 76 | 70 | ||
| 77 | info->map.virt = ioremap(info->map.phys, info->map.size); | 71 | info->map.virt = ioremap(info->map.phys, info->map.size); |
| 78 | if (!info->map.virt) { | 72 | if (!info->map.virt) { |
| @@ -104,18 +98,7 @@ static int __devinit pxa2xx_flash_probe(struct platform_device *pdev) | |||
| 104 | } | 98 | } |
| 105 | info->mtd->owner = THIS_MODULE; | 99 | info->mtd->owner = THIS_MODULE; |
| 106 | 100 | ||
| 107 | ret = parse_mtd_partitions(info->mtd, probes, &parts, 0); | 101 | mtd_device_parse_register(info->mtd, probes, 0, NULL, 0); |
| 108 | |||
| 109 | if (ret > 0) { | ||
| 110 | info->nr_parts = ret; | ||
| 111 | info->parts = parts; | ||
| 112 | } | ||
| 113 | |||
| 114 | if (!info->nr_parts) | ||
| 115 | printk("Registering %s as whole device\n", | ||
| 116 | info->map.name); | ||
| 117 | |||
| 118 | mtd_device_register(info->mtd, info->parts, info->nr_parts); | ||
| 119 | 102 | ||
| 120 | platform_set_drvdata(pdev, info); | 103 | platform_set_drvdata(pdev, info); |
| 121 | return 0; | 104 | return 0; |
| @@ -133,7 +116,6 @@ static int __devexit pxa2xx_flash_remove(struct platform_device *dev) | |||
| 133 | iounmap(info->map.virt); | 116 | iounmap(info->map.virt); |
| 134 | if (info->map.cached) | 117 | if (info->map.cached) |
| 135 | iounmap(info->map.cached); | 118 | iounmap(info->map.cached); |
| 136 | kfree(info->parts); | ||
| 137 | kfree(info); | 119 | kfree(info); |
| 138 | return 0; | 120 | return 0; |
| 139 | } | 121 | } |
