diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-27 23:06:53 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-27 23:06:53 -0400 |
commit | 29a6ccca3869bbe33879dae0cd7df2a1559eff54 (patch) | |
tree | 2d9d355d8662ede95af7bc812d686dc4d5f37ff3 /drivers/mtd/maps | |
parent | 426048313dfa7d65dbd2379b1665755511f9544f (diff) | |
parent | 6a8a98b22b10f1560d5f90aded4a54234b9b2724 (diff) |
Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6: (97 commits)
mtd: kill CONFIG_MTD_PARTITIONS
mtd: remove add_mtd_partitions, add_mtd_device and friends
mtd: convert remaining users to mtd_device_register()
mtd: samsung onenand: convert to mtd_device_register()
mtd: omap2 onenand: convert to mtd_device_register()
mtd: txx9ndfmc: convert to mtd_device_register()
mtd: tmio_nand: convert to mtd_device_register()
mtd: socrates_nand: convert to mtd_device_register()
mtd: sharpsl: convert to mtd_device_register()
mtd: s3c2410 nand: convert to mtd_device_register()
mtd: ppchameleonevb: convert to mtd_device_register()
mtd: orion_nand: convert to mtd_device_register()
mtd: omap2: convert to mtd_device_register()
mtd: nomadik_nand: convert to mtd_device_register()
mtd: ndfc: convert to mtd_device_register()
mtd: mxc_nand: convert to mtd_device_register()
mtd: mpc5121_nfc: convert to mtd_device_register()
mtd: jz4740_nand: convert to mtd_device_register()
mtd: h1910: convert to mtd_device_register()
mtd: fsmc_nand: convert to mtd_device_register()
...
Fixed up trivial conflicts in
- drivers/mtd/maps/integrator-flash.c: removed in ARM tree
- drivers/mtd/maps/physmap.c: addition of afs partition probe type
clashing with removal of CONFIG_MTD_PARTITIONS
Diffstat (limited to 'drivers/mtd/maps')
52 files changed, 208 insertions, 405 deletions
diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig index 5069111c81cc..c0c328c5b133 100644 --- a/drivers/mtd/maps/Kconfig +++ b/drivers/mtd/maps/Kconfig | |||
@@ -82,7 +82,6 @@ config MTD_PHYSMAP_OF | |||
82 | config MTD_PMC_MSP_EVM | 82 | config MTD_PMC_MSP_EVM |
83 | tristate "CFI Flash device mapped on PMC-Sierra MSP" | 83 | tristate "CFI Flash device mapped on PMC-Sierra MSP" |
84 | depends on PMC_MSP && MTD_CFI | 84 | depends on PMC_MSP && MTD_CFI |
85 | select MTD_PARTITIONS | ||
86 | help | 85 | help |
87 | This provides a 'mapping' driver which supports the way | 86 | This provides a 'mapping' driver which supports the way |
88 | in which user-programmable flash chips are connected on the | 87 | in which user-programmable flash chips are connected on the |
@@ -122,7 +121,7 @@ config MTD_SC520CDP | |||
122 | 121 | ||
123 | config MTD_NETSC520 | 122 | config MTD_NETSC520 |
124 | tristate "CFI Flash device mapped on AMD NetSc520" | 123 | tristate "CFI Flash device mapped on AMD NetSc520" |
125 | depends on X86 && MTD_CFI && MTD_PARTITIONS | 124 | depends on X86 && MTD_CFI |
126 | help | 125 | help |
127 | This enables access routines for the flash chips on the AMD NetSc520 | 126 | This enables access routines for the flash chips on the AMD NetSc520 |
128 | demonstration board. If you have one of these boards and would like | 127 | demonstration board. If you have one of these boards and would like |
@@ -131,7 +130,6 @@ config MTD_NETSC520 | |||
131 | config MTD_TS5500 | 130 | config MTD_TS5500 |
132 | tristate "JEDEC Flash device mapped on Technologic Systems TS-5500" | 131 | tristate "JEDEC Flash device mapped on Technologic Systems TS-5500" |
133 | depends on X86 | 132 | depends on X86 |
134 | select MTD_PARTITIONS | ||
135 | select MTD_JEDECPROBE | 133 | select MTD_JEDECPROBE |
136 | select MTD_CFI_AMDSTD | 134 | select MTD_CFI_AMDSTD |
137 | help | 135 | help |
@@ -149,7 +147,7 @@ config MTD_TS5500 | |||
149 | 147 | ||
150 | config MTD_SBC_GXX | 148 | config MTD_SBC_GXX |
151 | tristate "CFI Flash device mapped on Arcom SBC-GXx boards" | 149 | tristate "CFI Flash device mapped on Arcom SBC-GXx boards" |
152 | depends on X86 && MTD_CFI_INTELEXT && MTD_PARTITIONS && MTD_COMPLEX_MAPPINGS | 150 | depends on X86 && MTD_CFI_INTELEXT && MTD_COMPLEX_MAPPINGS |
153 | help | 151 | help |
154 | This provides a driver for the on-board flash of Arcom Control | 152 | This provides a driver for the on-board flash of Arcom Control |
155 | Systems' SBC-GXn family of boards, formerly known as SBC-MediaGX. | 153 | Systems' SBC-GXn family of boards, formerly known as SBC-MediaGX. |
@@ -161,7 +159,6 @@ config MTD_SBC_GXX | |||
161 | config MTD_PXA2XX | 159 | config MTD_PXA2XX |
162 | tristate "CFI Flash device mapped on Intel XScale PXA2xx based boards" | 160 | tristate "CFI Flash device mapped on Intel XScale PXA2xx based boards" |
163 | depends on (PXA25x || PXA27x) && MTD_CFI_INTELEXT | 161 | depends on (PXA25x || PXA27x) && MTD_CFI_INTELEXT |
164 | select MTD_PARTITIONS | ||
165 | help | 162 | help |
166 | This provides a driver for the NOR flash attached to a PXA2xx chip. | 163 | This provides a driver for the NOR flash attached to a PXA2xx chip. |
167 | 164 | ||
@@ -185,7 +182,7 @@ config MTD_VMAX | |||
185 | 182 | ||
186 | config MTD_SCx200_DOCFLASH | 183 | config MTD_SCx200_DOCFLASH |
187 | tristate "Flash device mapped with DOCCS on NatSemi SCx200" | 184 | tristate "Flash device mapped with DOCCS on NatSemi SCx200" |
188 | depends on SCx200 && MTD_CFI && MTD_PARTITIONS | 185 | depends on SCx200 && MTD_CFI |
189 | help | 186 | help |
190 | Enable support for a flash chip mapped using the DOCCS signal on a | 187 | Enable support for a flash chip mapped using the DOCCS signal on a |
191 | National Semiconductor SCx200 processor. | 188 | National Semiconductor SCx200 processor. |
@@ -247,7 +244,7 @@ config MTD_TSUNAMI | |||
247 | 244 | ||
248 | config MTD_NETtel | 245 | config MTD_NETtel |
249 | tristate "CFI flash device on SnapGear/SecureEdge" | 246 | tristate "CFI flash device on SnapGear/SecureEdge" |
250 | depends on X86 && MTD_PARTITIONS && MTD_JEDECPROBE | 247 | depends on X86 && MTD_JEDECPROBE |
251 | help | 248 | help |
252 | Support for flash chips on NETtel/SecureEdge/SnapGear boards. | 249 | Support for flash chips on NETtel/SecureEdge/SnapGear boards. |
253 | 250 | ||
@@ -269,7 +266,7 @@ config MTD_LANTIQ | |||
269 | 266 | ||
270 | config MTD_DILNETPC | 267 | config MTD_DILNETPC |
271 | tristate "CFI Flash device mapped on DIL/Net PC" | 268 | tristate "CFI Flash device mapped on DIL/Net PC" |
272 | depends on X86 && MTD_PARTITIONS && MTD_CFI_INTELEXT && BROKEN | 269 | depends on X86 && MTD_CFI_INTELEXT && BROKEN |
273 | help | 270 | help |
274 | MTD map driver for SSV DIL/Net PC Boards "DNP" and "ADNP". | 271 | MTD map driver for SSV DIL/Net PC Boards "DNP" and "ADNP". |
275 | For details, see <http://www.ssv-embedded.de/ssv/pc104/p169.htm> | 272 | For details, see <http://www.ssv-embedded.de/ssv/pc104/p169.htm> |
@@ -355,7 +352,7 @@ config MTD_CDB89712 | |||
355 | 352 | ||
356 | config MTD_SA1100 | 353 | config MTD_SA1100 |
357 | tristate "CFI Flash device mapped on StrongARM SA11x0" | 354 | tristate "CFI Flash device mapped on StrongARM SA11x0" |
358 | depends on MTD_CFI && ARCH_SA1100 && MTD_PARTITIONS | 355 | depends on MTD_CFI && ARCH_SA1100 |
359 | help | 356 | help |
360 | This enables access to the flash chips on most platforms based on | 357 | This enables access to the flash chips on most platforms based on |
361 | the SA1100 and SA1110, including the Assabet and the Compaq iPAQ. | 358 | the SA1100 and SA1110, including the Assabet and the Compaq iPAQ. |
@@ -389,7 +386,7 @@ config MTD_IXP2000 | |||
389 | 386 | ||
390 | config MTD_FORTUNET | 387 | config MTD_FORTUNET |
391 | tristate "CFI Flash device mapped on the FortuNet board" | 388 | tristate "CFI Flash device mapped on the FortuNet board" |
392 | depends on MTD_CFI && MTD_PARTITIONS && SA1100_FORTUNET | 389 | depends on MTD_CFI && SA1100_FORTUNET |
393 | help | 390 | help |
394 | This enables access to the Flash on the FortuNet board. If you | 391 | This enables access to the Flash on the FortuNet board. If you |
395 | have such a board, say 'Y'. | 392 | have such a board, say 'Y'. |
@@ -461,7 +458,6 @@ config MTD_PCMCIA_ANONYMOUS | |||
461 | config MTD_BFIN_ASYNC | 458 | config MTD_BFIN_ASYNC |
462 | tristate "Blackfin BF533-STAMP Flash Chip Support" | 459 | tristate "Blackfin BF533-STAMP Flash Chip Support" |
463 | depends on BFIN533_STAMP && MTD_CFI && MTD_COMPLEX_MAPPINGS | 460 | depends on BFIN533_STAMP && MTD_CFI && MTD_COMPLEX_MAPPINGS |
464 | select MTD_PARTITIONS | ||
465 | default y | 461 | default y |
466 | help | 462 | help |
467 | Map driver which allows for simultaneous utilization of | 463 | Map driver which allows for simultaneous utilization of |
@@ -473,7 +469,6 @@ config MTD_GPIO_ADDR | |||
473 | tristate "GPIO-assisted Flash Chip Support" | 469 | tristate "GPIO-assisted Flash Chip Support" |
474 | depends on GENERIC_GPIO || GPIOLIB | 470 | depends on GENERIC_GPIO || GPIOLIB |
475 | depends on MTD_COMPLEX_MAPPINGS | 471 | depends on MTD_COMPLEX_MAPPINGS |
476 | select MTD_PARTITIONS | ||
477 | help | 472 | help |
478 | Map driver which allows flashes to be partially physically addressed | 473 | Map driver which allows flashes to be partially physically addressed |
479 | and assisted by GPIOs. | 474 | and assisted by GPIOs. |
@@ -482,14 +477,13 @@ config MTD_GPIO_ADDR | |||
482 | 477 | ||
483 | config MTD_UCLINUX | 478 | config MTD_UCLINUX |
484 | bool "Generic uClinux RAM/ROM filesystem support" | 479 | bool "Generic uClinux RAM/ROM filesystem support" |
485 | depends on MTD_PARTITIONS && MTD_RAM=y && !MMU | 480 | depends on MTD_RAM=y && !MMU |
486 | help | 481 | help |
487 | Map driver to support image based filesystems for uClinux. | 482 | Map driver to support image based filesystems for uClinux. |
488 | 483 | ||
489 | config MTD_WRSBC8260 | 484 | config MTD_WRSBC8260 |
490 | tristate "Map driver for WindRiver PowerQUICC II MPC82xx board" | 485 | tristate "Map driver for WindRiver PowerQUICC II MPC82xx board" |
491 | depends on (SBC82xx || SBC8560) | 486 | depends on (SBC82xx || SBC8560) |
492 | select MTD_PARTITIONS | ||
493 | select MTD_MAP_BANK_WIDTH_4 | 487 | select MTD_MAP_BANK_WIDTH_4 |
494 | select MTD_MAP_BANK_WIDTH_1 | 488 | select MTD_MAP_BANK_WIDTH_1 |
495 | select MTD_CFI_I1 | 489 | select MTD_CFI_I1 |
@@ -502,7 +496,6 @@ config MTD_WRSBC8260 | |||
502 | config MTD_DMV182 | 496 | config MTD_DMV182 |
503 | tristate "Map driver for Dy-4 SVME/DMV-182 board." | 497 | tristate "Map driver for Dy-4 SVME/DMV-182 board." |
504 | depends on DMV182 | 498 | depends on DMV182 |
505 | select MTD_PARTITIONS | ||
506 | select MTD_MAP_BANK_WIDTH_32 | 499 | select MTD_MAP_BANK_WIDTH_32 |
507 | select MTD_CFI_I8 | 500 | select MTD_CFI_I8 |
508 | select MTD_CFI_AMDSTD | 501 | select MTD_CFI_AMDSTD |
diff --git a/drivers/mtd/maps/amd76xrom.c b/drivers/mtd/maps/amd76xrom.c index 92de7e3a49a5..e2875d6fe129 100644 --- a/drivers/mtd/maps/amd76xrom.c +++ b/drivers/mtd/maps/amd76xrom.c | |||
@@ -82,7 +82,7 @@ static void amd76xrom_cleanup(struct amd76xrom_window *window) | |||
82 | if (map->rsrc.parent) { | 82 | if (map->rsrc.parent) { |
83 | release_resource(&map->rsrc); | 83 | release_resource(&map->rsrc); |
84 | } | 84 | } |
85 | del_mtd_device(map->mtd); | 85 | mtd_device_unregister(map->mtd); |
86 | map_destroy(map->mtd); | 86 | map_destroy(map->mtd); |
87 | list_del(&map->list); | 87 | list_del(&map->list); |
88 | kfree(map); | 88 | kfree(map); |
@@ -262,7 +262,7 @@ static int __devinit amd76xrom_init_one (struct pci_dev *pdev, | |||
262 | 262 | ||
263 | /* Now that the mtd devices is complete claim and export it */ | 263 | /* Now that the mtd devices is complete claim and export it */ |
264 | map->mtd->owner = THIS_MODULE; | 264 | map->mtd->owner = THIS_MODULE; |
265 | if (add_mtd_device(map->mtd)) { | 265 | if (mtd_device_register(map->mtd, NULL, 0)) { |
266 | map_destroy(map->mtd); | 266 | map_destroy(map->mtd); |
267 | map->mtd = NULL; | 267 | map->mtd = NULL; |
268 | goto out; | 268 | goto out; |
diff --git a/drivers/mtd/maps/autcpu12-nvram.c b/drivers/mtd/maps/autcpu12-nvram.c index 53664188fc47..e5bfd0e093bb 100644 --- a/drivers/mtd/maps/autcpu12-nvram.c +++ b/drivers/mtd/maps/autcpu12-nvram.c | |||
@@ -88,7 +88,7 @@ map: | |||
88 | sram_mtd->owner = THIS_MODULE; | 88 | sram_mtd->owner = THIS_MODULE; |
89 | sram_mtd->erasesize = 16; | 89 | sram_mtd->erasesize = 16; |
90 | 90 | ||
91 | if (add_mtd_device(sram_mtd)) { | 91 | if (mtd_device_register(sram_mtd, NULL, 0)) { |
92 | printk("NV-RAM device addition failed\n"); | 92 | printk("NV-RAM device addition failed\n"); |
93 | err = -ENOMEM; | 93 | err = -ENOMEM; |
94 | goto out_probe; | 94 | goto out_probe; |
@@ -111,7 +111,7 @@ out: | |||
111 | static void __exit cleanup_autcpu12_maps(void) | 111 | static void __exit cleanup_autcpu12_maps(void) |
112 | { | 112 | { |
113 | if (sram_mtd) { | 113 | if (sram_mtd) { |
114 | del_mtd_device(sram_mtd); | 114 | mtd_device_unregister(sram_mtd); |
115 | map_destroy(sram_mtd); | 115 | map_destroy(sram_mtd); |
116 | iounmap((void *)autcpu12_sram_map.virt); | 116 | iounmap((void *)autcpu12_sram_map.virt); |
117 | } | 117 | } |
diff --git a/drivers/mtd/maps/bcm963xx-flash.c b/drivers/mtd/maps/bcm963xx-flash.c index 1f3049590d9e..608967fe74c6 100644 --- a/drivers/mtd/maps/bcm963xx-flash.c +++ b/drivers/mtd/maps/bcm963xx-flash.c | |||
@@ -224,8 +224,8 @@ probe_ok: | |||
224 | goto err_probe; | 224 | goto err_probe; |
225 | } | 225 | } |
226 | 226 | ||
227 | return add_mtd_partitions(bcm963xx_mtd_info, parsed_parts, | 227 | return mtd_device_register(bcm963xx_mtd_info, parsed_parts, |
228 | parsed_nr_parts); | 228 | parsed_nr_parts); |
229 | 229 | ||
230 | err_probe: | 230 | err_probe: |
231 | iounmap(bcm963xx_map.virt); | 231 | iounmap(bcm963xx_map.virt); |
@@ -235,7 +235,7 @@ err_probe: | |||
235 | static int bcm963xx_remove(struct platform_device *pdev) | 235 | static int bcm963xx_remove(struct platform_device *pdev) |
236 | { | 236 | { |
237 | if (bcm963xx_mtd_info) { | 237 | if (bcm963xx_mtd_info) { |
238 | del_mtd_partitions(bcm963xx_mtd_info); | 238 | mtd_device_unregister(bcm963xx_mtd_info); |
239 | map_destroy(bcm963xx_mtd_info); | 239 | map_destroy(bcm963xx_mtd_info); |
240 | } | 240 | } |
241 | 241 | ||
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; |
diff --git a/drivers/mtd/maps/cdb89712.c b/drivers/mtd/maps/cdb89712.c index 8d92d8db9a98..c29cbf87ea0c 100644 --- a/drivers/mtd/maps/cdb89712.c +++ b/drivers/mtd/maps/cdb89712.c | |||
@@ -75,7 +75,7 @@ static int __init init_cdb89712_flash (void) | |||
75 | 75 | ||
76 | flash_mtd->owner = THIS_MODULE; | 76 | flash_mtd->owner = THIS_MODULE; |
77 | 77 | ||
78 | if (add_mtd_device(flash_mtd)) { | 78 | if (mtd_device_register(flash_mtd, NULL, 0)) { |
79 | printk("FLASH device addition failed\n"); | 79 | printk("FLASH device addition failed\n"); |
80 | err = -ENOMEM; | 80 | err = -ENOMEM; |
81 | goto out_probe; | 81 | goto out_probe; |
@@ -141,7 +141,7 @@ static int __init init_cdb89712_sram (void) | |||
141 | sram_mtd->owner = THIS_MODULE; | 141 | sram_mtd->owner = THIS_MODULE; |
142 | sram_mtd->erasesize = 16; | 142 | sram_mtd->erasesize = 16; |
143 | 143 | ||
144 | if (add_mtd_device(sram_mtd)) { | 144 | if (mtd_device_register(sram_mtd, NULL, 0)) { |
145 | printk("SRAM device addition failed\n"); | 145 | printk("SRAM device addition failed\n"); |
146 | err = -ENOMEM; | 146 | err = -ENOMEM; |
147 | goto out_probe; | 147 | goto out_probe; |
@@ -209,7 +209,7 @@ static int __init init_cdb89712_bootrom (void) | |||
209 | bootrom_mtd->owner = THIS_MODULE; | 209 | bootrom_mtd->owner = THIS_MODULE; |
210 | bootrom_mtd->erasesize = 0x10000; | 210 | bootrom_mtd->erasesize = 0x10000; |
211 | 211 | ||
212 | if (add_mtd_device(bootrom_mtd)) { | 212 | if (mtd_device_register(bootrom_mtd, NULL, 0)) { |
213 | printk("BootROM device addition failed\n"); | 213 | printk("BootROM device addition failed\n"); |
214 | err = -ENOMEM; | 214 | err = -ENOMEM; |
215 | goto out_probe; | 215 | goto out_probe; |
@@ -249,21 +249,21 @@ static int __init init_cdb89712_maps(void) | |||
249 | static void __exit cleanup_cdb89712_maps(void) | 249 | static void __exit cleanup_cdb89712_maps(void) |
250 | { | 250 | { |
251 | if (sram_mtd) { | 251 | if (sram_mtd) { |
252 | del_mtd_device(sram_mtd); | 252 | mtd_device_unregister(sram_mtd); |
253 | map_destroy(sram_mtd); | 253 | map_destroy(sram_mtd); |
254 | iounmap((void *)cdb89712_sram_map.virt); | 254 | iounmap((void *)cdb89712_sram_map.virt); |
255 | release_resource (&cdb89712_sram_resource); | 255 | release_resource (&cdb89712_sram_resource); |
256 | } | 256 | } |
257 | 257 | ||
258 | if (flash_mtd) { | 258 | if (flash_mtd) { |
259 | del_mtd_device(flash_mtd); | 259 | mtd_device_unregister(flash_mtd); |
260 | map_destroy(flash_mtd); | 260 | map_destroy(flash_mtd); |
261 | iounmap((void *)cdb89712_flash_map.virt); | 261 | iounmap((void *)cdb89712_flash_map.virt); |
262 | release_resource (&cdb89712_flash_resource); | 262 | release_resource (&cdb89712_flash_resource); |
263 | } | 263 | } |
264 | 264 | ||
265 | if (bootrom_mtd) { | 265 | if (bootrom_mtd) { |
266 | del_mtd_device(bootrom_mtd); | 266 | mtd_device_unregister(bootrom_mtd); |
267 | map_destroy(bootrom_mtd); | 267 | map_destroy(bootrom_mtd); |
268 | iounmap((void *)cdb89712_bootrom_map.virt); | 268 | iounmap((void *)cdb89712_bootrom_map.virt); |
269 | release_resource (&cdb89712_bootrom_resource); | 269 | release_resource (&cdb89712_bootrom_resource); |
diff --git a/drivers/mtd/maps/ceiva.c b/drivers/mtd/maps/ceiva.c index 23f551dc8ca8..06f9c9815720 100644 --- a/drivers/mtd/maps/ceiva.c +++ b/drivers/mtd/maps/ceiva.c | |||
@@ -224,7 +224,7 @@ static void __exit clps_destroy_mtd(struct clps_info *clps, struct mtd_info *mtd | |||
224 | { | 224 | { |
225 | int i; | 225 | int i; |
226 | 226 | ||
227 | del_mtd_partitions(mtd); | 227 | mtd_device_unregister(mtd); |
228 | 228 | ||
229 | if (mtd != clps[0].mtd) | 229 | if (mtd != clps[0].mtd) |
230 | mtd_concat_destroy(mtd); | 230 | mtd_concat_destroy(mtd); |
@@ -292,11 +292,11 @@ static void __init clps_locate_partitions(struct mtd_info *mtd) | |||
292 | if (nr_parts == 0) { | 292 | if (nr_parts == 0) { |
293 | printk(KERN_NOTICE "clps flash: no partition info " | 293 | printk(KERN_NOTICE "clps flash: no partition info " |
294 | "available, registering whole flash\n"); | 294 | "available, registering whole flash\n"); |
295 | add_mtd_device(mtd); | 295 | mtd_device_register(mtd, NULL, 0); |
296 | } else { | 296 | } else { |
297 | printk(KERN_NOTICE "clps flash: using %s partition " | 297 | printk(KERN_NOTICE "clps flash: using %s partition " |
298 | "definition\n", part_type); | 298 | "definition\n", part_type); |
299 | add_mtd_partitions(mtd, parsed_parts, nr_parts); | 299 | mtd_device_register(mtd, parsed_parts, nr_parts); |
300 | } | 300 | } |
301 | 301 | ||
302 | /* Always succeeds. */ | 302 | /* Always succeeds. */ |
diff --git a/drivers/mtd/maps/cfi_flagadm.c b/drivers/mtd/maps/cfi_flagadm.c index f71343cd77cc..d16fc9d3b8cd 100644 --- a/drivers/mtd/maps/cfi_flagadm.c +++ b/drivers/mtd/maps/cfi_flagadm.c | |||
@@ -107,7 +107,7 @@ static int __init init_flagadm(void) | |||
107 | mymtd = do_map_probe("cfi_probe", &flagadm_map); | 107 | mymtd = do_map_probe("cfi_probe", &flagadm_map); |
108 | if (mymtd) { | 108 | if (mymtd) { |
109 | mymtd->owner = THIS_MODULE; | 109 | mymtd->owner = THIS_MODULE; |
110 | add_mtd_partitions(mymtd, flagadm_parts, PARTITION_COUNT); | 110 | mtd_device_register(mymtd, flagadm_parts, PARTITION_COUNT); |
111 | printk(KERN_NOTICE "FlagaDM flash device initialized\n"); | 111 | printk(KERN_NOTICE "FlagaDM flash device initialized\n"); |
112 | return 0; | 112 | return 0; |
113 | } | 113 | } |
@@ -119,7 +119,7 @@ static int __init init_flagadm(void) | |||
119 | static void __exit cleanup_flagadm(void) | 119 | static void __exit cleanup_flagadm(void) |
120 | { | 120 | { |
121 | if (mymtd) { | 121 | if (mymtd) { |
122 | del_mtd_partitions(mymtd); | 122 | mtd_device_unregister(mymtd); |
123 | map_destroy(mymtd); | 123 | map_destroy(mymtd); |
124 | } | 124 | } |
125 | if (flagadm_map.virt) { | 125 | if (flagadm_map.virt) { |
diff --git a/drivers/mtd/maps/ck804xrom.c b/drivers/mtd/maps/ck804xrom.c index 5fdb7b26cea3..3d0e762fa5f2 100644 --- a/drivers/mtd/maps/ck804xrom.c +++ b/drivers/mtd/maps/ck804xrom.c | |||
@@ -94,7 +94,7 @@ static void ck804xrom_cleanup(struct ck804xrom_window *window) | |||
94 | if (map->rsrc.parent) | 94 | if (map->rsrc.parent) |
95 | release_resource(&map->rsrc); | 95 | release_resource(&map->rsrc); |
96 | 96 | ||
97 | del_mtd_device(map->mtd); | 97 | mtd_device_unregister(map->mtd); |
98 | map_destroy(map->mtd); | 98 | map_destroy(map->mtd); |
99 | list_del(&map->list); | 99 | list_del(&map->list); |
100 | kfree(map); | 100 | kfree(map); |
@@ -291,7 +291,7 @@ static int __devinit ck804xrom_init_one (struct pci_dev *pdev, | |||
291 | 291 | ||
292 | /* Now that the mtd devices is complete claim and export it */ | 292 | /* Now that the mtd devices is complete claim and export it */ |
293 | map->mtd->owner = THIS_MODULE; | 293 | map->mtd->owner = THIS_MODULE; |
294 | if (add_mtd_device(map->mtd)) { | 294 | if (mtd_device_register(map->mtd, NULL, 0)) { |
295 | map_destroy(map->mtd); | 295 | map_destroy(map->mtd); |
296 | map->mtd = NULL; | 296 | map->mtd = NULL; |
297 | goto out; | 297 | goto out; |
diff --git a/drivers/mtd/maps/dbox2-flash.c b/drivers/mtd/maps/dbox2-flash.c index cfacfa6f45dd..85bdece6ab3f 100644 --- a/drivers/mtd/maps/dbox2-flash.c +++ b/drivers/mtd/maps/dbox2-flash.c | |||
@@ -93,7 +93,7 @@ static int __init init_dbox2_flash(void) | |||
93 | mymtd->owner = THIS_MODULE; | 93 | mymtd->owner = THIS_MODULE; |
94 | 94 | ||
95 | /* Create MTD devices for each partition. */ | 95 | /* Create MTD devices for each partition. */ |
96 | add_mtd_partitions(mymtd, partition_info, NUM_PARTITIONS); | 96 | mtd_device_register(mymtd, partition_info, NUM_PARTITIONS); |
97 | 97 | ||
98 | return 0; | 98 | return 0; |
99 | } | 99 | } |
@@ -105,7 +105,7 @@ static int __init init_dbox2_flash(void) | |||
105 | static void __exit cleanup_dbox2_flash(void) | 105 | static void __exit cleanup_dbox2_flash(void) |
106 | { | 106 | { |
107 | if (mymtd) { | 107 | if (mymtd) { |
108 | del_mtd_partitions(mymtd); | 108 | mtd_device_unregister(mymtd); |
109 | map_destroy(mymtd); | 109 | map_destroy(mymtd); |
110 | } | 110 | } |
111 | if (dbox2_flash_map.virt) { | 111 | if (dbox2_flash_map.virt) { |
diff --git a/drivers/mtd/maps/dc21285.c b/drivers/mtd/maps/dc21285.c index b3cb3a183809..7a9e1989c977 100644 --- a/drivers/mtd/maps/dc21285.c +++ b/drivers/mtd/maps/dc21285.c | |||
@@ -145,17 +145,13 @@ static struct map_info dc21285_map = { | |||
145 | 145 | ||
146 | 146 | ||
147 | /* Partition stuff */ | 147 | /* Partition stuff */ |
148 | #ifdef CONFIG_MTD_PARTITIONS | ||
149 | static struct mtd_partition *dc21285_parts; | 148 | static struct mtd_partition *dc21285_parts; |
150 | static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; | 149 | static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; |
151 | #endif | ||
152 | 150 | ||
153 | static int __init init_dc21285(void) | 151 | static int __init init_dc21285(void) |
154 | { | 152 | { |
155 | 153 | ||
156 | #ifdef CONFIG_MTD_PARTITIONS | ||
157 | int nrparts; | 154 | int nrparts; |
158 | #endif | ||
159 | 155 | ||
160 | /* Determine bankwidth */ | 156 | /* Determine bankwidth */ |
161 | switch (*CSR_SA110_CNTL & (3<<14)) { | 157 | switch (*CSR_SA110_CNTL & (3<<14)) { |
@@ -204,13 +200,8 @@ static int __init init_dc21285(void) | |||
204 | 200 | ||
205 | dc21285_mtd->owner = THIS_MODULE; | 201 | dc21285_mtd->owner = THIS_MODULE; |
206 | 202 | ||
207 | #ifdef CONFIG_MTD_PARTITIONS | ||
208 | nrparts = parse_mtd_partitions(dc21285_mtd, probes, &dc21285_parts, 0); | 203 | nrparts = parse_mtd_partitions(dc21285_mtd, probes, &dc21285_parts, 0); |
209 | if (nrparts > 0) | 204 | mtd_device_register(dc21285_mtd, dc21285_parts, nrparts); |
210 | add_mtd_partitions(dc21285_mtd, dc21285_parts, nrparts); | ||
211 | else | ||
212 | #endif | ||
213 | add_mtd_device(dc21285_mtd); | ||
214 | 205 | ||
215 | if(machine_is_ebsa285()) { | 206 | if(machine_is_ebsa285()) { |
216 | /* | 207 | /* |
@@ -232,14 +223,9 @@ static int __init init_dc21285(void) | |||
232 | 223 | ||
233 | static void __exit cleanup_dc21285(void) | 224 | static void __exit cleanup_dc21285(void) |
234 | { | 225 | { |
235 | #ifdef CONFIG_MTD_PARTITIONS | 226 | mtd_device_unregister(dc21285_mtd); |
236 | if (dc21285_parts) { | 227 | if (dc21285_parts) |
237 | del_mtd_partitions(dc21285_mtd); | ||
238 | kfree(dc21285_parts); | 228 | kfree(dc21285_parts); |
239 | } else | ||
240 | #endif | ||
241 | del_mtd_device(dc21285_mtd); | ||
242 | |||
243 | map_destroy(dc21285_mtd); | 229 | map_destroy(dc21285_mtd); |
244 | iounmap(dc21285_map.virt); | 230 | iounmap(dc21285_map.virt); |
245 | } | 231 | } |
diff --git a/drivers/mtd/maps/dilnetpc.c b/drivers/mtd/maps/dilnetpc.c index 0713e3a5a22c..3e393f0da823 100644 --- a/drivers/mtd/maps/dilnetpc.c +++ b/drivers/mtd/maps/dilnetpc.c | |||
@@ -450,7 +450,7 @@ static int __init init_dnpc(void) | |||
450 | partition_info[2].mtdp = &lowlvl_parts[1]; | 450 | partition_info[2].mtdp = &lowlvl_parts[1]; |
451 | partition_info[3].mtdp = &lowlvl_parts[3]; | 451 | partition_info[3].mtdp = &lowlvl_parts[3]; |
452 | 452 | ||
453 | add_mtd_partitions(mymtd, partition_info, NUM_PARTITIONS); | 453 | mtd_device_register(mymtd, partition_info, NUM_PARTITIONS); |
454 | 454 | ||
455 | /* | 455 | /* |
456 | ** now create a virtual MTD device by concatenating the for partitions | 456 | ** now create a virtual MTD device by concatenating the for partitions |
@@ -463,7 +463,8 @@ static int __init init_dnpc(void) | |||
463 | ** we do not supply mtd pointers in higlvl_partition_info, so | 463 | ** we do not supply mtd pointers in higlvl_partition_info, so |
464 | ** add_mtd_partitions() will register the devices. | 464 | ** add_mtd_partitions() will register the devices. |
465 | */ | 465 | */ |
466 | add_mtd_partitions(merged_mtd, higlvl_partition_info, NUM_HIGHLVL_PARTITIONS); | 466 | mtd_device_register(merged_mtd, higlvl_partition_info, |
467 | NUM_HIGHLVL_PARTITIONS); | ||
467 | } | 468 | } |
468 | 469 | ||
469 | return 0; | 470 | return 0; |
@@ -472,12 +473,12 @@ static int __init init_dnpc(void) | |||
472 | static void __exit cleanup_dnpc(void) | 473 | static void __exit cleanup_dnpc(void) |
473 | { | 474 | { |
474 | if(merged_mtd) { | 475 | if(merged_mtd) { |
475 | del_mtd_partitions(merged_mtd); | 476 | mtd_device_unregister(merged_mtd); |
476 | mtd_concat_destroy(merged_mtd); | 477 | mtd_concat_destroy(merged_mtd); |
477 | } | 478 | } |
478 | 479 | ||
479 | if (mymtd) { | 480 | if (mymtd) { |
480 | del_mtd_partitions(mymtd); | 481 | mtd_device_unregister(mymtd); |
481 | map_destroy(mymtd); | 482 | map_destroy(mymtd); |
482 | } | 483 | } |
483 | if (dnpc_map.virt) { | 484 | if (dnpc_map.virt) { |
diff --git a/drivers/mtd/maps/dmv182.c b/drivers/mtd/maps/dmv182.c index d171674eb2ed..6538ac675e00 100644 --- a/drivers/mtd/maps/dmv182.c +++ b/drivers/mtd/maps/dmv182.c | |||
@@ -120,7 +120,7 @@ static int __init init_svme182(void) | |||
120 | this_mtd->size >> 20, FLASH_BASE_ADDR); | 120 | this_mtd->size >> 20, FLASH_BASE_ADDR); |
121 | 121 | ||
122 | this_mtd->owner = THIS_MODULE; | 122 | this_mtd->owner = THIS_MODULE; |
123 | add_mtd_partitions(this_mtd, partitions, num_parts); | 123 | mtd_device_register(this_mtd, partitions, num_parts); |
124 | 124 | ||
125 | return 0; | 125 | return 0; |
126 | } | 126 | } |
@@ -129,7 +129,7 @@ static void __exit cleanup_svme182(void) | |||
129 | { | 129 | { |
130 | if (this_mtd) | 130 | if (this_mtd) |
131 | { | 131 | { |
132 | del_mtd_partitions(this_mtd); | 132 | mtd_device_unregister(this_mtd); |
133 | map_destroy(this_mtd); | 133 | map_destroy(this_mtd); |
134 | } | 134 | } |
135 | 135 | ||
diff --git a/drivers/mtd/maps/edb7312.c b/drivers/mtd/maps/edb7312.c index be9e90b44587..fe42a212bb3e 100644 --- a/drivers/mtd/maps/edb7312.c +++ b/drivers/mtd/maps/edb7312.c | |||
@@ -15,10 +15,7 @@ | |||
15 | #include <asm/io.h> | 15 | #include <asm/io.h> |
16 | #include <linux/mtd/mtd.h> | 16 | #include <linux/mtd/mtd.h> |
17 | #include <linux/mtd/map.h> | 17 | #include <linux/mtd/map.h> |
18 | |||
19 | #ifdef CONFIG_MTD_PARTITIONS | ||
20 | #include <linux/mtd/partitions.h> | 18 | #include <linux/mtd/partitions.h> |
21 | #endif | ||
22 | 19 | ||
23 | #define WINDOW_ADDR 0x00000000 /* physical properties of flash */ | 20 | #define WINDOW_ADDR 0x00000000 /* physical properties of flash */ |
24 | #define WINDOW_SIZE 0x01000000 | 21 | #define WINDOW_SIZE 0x01000000 |
@@ -40,8 +37,6 @@ struct map_info edb7312nor_map = { | |||
40 | .phys = WINDOW_ADDR, | 37 | .phys = WINDOW_ADDR, |
41 | }; | 38 | }; |
42 | 39 | ||
43 | #ifdef CONFIG_MTD_PARTITIONS | ||
44 | |||
45 | /* | 40 | /* |
46 | * MTD partitioning stuff | 41 | * MTD partitioning stuff |
47 | */ | 42 | */ |
@@ -66,8 +61,6 @@ static struct mtd_partition static_partitions[3] = | |||
66 | 61 | ||
67 | static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; | 62 | static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; |
68 | 63 | ||
69 | #endif | ||
70 | |||
71 | static int mtd_parts_nb = 0; | 64 | static int mtd_parts_nb = 0; |
72 | static struct mtd_partition *mtd_parts = 0; | 65 | static struct mtd_partition *mtd_parts = 0; |
73 | 66 | ||
@@ -96,27 +89,24 @@ static int __init init_edb7312nor(void) | |||
96 | if (mymtd) { | 89 | if (mymtd) { |
97 | mymtd->owner = THIS_MODULE; | 90 | mymtd->owner = THIS_MODULE; |
98 | 91 | ||
99 | #ifdef CONFIG_MTD_PARTITIONS | ||
100 | mtd_parts_nb = parse_mtd_partitions(mymtd, probes, &mtd_parts, MTDID); | 92 | mtd_parts_nb = parse_mtd_partitions(mymtd, probes, &mtd_parts, MTDID); |
101 | if (mtd_parts_nb > 0) | 93 | if (mtd_parts_nb > 0) |
102 | part_type = "detected"; | 94 | part_type = "detected"; |
103 | 95 | ||
104 | if (mtd_parts_nb == 0) | 96 | if (mtd_parts_nb == 0) { |
105 | { | ||
106 | mtd_parts = static_partitions; | 97 | mtd_parts = static_partitions; |
107 | mtd_parts_nb = ARRAY_SIZE(static_partitions); | 98 | mtd_parts_nb = ARRAY_SIZE(static_partitions); |
108 | part_type = "static"; | 99 | part_type = "static"; |
109 | } | 100 | } |
110 | #endif | 101 | |
111 | add_mtd_device(mymtd); | ||
112 | if (mtd_parts_nb == 0) | 102 | if (mtd_parts_nb == 0) |
113 | printk(KERN_NOTICE MSG_PREFIX "no partition info available\n"); | 103 | printk(KERN_NOTICE MSG_PREFIX "no partition info available\n"); |
114 | else | 104 | else |
115 | { | ||
116 | printk(KERN_NOTICE MSG_PREFIX | 105 | printk(KERN_NOTICE MSG_PREFIX |
117 | "using %s partition definition\n", part_type); | 106 | "using %s partition definition\n", part_type); |
118 | add_mtd_partitions(mymtd, mtd_parts, mtd_parts_nb); | 107 | /* Register the whole device first. */ |
119 | } | 108 | mtd_device_register(mymtd, NULL, 0); |
109 | mtd_device_register(mymtd, mtd_parts, mtd_parts_nb); | ||
120 | return 0; | 110 | return 0; |
121 | } | 111 | } |
122 | 112 | ||
@@ -127,7 +117,7 @@ static int __init init_edb7312nor(void) | |||
127 | static void __exit cleanup_edb7312nor(void) | 117 | static void __exit cleanup_edb7312nor(void) |
128 | { | 118 | { |
129 | if (mymtd) { | 119 | if (mymtd) { |
130 | del_mtd_device(mymtd); | 120 | mtd_device_unregister(mymtd); |
131 | map_destroy(mymtd); | 121 | map_destroy(mymtd); |
132 | } | 122 | } |
133 | if (edb7312nor_map.virt) { | 123 | if (edb7312nor_map.virt) { |
diff --git a/drivers/mtd/maps/esb2rom.c b/drivers/mtd/maps/esb2rom.c index 4feb7507ab7c..08322b1c3e81 100644 --- a/drivers/mtd/maps/esb2rom.c +++ b/drivers/mtd/maps/esb2rom.c | |||
@@ -128,7 +128,7 @@ static void esb2rom_cleanup(struct esb2rom_window *window) | |||
128 | list_for_each_entry_safe(map, scratch, &window->maps, list) { | 128 | list_for_each_entry_safe(map, scratch, &window->maps, list) { |
129 | if (map->rsrc.parent) | 129 | if (map->rsrc.parent) |
130 | release_resource(&map->rsrc); | 130 | release_resource(&map->rsrc); |
131 | del_mtd_device(map->mtd); | 131 | mtd_device_unregister(map->mtd); |
132 | map_destroy(map->mtd); | 132 | map_destroy(map->mtd); |
133 | list_del(&map->list); | 133 | list_del(&map->list); |
134 | kfree(map); | 134 | kfree(map); |
@@ -352,7 +352,7 @@ static int __devinit esb2rom_init_one(struct pci_dev *pdev, | |||
352 | 352 | ||
353 | /* Now that the mtd devices is complete claim and export it */ | 353 | /* Now that the mtd devices is complete claim and export it */ |
354 | map->mtd->owner = THIS_MODULE; | 354 | map->mtd->owner = THIS_MODULE; |
355 | if (add_mtd_device(map->mtd)) { | 355 | if (mtd_device_register(map->mtd, NULL, 0)) { |
356 | map_destroy(map->mtd); | 356 | map_destroy(map->mtd); |
357 | map->mtd = NULL; | 357 | map->mtd = NULL; |
358 | goto out; | 358 | goto out; |
diff --git a/drivers/mtd/maps/fortunet.c b/drivers/mtd/maps/fortunet.c index 1e43124d498b..956e2e4f30ea 100644 --- a/drivers/mtd/maps/fortunet.c +++ b/drivers/mtd/maps/fortunet.c | |||
@@ -243,8 +243,9 @@ static int __init init_fortunet(void) | |||
243 | &map_regions[ix].map_info); | 243 | &map_regions[ix].map_info); |
244 | } | 244 | } |
245 | map_regions[ix].mymtd->owner = THIS_MODULE; | 245 | map_regions[ix].mymtd->owner = THIS_MODULE; |
246 | add_mtd_partitions(map_regions[ix].mymtd, | 246 | mtd_device_register(map_regions[ix].mymtd, |
247 | map_regions[ix].parts,map_regions_parts[ix]); | 247 | map_regions[ix].parts, |
248 | map_regions_parts[ix]); | ||
248 | } | 249 | } |
249 | } | 250 | } |
250 | if(iy) | 251 | if(iy) |
@@ -261,7 +262,7 @@ static void __exit cleanup_fortunet(void) | |||
261 | { | 262 | { |
262 | if( map_regions[ix].mymtd ) | 263 | if( map_regions[ix].mymtd ) |
263 | { | 264 | { |
264 | del_mtd_partitions( map_regions[ix].mymtd ); | 265 | mtd_device_unregister(map_regions[ix].mymtd); |
265 | map_destroy( map_regions[ix].mymtd ); | 266 | map_destroy( map_regions[ix].mymtd ); |
266 | } | 267 | } |
267 | iounmap((void *)map_regions[ix].map_info.virt); | 268 | iounmap((void *)map_regions[ix].map_info.virt); |
diff --git a/drivers/mtd/maps/gpio-addr-flash.c b/drivers/mtd/maps/gpio-addr-flash.c index af5707a80205..7568c5f8b8ae 100644 --- a/drivers/mtd/maps/gpio-addr-flash.c +++ b/drivers/mtd/maps/gpio-addr-flash.c | |||
@@ -155,9 +155,7 @@ static void gf_copy_to(struct map_info *map, unsigned long to, const void *from, | |||
155 | memcpy_toio(map->virt + (to % state->win_size), from, len); | 155 | memcpy_toio(map->virt + (to % state->win_size), from, len); |
156 | } | 156 | } |
157 | 157 | ||
158 | #ifdef CONFIG_MTD_PARTITIONS | ||
159 | static const char *part_probe_types[] = { "cmdlinepart", "RedBoot", NULL }; | 158 | static const char *part_probe_types[] = { "cmdlinepart", "RedBoot", NULL }; |
160 | #endif | ||
161 | 159 | ||
162 | /** | 160 | /** |
163 | * gpio_flash_probe() - setup a mapping for a GPIO assisted flash | 161 | * gpio_flash_probe() - setup a mapping for a GPIO assisted flash |
@@ -189,7 +187,7 @@ static const char *part_probe_types[] = { "cmdlinepart", "RedBoot", NULL }; | |||
189 | */ | 187 | */ |
190 | static int __devinit gpio_flash_probe(struct platform_device *pdev) | 188 | static int __devinit gpio_flash_probe(struct platform_device *pdev) |
191 | { | 189 | { |
192 | int ret; | 190 | int nr_parts; |
193 | size_t i, arr_size; | 191 | size_t i, arr_size; |
194 | struct physmap_flash_data *pdata; | 192 | struct physmap_flash_data *pdata; |
195 | struct resource *memory; | 193 | struct resource *memory; |
@@ -254,24 +252,21 @@ static int __devinit gpio_flash_probe(struct platform_device *pdev) | |||
254 | return -ENXIO; | 252 | return -ENXIO; |
255 | } | 253 | } |
256 | 254 | ||
257 | #ifdef CONFIG_MTD_PARTITIONS | 255 | nr_parts = parse_mtd_partitions(state->mtd, part_probe_types, |
258 | ret = parse_mtd_partitions(state->mtd, part_probe_types, &pdata->parts, 0); | 256 | &pdata->parts, 0); |
259 | if (ret > 0) { | 257 | if (nr_parts > 0) { |
260 | pr_devinit(KERN_NOTICE PFX "Using commandline partition definition\n"); | 258 | pr_devinit(KERN_NOTICE PFX "Using commandline partition definition\n"); |
261 | add_mtd_partitions(state->mtd, pdata->parts, ret); | ||
262 | kfree(pdata->parts); | 259 | kfree(pdata->parts); |
263 | |||
264 | } else if (pdata->nr_parts) { | 260 | } else if (pdata->nr_parts) { |
265 | pr_devinit(KERN_NOTICE PFX "Using board partition definition\n"); | 261 | pr_devinit(KERN_NOTICE PFX "Using board partition definition\n"); |
266 | add_mtd_partitions(state->mtd, pdata->parts, pdata->nr_parts); | 262 | nr_parts = pdata->nr_parts; |
267 | 263 | } else { | |
268 | } else | ||
269 | #endif | ||
270 | { | ||
271 | pr_devinit(KERN_NOTICE PFX "no partition info available, registering whole flash at once\n"); | 264 | pr_devinit(KERN_NOTICE PFX "no partition info available, registering whole flash at once\n"); |
272 | add_mtd_device(state->mtd); | 265 | nr_parts = 0; |
273 | } | 266 | } |
274 | 267 | ||
268 | mtd_device_register(state->mtd, pdata->parts, nr_parts); | ||
269 | |||
275 | return 0; | 270 | return 0; |
276 | } | 271 | } |
277 | 272 | ||
@@ -282,9 +277,7 @@ static int __devexit gpio_flash_remove(struct platform_device *pdev) | |||
282 | do { | 277 | do { |
283 | gpio_free(state->gpio_addrs[i]); | 278 | gpio_free(state->gpio_addrs[i]); |
284 | } while (++i < state->gpio_count); | 279 | } while (++i < state->gpio_count); |
285 | #ifdef CONFIG_MTD_PARTITIONS | 280 | mtd_device_unregister(state->mtd); |
286 | del_mtd_partitions(state->mtd); | ||
287 | #endif | ||
288 | map_destroy(state->mtd); | 281 | map_destroy(state->mtd); |
289 | kfree(state); | 282 | kfree(state); |
290 | return 0; | 283 | return 0; |
diff --git a/drivers/mtd/maps/h720x-flash.c b/drivers/mtd/maps/h720x-flash.c index 72c724fa8c27..7f035860a36b 100644 --- a/drivers/mtd/maps/h720x-flash.c +++ b/drivers/mtd/maps/h720x-flash.c | |||
@@ -92,18 +92,16 @@ static int __init h720x_mtd_init(void) | |||
92 | if (mymtd) { | 92 | if (mymtd) { |
93 | mymtd->owner = THIS_MODULE; | 93 | mymtd->owner = THIS_MODULE; |
94 | 94 | ||
95 | #ifdef CONFIG_MTD_PARTITIONS | ||
96 | nr_mtd_parts = parse_mtd_partitions(mymtd, probes, &mtd_parts, 0); | 95 | nr_mtd_parts = parse_mtd_partitions(mymtd, probes, &mtd_parts, 0); |
97 | if (nr_mtd_parts > 0) | 96 | if (nr_mtd_parts > 0) |
98 | part_type = "command line"; | 97 | part_type = "command line"; |
99 | #endif | ||
100 | if (nr_mtd_parts <= 0) { | 98 | if (nr_mtd_parts <= 0) { |
101 | mtd_parts = h720x_partitions; | 99 | mtd_parts = h720x_partitions; |
102 | nr_mtd_parts = NUM_PARTITIONS; | 100 | nr_mtd_parts = NUM_PARTITIONS; |
103 | part_type = "builtin"; | 101 | part_type = "builtin"; |
104 | } | 102 | } |
105 | printk(KERN_INFO "Using %s partition table\n", part_type); | 103 | printk(KERN_INFO "Using %s partition table\n", part_type); |
106 | add_mtd_partitions(mymtd, mtd_parts, nr_mtd_parts); | 104 | mtd_device_register(mymtd, mtd_parts, nr_mtd_parts); |
107 | return 0; | 105 | return 0; |
108 | } | 106 | } |
109 | 107 | ||
@@ -118,7 +116,7 @@ static void __exit h720x_mtd_cleanup(void) | |||
118 | { | 116 | { |
119 | 117 | ||
120 | if (mymtd) { | 118 | if (mymtd) { |
121 | del_mtd_partitions(mymtd); | 119 | mtd_device_unregister(mymtd); |
122 | map_destroy(mymtd); | 120 | map_destroy(mymtd); |
123 | } | 121 | } |
124 | 122 | ||
diff --git a/drivers/mtd/maps/ichxrom.c b/drivers/mtd/maps/ichxrom.c index 1337a4191a0c..6689dcb3124d 100644 --- a/drivers/mtd/maps/ichxrom.c +++ b/drivers/mtd/maps/ichxrom.c | |||
@@ -67,7 +67,7 @@ static void ichxrom_cleanup(struct ichxrom_window *window) | |||
67 | list_for_each_entry_safe(map, scratch, &window->maps, list) { | 67 | list_for_each_entry_safe(map, scratch, &window->maps, list) { |
68 | if (map->rsrc.parent) | 68 | if (map->rsrc.parent) |
69 | release_resource(&map->rsrc); | 69 | release_resource(&map->rsrc); |
70 | del_mtd_device(map->mtd); | 70 | mtd_device_unregister(map->mtd); |
71 | map_destroy(map->mtd); | 71 | map_destroy(map->mtd); |
72 | list_del(&map->list); | 72 | list_del(&map->list); |
73 | kfree(map); | 73 | kfree(map); |
@@ -287,7 +287,7 @@ static int __devinit ichxrom_init_one (struct pci_dev *pdev, | |||
287 | 287 | ||
288 | /* Now that the mtd devices is complete claim and export it */ | 288 | /* Now that the mtd devices is complete claim and export it */ |
289 | map->mtd->owner = THIS_MODULE; | 289 | map->mtd->owner = THIS_MODULE; |
290 | if (add_mtd_device(map->mtd)) { | 290 | if (mtd_device_register(map->mtd, NULL, 0)) { |
291 | map_destroy(map->mtd); | 291 | map_destroy(map->mtd); |
292 | map->mtd = NULL; | 292 | map->mtd = NULL; |
293 | goto out; | 293 | goto out; |
diff --git a/drivers/mtd/maps/impa7.c b/drivers/mtd/maps/impa7.c index 998a27da97f3..404a50cbafa0 100644 --- a/drivers/mtd/maps/impa7.c +++ b/drivers/mtd/maps/impa7.c | |||
@@ -15,10 +15,7 @@ | |||
15 | #include <asm/io.h> | 15 | #include <asm/io.h> |
16 | #include <linux/mtd/mtd.h> | 16 | #include <linux/mtd/mtd.h> |
17 | #include <linux/mtd/map.h> | 17 | #include <linux/mtd/map.h> |
18 | |||
19 | #ifdef CONFIG_MTD_PARTITIONS | ||
20 | #include <linux/mtd/partitions.h> | 18 | #include <linux/mtd/partitions.h> |
21 | #endif | ||
22 | 19 | ||
23 | #define WINDOW_ADDR0 0x00000000 /* physical properties of flash */ | 20 | #define WINDOW_ADDR0 0x00000000 /* physical properties of flash */ |
24 | #define WINDOW_SIZE0 0x00800000 | 21 | #define WINDOW_SIZE0 0x00800000 |
@@ -49,8 +46,6 @@ static struct map_info impa7_map[NUM_FLASHBANKS] = { | |||
49 | }, | 46 | }, |
50 | }; | 47 | }; |
51 | 48 | ||
52 | #ifdef CONFIG_MTD_PARTITIONS | ||
53 | |||
54 | /* | 49 | /* |
55 | * MTD partitioning stuff | 50 | * MTD partitioning stuff |
56 | */ | 51 | */ |
@@ -66,8 +61,6 @@ static struct mtd_partition static_partitions[] = | |||
66 | static int mtd_parts_nb[NUM_FLASHBANKS]; | 61 | static int mtd_parts_nb[NUM_FLASHBANKS]; |
67 | static struct mtd_partition *mtd_parts[NUM_FLASHBANKS]; | 62 | static struct mtd_partition *mtd_parts[NUM_FLASHBANKS]; |
68 | 63 | ||
69 | #endif | ||
70 | |||
71 | static const char *probes[] = { "cmdlinepart", NULL }; | 64 | static const char *probes[] = { "cmdlinepart", NULL }; |
72 | 65 | ||
73 | static int __init init_impa7(void) | 66 | static int __init init_impa7(void) |
@@ -104,7 +97,6 @@ static int __init init_impa7(void) | |||
104 | if (impa7_mtd[i]) { | 97 | if (impa7_mtd[i]) { |
105 | impa7_mtd[i]->owner = THIS_MODULE; | 98 | impa7_mtd[i]->owner = THIS_MODULE; |
106 | devicesfound++; | 99 | devicesfound++; |
107 | #ifdef CONFIG_MTD_PARTITIONS | ||
108 | mtd_parts_nb[i] = parse_mtd_partitions(impa7_mtd[i], | 100 | mtd_parts_nb[i] = parse_mtd_partitions(impa7_mtd[i], |
109 | probes, | 101 | probes, |
110 | &mtd_parts[i], | 102 | &mtd_parts[i], |
@@ -120,12 +112,8 @@ static int __init init_impa7(void) | |||
120 | printk(KERN_NOTICE MSG_PREFIX | 112 | printk(KERN_NOTICE MSG_PREFIX |
121 | "using %s partition definition\n", | 113 | "using %s partition definition\n", |
122 | part_type); | 114 | part_type); |
123 | add_mtd_partitions(impa7_mtd[i], | 115 | mtd_device_register(impa7_mtd[i], |
124 | mtd_parts[i], mtd_parts_nb[i]); | 116 | mtd_parts[i], mtd_parts_nb[i]); |
125 | #else | ||
126 | add_mtd_device(impa7_mtd[i]); | ||
127 | |||
128 | #endif | ||
129 | } | 117 | } |
130 | else | 118 | else |
131 | iounmap((void *)impa7_map[i].virt); | 119 | iounmap((void *)impa7_map[i].virt); |
@@ -138,11 +126,7 @@ static void __exit cleanup_impa7(void) | |||
138 | int i; | 126 | int i; |
139 | for (i=0; i<NUM_FLASHBANKS; i++) { | 127 | for (i=0; i<NUM_FLASHBANKS; i++) { |
140 | if (impa7_mtd[i]) { | 128 | if (impa7_mtd[i]) { |
141 | #ifdef CONFIG_MTD_PARTITIONS | 129 | mtd_device_unregister(impa7_mtd[i]); |
142 | del_mtd_partitions(impa7_mtd[i]); | ||
143 | #else | ||
144 | del_mtd_device(impa7_mtd[i]); | ||
145 | #endif | ||
146 | map_destroy(impa7_mtd[i]); | 130 | map_destroy(impa7_mtd[i]); |
147 | iounmap((void *)impa7_map[i].virt); | 131 | iounmap((void *)impa7_map[i].virt); |
148 | impa7_map[i].virt = 0; | 132 | impa7_map[i].virt = 0; |
diff --git a/drivers/mtd/maps/intel_vr_nor.c b/drivers/mtd/maps/intel_vr_nor.c index fc1998512eb4..d2f47be8754b 100644 --- a/drivers/mtd/maps/intel_vr_nor.c +++ b/drivers/mtd/maps/intel_vr_nor.c | |||
@@ -66,33 +66,18 @@ struct vr_nor_mtd { | |||
66 | 66 | ||
67 | static void __devexit vr_nor_destroy_partitions(struct vr_nor_mtd *p) | 67 | static void __devexit vr_nor_destroy_partitions(struct vr_nor_mtd *p) |
68 | { | 68 | { |
69 | if (p->nr_parts > 0) { | 69 | mtd_device_unregister(p->info); |
70 | #if defined(CONFIG_MTD_PARTITIONS) || defined(CONFIG_MTD_PARTITIONS_MODULE) | ||
71 | del_mtd_partitions(p->info); | ||
72 | #endif | ||
73 | } else | ||
74 | del_mtd_device(p->info); | ||
75 | } | 70 | } |
76 | 71 | ||
77 | static int __devinit vr_nor_init_partitions(struct vr_nor_mtd *p) | 72 | static int __devinit vr_nor_init_partitions(struct vr_nor_mtd *p) |
78 | { | 73 | { |
79 | int err = 0; | ||
80 | #if defined(CONFIG_MTD_PARTITIONS) || defined(CONFIG_MTD_PARTITIONS_MODULE) | ||
81 | struct mtd_partition *parts; | 74 | struct mtd_partition *parts; |
82 | static const char *part_probes[] = { "cmdlinepart", NULL }; | 75 | static const char *part_probes[] = { "cmdlinepart", NULL }; |
83 | #endif | ||
84 | 76 | ||
85 | /* register the flash bank */ | 77 | /* register the flash bank */ |
86 | #if defined(CONFIG_MTD_PARTITIONS) || defined(CONFIG_MTD_PARTITIONS_MODULE) | ||
87 | /* partition the flash bank */ | 78 | /* partition the flash bank */ |
88 | p->nr_parts = parse_mtd_partitions(p->info, part_probes, &parts, 0); | 79 | p->nr_parts = parse_mtd_partitions(p->info, part_probes, &parts, 0); |
89 | if (p->nr_parts > 0) | 80 | return mtd_device_register(p->info, parts, p->nr_parts); |
90 | err = add_mtd_partitions(p->info, parts, p->nr_parts); | ||
91 | #endif | ||
92 | if (p->nr_parts <= 0) | ||
93 | err = add_mtd_device(p->info); | ||
94 | |||
95 | return err; | ||
96 | } | 81 | } |
97 | 82 | ||
98 | static void __devexit vr_nor_destroy_mtd_setup(struct vr_nor_mtd *p) | 83 | static void __devexit vr_nor_destroy_mtd_setup(struct vr_nor_mtd *p) |
diff --git a/drivers/mtd/maps/ixp2000.c b/drivers/mtd/maps/ixp2000.c index 9639d83a9d6c..c00b9175ba9e 100644 --- a/drivers/mtd/maps/ixp2000.c +++ b/drivers/mtd/maps/ixp2000.c | |||
@@ -119,7 +119,7 @@ static int ixp2000_flash_remove(struct platform_device *dev) | |||
119 | return 0; | 119 | return 0; |
120 | 120 | ||
121 | if (info->mtd) { | 121 | if (info->mtd) { |
122 | del_mtd_partitions(info->mtd); | 122 | mtd_device_unregister(info->mtd); |
123 | map_destroy(info->mtd); | 123 | map_destroy(info->mtd); |
124 | } | 124 | } |
125 | if (info->map.map_priv_1) | 125 | if (info->map.map_priv_1) |
@@ -230,7 +230,7 @@ static int ixp2000_flash_probe(struct platform_device *dev) | |||
230 | 230 | ||
231 | err = parse_mtd_partitions(info->mtd, probes, &info->partitions, 0); | 231 | err = parse_mtd_partitions(info->mtd, probes, &info->partitions, 0); |
232 | if (err > 0) { | 232 | if (err > 0) { |
233 | err = add_mtd_partitions(info->mtd, info->partitions, err); | 233 | err = mtd_device_register(info->mtd, info->partitions, err); |
234 | if(err) | 234 | if(err) |
235 | dev_err(&dev->dev, "Could not parse partitions\n"); | 235 | dev_err(&dev->dev, "Could not parse partitions\n"); |
236 | } | 236 | } |
diff --git a/drivers/mtd/maps/ixp4xx.c b/drivers/mtd/maps/ixp4xx.c index 1f9fde0dad35..155b21942f47 100644 --- a/drivers/mtd/maps/ixp4xx.c +++ b/drivers/mtd/maps/ixp4xx.c | |||
@@ -162,7 +162,7 @@ static int ixp4xx_flash_remove(struct platform_device *dev) | |||
162 | return 0; | 162 | return 0; |
163 | 163 | ||
164 | if (info->mtd) { | 164 | if (info->mtd) { |
165 | del_mtd_partitions(info->mtd); | 165 | mtd_device_unregister(info->mtd); |
166 | map_destroy(info->mtd); | 166 | map_destroy(info->mtd); |
167 | } | 167 | } |
168 | if (info->map.virt) | 168 | if (info->map.virt) |
@@ -252,10 +252,8 @@ static int ixp4xx_flash_probe(struct platform_device *dev) | |||
252 | /* Use the fast version */ | 252 | /* Use the fast version */ |
253 | info->map.write = ixp4xx_write16; | 253 | info->map.write = ixp4xx_write16; |
254 | 254 | ||
255 | #ifdef CONFIG_MTD_PARTITIONS | ||
256 | nr_parts = parse_mtd_partitions(info->mtd, probes, &info->partitions, | 255 | nr_parts = parse_mtd_partitions(info->mtd, probes, &info->partitions, |
257 | dev->resource->start); | 256 | dev->resource->start); |
258 | #endif | ||
259 | if (nr_parts > 0) { | 257 | if (nr_parts > 0) { |
260 | part_type = "dynamic"; | 258 | part_type = "dynamic"; |
261 | } else { | 259 | } else { |
@@ -263,18 +261,16 @@ static int ixp4xx_flash_probe(struct platform_device *dev) | |||
263 | nr_parts = plat->nr_parts; | 261 | nr_parts = plat->nr_parts; |
264 | part_type = "static"; | 262 | part_type = "static"; |
265 | } | 263 | } |
266 | if (nr_parts == 0) { | 264 | if (nr_parts == 0) |
267 | printk(KERN_NOTICE "IXP4xx flash: no partition info " | 265 | printk(KERN_NOTICE "IXP4xx flash: no partition info " |
268 | "available, registering whole flash\n"); | 266 | "available, registering whole flash\n"); |
269 | err = add_mtd_device(info->mtd); | 267 | else |
270 | } else { | ||
271 | printk(KERN_NOTICE "IXP4xx flash: using %s partition " | 268 | printk(KERN_NOTICE "IXP4xx flash: using %s partition " |
272 | "definition\n", part_type); | 269 | "definition\n", part_type); |
273 | err = add_mtd_partitions(info->mtd, info->partitions, nr_parts); | ||
274 | 270 | ||
275 | if(err) | 271 | err = mtd_device_register(info->mtd, info->partitions, nr_parts); |
276 | printk(KERN_ERR "Could not parse partitions\n"); | 272 | if (err) |
277 | } | 273 | printk(KERN_ERR "Could not parse partitions\n"); |
278 | 274 | ||
279 | if (err) | 275 | if (err) |
280 | goto Error; | 276 | goto Error; |
diff --git a/drivers/mtd/maps/l440gx.c b/drivers/mtd/maps/l440gx.c index 9e054503c4cf..dd0360ba2412 100644 --- a/drivers/mtd/maps/l440gx.c +++ b/drivers/mtd/maps/l440gx.c | |||
@@ -138,7 +138,7 @@ static int __init init_l440gx(void) | |||
138 | if (mymtd) { | 138 | if (mymtd) { |
139 | mymtd->owner = THIS_MODULE; | 139 | mymtd->owner = THIS_MODULE; |
140 | 140 | ||
141 | add_mtd_device(mymtd); | 141 | mtd_device_register(mymtd, NULL, 0); |
142 | return 0; | 142 | return 0; |
143 | } | 143 | } |
144 | 144 | ||
@@ -148,7 +148,7 @@ static int __init init_l440gx(void) | |||
148 | 148 | ||
149 | static void __exit cleanup_l440gx(void) | 149 | static void __exit cleanup_l440gx(void) |
150 | { | 150 | { |
151 | del_mtd_device(mymtd); | 151 | mtd_device_unregister(mymtd); |
152 | map_destroy(mymtd); | 152 | map_destroy(mymtd); |
153 | 153 | ||
154 | iounmap(l440gx_map.virt); | 154 | iounmap(l440gx_map.virt); |
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: |
diff --git a/drivers/mtd/maps/mbx860.c b/drivers/mtd/maps/mbx860.c index 0eb5a7c85380..93fa56c33003 100644 --- a/drivers/mtd/maps/mbx860.c +++ b/drivers/mtd/maps/mbx860.c | |||
@@ -69,8 +69,8 @@ static int __init init_mbx(void) | |||
69 | mymtd = do_map_probe("jedec_probe", &mbx_map); | 69 | mymtd = do_map_probe("jedec_probe", &mbx_map); |
70 | if (mymtd) { | 70 | if (mymtd) { |
71 | mymtd->owner = THIS_MODULE; | 71 | mymtd->owner = THIS_MODULE; |
72 | add_mtd_device(mymtd); | 72 | mtd_device_register(mymtd, NULL, 0); |
73 | add_mtd_partitions(mymtd, partition_info, NUM_PARTITIONS); | 73 | mtd_device_register(mymtd, partition_info, NUM_PARTITIONS); |
74 | return 0; | 74 | return 0; |
75 | } | 75 | } |
76 | 76 | ||
@@ -81,7 +81,7 @@ static int __init init_mbx(void) | |||
81 | static void __exit cleanup_mbx(void) | 81 | static void __exit cleanup_mbx(void) |
82 | { | 82 | { |
83 | if (mymtd) { | 83 | if (mymtd) { |
84 | del_mtd_device(mymtd); | 84 | mtd_device_unregister(mymtd); |
85 | map_destroy(mymtd); | 85 | map_destroy(mymtd); |
86 | } | 86 | } |
87 | if (mbx_map.virt) { | 87 | if (mbx_map.virt) { |
diff --git a/drivers/mtd/maps/netsc520.c b/drivers/mtd/maps/netsc520.c index c0cb319b2b70..81dc2598bc0a 100644 --- a/drivers/mtd/maps/netsc520.c +++ b/drivers/mtd/maps/netsc520.c | |||
@@ -116,14 +116,14 @@ static int __init init_netsc520(void) | |||
116 | } | 116 | } |
117 | 117 | ||
118 | mymtd->owner = THIS_MODULE; | 118 | mymtd->owner = THIS_MODULE; |
119 | add_mtd_partitions( mymtd, partition_info, NUM_PARTITIONS ); | 119 | mtd_device_register(mymtd, partition_info, NUM_PARTITIONS); |
120 | return 0; | 120 | return 0; |
121 | } | 121 | } |
122 | 122 | ||
123 | static void __exit cleanup_netsc520(void) | 123 | static void __exit cleanup_netsc520(void) |
124 | { | 124 | { |
125 | if (mymtd) { | 125 | if (mymtd) { |
126 | del_mtd_partitions(mymtd); | 126 | mtd_device_unregister(mymtd); |
127 | map_destroy(mymtd); | 127 | map_destroy(mymtd); |
128 | } | 128 | } |
129 | if (netsc520_map.virt) { | 129 | if (netsc520_map.virt) { |
diff --git a/drivers/mtd/maps/nettel.c b/drivers/mtd/maps/nettel.c index a97133eb9d70..eadcfffc4f9c 100644 --- a/drivers/mtd/maps/nettel.c +++ b/drivers/mtd/maps/nettel.c | |||
@@ -383,13 +383,13 @@ static int __init nettel_init(void) | |||
383 | /* No BIOS regions when AMD boot */ | 383 | /* No BIOS regions when AMD boot */ |
384 | num_intel_partitions -= 2; | 384 | num_intel_partitions -= 2; |
385 | } | 385 | } |
386 | rc = add_mtd_partitions(intel_mtd, nettel_intel_partitions, | 386 | rc = mtd_device_register(intel_mtd, nettel_intel_partitions, |
387 | num_intel_partitions); | 387 | num_intel_partitions); |
388 | #endif | 388 | #endif |
389 | 389 | ||
390 | if (amd_mtd) { | 390 | if (amd_mtd) { |
391 | rc = add_mtd_partitions(amd_mtd, nettel_amd_partitions, | 391 | rc = mtd_device_register(amd_mtd, nettel_amd_partitions, |
392 | num_amd_partitions); | 392 | num_amd_partitions); |
393 | } | 393 | } |
394 | 394 | ||
395 | #ifdef CONFIG_MTD_CFI_INTELEXT | 395 | #ifdef CONFIG_MTD_CFI_INTELEXT |
@@ -419,7 +419,7 @@ static void __exit nettel_cleanup(void) | |||
419 | unregister_reboot_notifier(&nettel_notifier_block); | 419 | unregister_reboot_notifier(&nettel_notifier_block); |
420 | #endif | 420 | #endif |
421 | if (amd_mtd) { | 421 | if (amd_mtd) { |
422 | del_mtd_partitions(amd_mtd); | 422 | mtd_device_unregister(amd_mtd); |
423 | map_destroy(amd_mtd); | 423 | map_destroy(amd_mtd); |
424 | } | 424 | } |
425 | if (nettel_mmcrp) { | 425 | if (nettel_mmcrp) { |
@@ -432,7 +432,7 @@ static void __exit nettel_cleanup(void) | |||
432 | } | 432 | } |
433 | #ifdef CONFIG_MTD_CFI_INTELEXT | 433 | #ifdef CONFIG_MTD_CFI_INTELEXT |
434 | if (intel_mtd) { | 434 | if (intel_mtd) { |
435 | del_mtd_partitions(intel_mtd); | 435 | mtd_device_unregister(intel_mtd); |
436 | map_destroy(intel_mtd); | 436 | map_destroy(intel_mtd); |
437 | } | 437 | } |
438 | if (nettel_intel_map.virt) { | 438 | if (nettel_intel_map.virt) { |
diff --git a/drivers/mtd/maps/octagon-5066.c b/drivers/mtd/maps/octagon-5066.c index 23fe1786770f..807ac2a2e686 100644 --- a/drivers/mtd/maps/octagon-5066.c +++ b/drivers/mtd/maps/octagon-5066.c | |||
@@ -175,7 +175,7 @@ void cleanup_oct5066(void) | |||
175 | int i; | 175 | int i; |
176 | for (i=0; i<2; i++) { | 176 | for (i=0; i<2; i++) { |
177 | if (oct5066_mtd[i]) { | 177 | if (oct5066_mtd[i]) { |
178 | del_mtd_device(oct5066_mtd[i]); | 178 | mtd_device_unregister(oct5066_mtd[i]); |
179 | map_destroy(oct5066_mtd[i]); | 179 | map_destroy(oct5066_mtd[i]); |
180 | } | 180 | } |
181 | } | 181 | } |
@@ -220,7 +220,7 @@ static int __init init_oct5066(void) | |||
220 | oct5066_mtd[i] = do_map_probe("map_rom", &oct5066_map[i]); | 220 | oct5066_mtd[i] = do_map_probe("map_rom", &oct5066_map[i]); |
221 | if (oct5066_mtd[i]) { | 221 | if (oct5066_mtd[i]) { |
222 | oct5066_mtd[i]->owner = THIS_MODULE; | 222 | oct5066_mtd[i]->owner = THIS_MODULE; |
223 | add_mtd_device(oct5066_mtd[i]); | 223 | mtd_device_register(oct5066_mtd[i], NULL, 0); |
224 | } | 224 | } |
225 | } | 225 | } |
226 | 226 | ||
diff --git a/drivers/mtd/maps/pci.c b/drivers/mtd/maps/pci.c index 48f4cf5cb9d1..1d005a3e9b41 100644 --- a/drivers/mtd/maps/pci.c +++ b/drivers/mtd/maps/pci.c | |||
@@ -313,7 +313,7 @@ mtd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
313 | goto release; | 313 | goto release; |
314 | 314 | ||
315 | mtd->owner = THIS_MODULE; | 315 | mtd->owner = THIS_MODULE; |
316 | add_mtd_device(mtd); | 316 | mtd_device_register(mtd, NULL, 0); |
317 | 317 | ||
318 | pci_set_drvdata(dev, mtd); | 318 | pci_set_drvdata(dev, mtd); |
319 | 319 | ||
@@ -336,7 +336,7 @@ mtd_pci_remove(struct pci_dev *dev) | |||
336 | struct mtd_info *mtd = pci_get_drvdata(dev); | 336 | struct mtd_info *mtd = pci_get_drvdata(dev); |
337 | struct map_pci_info *map = mtd->priv; | 337 | struct map_pci_info *map = mtd->priv; |
338 | 338 | ||
339 | del_mtd_device(mtd); | 339 | mtd_device_unregister(mtd); |
340 | map_destroy(mtd); | 340 | map_destroy(mtd); |
341 | map->exit(dev, map); | 341 | map->exit(dev, map); |
342 | kfree(map); | 342 | kfree(map); |
diff --git a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c index 33dc2829b01b..bbe168b65c26 100644 --- a/drivers/mtd/maps/pcmciamtd.c +++ b/drivers/mtd/maps/pcmciamtd.c | |||
@@ -630,7 +630,7 @@ static int pcmciamtd_config(struct pcmcia_device *link) | |||
630 | dev->pcmcia_map.copy_to = pcmcia_copy_to; | 630 | dev->pcmcia_map.copy_to = pcmcia_copy_to; |
631 | } | 631 | } |
632 | 632 | ||
633 | if(add_mtd_device(mtd)) { | 633 | if (mtd_device_register(mtd, NULL, 0)) { |
634 | map_destroy(mtd); | 634 | map_destroy(mtd); |
635 | dev->mtd_info = NULL; | 635 | dev->mtd_info = NULL; |
636 | dev_err(&dev->p_dev->dev, | 636 | dev_err(&dev->p_dev->dev, |
@@ -669,7 +669,7 @@ static void pcmciamtd_detach(struct pcmcia_device *link) | |||
669 | DEBUG(3, "link=0x%p", link); | 669 | DEBUG(3, "link=0x%p", link); |
670 | 670 | ||
671 | if(dev->mtd_info) { | 671 | if(dev->mtd_info) { |
672 | del_mtd_device(dev->mtd_info); | 672 | mtd_device_unregister(dev->mtd_info); |
673 | dev_info(&dev->p_dev->dev, "mtd%d: Removing\n", | 673 | dev_info(&dev->p_dev->dev, "mtd%d: Removing\n", |
674 | dev->mtd_info->index); | 674 | dev->mtd_info->index); |
675 | map_destroy(dev->mtd_info); | 675 | map_destroy(dev->mtd_info); |
diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c index 1a9b94f0ee54..f64cee4a3bfb 100644 --- a/drivers/mtd/maps/physmap.c +++ b/drivers/mtd/maps/physmap.c | |||
@@ -27,10 +27,8 @@ struct physmap_flash_info { | |||
27 | struct mtd_info *mtd[MAX_RESOURCES]; | 27 | struct mtd_info *mtd[MAX_RESOURCES]; |
28 | struct mtd_info *cmtd; | 28 | struct mtd_info *cmtd; |
29 | struct map_info map[MAX_RESOURCES]; | 29 | struct map_info map[MAX_RESOURCES]; |
30 | #ifdef CONFIG_MTD_PARTITIONS | ||
31 | int nr_parts; | 30 | int nr_parts; |
32 | struct mtd_partition *parts; | 31 | struct mtd_partition *parts; |
33 | #endif | ||
34 | }; | 32 | }; |
35 | 33 | ||
36 | static int physmap_flash_remove(struct platform_device *dev) | 34 | static int physmap_flash_remove(struct platform_device *dev) |
@@ -47,18 +45,9 @@ static int physmap_flash_remove(struct platform_device *dev) | |||
47 | physmap_data = dev->dev.platform_data; | 45 | physmap_data = dev->dev.platform_data; |
48 | 46 | ||
49 | if (info->cmtd) { | 47 | if (info->cmtd) { |
50 | #ifdef CONFIG_MTD_PARTITIONS | 48 | mtd_device_unregister(info->cmtd); |
51 | if (info->nr_parts || physmap_data->nr_parts) { | 49 | if (info->nr_parts) |
52 | del_mtd_partitions(info->cmtd); | 50 | kfree(info->parts); |
53 | |||
54 | if (info->nr_parts) | ||
55 | kfree(info->parts); | ||
56 | } else { | ||
57 | del_mtd_device(info->cmtd); | ||
58 | } | ||
59 | #else | ||
60 | del_mtd_device(info->cmtd); | ||
61 | #endif | ||
62 | if (info->cmtd != info->mtd[0]) | 51 | if (info->cmtd != info->mtd[0]) |
63 | mtd_concat_destroy(info->cmtd); | 52 | mtd_concat_destroy(info->cmtd); |
64 | } | 53 | } |
@@ -92,10 +81,8 @@ static const char *rom_probe_types[] = { | |||
92 | "qinfo_probe", | 81 | "qinfo_probe", |
93 | "map_rom", | 82 | "map_rom", |
94 | NULL }; | 83 | NULL }; |
95 | #ifdef CONFIG_MTD_PARTITIONS | ||
96 | static const char *part_probe_types[] = { "cmdlinepart", "RedBoot", "afs", | 84 | static const char *part_probe_types[] = { "cmdlinepart", "RedBoot", "afs", |
97 | NULL }; | 85 | NULL }; |
98 | #endif | ||
99 | 86 | ||
100 | static int physmap_flash_probe(struct platform_device *dev) | 87 | static int physmap_flash_probe(struct platform_device *dev) |
101 | { | 88 | { |
@@ -188,24 +175,23 @@ static int physmap_flash_probe(struct platform_device *dev) | |||
188 | if (err) | 175 | if (err) |
189 | goto err_out; | 176 | goto err_out; |
190 | 177 | ||
191 | #ifdef CONFIG_MTD_PARTITIONS | ||
192 | err = parse_mtd_partitions(info->cmtd, part_probe_types, | 178 | err = parse_mtd_partitions(info->cmtd, part_probe_types, |
193 | &info->parts, 0); | 179 | &info->parts, 0); |
194 | if (err > 0) { | 180 | if (err > 0) { |
195 | add_mtd_partitions(info->cmtd, info->parts, err); | 181 | mtd_device_register(info->cmtd, info->parts, err); |
196 | info->nr_parts = err; | 182 | info->nr_parts = err; |
197 | return 0; | 183 | return 0; |
198 | } | 184 | } |
199 | 185 | ||
200 | if (physmap_data->nr_parts) { | 186 | if (physmap_data->nr_parts) { |
201 | printk(KERN_NOTICE "Using physmap partition information\n"); | 187 | printk(KERN_NOTICE "Using physmap partition information\n"); |
202 | add_mtd_partitions(info->cmtd, physmap_data->parts, | 188 | mtd_device_register(info->cmtd, physmap_data->parts, |
203 | physmap_data->nr_parts); | 189 | physmap_data->nr_parts); |
204 | return 0; | 190 | return 0; |
205 | } | 191 | } |
206 | #endif | ||
207 | 192 | ||
208 | add_mtd_device(info->cmtd); | 193 | mtd_device_register(info->cmtd, NULL, 0); |
194 | |||
209 | return 0; | 195 | return 0; |
210 | 196 | ||
211 | err_out: | 197 | err_out: |
@@ -269,14 +255,12 @@ void physmap_configure(unsigned long addr, unsigned long size, | |||
269 | physmap_flash_data.set_vpp = set_vpp; | 255 | physmap_flash_data.set_vpp = set_vpp; |
270 | } | 256 | } |
271 | 257 | ||
272 | #ifdef CONFIG_MTD_PARTITIONS | ||
273 | void physmap_set_partitions(struct mtd_partition *parts, int num_parts) | 258 | void physmap_set_partitions(struct mtd_partition *parts, int num_parts) |
274 | { | 259 | { |
275 | physmap_flash_data.nr_parts = num_parts; | 260 | physmap_flash_data.nr_parts = num_parts; |
276 | physmap_flash_data.parts = parts; | 261 | physmap_flash_data.parts = parts; |
277 | } | 262 | } |
278 | #endif | 263 | #endif |
279 | #endif | ||
280 | 264 | ||
281 | static int __init physmap_init(void) | 265 | static int __init physmap_init(void) |
282 | { | 266 | { |
diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c index c1d33464aee8..d251d1db129b 100644 --- a/drivers/mtd/maps/physmap_of.c +++ b/drivers/mtd/maps/physmap_of.c | |||
@@ -34,16 +34,12 @@ struct of_flash_list { | |||
34 | 34 | ||
35 | struct of_flash { | 35 | struct of_flash { |
36 | struct mtd_info *cmtd; | 36 | struct mtd_info *cmtd; |
37 | #ifdef CONFIG_MTD_PARTITIONS | ||
38 | struct mtd_partition *parts; | 37 | struct mtd_partition *parts; |
39 | #endif | ||
40 | int list_size; /* number of elements in of_flash_list */ | 38 | int list_size; /* number of elements in of_flash_list */ |
41 | struct of_flash_list list[0]; | 39 | struct of_flash_list list[0]; |
42 | }; | 40 | }; |
43 | 41 | ||
44 | #ifdef CONFIG_MTD_PARTITIONS | ||
45 | #define OF_FLASH_PARTS(info) ((info)->parts) | 42 | #define OF_FLASH_PARTS(info) ((info)->parts) |
46 | |||
47 | static int parse_obsolete_partitions(struct platform_device *dev, | 43 | static int parse_obsolete_partitions(struct platform_device *dev, |
48 | struct of_flash *info, | 44 | struct of_flash *info, |
49 | struct device_node *dp) | 45 | struct device_node *dp) |
@@ -89,10 +85,6 @@ static int parse_obsolete_partitions(struct platform_device *dev, | |||
89 | 85 | ||
90 | return nr_parts; | 86 | return nr_parts; |
91 | } | 87 | } |
92 | #else /* MTD_PARTITIONS */ | ||
93 | #define OF_FLASH_PARTS(info) (0) | ||
94 | #define parse_partitions(info, dev) (0) | ||
95 | #endif /* MTD_PARTITIONS */ | ||
96 | 88 | ||
97 | static int of_flash_remove(struct platform_device *dev) | 89 | static int of_flash_remove(struct platform_device *dev) |
98 | { | 90 | { |
@@ -105,17 +97,14 @@ static int of_flash_remove(struct platform_device *dev) | |||
105 | dev_set_drvdata(&dev->dev, NULL); | 97 | dev_set_drvdata(&dev->dev, NULL); |
106 | 98 | ||
107 | if (info->cmtd != info->list[0].mtd) { | 99 | if (info->cmtd != info->list[0].mtd) { |
108 | del_mtd_device(info->cmtd); | 100 | mtd_device_unregister(info->cmtd); |
109 | mtd_concat_destroy(info->cmtd); | 101 | mtd_concat_destroy(info->cmtd); |
110 | } | 102 | } |
111 | 103 | ||
112 | if (info->cmtd) { | 104 | if (info->cmtd) { |
113 | if (OF_FLASH_PARTS(info)) { | 105 | if (OF_FLASH_PARTS(info)) |
114 | del_mtd_partitions(info->cmtd); | ||
115 | kfree(OF_FLASH_PARTS(info)); | 106 | kfree(OF_FLASH_PARTS(info)); |
116 | } else { | 107 | mtd_device_unregister(info->cmtd); |
117 | del_mtd_device(info->cmtd); | ||
118 | } | ||
119 | } | 108 | } |
120 | 109 | ||
121 | for (i = 0; i < info->list_size; i++) { | 110 | for (i = 0; i < info->list_size; i++) { |
@@ -172,7 +161,6 @@ static struct mtd_info * __devinit obsolete_probe(struct platform_device *dev, | |||
172 | } | 161 | } |
173 | } | 162 | } |
174 | 163 | ||
175 | #ifdef CONFIG_MTD_PARTITIONS | ||
176 | /* When partitions are set we look for a linux,part-probe property which | 164 | /* When partitions are set we look for a linux,part-probe property which |
177 | specifies the list of partition probers to use. If none is given then the | 165 | specifies the list of partition probers to use. If none is given then the |
178 | default is use. These take precedence over other device tree | 166 | default is use. These take precedence over other device tree |
@@ -212,14 +200,11 @@ static void __devinit of_free_probes(const char **probes) | |||
212 | if (probes != part_probe_types_def) | 200 | if (probes != part_probe_types_def) |
213 | kfree(probes); | 201 | kfree(probes); |
214 | } | 202 | } |
215 | #endif | ||
216 | 203 | ||
217 | static struct of_device_id of_flash_match[]; | 204 | static struct of_device_id of_flash_match[]; |
218 | static int __devinit of_flash_probe(struct platform_device *dev) | 205 | static int __devinit of_flash_probe(struct platform_device *dev) |
219 | { | 206 | { |
220 | #ifdef CONFIG_MTD_PARTITIONS | ||
221 | const char **part_probe_types; | 207 | const char **part_probe_types; |
222 | #endif | ||
223 | const struct of_device_id *match; | 208 | const struct of_device_id *match; |
224 | struct device_node *dp = dev->dev.of_node; | 209 | struct device_node *dp = dev->dev.of_node; |
225 | struct resource res; | 210 | struct resource res; |
@@ -346,7 +331,6 @@ static int __devinit of_flash_probe(struct platform_device *dev) | |||
346 | if (err) | 331 | if (err) |
347 | goto err_out; | 332 | goto err_out; |
348 | 333 | ||
349 | #ifdef CONFIG_MTD_PARTITIONS | ||
350 | part_probe_types = of_get_probes(dp); | 334 | part_probe_types = of_get_probes(dp); |
351 | err = parse_mtd_partitions(info->cmtd, part_probe_types, | 335 | err = parse_mtd_partitions(info->cmtd, part_probe_types, |
352 | &info->parts, 0); | 336 | &info->parts, 0); |
@@ -356,13 +340,11 @@ static int __devinit of_flash_probe(struct platform_device *dev) | |||
356 | } | 340 | } |
357 | of_free_probes(part_probe_types); | 341 | of_free_probes(part_probe_types); |
358 | 342 | ||
359 | #ifdef CONFIG_MTD_OF_PARTS | ||
360 | if (err == 0) { | 343 | if (err == 0) { |
361 | err = of_mtd_parse_partitions(&dev->dev, dp, &info->parts); | 344 | err = of_mtd_parse_partitions(&dev->dev, dp, &info->parts); |
362 | if (err < 0) | 345 | if (err < 0) |
363 | goto err_out; | 346 | goto err_out; |
364 | } | 347 | } |
365 | #endif | ||
366 | 348 | ||
367 | if (err == 0) { | 349 | if (err == 0) { |
368 | err = parse_obsolete_partitions(dev, info, dp); | 350 | err = parse_obsolete_partitions(dev, info, dp); |
@@ -370,11 +352,7 @@ static int __devinit of_flash_probe(struct platform_device *dev) | |||
370 | goto err_out; | 352 | goto err_out; |
371 | } | 353 | } |
372 | 354 | ||
373 | if (err > 0) | 355 | mtd_device_register(info->cmtd, info->parts, err); |
374 | add_mtd_partitions(info->cmtd, info->parts, err); | ||
375 | else | ||
376 | #endif | ||
377 | add_mtd_device(info->cmtd); | ||
378 | 356 | ||
379 | kfree(mtd_list); | 357 | kfree(mtd_list); |
380 | 358 | ||
diff --git a/drivers/mtd/maps/plat-ram.c b/drivers/mtd/maps/plat-ram.c index 76a76be5a7bd..9ca1eccba4bc 100644 --- a/drivers/mtd/maps/plat-ram.c +++ b/drivers/mtd/maps/plat-ram.c | |||
@@ -94,14 +94,11 @@ static int platram_remove(struct platform_device *pdev) | |||
94 | return 0; | 94 | return 0; |
95 | 95 | ||
96 | if (info->mtd) { | 96 | if (info->mtd) { |
97 | #ifdef CONFIG_MTD_PARTITIONS | 97 | mtd_device_unregister(info->mtd); |
98 | if (info->partitions) { | 98 | if (info->partitions) { |
99 | del_mtd_partitions(info->mtd); | ||
100 | if (info->free_partitions) | 99 | if (info->free_partitions) |
101 | kfree(info->partitions); | 100 | kfree(info->partitions); |
102 | } | 101 | } |
103 | #endif | ||
104 | del_mtd_device(info->mtd); | ||
105 | map_destroy(info->mtd); | 102 | map_destroy(info->mtd); |
106 | } | 103 | } |
107 | 104 | ||
@@ -231,7 +228,6 @@ static int platram_probe(struct platform_device *pdev) | |||
231 | /* check to see if there are any available partitions, or wether | 228 | /* check to see if there are any available partitions, or wether |
232 | * to add this device whole */ | 229 | * to add this device whole */ |
233 | 230 | ||
234 | #ifdef CONFIG_MTD_PARTITIONS | ||
235 | if (!pdata->nr_partitions) { | 231 | if (!pdata->nr_partitions) { |
236 | /* try to probe using the supplied probe type */ | 232 | /* try to probe using the supplied probe type */ |
237 | if (pdata->probes) { | 233 | if (pdata->probes) { |
@@ -239,24 +235,22 @@ static int platram_probe(struct platform_device *pdev) | |||
239 | &info->partitions, 0); | 235 | &info->partitions, 0); |
240 | info->free_partitions = 1; | 236 | info->free_partitions = 1; |
241 | if (err > 0) | 237 | if (err > 0) |
242 | err = add_mtd_partitions(info->mtd, | 238 | err = mtd_device_register(info->mtd, |
243 | info->partitions, err); | 239 | info->partitions, err); |
244 | } | 240 | } |
245 | } | 241 | } |
246 | /* use the static mapping */ | 242 | /* use the static mapping */ |
247 | else | 243 | else |
248 | err = add_mtd_partitions(info->mtd, pdata->partitions, | 244 | err = mtd_device_register(info->mtd, pdata->partitions, |
249 | pdata->nr_partitions); | 245 | pdata->nr_partitions); |
250 | #endif /* CONFIG_MTD_PARTITIONS */ | ||
251 | |||
252 | if (add_mtd_device(info->mtd)) { | ||
253 | dev_err(&pdev->dev, "add_mtd_device() failed\n"); | ||
254 | err = -ENOMEM; | ||
255 | } | ||
256 | |||
257 | if (!err) | 246 | if (!err) |
258 | dev_info(&pdev->dev, "registered mtd device\n"); | 247 | dev_info(&pdev->dev, "registered mtd device\n"); |
259 | 248 | ||
249 | /* add the whole device. */ | ||
250 | err = mtd_device_register(info->mtd, NULL, 0); | ||
251 | if (err) | ||
252 | dev_err(&pdev->dev, "failed to register the entire device\n"); | ||
253 | |||
260 | return err; | 254 | return err; |
261 | 255 | ||
262 | exit_free: | 256 | exit_free: |
diff --git a/drivers/mtd/maps/pmcmsp-flash.c b/drivers/mtd/maps/pmcmsp-flash.c index 64aea6acd48e..744ca5cacc9b 100644 --- a/drivers/mtd/maps/pmcmsp-flash.c +++ b/drivers/mtd/maps/pmcmsp-flash.c | |||
@@ -173,7 +173,7 @@ static int __init init_msp_flash(void) | |||
173 | msp_flash[i] = do_map_probe("cfi_probe", &msp_maps[i]); | 173 | msp_flash[i] = do_map_probe("cfi_probe", &msp_maps[i]); |
174 | if (msp_flash[i]) { | 174 | if (msp_flash[i]) { |
175 | msp_flash[i]->owner = THIS_MODULE; | 175 | msp_flash[i]->owner = THIS_MODULE; |
176 | add_mtd_partitions(msp_flash[i], msp_parts[i], pcnt); | 176 | mtd_device_register(msp_flash[i], msp_parts[i], pcnt); |
177 | } else { | 177 | } else { |
178 | printk(KERN_ERR "map probe failed for flash\n"); | 178 | printk(KERN_ERR "map probe failed for flash\n"); |
179 | ret = -ENXIO; | 179 | ret = -ENXIO; |
@@ -188,7 +188,7 @@ static int __init init_msp_flash(void) | |||
188 | 188 | ||
189 | cleanup_loop: | 189 | cleanup_loop: |
190 | while (i--) { | 190 | while (i--) { |
191 | del_mtd_partitions(msp_flash[i]); | 191 | mtd_device_unregister(msp_flash[i]); |
192 | map_destroy(msp_flash[i]); | 192 | map_destroy(msp_flash[i]); |
193 | kfree(msp_maps[i].name); | 193 | kfree(msp_maps[i].name); |
194 | iounmap(msp_maps[i].virt); | 194 | iounmap(msp_maps[i].virt); |
@@ -207,7 +207,7 @@ static void __exit cleanup_msp_flash(void) | |||
207 | int i; | 207 | int i; |
208 | 208 | ||
209 | for (i = 0; i < fcnt; i++) { | 209 | for (i = 0; i < fcnt; i++) { |
210 | del_mtd_partitions(msp_flash[i]); | 210 | mtd_device_unregister(msp_flash[i]); |
211 | map_destroy(msp_flash[i]); | 211 | map_destroy(msp_flash[i]); |
212 | iounmap((void *)msp_maps[i].virt); | 212 | iounmap((void *)msp_maps[i].virt); |
213 | 213 | ||
diff --git a/drivers/mtd/maps/pxa2xx-flash.c b/drivers/mtd/maps/pxa2xx-flash.c index d8ae634d347e..f59d62f74d44 100644 --- a/drivers/mtd/maps/pxa2xx-flash.c +++ b/drivers/mtd/maps/pxa2xx-flash.c | |||
@@ -104,23 +104,18 @@ static int __devinit pxa2xx_flash_probe(struct platform_device *pdev) | |||
104 | } | 104 | } |
105 | info->mtd->owner = THIS_MODULE; | 105 | info->mtd->owner = THIS_MODULE; |
106 | 106 | ||
107 | #ifdef CONFIG_MTD_PARTITIONS | ||
108 | ret = parse_mtd_partitions(info->mtd, probes, &parts, 0); | 107 | ret = parse_mtd_partitions(info->mtd, probes, &parts, 0); |
109 | 108 | ||
110 | if (ret > 0) { | 109 | if (ret > 0) { |
111 | info->nr_parts = ret; | 110 | info->nr_parts = ret; |
112 | info->parts = parts; | 111 | info->parts = parts; |
113 | } | 112 | } |
114 | #endif | ||
115 | 113 | ||
116 | if (info->nr_parts) { | 114 | if (!info->nr_parts) |
117 | add_mtd_partitions(info->mtd, info->parts, | ||
118 | info->nr_parts); | ||
119 | } else { | ||
120 | printk("Registering %s as whole device\n", | 115 | printk("Registering %s as whole device\n", |
121 | info->map.name); | 116 | info->map.name); |
122 | add_mtd_device(info->mtd); | 117 | |
123 | } | 118 | mtd_device_register(info->mtd, info->parts, info->nr_parts); |
124 | 119 | ||
125 | platform_set_drvdata(pdev, info); | 120 | platform_set_drvdata(pdev, info); |
126 | return 0; | 121 | return 0; |
@@ -132,12 +127,7 @@ static int __devexit pxa2xx_flash_remove(struct platform_device *dev) | |||
132 | 127 | ||
133 | platform_set_drvdata(dev, NULL); | 128 | platform_set_drvdata(dev, NULL); |
134 | 129 | ||
135 | #ifdef CONFIG_MTD_PARTITIONS | 130 | mtd_device_unregister(info->mtd); |
136 | if (info->nr_parts) | ||
137 | del_mtd_partitions(info->mtd); | ||
138 | else | ||
139 | #endif | ||
140 | del_mtd_device(info->mtd); | ||
141 | 131 | ||
142 | map_destroy(info->mtd); | 132 | map_destroy(info->mtd); |
143 | iounmap(info->map.virt); | 133 | iounmap(info->map.virt); |
diff --git a/drivers/mtd/maps/rbtx4939-flash.c b/drivers/mtd/maps/rbtx4939-flash.c index 83ed64512c5e..761fb459d2c7 100644 --- a/drivers/mtd/maps/rbtx4939-flash.c +++ b/drivers/mtd/maps/rbtx4939-flash.c | |||
@@ -25,10 +25,8 @@ | |||
25 | struct rbtx4939_flash_info { | 25 | struct rbtx4939_flash_info { |
26 | struct mtd_info *mtd; | 26 | struct mtd_info *mtd; |
27 | struct map_info map; | 27 | struct map_info map; |
28 | #ifdef CONFIG_MTD_PARTITIONS | ||
29 | int nr_parts; | 28 | int nr_parts; |
30 | struct mtd_partition *parts; | 29 | struct mtd_partition *parts; |
31 | #endif | ||
32 | }; | 30 | }; |
33 | 31 | ||
34 | static int rbtx4939_flash_remove(struct platform_device *dev) | 32 | static int rbtx4939_flash_remove(struct platform_device *dev) |
@@ -41,28 +39,18 @@ static int rbtx4939_flash_remove(struct platform_device *dev) | |||
41 | platform_set_drvdata(dev, NULL); | 39 | platform_set_drvdata(dev, NULL); |
42 | 40 | ||
43 | if (info->mtd) { | 41 | if (info->mtd) { |
44 | #ifdef CONFIG_MTD_PARTITIONS | ||
45 | struct rbtx4939_flash_data *pdata = dev->dev.platform_data; | 42 | struct rbtx4939_flash_data *pdata = dev->dev.platform_data; |
46 | 43 | ||
47 | if (info->nr_parts) { | 44 | if (info->nr_parts) |
48 | del_mtd_partitions(info->mtd); | ||
49 | kfree(info->parts); | 45 | kfree(info->parts); |
50 | } else if (pdata->nr_parts) | 46 | mtd_device_unregister(info->mtd); |
51 | del_mtd_partitions(info->mtd); | ||
52 | else | ||
53 | del_mtd_device(info->mtd); | ||
54 | #else | ||
55 | del_mtd_device(info->mtd); | ||
56 | #endif | ||
57 | map_destroy(info->mtd); | 47 | map_destroy(info->mtd); |
58 | } | 48 | } |
59 | return 0; | 49 | return 0; |
60 | } | 50 | } |
61 | 51 | ||
62 | static const char *rom_probe_types[] = { "cfi_probe", "jedec_probe", NULL }; | 52 | static const char *rom_probe_types[] = { "cfi_probe", "jedec_probe", NULL }; |
63 | #ifdef CONFIG_MTD_PARTITIONS | ||
64 | static const char *part_probe_types[] = { "cmdlinepart", NULL }; | 53 | static const char *part_probe_types[] = { "cmdlinepart", NULL }; |
65 | #endif | ||
66 | 54 | ||
67 | static int rbtx4939_flash_probe(struct platform_device *dev) | 55 | static int rbtx4939_flash_probe(struct platform_device *dev) |
68 | { | 56 | { |
@@ -120,23 +108,21 @@ static int rbtx4939_flash_probe(struct platform_device *dev) | |||
120 | if (err) | 108 | if (err) |
121 | goto err_out; | 109 | goto err_out; |
122 | 110 | ||
123 | #ifdef CONFIG_MTD_PARTITIONS | ||
124 | err = parse_mtd_partitions(info->mtd, part_probe_types, | 111 | err = parse_mtd_partitions(info->mtd, part_probe_types, |
125 | &info->parts, 0); | 112 | &info->parts, 0); |
126 | if (err > 0) { | 113 | if (err > 0) { |
127 | add_mtd_partitions(info->mtd, info->parts, err); | 114 | mtd_device_register(info->mtd, info->parts, err); |
128 | info->nr_parts = err; | 115 | info->nr_parts = err; |
129 | return 0; | 116 | return 0; |
130 | } | 117 | } |
131 | 118 | ||
132 | if (pdata->nr_parts) { | 119 | if (pdata->nr_parts) { |
133 | pr_notice("Using rbtx4939 partition information\n"); | 120 | pr_notice("Using rbtx4939 partition information\n"); |
134 | add_mtd_partitions(info->mtd, pdata->parts, pdata->nr_parts); | 121 | mtd_device_register(info->mtd, pdata->parts, pdata->nr_parts); |
135 | return 0; | 122 | return 0; |
136 | } | 123 | } |
137 | #endif | ||
138 | 124 | ||
139 | add_mtd_device(info->mtd); | 125 | mtd_device_register(info->mtd, NULL, 0); |
140 | return 0; | 126 | return 0; |
141 | 127 | ||
142 | err_out: | 128 | err_out: |
diff --git a/drivers/mtd/maps/rpxlite.c b/drivers/mtd/maps/rpxlite.c index 3e3ef53d4fd4..ed88225bf667 100644 --- a/drivers/mtd/maps/rpxlite.c +++ b/drivers/mtd/maps/rpxlite.c | |||
@@ -36,7 +36,7 @@ static int __init init_rpxlite(void) | |||
36 | mymtd = do_map_probe("cfi_probe", &rpxlite_map); | 36 | mymtd = do_map_probe("cfi_probe", &rpxlite_map); |
37 | if (mymtd) { | 37 | if (mymtd) { |
38 | mymtd->owner = THIS_MODULE; | 38 | mymtd->owner = THIS_MODULE; |
39 | add_mtd_device(mymtd); | 39 | mtd_device_register(mymtd, NULL, 0); |
40 | return 0; | 40 | return 0; |
41 | } | 41 | } |
42 | 42 | ||
@@ -47,7 +47,7 @@ static int __init init_rpxlite(void) | |||
47 | static void __exit cleanup_rpxlite(void) | 47 | static void __exit cleanup_rpxlite(void) |
48 | { | 48 | { |
49 | if (mymtd) { | 49 | if (mymtd) { |
50 | del_mtd_device(mymtd); | 50 | mtd_device_unregister(mymtd); |
51 | map_destroy(mymtd); | 51 | map_destroy(mymtd); |
52 | } | 52 | } |
53 | if (rpxlite_map.virt) { | 53 | if (rpxlite_map.virt) { |
diff --git a/drivers/mtd/maps/sa1100-flash.c b/drivers/mtd/maps/sa1100-flash.c index da875908ea8e..a9b5e0e5c4c5 100644 --- a/drivers/mtd/maps/sa1100-flash.c +++ b/drivers/mtd/maps/sa1100-flash.c | |||
@@ -226,12 +226,7 @@ static void sa1100_destroy(struct sa_info *info, struct flash_platform_data *pla | |||
226 | int i; | 226 | int i; |
227 | 227 | ||
228 | if (info->mtd) { | 228 | if (info->mtd) { |
229 | if (info->nr_parts == 0) | 229 | mtd_device_unregister(info->mtd); |
230 | del_mtd_device(info->mtd); | ||
231 | #ifdef CONFIG_MTD_PARTITIONS | ||
232 | else | ||
233 | del_mtd_partitions(info->mtd); | ||
234 | #endif | ||
235 | if (info->mtd != info->subdev[0].mtd) | 230 | if (info->mtd != info->subdev[0].mtd) |
236 | mtd_concat_destroy(info->mtd); | 231 | mtd_concat_destroy(info->mtd); |
237 | } | 232 | } |
@@ -363,28 +358,24 @@ static int __devinit sa1100_mtd_probe(struct platform_device *pdev) | |||
363 | /* | 358 | /* |
364 | * Partition selection stuff. | 359 | * Partition selection stuff. |
365 | */ | 360 | */ |
366 | #ifdef CONFIG_MTD_PARTITIONS | ||
367 | nr_parts = parse_mtd_partitions(info->mtd, part_probes, &parts, 0); | 361 | nr_parts = parse_mtd_partitions(info->mtd, part_probes, &parts, 0); |
368 | if (nr_parts > 0) { | 362 | if (nr_parts > 0) { |
369 | info->parts = parts; | 363 | info->parts = parts; |
370 | part_type = "dynamic"; | 364 | part_type = "dynamic"; |
371 | } else | 365 | } else { |
372 | #endif | ||
373 | { | ||
374 | parts = plat->parts; | 366 | parts = plat->parts; |
375 | nr_parts = plat->nr_parts; | 367 | nr_parts = plat->nr_parts; |
376 | part_type = "static"; | 368 | part_type = "static"; |
377 | } | 369 | } |
378 | 370 | ||
379 | if (nr_parts == 0) { | 371 | if (nr_parts == 0) |
380 | printk(KERN_NOTICE "SA1100 flash: no partition info " | 372 | printk(KERN_NOTICE "SA1100 flash: no partition info " |
381 | "available, registering whole flash\n"); | 373 | "available, registering whole flash\n"); |
382 | add_mtd_device(info->mtd); | 374 | else |
383 | } else { | ||
384 | printk(KERN_NOTICE "SA1100 flash: using %s partition " | 375 | printk(KERN_NOTICE "SA1100 flash: using %s partition " |
385 | "definition\n", part_type); | 376 | "definition\n", part_type); |
386 | add_mtd_partitions(info->mtd, parts, nr_parts); | 377 | |
387 | } | 378 | mtd_device_register(info->mtd, parts, nr_parts); |
388 | 379 | ||
389 | info->nr_parts = nr_parts; | 380 | info->nr_parts = nr_parts; |
390 | 381 | ||
diff --git a/drivers/mtd/maps/sbc_gxx.c b/drivers/mtd/maps/sbc_gxx.c index 04b2781fc627..556a2dfe94c5 100644 --- a/drivers/mtd/maps/sbc_gxx.c +++ b/drivers/mtd/maps/sbc_gxx.c | |||
@@ -182,7 +182,7 @@ static struct mtd_info *all_mtd; | |||
182 | static void cleanup_sbc_gxx(void) | 182 | static void cleanup_sbc_gxx(void) |
183 | { | 183 | { |
184 | if( all_mtd ) { | 184 | if( all_mtd ) { |
185 | del_mtd_partitions( all_mtd ); | 185 | mtd_device_unregister(all_mtd); |
186 | map_destroy( all_mtd ); | 186 | map_destroy( all_mtd ); |
187 | } | 187 | } |
188 | 188 | ||
@@ -223,7 +223,7 @@ static int __init init_sbc_gxx(void) | |||
223 | all_mtd->owner = THIS_MODULE; | 223 | all_mtd->owner = THIS_MODULE; |
224 | 224 | ||
225 | /* Create MTD devices for each partition. */ | 225 | /* Create MTD devices for each partition. */ |
226 | add_mtd_partitions(all_mtd, partition_info, NUM_PARTITIONS ); | 226 | mtd_device_register(all_mtd, partition_info, NUM_PARTITIONS); |
227 | 227 | ||
228 | return 0; | 228 | return 0; |
229 | } | 229 | } |
diff --git a/drivers/mtd/maps/sc520cdp.c b/drivers/mtd/maps/sc520cdp.c index 4d8aaaf4bb76..8fead8e46bce 100644 --- a/drivers/mtd/maps/sc520cdp.c +++ b/drivers/mtd/maps/sc520cdp.c | |||
@@ -266,10 +266,10 @@ static int __init init_sc520cdp(void) | |||
266 | /* Combine the two flash banks into a single MTD device & register it: */ | 266 | /* Combine the two flash banks into a single MTD device & register it: */ |
267 | merged_mtd = mtd_concat_create(mymtd, 2, "SC520CDP Flash Banks #0 and #1"); | 267 | merged_mtd = mtd_concat_create(mymtd, 2, "SC520CDP Flash Banks #0 and #1"); |
268 | if(merged_mtd) | 268 | if(merged_mtd) |
269 | add_mtd_device(merged_mtd); | 269 | mtd_device_register(merged_mtd, NULL, 0); |
270 | } | 270 | } |
271 | if(devices_found == 3) /* register the third (DIL-Flash) device */ | 271 | if(devices_found == 3) /* register the third (DIL-Flash) device */ |
272 | add_mtd_device(mymtd[2]); | 272 | mtd_device_register(mymtd[2], NULL, 0); |
273 | return(devices_found ? 0 : -ENXIO); | 273 | return(devices_found ? 0 : -ENXIO); |
274 | } | 274 | } |
275 | 275 | ||
@@ -278,11 +278,11 @@ static void __exit cleanup_sc520cdp(void) | |||
278 | int i; | 278 | int i; |
279 | 279 | ||
280 | if (merged_mtd) { | 280 | if (merged_mtd) { |
281 | del_mtd_device(merged_mtd); | 281 | mtd_device_unregister(merged_mtd); |
282 | mtd_concat_destroy(merged_mtd); | 282 | mtd_concat_destroy(merged_mtd); |
283 | } | 283 | } |
284 | if (mymtd[2]) | 284 | if (mymtd[2]) |
285 | del_mtd_device(mymtd[2]); | 285 | mtd_device_unregister(mymtd[2]); |
286 | 286 | ||
287 | for (i = 0; i < NUM_FLASH_BANKS; i++) { | 287 | for (i = 0; i < NUM_FLASH_BANKS; i++) { |
288 | if (mymtd[i]) | 288 | if (mymtd[i]) |
diff --git a/drivers/mtd/maps/scb2_flash.c b/drivers/mtd/maps/scb2_flash.c index 7e329f09a548..d88c8426bb0f 100644 --- a/drivers/mtd/maps/scb2_flash.c +++ b/drivers/mtd/maps/scb2_flash.c | |||
@@ -180,7 +180,7 @@ scb2_flash_probe(struct pci_dev *dev, const struct pci_device_id *ent) | |||
180 | 180 | ||
181 | scb2_mtd->owner = THIS_MODULE; | 181 | scb2_mtd->owner = THIS_MODULE; |
182 | if (scb2_fixup_mtd(scb2_mtd) < 0) { | 182 | if (scb2_fixup_mtd(scb2_mtd) < 0) { |
183 | del_mtd_device(scb2_mtd); | 183 | mtd_device_unregister(scb2_mtd); |
184 | map_destroy(scb2_mtd); | 184 | map_destroy(scb2_mtd); |
185 | iounmap(scb2_ioaddr); | 185 | iounmap(scb2_ioaddr); |
186 | if (!region_fail) | 186 | if (!region_fail) |
@@ -192,7 +192,7 @@ scb2_flash_probe(struct pci_dev *dev, const struct pci_device_id *ent) | |||
192 | (unsigned long long)scb2_mtd->size, | 192 | (unsigned long long)scb2_mtd->size, |
193 | (unsigned long long)(SCB2_WINDOW - scb2_mtd->size)); | 193 | (unsigned long long)(SCB2_WINDOW - scb2_mtd->size)); |
194 | 194 | ||
195 | add_mtd_device(scb2_mtd); | 195 | mtd_device_register(scb2_mtd, NULL, 0); |
196 | 196 | ||
197 | return 0; | 197 | return 0; |
198 | } | 198 | } |
@@ -207,7 +207,7 @@ scb2_flash_remove(struct pci_dev *dev) | |||
207 | if (scb2_mtd->lock) | 207 | if (scb2_mtd->lock) |
208 | scb2_mtd->lock(scb2_mtd, 0, scb2_mtd->size); | 208 | scb2_mtd->lock(scb2_mtd, 0, scb2_mtd->size); |
209 | 209 | ||
210 | del_mtd_device(scb2_mtd); | 210 | mtd_device_unregister(scb2_mtd); |
211 | map_destroy(scb2_mtd); | 211 | map_destroy(scb2_mtd); |
212 | 212 | ||
213 | iounmap(scb2_ioaddr); | 213 | iounmap(scb2_ioaddr); |
diff --git a/drivers/mtd/maps/scx200_docflash.c b/drivers/mtd/maps/scx200_docflash.c index 027e628a4f1d..f1c1f737d0d7 100644 --- a/drivers/mtd/maps/scx200_docflash.c +++ b/drivers/mtd/maps/scx200_docflash.c | |||
@@ -44,7 +44,6 @@ static struct resource docmem = { | |||
44 | 44 | ||
45 | static struct mtd_info *mymtd; | 45 | static struct mtd_info *mymtd; |
46 | 46 | ||
47 | #ifdef CONFIG_MTD_PARTITIONS | ||
48 | static struct mtd_partition partition_info[] = { | 47 | static struct mtd_partition partition_info[] = { |
49 | { | 48 | { |
50 | .name = "DOCCS Boot kernel", | 49 | .name = "DOCCS Boot kernel", |
@@ -68,8 +67,6 @@ static struct mtd_partition partition_info[] = { | |||
68 | }, | 67 | }, |
69 | }; | 68 | }; |
70 | #define NUM_PARTITIONS ARRAY_SIZE(partition_info) | 69 | #define NUM_PARTITIONS ARRAY_SIZE(partition_info) |
71 | #endif | ||
72 | |||
73 | 70 | ||
74 | static struct map_info scx200_docflash_map = { | 71 | static struct map_info scx200_docflash_map = { |
75 | .name = "NatSemi SCx200 DOCCS Flash", | 72 | .name = "NatSemi SCx200 DOCCS Flash", |
@@ -198,24 +195,17 @@ static int __init init_scx200_docflash(void) | |||
198 | 195 | ||
199 | mymtd->owner = THIS_MODULE; | 196 | mymtd->owner = THIS_MODULE; |
200 | 197 | ||
201 | #ifdef CONFIG_MTD_PARTITIONS | ||
202 | partition_info[3].offset = mymtd->size-partition_info[3].size; | 198 | partition_info[3].offset = mymtd->size-partition_info[3].size; |
203 | partition_info[2].size = partition_info[3].offset-partition_info[2].offset; | 199 | partition_info[2].size = partition_info[3].offset-partition_info[2].offset; |
204 | add_mtd_partitions(mymtd, partition_info, NUM_PARTITIONS); | 200 | mtd_device_register(mymtd, partition_info, NUM_PARTITIONS); |
205 | #else | 201 | |
206 | add_mtd_device(mymtd); | ||
207 | #endif | ||
208 | return 0; | 202 | return 0; |
209 | } | 203 | } |
210 | 204 | ||
211 | static void __exit cleanup_scx200_docflash(void) | 205 | static void __exit cleanup_scx200_docflash(void) |
212 | { | 206 | { |
213 | if (mymtd) { | 207 | if (mymtd) { |
214 | #ifdef CONFIG_MTD_PARTITIONS | 208 | mtd_device_unregister(mymtd); |
215 | del_mtd_partitions(mymtd); | ||
216 | #else | ||
217 | del_mtd_device(mymtd); | ||
218 | #endif | ||
219 | map_destroy(mymtd); | 209 | map_destroy(mymtd); |
220 | } | 210 | } |
221 | if (scx200_docflash_map.virt) { | 211 | if (scx200_docflash_map.virt) { |
diff --git a/drivers/mtd/maps/solutionengine.c b/drivers/mtd/maps/solutionengine.c index 0eb41d9c6786..cbf6bade9354 100644 --- a/drivers/mtd/maps/solutionengine.c +++ b/drivers/mtd/maps/solutionengine.c | |||
@@ -89,7 +89,7 @@ static int __init init_soleng_maps(void) | |||
89 | eprom_mtd = do_map_probe("map_rom", &soleng_eprom_map); | 89 | eprom_mtd = do_map_probe("map_rom", &soleng_eprom_map); |
90 | if (eprom_mtd) { | 90 | if (eprom_mtd) { |
91 | eprom_mtd->owner = THIS_MODULE; | 91 | eprom_mtd->owner = THIS_MODULE; |
92 | add_mtd_device(eprom_mtd); | 92 | mtd_device_register(eprom_mtd, NULL, 0); |
93 | } | 93 | } |
94 | 94 | ||
95 | nr_parts = parse_mtd_partitions(flash_mtd, probes, &parsed_parts, 0); | 95 | nr_parts = parse_mtd_partitions(flash_mtd, probes, &parsed_parts, 0); |
@@ -104,9 +104,9 @@ static int __init init_soleng_maps(void) | |||
104 | #endif /* CONFIG_MTD_SUPERH_RESERVE */ | 104 | #endif /* CONFIG_MTD_SUPERH_RESERVE */ |
105 | 105 | ||
106 | if (nr_parts > 0) | 106 | if (nr_parts > 0) |
107 | add_mtd_partitions(flash_mtd, parsed_parts, nr_parts); | 107 | mtd_device_register(flash_mtd, parsed_parts, nr_parts); |
108 | else | 108 | else |
109 | add_mtd_device(flash_mtd); | 109 | mtd_device_register(flash_mtd, NULL, 0); |
110 | 110 | ||
111 | return 0; | 111 | return 0; |
112 | } | 112 | } |
@@ -114,14 +114,14 @@ static int __init init_soleng_maps(void) | |||
114 | static void __exit cleanup_soleng_maps(void) | 114 | static void __exit cleanup_soleng_maps(void) |
115 | { | 115 | { |
116 | if (eprom_mtd) { | 116 | if (eprom_mtd) { |
117 | del_mtd_device(eprom_mtd); | 117 | mtd_device_unregister(eprom_mtd); |
118 | map_destroy(eprom_mtd); | 118 | map_destroy(eprom_mtd); |
119 | } | 119 | } |
120 | 120 | ||
121 | if (parsed_parts) | 121 | if (parsed_parts) |
122 | del_mtd_partitions(flash_mtd); | 122 | mtd_device_unregister(flash_mtd); |
123 | else | 123 | else |
124 | del_mtd_device(flash_mtd); | 124 | mtd_device_unregister(flash_mtd); |
125 | map_destroy(flash_mtd); | 125 | map_destroy(flash_mtd); |
126 | } | 126 | } |
127 | 127 | ||
diff --git a/drivers/mtd/maps/sun_uflash.c b/drivers/mtd/maps/sun_uflash.c index 3f1cb328a574..2d66234f57cb 100644 --- a/drivers/mtd/maps/sun_uflash.c +++ b/drivers/mtd/maps/sun_uflash.c | |||
@@ -101,7 +101,7 @@ int uflash_devinit(struct platform_device *op, struct device_node *dp) | |||
101 | 101 | ||
102 | up->mtd->owner = THIS_MODULE; | 102 | up->mtd->owner = THIS_MODULE; |
103 | 103 | ||
104 | add_mtd_device(up->mtd); | 104 | mtd_device_register(up->mtd, NULL, 0); |
105 | 105 | ||
106 | dev_set_drvdata(&op->dev, up); | 106 | dev_set_drvdata(&op->dev, up); |
107 | 107 | ||
@@ -126,7 +126,7 @@ static int __devexit uflash_remove(struct platform_device *op) | |||
126 | struct uflash_dev *up = dev_get_drvdata(&op->dev); | 126 | struct uflash_dev *up = dev_get_drvdata(&op->dev); |
127 | 127 | ||
128 | if (up->mtd) { | 128 | if (up->mtd) { |
129 | del_mtd_device(up->mtd); | 129 | mtd_device_unregister(up->mtd); |
130 | map_destroy(up->mtd); | 130 | map_destroy(up->mtd); |
131 | } | 131 | } |
132 | if (up->map.virt) { | 132 | if (up->map.virt) { |
diff --git a/drivers/mtd/maps/tqm8xxl.c b/drivers/mtd/maps/tqm8xxl.c index 0718dfb3ee64..d78587990e7e 100644 --- a/drivers/mtd/maps/tqm8xxl.c +++ b/drivers/mtd/maps/tqm8xxl.c | |||
@@ -62,7 +62,6 @@ static void __iomem *start_scan_addr; | |||
62 | * "struct map_desc *_io_desc" for the corresponding machine. | 62 | * "struct map_desc *_io_desc" for the corresponding machine. |
63 | */ | 63 | */ |
64 | 64 | ||
65 | #ifdef CONFIG_MTD_PARTITIONS | ||
66 | /* Currently, TQM8xxL has up to 8MiB flash */ | 65 | /* Currently, TQM8xxL has up to 8MiB flash */ |
67 | static unsigned long tqm8xxl_max_flash_size = 0x00800000; | 66 | static unsigned long tqm8xxl_max_flash_size = 0x00800000; |
68 | 67 | ||
@@ -107,7 +106,6 @@ static struct mtd_partition tqm8xxl_fs_partitions[] = { | |||
107 | //.size = MTDPART_SIZ_FULL, | 106 | //.size = MTDPART_SIZ_FULL, |
108 | } | 107 | } |
109 | }; | 108 | }; |
110 | #endif | ||
111 | 109 | ||
112 | static int __init init_tqm_mtd(void) | 110 | static int __init init_tqm_mtd(void) |
113 | { | 111 | { |
@@ -188,7 +186,6 @@ static int __init init_tqm_mtd(void) | |||
188 | goto error_mem; | 186 | goto error_mem; |
189 | } | 187 | } |
190 | 188 | ||
191 | #ifdef CONFIG_MTD_PARTITIONS | ||
192 | /* | 189 | /* |
193 | * Select Static partition definitions | 190 | * Select Static partition definitions |
194 | */ | 191 | */ |
@@ -201,21 +198,14 @@ static int __init init_tqm_mtd(void) | |||
201 | part_banks[1].nums = ARRAY_SIZE(tqm8xxl_fs_partitions); | 198 | part_banks[1].nums = ARRAY_SIZE(tqm8xxl_fs_partitions); |
202 | 199 | ||
203 | for(idx = 0; idx < num_banks ; idx++) { | 200 | for(idx = 0; idx < num_banks ; idx++) { |
204 | if (part_banks[idx].nums == 0) { | 201 | if (part_banks[idx].nums == 0) |
205 | printk(KERN_NOTICE "TQM flash%d: no partition info available, registering whole flash at once\n", idx); | 202 | printk(KERN_NOTICE "TQM flash%d: no partition info available, registering whole flash at once\n", idx); |
206 | add_mtd_device(mtd_banks[idx]); | 203 | else |
207 | } else { | ||
208 | printk(KERN_NOTICE "TQM flash%d: Using %s partition definition\n", | 204 | printk(KERN_NOTICE "TQM flash%d: Using %s partition definition\n", |
209 | idx, part_banks[idx].type); | 205 | idx, part_banks[idx].type); |
210 | add_mtd_partitions(mtd_banks[idx], part_banks[idx].mtd_part, | 206 | mtd_device_register(mtd_banks[idx], part_banks[idx].mtd_part, |
211 | part_banks[idx].nums); | 207 | part_banks[idx].nums); |
212 | } | ||
213 | } | 208 | } |
214 | #else | ||
215 | printk(KERN_NOTICE "TQM flash: registering %d whole flash banks at once\n", num_banks); | ||
216 | for(idx = 0 ; idx < num_banks ; idx++) | ||
217 | add_mtd_device(mtd_banks[idx]); | ||
218 | #endif | ||
219 | return 0; | 209 | return 0; |
220 | error_mem: | 210 | error_mem: |
221 | for(idx = 0 ; idx < FLASH_BANK_MAX ; idx++) { | 211 | for(idx = 0 ; idx < FLASH_BANK_MAX ; idx++) { |
@@ -237,7 +227,7 @@ static void __exit cleanup_tqm_mtd(void) | |||
237 | for(idx = 0 ; idx < num_banks ; idx++) { | 227 | for(idx = 0 ; idx < num_banks ; idx++) { |
238 | /* destroy mtd_info previously allocated */ | 228 | /* destroy mtd_info previously allocated */ |
239 | if (mtd_banks[idx]) { | 229 | if (mtd_banks[idx]) { |
240 | del_mtd_partitions(mtd_banks[idx]); | 230 | mtd_device_unregister(mtd_banks[idx]); |
241 | map_destroy(mtd_banks[idx]); | 231 | map_destroy(mtd_banks[idx]); |
242 | } | 232 | } |
243 | /* release map_info not used anymore */ | 233 | /* release map_info not used anymore */ |
diff --git a/drivers/mtd/maps/ts5500_flash.c b/drivers/mtd/maps/ts5500_flash.c index e02dfa9d4ddd..d1d671daf235 100644 --- a/drivers/mtd/maps/ts5500_flash.c +++ b/drivers/mtd/maps/ts5500_flash.c | |||
@@ -89,7 +89,7 @@ static int __init init_ts5500_map(void) | |||
89 | } | 89 | } |
90 | 90 | ||
91 | mymtd->owner = THIS_MODULE; | 91 | mymtd->owner = THIS_MODULE; |
92 | add_mtd_partitions(mymtd, ts5500_partitions, NUM_PARTITIONS); | 92 | mtd_device_register(mymtd, ts5500_partitions, NUM_PARTITIONS); |
93 | 93 | ||
94 | return 0; | 94 | return 0; |
95 | 95 | ||
@@ -102,7 +102,7 @@ err2: | |||
102 | static void __exit cleanup_ts5500_map(void) | 102 | static void __exit cleanup_ts5500_map(void) |
103 | { | 103 | { |
104 | if (mymtd) { | 104 | if (mymtd) { |
105 | del_mtd_partitions(mymtd); | 105 | mtd_device_unregister(mymtd); |
106 | map_destroy(mymtd); | 106 | map_destroy(mymtd); |
107 | } | 107 | } |
108 | 108 | ||
diff --git a/drivers/mtd/maps/tsunami_flash.c b/drivers/mtd/maps/tsunami_flash.c index 77a8bfc02577..1de390e1c2fb 100644 --- a/drivers/mtd/maps/tsunami_flash.c +++ b/drivers/mtd/maps/tsunami_flash.c | |||
@@ -76,7 +76,7 @@ static void __exit cleanup_tsunami_flash(void) | |||
76 | struct mtd_info *mtd; | 76 | struct mtd_info *mtd; |
77 | mtd = tsunami_flash_mtd; | 77 | mtd = tsunami_flash_mtd; |
78 | if (mtd) { | 78 | if (mtd) { |
79 | del_mtd_device(mtd); | 79 | mtd_device_unregister(mtd); |
80 | map_destroy(mtd); | 80 | map_destroy(mtd); |
81 | } | 81 | } |
82 | tsunami_flash_mtd = 0; | 82 | tsunami_flash_mtd = 0; |
@@ -97,7 +97,7 @@ static int __init init_tsunami_flash(void) | |||
97 | } | 97 | } |
98 | if (tsunami_flash_mtd) { | 98 | if (tsunami_flash_mtd) { |
99 | tsunami_flash_mtd->owner = THIS_MODULE; | 99 | tsunami_flash_mtd->owner = THIS_MODULE; |
100 | add_mtd_device(tsunami_flash_mtd); | 100 | mtd_device_register(tsunami_flash_mtd, NULL, 0); |
101 | return 0; | 101 | return 0; |
102 | } | 102 | } |
103 | return -ENXIO; | 103 | return -ENXIO; |
diff --git a/drivers/mtd/maps/uclinux.c b/drivers/mtd/maps/uclinux.c index 35009294b435..6793074f3f40 100644 --- a/drivers/mtd/maps/uclinux.c +++ b/drivers/mtd/maps/uclinux.c | |||
@@ -89,11 +89,7 @@ static int __init uclinux_mtd_init(void) | |||
89 | mtd->priv = mapp; | 89 | mtd->priv = mapp; |
90 | 90 | ||
91 | uclinux_ram_mtdinfo = mtd; | 91 | uclinux_ram_mtdinfo = mtd; |
92 | #ifdef CONFIG_MTD_PARTITIONS | 92 | mtd_device_register(mtd, uclinux_romfs, NUM_PARTITIONS); |
93 | add_mtd_partitions(mtd, uclinux_romfs, NUM_PARTITIONS); | ||
94 | #else | ||
95 | add_mtd_device(mtd); | ||
96 | #endif | ||
97 | 93 | ||
98 | return(0); | 94 | return(0); |
99 | } | 95 | } |
@@ -103,11 +99,7 @@ static int __init uclinux_mtd_init(void) | |||
103 | static void __exit uclinux_mtd_cleanup(void) | 99 | static void __exit uclinux_mtd_cleanup(void) |
104 | { | 100 | { |
105 | if (uclinux_ram_mtdinfo) { | 101 | if (uclinux_ram_mtdinfo) { |
106 | #ifdef CONFIG_MTD_PARTITIONS | 102 | mtd_device_unregister(uclinux_ram_mtdinfo); |
107 | del_mtd_partitions(uclinux_ram_mtdinfo); | ||
108 | #else | ||
109 | del_mtd_device(uclinux_ram_mtdinfo); | ||
110 | #endif | ||
111 | map_destroy(uclinux_ram_mtdinfo); | 103 | map_destroy(uclinux_ram_mtdinfo); |
112 | uclinux_ram_mtdinfo = NULL; | 104 | uclinux_ram_mtdinfo = NULL; |
113 | } | 105 | } |
diff --git a/drivers/mtd/maps/vmax301.c b/drivers/mtd/maps/vmax301.c index 6adaa6acc193..5e68de73eabc 100644 --- a/drivers/mtd/maps/vmax301.c +++ b/drivers/mtd/maps/vmax301.c | |||
@@ -138,7 +138,7 @@ static void __exit cleanup_vmax301(void) | |||
138 | 138 | ||
139 | for (i=0; i<2; i++) { | 139 | for (i=0; i<2; i++) { |
140 | if (vmax_mtd[i]) { | 140 | if (vmax_mtd[i]) { |
141 | del_mtd_device(vmax_mtd[i]); | 141 | mtd_device_unregister(vmax_mtd[i]); |
142 | map_destroy(vmax_mtd[i]); | 142 | map_destroy(vmax_mtd[i]); |
143 | } | 143 | } |
144 | } | 144 | } |
@@ -176,7 +176,7 @@ static int __init init_vmax301(void) | |||
176 | vmax_mtd[i] = do_map_probe("map_rom", &vmax_map[i]); | 176 | vmax_mtd[i] = do_map_probe("map_rom", &vmax_map[i]); |
177 | if (vmax_mtd[i]) { | 177 | if (vmax_mtd[i]) { |
178 | vmax_mtd[i]->owner = THIS_MODULE; | 178 | vmax_mtd[i]->owner = THIS_MODULE; |
179 | add_mtd_device(vmax_mtd[i]); | 179 | mtd_device_register(vmax_mtd[i], NULL, 0); |
180 | } | 180 | } |
181 | } | 181 | } |
182 | 182 | ||
diff --git a/drivers/mtd/maps/vmu-flash.c b/drivers/mtd/maps/vmu-flash.c index 4afc167731ef..3a04b078576a 100644 --- a/drivers/mtd/maps/vmu-flash.c +++ b/drivers/mtd/maps/vmu-flash.c | |||
@@ -563,7 +563,7 @@ static void vmu_queryblocks(struct mapleq *mq) | |||
563 | goto fail_cache_create; | 563 | goto fail_cache_create; |
564 | part_cur->pcache = pcache; | 564 | part_cur->pcache = pcache; |
565 | 565 | ||
566 | error = add_mtd_device(mtd_cur); | 566 | error = mtd_device_register(mtd_cur, NULL, 0); |
567 | if (error) | 567 | if (error) |
568 | goto fail_mtd_register; | 568 | goto fail_mtd_register; |
569 | 569 | ||
@@ -709,7 +709,7 @@ static void __devexit vmu_disconnect(struct maple_device *mdev) | |||
709 | for (x = 0; x < card->partitions; x++) { | 709 | for (x = 0; x < card->partitions; x++) { |
710 | mpart = ((card->mtd)[x]).priv; | 710 | mpart = ((card->mtd)[x]).priv; |
711 | mpart->mdev = NULL; | 711 | mpart->mdev = NULL; |
712 | del_mtd_device(&((card->mtd)[x])); | 712 | mtd_device_unregister(&((card->mtd)[x])); |
713 | kfree(((card->parts)[x]).name); | 713 | kfree(((card->parts)[x]).name); |
714 | } | 714 | } |
715 | kfree(card->parts); | 715 | kfree(card->parts); |
diff --git a/drivers/mtd/maps/wr_sbc82xx_flash.c b/drivers/mtd/maps/wr_sbc82xx_flash.c index 933a2b6598b4..901ce968efae 100644 --- a/drivers/mtd/maps/wr_sbc82xx_flash.c +++ b/drivers/mtd/maps/wr_sbc82xx_flash.c | |||
@@ -132,17 +132,20 @@ static int __init init_sbc82xx_flash(void) | |||
132 | nr_parts = parse_mtd_partitions(sbcmtd[i], part_probes, | 132 | nr_parts = parse_mtd_partitions(sbcmtd[i], part_probes, |
133 | &sbcmtd_parts[i], 0); | 133 | &sbcmtd_parts[i], 0); |
134 | if (nr_parts > 0) { | 134 | if (nr_parts > 0) { |
135 | add_mtd_partitions (sbcmtd[i], sbcmtd_parts[i], nr_parts); | 135 | mtd_device_register(sbcmtd[i], sbcmtd_parts[i], |
136 | nr_parts); | ||
136 | continue; | 137 | continue; |
137 | } | 138 | } |
138 | 139 | ||
139 | /* No partitioning detected. Use default */ | 140 | /* No partitioning detected. Use default */ |
140 | if (i == 2) { | 141 | if (i == 2) { |
141 | add_mtd_device(sbcmtd[i]); | 142 | mtd_device_register(sbcmtd[i], NULL, 0); |
142 | } else if (i == bigflash) { | 143 | } else if (i == bigflash) { |
143 | add_mtd_partitions (sbcmtd[i], bigflash_parts, ARRAY_SIZE(bigflash_parts)); | 144 | mtd_device_register(sbcmtd[i], bigflash_parts, |
145 | ARRAY_SIZE(bigflash_parts)); | ||
144 | } else { | 146 | } else { |
145 | add_mtd_partitions (sbcmtd[i], smallflash_parts, ARRAY_SIZE(smallflash_parts)); | 147 | mtd_device_register(sbcmtd[i], smallflash_parts, |
148 | ARRAY_SIZE(smallflash_parts)); | ||
146 | } | 149 | } |
147 | } | 150 | } |
148 | return 0; | 151 | return 0; |
@@ -157,9 +160,9 @@ static void __exit cleanup_sbc82xx_flash(void) | |||
157 | continue; | 160 | continue; |
158 | 161 | ||
159 | if (i<2 || sbcmtd_parts[i]) | 162 | if (i<2 || sbcmtd_parts[i]) |
160 | del_mtd_partitions(sbcmtd[i]); | 163 | mtd_device_unregister(sbcmtd[i]); |
161 | else | 164 | else |
162 | del_mtd_device(sbcmtd[i]); | 165 | mtd_device_unregister(sbcmtd[i]); |
163 | 166 | ||
164 | kfree(sbcmtd_parts[i]); | 167 | kfree(sbcmtd_parts[i]); |
165 | map_destroy(sbcmtd[i]); | 168 | map_destroy(sbcmtd[i]); |