aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/maps
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/maps')
-rw-r--r--drivers/mtd/maps/amd76xrom.c4
-rw-r--r--drivers/mtd/maps/autcpu12-nvram.c4
-rw-r--r--drivers/mtd/maps/bcm963xx-flash.c6
-rw-r--r--drivers/mtd/maps/cdb89712.c12
-rw-r--r--drivers/mtd/maps/ceiva.c6
-rw-r--r--drivers/mtd/maps/cfi_flagadm.c4
-rw-r--r--drivers/mtd/maps/ck804xrom.c4
-rw-r--r--drivers/mtd/maps/dbox2-flash.c4
-rw-r--r--drivers/mtd/maps/dilnetpc.c9
-rw-r--r--drivers/mtd/maps/dmv182.c4
-rw-r--r--drivers/mtd/maps/esb2rom.c4
-rw-r--r--drivers/mtd/maps/fortunet.c7
-rw-r--r--drivers/mtd/maps/ichxrom.c4
-rw-r--r--drivers/mtd/maps/integrator-flash.c6
-rw-r--r--drivers/mtd/maps/l440gx.c4
-rw-r--r--drivers/mtd/maps/mbx860.c6
-rw-r--r--drivers/mtd/maps/netsc520.c4
-rw-r--r--drivers/mtd/maps/nettel.c12
-rw-r--r--drivers/mtd/maps/octagon-5066.c4
-rw-r--r--drivers/mtd/maps/pci.c4
-rw-r--r--drivers/mtd/maps/pcmciamtd.c4
-rw-r--r--drivers/mtd/maps/pmcmsp-flash.c6
-rw-r--r--drivers/mtd/maps/rpxlite.c4
-rw-r--r--drivers/mtd/maps/sbc_gxx.c4
-rw-r--r--drivers/mtd/maps/sc520cdp.c8
-rw-r--r--drivers/mtd/maps/scb2_flash.c6
-rw-r--r--drivers/mtd/maps/solutionengine.c12
-rw-r--r--drivers/mtd/maps/sun_uflash.c4
-rw-r--r--drivers/mtd/maps/ts5500_flash.c4
-rw-r--r--drivers/mtd/maps/tsunami_flash.c4
-rw-r--r--drivers/mtd/maps/vmax301.c4
-rw-r--r--drivers/mtd/maps/vmu-flash.c4
-rw-r--r--drivers/mtd/maps/wr_sbc82xx_flash.c15
33 files changed, 98 insertions, 93 deletions
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:
111static void __exit cleanup_autcpu12_maps(void) 111static 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
230err_probe: 230err_probe:
231 iounmap(bcm963xx_map.virt); 231 iounmap(bcm963xx_map.virt);
@@ -235,7 +235,7 @@ err_probe:
235static int bcm963xx_remove(struct platform_device *pdev) 235static 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/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)
249static void __exit cleanup_cdb89712_maps(void) 249static 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)
119static void __exit cleanup_flagadm(void) 119static 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)
105static void __exit cleanup_dbox2_flash(void) 105static 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/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)
472static void __exit cleanup_dnpc(void) 473static 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/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/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/integrator-flash.c b/drivers/mtd/maps/integrator-flash.c
index e22ff5adbbf4..a97bbcf0d584 100644
--- a/drivers/mtd/maps/integrator-flash.c
+++ b/drivers/mtd/maps/integrator-flash.c
@@ -221,7 +221,7 @@ static int armflash_probe(struct platform_device *dev)
221 221
222 err = parse_mtd_partitions(info->mtd, probes, &info->parts, 0); 222 err = parse_mtd_partitions(info->mtd, probes, &info->parts, 0);
223 if (err > 0) { 223 if (err > 0) {
224 err = add_mtd_partitions(info->mtd, info->parts, err); 224 err = mtd_device_register(info->mtd, info->parts, err);
225 if (err) 225 if (err)
226 printk(KERN_ERR 226 printk(KERN_ERR
227 "mtd partition registration failed: %d\n", err); 227 "mtd partition registration failed: %d\n", err);
@@ -237,7 +237,7 @@ static int armflash_probe(struct platform_device *dev)
237 */ 237 */
238 cleanup: 238 cleanup:
239 if (info->mtd) { 239 if (info->mtd) {
240 del_mtd_partitions(info->mtd); 240 mtd_device_unregister(info->mtd);
241 if (info->mtd != info->subdev[0].mtd) 241 if (info->mtd != info->subdev[0].mtd)
242 mtd_concat_destroy(info->mtd); 242 mtd_concat_destroy(info->mtd);
243 } 243 }
@@ -263,7 +263,7 @@ static int armflash_remove(struct platform_device *dev)
263 263
264 if (info) { 264 if (info) {
265 if (info->mtd) { 265 if (info->mtd) {
266 del_mtd_partitions(info->mtd); 266 mtd_device_unregister(info->mtd);
267 if (info->mtd != info->subdev[0].mtd) 267 if (info->mtd != info->subdev[0].mtd)
268 mtd_concat_destroy(info->mtd); 268 mtd_concat_destroy(info->mtd);
269 } 269 }
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
149static void __exit cleanup_l440gx(void) 149static 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/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)
81static void __exit cleanup_mbx(void) 81static 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
123static void __exit cleanup_netsc520(void) 123static 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 6799e75d74e0..a523e2a6af53 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/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
189cleanup_loop: 189cleanup_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/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)
47static void __exit cleanup_rpxlite(void) 47static 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/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;
182static void cleanup_sbc_gxx(void) 182static 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/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)
114static void __exit cleanup_soleng_maps(void) 114static 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/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:
102static void __exit cleanup_ts5500_map(void) 102static 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/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]);