diff options
Diffstat (limited to 'drivers/mtd/maps/bfin-async-flash.c')
-rw-r--r-- | drivers/mtd/maps/bfin-async-flash.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/drivers/mtd/maps/bfin-async-flash.c b/drivers/mtd/maps/bfin-async-flash.c index 85dd18193cf2..d4297a97e100 100644 --- a/drivers/mtd/maps/bfin-async-flash.c +++ b/drivers/mtd/maps/bfin-async-flash.c | |||
@@ -41,9 +41,7 @@ struct async_state { | |||
41 | uint32_t flash_ambctl0, flash_ambctl1; | 41 | uint32_t flash_ambctl0, flash_ambctl1; |
42 | uint32_t save_ambctl0, save_ambctl1; | 42 | uint32_t save_ambctl0, save_ambctl1; |
43 | unsigned long irq_flags; | 43 | unsigned long irq_flags; |
44 | #ifdef CONFIG_MTD_PARTITIONS | ||
45 | struct mtd_partition *parts; | 44 | struct mtd_partition *parts; |
46 | #endif | ||
47 | }; | 45 | }; |
48 | 46 | ||
49 | static void switch_to_flash(struct async_state *state) | 47 | static void switch_to_flash(struct async_state *state) |
@@ -124,9 +122,7 @@ static void bfin_flash_copy_to(struct map_info *map, unsigned long to, const voi | |||
124 | switch_back(state); | 122 | switch_back(state); |
125 | } | 123 | } |
126 | 124 | ||
127 | #ifdef CONFIG_MTD_PARTITIONS | ||
128 | static const char *part_probe_types[] = { "cmdlinepart", "RedBoot", NULL }; | 125 | static const char *part_probe_types[] = { "cmdlinepart", "RedBoot", NULL }; |
129 | #endif | ||
130 | 126 | ||
131 | static int __devinit bfin_flash_probe(struct platform_device *pdev) | 127 | static int __devinit bfin_flash_probe(struct platform_device *pdev) |
132 | { | 128 | { |
@@ -169,22 +165,17 @@ static int __devinit bfin_flash_probe(struct platform_device *pdev) | |||
169 | return -ENXIO; | 165 | return -ENXIO; |
170 | } | 166 | } |
171 | 167 | ||
172 | #ifdef CONFIG_MTD_PARTITIONS | ||
173 | ret = parse_mtd_partitions(state->mtd, part_probe_types, &pdata->parts, 0); | 168 | ret = parse_mtd_partitions(state->mtd, part_probe_types, &pdata->parts, 0); |
174 | if (ret > 0) { | 169 | if (ret > 0) { |
175 | pr_devinit(KERN_NOTICE DRIVER_NAME ": Using commandline partition definition\n"); | 170 | pr_devinit(KERN_NOTICE DRIVER_NAME ": Using commandline partition definition\n"); |
176 | add_mtd_partitions(state->mtd, pdata->parts, ret); | 171 | mtd_device_register(state->mtd, pdata->parts, ret); |
177 | state->parts = pdata->parts; | 172 | state->parts = pdata->parts; |
178 | |||
179 | } else if (pdata->nr_parts) { | 173 | } else if (pdata->nr_parts) { |
180 | pr_devinit(KERN_NOTICE DRIVER_NAME ": Using board partition definition\n"); | 174 | pr_devinit(KERN_NOTICE DRIVER_NAME ": Using board partition definition\n"); |
181 | add_mtd_partitions(state->mtd, pdata->parts, pdata->nr_parts); | 175 | mtd_device_register(state->mtd, pdata->parts, pdata->nr_parts); |
182 | 176 | } else { | |
183 | } else | ||
184 | #endif | ||
185 | { | ||
186 | pr_devinit(KERN_NOTICE DRIVER_NAME ": no partition info available, registering whole flash at once\n"); | 177 | pr_devinit(KERN_NOTICE DRIVER_NAME ": no partition info available, registering whole flash at once\n"); |
187 | add_mtd_device(state->mtd); | 178 | mtd_device_register(state->mtd, NULL, 0); |
188 | } | 179 | } |
189 | 180 | ||
190 | platform_set_drvdata(pdev, state); | 181 | platform_set_drvdata(pdev, state); |
@@ -196,10 +187,8 @@ static int __devexit bfin_flash_remove(struct platform_device *pdev) | |||
196 | { | 187 | { |
197 | struct async_state *state = platform_get_drvdata(pdev); | 188 | struct async_state *state = platform_get_drvdata(pdev); |
198 | gpio_free(state->enet_flash_pin); | 189 | gpio_free(state->enet_flash_pin); |
199 | #ifdef CONFIG_MTD_PARTITIONS | 190 | mtd_device_unregister(state->mtd); |
200 | del_mtd_partitions(state->mtd); | ||
201 | kfree(state->parts); | 191 | kfree(state->parts); |
202 | #endif | ||
203 | map_destroy(state->mtd); | 192 | map_destroy(state->mtd); |
204 | kfree(state); | 193 | kfree(state); |
205 | return 0; | 194 | return 0; |