Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mtd: convert remaining users to mtd_device_register()

The older add_mtd_device()/add_mtd_partitions() and their removal
counterparts will soon be gone. Replace uses with mtd_device_register()
and mtd_device_unregister().

Signed-off-by: Jamie Iles <jamie@jamieiles.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>

authored by

Jamie Iles and committed by
David Woodhouse
ee0e87b1 6b57c116

+160 -150
+2 -2
drivers/mtd/devices/block2mtd.c
··· 294 294 dev->mtd.priv = dev; 295 295 dev->mtd.owner = THIS_MODULE; 296 296 297 - if (add_mtd_device(&dev->mtd)) { 297 + if (mtd_device_register(&dev->mtd, NULL, 0)) { 298 298 /* Device didn't get added, so free the entry */ 299 299 goto devinit_err; 300 300 } ··· 465 465 list_for_each_safe(pos, next, &blkmtd_device_list) { 466 466 struct block2mtd_dev *dev = list_entry(pos, typeof(*dev), list); 467 467 block2mtd_sync(&dev->mtd); 468 - del_mtd_device(&dev->mtd); 468 + mtd_device_unregister(&dev->mtd); 469 469 INFO("mtd%d: [%s] removed", dev->mtd.index, 470 470 dev->mtd.name + strlen("block2mtd: ")); 471 471 list_del(&dev->list);
+2 -2
drivers/mtd/devices/doc2000.c
··· 597 597 doc2klist = mtd; 598 598 mtd->size = this->totlen; 599 599 mtd->erasesize = this->erasesize; 600 - add_mtd_device(mtd); 600 + mtd_device_register(mtd, NULL, 0); 601 601 return; 602 602 } 603 603 } ··· 1185 1185 this = mtd->priv; 1186 1186 doc2klist = this->nextdoc; 1187 1187 1188 - del_mtd_device(mtd); 1188 + mtd_device_unregister(mtd); 1189 1189 1190 1190 iounmap(this->virtadr); 1191 1191 kfree(this->chips);
+2 -2
drivers/mtd/devices/doc2001.c
··· 376 376 this->nextdoc = docmillist; 377 377 docmillist = mtd; 378 378 mtd->size = this->totlen; 379 - add_mtd_device(mtd); 379 + mtd_device_register(mtd, NULL, 0); 380 380 return; 381 381 } 382 382 } ··· 826 826 this = mtd->priv; 827 827 docmillist = this->nextdoc; 828 828 829 - del_mtd_device(mtd); 829 + mtd_device_unregister(mtd); 830 830 831 831 iounmap(this->virtadr); 832 832 kfree(this->chips);
+2 -2
drivers/mtd/devices/doc2001plus.c
··· 499 499 docmilpluslist = mtd; 500 500 mtd->size = this->totlen; 501 501 mtd->erasesize = this->erasesize; 502 - add_mtd_device(mtd); 502 + mtd_device_register(mtd, NULL, 0); 503 503 return; 504 504 } 505 505 } ··· 1091 1091 this = mtd->priv; 1092 1092 docmilpluslist = this->nextdoc; 1093 1093 1094 - del_mtd_device(mtd); 1094 + mtd_device_unregister(mtd); 1095 1095 1096 1096 iounmap(this->virtadr); 1097 1097 kfree(this->chips);
+5 -4
drivers/mtd/devices/lart.c
··· 684 684 #endif 685 685 686 686 #ifndef HAVE_PARTITIONS 687 - result = add_mtd_device (&mtd); 687 + result = mtd_device_register(&mtd, NULL, 0); 688 688 #else 689 - result = add_mtd_partitions (&mtd,lart_partitions, ARRAY_SIZE(lart_partitions)); 689 + result = mtd_device_register(&mtd, lart_partitions, 690 + ARRAY_SIZE(lart_partitions)); 690 691 #endif 691 692 692 693 return (result); ··· 696 695 static void __exit lart_flash_exit (void) 697 696 { 698 697 #ifndef HAVE_PARTITIONS 699 - del_mtd_device (&mtd); 698 + mtd_device_unregister(&mtd); 700 699 #else 701 - del_mtd_partitions (&mtd); 700 + mtd_device_unregister(&mtd); 702 701 #endif 703 702 } 704 703
+2 -2
drivers/mtd/devices/ms02-nv.c
··· 220 220 mtd->writesize = 1; 221 221 222 222 ret = -EIO; 223 - if (add_mtd_device(mtd)) { 223 + if (mtd_device_register(mtd, NULL, 0)) { 224 224 printk(KERN_ERR 225 225 "ms02-nv: Unable to register MTD device, aborting!\n"); 226 226 goto err_out_csr_res; ··· 262 262 263 263 root_ms02nv_mtd = mp->next; 264 264 265 - del_mtd_device(mtd); 265 + mtd_device_unregister(mtd); 266 266 267 267 release_resource(mp->resource.csr); 268 268 kfree(mp->resource.csr);
+2 -3
drivers/mtd/devices/mtdram.c
··· 104 104 static void __exit cleanup_mtdram(void) 105 105 { 106 106 if (mtd_info) { 107 - del_mtd_device(mtd_info); 107 + mtd_device_unregister(mtd_info); 108 108 vfree(mtd_info->priv); 109 109 kfree(mtd_info); 110 110 } ··· 133 133 mtd->read = ram_read; 134 134 mtd->write = ram_write; 135 135 136 - if (add_mtd_device(mtd)) { 136 + if (mtd_device_register(mtd, NULL, 0)) 137 137 return -EIO; 138 - } 139 138 140 139 return 0; 141 140 }
+2 -2
drivers/mtd/devices/phram.c
··· 115 115 struct phram_mtd_list *this, *safe; 116 116 117 117 list_for_each_entry_safe(this, safe, &phram_list, list) { 118 - del_mtd_device(&this->mtd); 118 + mtd_device_unregister(&this->mtd); 119 119 iounmap(this->mtd.priv); 120 120 kfree(this->mtd.name); 121 121 kfree(this); ··· 153 153 new->mtd.writesize = 1; 154 154 155 155 ret = -EAGAIN; 156 - if (add_mtd_device(&new->mtd)) { 156 + if (mtd_device_register(&new->mtd, NULL, 0)) { 157 157 pr_err("Failed to register new device\n"); 158 158 goto out2; 159 159 }
+3 -3
drivers/mtd/devices/pmc551.c
··· 798 798 mtd->writesize = 1; 799 799 mtd->owner = THIS_MODULE; 800 800 801 - if (add_mtd_device(mtd)) { 801 + if (mtd_device_register(mtd, NULL, 0)) { 802 802 printk(KERN_NOTICE "pmc551: Failed to register new device\n"); 803 803 pci_iounmap(PCI_Device, priv->start); 804 804 kfree(mtd->priv); ··· 806 806 break; 807 807 } 808 808 809 - /* Keep a reference as the add_mtd_device worked */ 809 + /* Keep a reference as the mtd_device_register worked */ 810 810 pci_dev_get(PCI_Device); 811 811 812 812 printk(KERN_NOTICE "Registered pmc551 memory device.\n"); ··· 856 856 pci_dev_put(priv->dev); 857 857 858 858 kfree(mtd->priv); 859 - del_mtd_device(mtd); 859 + mtd_device_unregister(mtd); 860 860 kfree(mtd); 861 861 found++; 862 862 }
+2 -2
drivers/mtd/devices/slram.c
··· 210 210 (*curmtd)->mtdinfo->erasesize = SLRAM_BLK_SZ; 211 211 (*curmtd)->mtdinfo->writesize = 1; 212 212 213 - if (add_mtd_device((*curmtd)->mtdinfo)) { 213 + if (mtd_device_register((*curmtd)->mtdinfo, NULL, 0)) { 214 214 E("slram: Failed to register new device\n"); 215 215 iounmap(((slram_priv_t *)(*curmtd)->mtdinfo->priv)->start); 216 216 kfree((*curmtd)->mtdinfo->priv); ··· 231 231 232 232 while (slram_mtdlist) { 233 233 nextitem = slram_mtdlist->next; 234 - del_mtd_device(slram_mtdlist->mtdinfo); 234 + mtd_device_unregister(slram_mtdlist->mtdinfo); 235 235 iounmap(((slram_priv_t *)slram_mtdlist->mtdinfo->priv)->start); 236 236 kfree(slram_mtdlist->mtdinfo->priv); 237 237 kfree(slram_mtdlist->mtdinfo);
+2 -2
drivers/mtd/maps/amd76xrom.c
··· 82 82 if (map->rsrc.parent) { 83 83 release_resource(&map->rsrc); 84 84 } 85 - del_mtd_device(map->mtd); 85 + mtd_device_unregister(map->mtd); 86 86 map_destroy(map->mtd); 87 87 list_del(&map->list); 88 88 kfree(map); ··· 262 262 263 263 /* Now that the mtd devices is complete claim and export it */ 264 264 map->mtd->owner = THIS_MODULE; 265 - if (add_mtd_device(map->mtd)) { 265 + if (mtd_device_register(map->mtd, NULL, 0)) { 266 266 map_destroy(map->mtd); 267 267 map->mtd = NULL; 268 268 goto out;
+2 -2
drivers/mtd/maps/autcpu12-nvram.c
··· 88 88 sram_mtd->owner = THIS_MODULE; 89 89 sram_mtd->erasesize = 16; 90 90 91 - if (add_mtd_device(sram_mtd)) { 91 + if (mtd_device_register(sram_mtd, NULL, 0)) { 92 92 printk("NV-RAM device addition failed\n"); 93 93 err = -ENOMEM; 94 94 goto out_probe; ··· 111 111 static void __exit cleanup_autcpu12_maps(void) 112 112 { 113 113 if (sram_mtd) { 114 - del_mtd_device(sram_mtd); 114 + mtd_device_unregister(sram_mtd); 115 115 map_destroy(sram_mtd); 116 116 iounmap((void *)autcpu12_sram_map.virt); 117 117 }
+3 -3
drivers/mtd/maps/bcm963xx-flash.c
··· 224 224 goto err_probe; 225 225 } 226 226 227 - return add_mtd_partitions(bcm963xx_mtd_info, parsed_parts, 228 - parsed_nr_parts); 227 + return mtd_device_register(bcm963xx_mtd_info, parsed_parts, 228 + parsed_nr_parts); 229 229 230 230 err_probe: 231 231 iounmap(bcm963xx_map.virt); ··· 235 235 static int bcm963xx_remove(struct platform_device *pdev) 236 236 { 237 237 if (bcm963xx_mtd_info) { 238 - del_mtd_partitions(bcm963xx_mtd_info); 238 + mtd_device_unregister(bcm963xx_mtd_info); 239 239 map_destroy(bcm963xx_mtd_info); 240 240 } 241 241
+6 -6
drivers/mtd/maps/cdb89712.c
··· 75 75 76 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 79 printk("FLASH device addition failed\n"); 80 80 err = -ENOMEM; 81 81 goto out_probe; ··· 141 141 sram_mtd->owner = THIS_MODULE; 142 142 sram_mtd->erasesize = 16; 143 143 144 - if (add_mtd_device(sram_mtd)) { 144 + if (mtd_device_register(sram_mtd, NULL, 0)) { 145 145 printk("SRAM device addition failed\n"); 146 146 err = -ENOMEM; 147 147 goto out_probe; ··· 209 209 bootrom_mtd->owner = THIS_MODULE; 210 210 bootrom_mtd->erasesize = 0x10000; 211 211 212 - if (add_mtd_device(bootrom_mtd)) { 212 + if (mtd_device_register(bootrom_mtd, NULL, 0)) { 213 213 printk("BootROM device addition failed\n"); 214 214 err = -ENOMEM; 215 215 goto out_probe; ··· 249 249 static void __exit cleanup_cdb89712_maps(void) 250 250 { 251 251 if (sram_mtd) { 252 - del_mtd_device(sram_mtd); 252 + mtd_device_unregister(sram_mtd); 253 253 map_destroy(sram_mtd); 254 254 iounmap((void *)cdb89712_sram_map.virt); 255 255 release_resource (&cdb89712_sram_resource); 256 256 } 257 257 258 258 if (flash_mtd) { 259 - del_mtd_device(flash_mtd); 259 + mtd_device_unregister(flash_mtd); 260 260 map_destroy(flash_mtd); 261 261 iounmap((void *)cdb89712_flash_map.virt); 262 262 release_resource (&cdb89712_flash_resource); 263 263 } 264 264 265 265 if (bootrom_mtd) { 266 - del_mtd_device(bootrom_mtd); 266 + mtd_device_unregister(bootrom_mtd); 267 267 map_destroy(bootrom_mtd); 268 268 iounmap((void *)cdb89712_bootrom_map.virt); 269 269 release_resource (&cdb89712_bootrom_resource);
+3 -3
drivers/mtd/maps/ceiva.c
··· 224 224 { 225 225 int i; 226 226 227 - del_mtd_partitions(mtd); 227 + mtd_device_unregister(mtd); 228 228 229 229 if (mtd != clps[0].mtd) 230 230 mtd_concat_destroy(mtd); ··· 292 292 if (nr_parts == 0) { 293 293 printk(KERN_NOTICE "clps flash: no partition info " 294 294 "available, registering whole flash\n"); 295 - add_mtd_device(mtd); 295 + mtd_device_register(mtd, NULL, 0); 296 296 } else { 297 297 printk(KERN_NOTICE "clps flash: using %s partition " 298 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 302 /* Always succeeds. */
+2 -2
drivers/mtd/maps/cfi_flagadm.c
··· 107 107 mymtd = do_map_probe("cfi_probe", &flagadm_map); 108 108 if (mymtd) { 109 109 mymtd->owner = THIS_MODULE; 110 - add_mtd_partitions(mymtd, flagadm_parts, PARTITION_COUNT); 110 + mtd_device_register(mymtd, flagadm_parts, PARTITION_COUNT); 111 111 printk(KERN_NOTICE "FlagaDM flash device initialized\n"); 112 112 return 0; 113 113 } ··· 119 119 static void __exit cleanup_flagadm(void) 120 120 { 121 121 if (mymtd) { 122 - del_mtd_partitions(mymtd); 122 + mtd_device_unregister(mymtd); 123 123 map_destroy(mymtd); 124 124 } 125 125 if (flagadm_map.virt) {
+2 -2
drivers/mtd/maps/ck804xrom.c
··· 94 94 if (map->rsrc.parent) 95 95 release_resource(&map->rsrc); 96 96 97 - del_mtd_device(map->mtd); 97 + mtd_device_unregister(map->mtd); 98 98 map_destroy(map->mtd); 99 99 list_del(&map->list); 100 100 kfree(map); ··· 291 291 292 292 /* Now that the mtd devices is complete claim and export it */ 293 293 map->mtd->owner = THIS_MODULE; 294 - if (add_mtd_device(map->mtd)) { 294 + if (mtd_device_register(map->mtd, NULL, 0)) { 295 295 map_destroy(map->mtd); 296 296 map->mtd = NULL; 297 297 goto out;
+2 -2
drivers/mtd/maps/dbox2-flash.c
··· 93 93 mymtd->owner = THIS_MODULE; 94 94 95 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 98 return 0; 99 99 } ··· 105 105 static void __exit cleanup_dbox2_flash(void) 106 106 { 107 107 if (mymtd) { 108 - del_mtd_partitions(mymtd); 108 + mtd_device_unregister(mymtd); 109 109 map_destroy(mymtd); 110 110 } 111 111 if (dbox2_flash_map.virt) {
+5 -4
drivers/mtd/maps/dilnetpc.c
··· 450 450 partition_info[2].mtdp = &lowlvl_parts[1]; 451 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 456 ** now create a virtual MTD device by concatenating the for partitions ··· 463 463 ** we do not supply mtd pointers in higlvl_partition_info, so 464 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 470 return 0; ··· 473 472 static void __exit cleanup_dnpc(void) 474 473 { 475 474 if(merged_mtd) { 476 - del_mtd_partitions(merged_mtd); 475 + mtd_device_unregister(merged_mtd); 477 476 mtd_concat_destroy(merged_mtd); 478 477 } 479 478 480 479 if (mymtd) { 481 - del_mtd_partitions(mymtd); 480 + mtd_device_unregister(mymtd); 482 481 map_destroy(mymtd); 483 482 } 484 483 if (dnpc_map.virt) {
+2 -2
drivers/mtd/maps/dmv182.c
··· 120 120 this_mtd->size >> 20, FLASH_BASE_ADDR); 121 121 122 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 125 return 0; 126 126 } ··· 129 129 { 130 130 if (this_mtd) 131 131 { 132 - del_mtd_partitions(this_mtd); 132 + mtd_device_unregister(this_mtd); 133 133 map_destroy(this_mtd); 134 134 } 135 135
+2 -2
drivers/mtd/maps/esb2rom.c
··· 128 128 list_for_each_entry_safe(map, scratch, &window->maps, list) { 129 129 if (map->rsrc.parent) 130 130 release_resource(&map->rsrc); 131 - del_mtd_device(map->mtd); 131 + mtd_device_unregister(map->mtd); 132 132 map_destroy(map->mtd); 133 133 list_del(&map->list); 134 134 kfree(map); ··· 352 352 353 353 /* Now that the mtd devices is complete claim and export it */ 354 354 map->mtd->owner = THIS_MODULE; 355 - if (add_mtd_device(map->mtd)) { 355 + if (mtd_device_register(map->mtd, NULL, 0)) { 356 356 map_destroy(map->mtd); 357 357 map->mtd = NULL; 358 358 goto out;
+4 -3
drivers/mtd/maps/fortunet.c
··· 243 243 &map_regions[ix].map_info); 244 244 } 245 245 map_regions[ix].mymtd->owner = THIS_MODULE; 246 - add_mtd_partitions(map_regions[ix].mymtd, 247 - map_regions[ix].parts,map_regions_parts[ix]); 246 + mtd_device_register(map_regions[ix].mymtd, 247 + map_regions[ix].parts, 248 + map_regions_parts[ix]); 248 249 } 249 250 } 250 251 if(iy) ··· 262 261 { 263 262 if( map_regions[ix].mymtd ) 264 263 { 265 - del_mtd_partitions( map_regions[ix].mymtd ); 264 + mtd_device_unregister(map_regions[ix].mymtd); 266 265 map_destroy( map_regions[ix].mymtd ); 267 266 } 268 267 iounmap((void *)map_regions[ix].map_info.virt);
+2 -2
drivers/mtd/maps/ichxrom.c
··· 67 67 list_for_each_entry_safe(map, scratch, &window->maps, list) { 68 68 if (map->rsrc.parent) 69 69 release_resource(&map->rsrc); 70 - del_mtd_device(map->mtd); 70 + mtd_device_unregister(map->mtd); 71 71 map_destroy(map->mtd); 72 72 list_del(&map->list); 73 73 kfree(map); ··· 287 287 288 288 /* Now that the mtd devices is complete claim and export it */ 289 289 map->mtd->owner = THIS_MODULE; 290 - if (add_mtd_device(map->mtd)) { 290 + if (mtd_device_register(map->mtd, NULL, 0)) { 291 291 map_destroy(map->mtd); 292 292 map->mtd = NULL; 293 293 goto out;
+3 -3
drivers/mtd/maps/integrator-flash.c
··· 221 221 222 222 err = parse_mtd_partitions(info->mtd, probes, &info->parts, 0); 223 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 225 if (err) 226 226 printk(KERN_ERR 227 227 "mtd partition registration failed: %d\n", err); ··· 237 237 */ 238 238 cleanup: 239 239 if (info->mtd) { 240 - del_mtd_partitions(info->mtd); 240 + mtd_device_unregister(info->mtd); 241 241 if (info->mtd != info->subdev[0].mtd) 242 242 mtd_concat_destroy(info->mtd); 243 243 } ··· 263 263 264 264 if (info) { 265 265 if (info->mtd) { 266 - del_mtd_partitions(info->mtd); 266 + mtd_device_unregister(info->mtd); 267 267 if (info->mtd != info->subdev[0].mtd) 268 268 mtd_concat_destroy(info->mtd); 269 269 }
+2 -2
drivers/mtd/maps/l440gx.c
··· 138 138 if (mymtd) { 139 139 mymtd->owner = THIS_MODULE; 140 140 141 - add_mtd_device(mymtd); 141 + mtd_device_register(mymtd, NULL, 0); 142 142 return 0; 143 143 } 144 144 ··· 148 148 149 149 static void __exit cleanup_l440gx(void) 150 150 { 151 - del_mtd_device(mymtd); 151 + mtd_device_unregister(mymtd); 152 152 map_destroy(mymtd); 153 153 154 154 iounmap(l440gx_map.virt);
+3 -3
drivers/mtd/maps/mbx860.c
··· 69 69 mymtd = do_map_probe("jedec_probe", &mbx_map); 70 70 if (mymtd) { 71 71 mymtd->owner = THIS_MODULE; 72 - add_mtd_device(mymtd); 73 - add_mtd_partitions(mymtd, partition_info, NUM_PARTITIONS); 72 + mtd_device_register(mymtd, NULL, 0); 73 + mtd_device_register(mymtd, partition_info, NUM_PARTITIONS); 74 74 return 0; 75 75 } 76 76 ··· 81 81 static void __exit cleanup_mbx(void) 82 82 { 83 83 if (mymtd) { 84 - del_mtd_device(mymtd); 84 + mtd_device_unregister(mymtd); 85 85 map_destroy(mymtd); 86 86 } 87 87 if (mbx_map.virt) {
+2 -2
drivers/mtd/maps/netsc520.c
··· 116 116 } 117 117 118 118 mymtd->owner = THIS_MODULE; 119 - add_mtd_partitions( mymtd, partition_info, NUM_PARTITIONS ); 119 + mtd_device_register(mymtd, partition_info, NUM_PARTITIONS); 120 120 return 0; 121 121 } 122 122 123 123 static void __exit cleanup_netsc520(void) 124 124 { 125 125 if (mymtd) { 126 - del_mtd_partitions(mymtd); 126 + mtd_device_unregister(mymtd); 127 127 map_destroy(mymtd); 128 128 } 129 129 if (netsc520_map.virt) {
+6 -6
drivers/mtd/maps/nettel.c
··· 383 383 /* No BIOS regions when AMD boot */ 384 384 num_intel_partitions -= 2; 385 385 } 386 - rc = add_mtd_partitions(intel_mtd, nettel_intel_partitions, 387 - num_intel_partitions); 386 + rc = mtd_device_register(intel_mtd, nettel_intel_partitions, 387 + num_intel_partitions); 388 388 #endif 389 389 390 390 if (amd_mtd) { 391 - rc = add_mtd_partitions(amd_mtd, nettel_amd_partitions, 392 - num_amd_partitions); 391 + rc = mtd_device_register(amd_mtd, nettel_amd_partitions, 392 + num_amd_partitions); 393 393 } 394 394 395 395 #ifdef CONFIG_MTD_CFI_INTELEXT ··· 419 419 unregister_reboot_notifier(&nettel_notifier_block); 420 420 #endif 421 421 if (amd_mtd) { 422 - del_mtd_partitions(amd_mtd); 422 + mtd_device_unregister(amd_mtd); 423 423 map_destroy(amd_mtd); 424 424 } 425 425 if (nettel_mmcrp) { ··· 432 432 } 433 433 #ifdef CONFIG_MTD_CFI_INTELEXT 434 434 if (intel_mtd) { 435 - del_mtd_partitions(intel_mtd); 435 + mtd_device_unregister(intel_mtd); 436 436 map_destroy(intel_mtd); 437 437 } 438 438 if (nettel_intel_map.virt) {
+2 -2
drivers/mtd/maps/octagon-5066.c
··· 175 175 int i; 176 176 for (i=0; i<2; i++) { 177 177 if (oct5066_mtd[i]) { 178 - del_mtd_device(oct5066_mtd[i]); 178 + mtd_device_unregister(oct5066_mtd[i]); 179 179 map_destroy(oct5066_mtd[i]); 180 180 } 181 181 } ··· 220 220 oct5066_mtd[i] = do_map_probe("map_rom", &oct5066_map[i]); 221 221 if (oct5066_mtd[i]) { 222 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
+2 -2
drivers/mtd/maps/pci.c
··· 313 313 goto release; 314 314 315 315 mtd->owner = THIS_MODULE; 316 - add_mtd_device(mtd); 316 + mtd_device_register(mtd, NULL, 0); 317 317 318 318 pci_set_drvdata(dev, mtd); 319 319 ··· 336 336 struct mtd_info *mtd = pci_get_drvdata(dev); 337 337 struct map_pci_info *map = mtd->priv; 338 338 339 - del_mtd_device(mtd); 339 + mtd_device_unregister(mtd); 340 340 map_destroy(mtd); 341 341 map->exit(dev, map); 342 342 kfree(map);
+2 -2
drivers/mtd/maps/pcmciamtd.c
··· 630 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 634 map_destroy(mtd); 635 635 dev->mtd_info = NULL; 636 636 dev_err(&dev->p_dev->dev, ··· 669 669 DEBUG(3, "link=0x%p", link); 670 670 671 671 if(dev->mtd_info) { 672 - del_mtd_device(dev->mtd_info); 672 + mtd_device_unregister(dev->mtd_info); 673 673 dev_info(&dev->p_dev->dev, "mtd%d: Removing\n", 674 674 dev->mtd_info->index); 675 675 map_destroy(dev->mtd_info);
+3 -3
drivers/mtd/maps/pmcmsp-flash.c
··· 173 173 msp_flash[i] = do_map_probe("cfi_probe", &msp_maps[i]); 174 174 if (msp_flash[i]) { 175 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 177 } else { 178 178 printk(KERN_ERR "map probe failed for flash\n"); 179 179 ret = -ENXIO; ··· 188 188 189 189 cleanup_loop: 190 190 while (i--) { 191 - del_mtd_partitions(msp_flash[i]); 191 + mtd_device_unregister(msp_flash[i]); 192 192 map_destroy(msp_flash[i]); 193 193 kfree(msp_maps[i].name); 194 194 iounmap(msp_maps[i].virt); ··· 207 207 int i; 208 208 209 209 for (i = 0; i < fcnt; i++) { 210 - del_mtd_partitions(msp_flash[i]); 210 + mtd_device_unregister(msp_flash[i]); 211 211 map_destroy(msp_flash[i]); 212 212 iounmap((void *)msp_maps[i].virt); 213 213
+2 -2
drivers/mtd/maps/rpxlite.c
··· 36 36 mymtd = do_map_probe("cfi_probe", &rpxlite_map); 37 37 if (mymtd) { 38 38 mymtd->owner = THIS_MODULE; 39 - add_mtd_device(mymtd); 39 + mtd_device_register(mymtd, NULL, 0); 40 40 return 0; 41 41 } 42 42 ··· 47 47 static void __exit cleanup_rpxlite(void) 48 48 { 49 49 if (mymtd) { 50 - del_mtd_device(mymtd); 50 + mtd_device_unregister(mymtd); 51 51 map_destroy(mymtd); 52 52 } 53 53 if (rpxlite_map.virt) {
+2 -2
drivers/mtd/maps/sbc_gxx.c
··· 182 182 static void cleanup_sbc_gxx(void) 183 183 { 184 184 if( all_mtd ) { 185 - del_mtd_partitions( all_mtd ); 185 + mtd_device_unregister(all_mtd); 186 186 map_destroy( all_mtd ); 187 187 } 188 188 ··· 223 223 all_mtd->owner = THIS_MODULE; 224 224 225 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 228 return 0; 229 229 }
+4 -4
drivers/mtd/maps/sc520cdp.c
··· 266 266 /* Combine the two flash banks into a single MTD device & register it: */ 267 267 merged_mtd = mtd_concat_create(mymtd, 2, "SC520CDP Flash Banks #0 and #1"); 268 268 if(merged_mtd) 269 - add_mtd_device(merged_mtd); 269 + mtd_device_register(merged_mtd, NULL, 0); 270 270 } 271 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 273 return(devices_found ? 0 : -ENXIO); 274 274 } 275 275 ··· 278 278 int i; 279 279 280 280 if (merged_mtd) { 281 - del_mtd_device(merged_mtd); 281 + mtd_device_unregister(merged_mtd); 282 282 mtd_concat_destroy(merged_mtd); 283 283 } 284 284 if (mymtd[2]) 285 - del_mtd_device(mymtd[2]); 285 + mtd_device_unregister(mymtd[2]); 286 286 287 287 for (i = 0; i < NUM_FLASH_BANKS; i++) { 288 288 if (mymtd[i])
+3 -3
drivers/mtd/maps/scb2_flash.c
··· 180 180 181 181 scb2_mtd->owner = THIS_MODULE; 182 182 if (scb2_fixup_mtd(scb2_mtd) < 0) { 183 - del_mtd_device(scb2_mtd); 183 + mtd_device_unregister(scb2_mtd); 184 184 map_destroy(scb2_mtd); 185 185 iounmap(scb2_ioaddr); 186 186 if (!region_fail) ··· 192 192 (unsigned long long)scb2_mtd->size, 193 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 197 return 0; 198 198 } ··· 207 207 if (scb2_mtd->lock) 208 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 211 map_destroy(scb2_mtd); 212 212 213 213 iounmap(scb2_ioaddr);
+6 -6
drivers/mtd/maps/solutionengine.c
··· 89 89 eprom_mtd = do_map_probe("map_rom", &soleng_eprom_map); 90 90 if (eprom_mtd) { 91 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 95 nr_parts = parse_mtd_partitions(flash_mtd, probes, &parsed_parts, 0); ··· 104 104 #endif /* CONFIG_MTD_SUPERH_RESERVE */ 105 105 106 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 108 else 109 - add_mtd_device(flash_mtd); 109 + mtd_device_register(flash_mtd, NULL, 0); 110 110 111 111 return 0; 112 112 } ··· 114 114 static void __exit cleanup_soleng_maps(void) 115 115 { 116 116 if (eprom_mtd) { 117 - del_mtd_device(eprom_mtd); 117 + mtd_device_unregister(eprom_mtd); 118 118 map_destroy(eprom_mtd); 119 119 } 120 120 121 121 if (parsed_parts) 122 - del_mtd_partitions(flash_mtd); 122 + mtd_device_unregister(flash_mtd); 123 123 else 124 - del_mtd_device(flash_mtd); 124 + mtd_device_unregister(flash_mtd); 125 125 map_destroy(flash_mtd); 126 126 } 127 127
+2 -2
drivers/mtd/maps/sun_uflash.c
··· 101 101 102 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 106 dev_set_drvdata(&op->dev, up); 107 107 ··· 126 126 struct uflash_dev *up = dev_get_drvdata(&op->dev); 127 127 128 128 if (up->mtd) { 129 - del_mtd_device(up->mtd); 129 + mtd_device_unregister(up->mtd); 130 130 map_destroy(up->mtd); 131 131 } 132 132 if (up->map.virt) {
+2 -2
drivers/mtd/maps/ts5500_flash.c
··· 89 89 } 90 90 91 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 94 return 0; 95 95 ··· 102 102 static void __exit cleanup_ts5500_map(void) 103 103 { 104 104 if (mymtd) { 105 - del_mtd_partitions(mymtd); 105 + mtd_device_unregister(mymtd); 106 106 map_destroy(mymtd); 107 107 } 108 108
+2 -2
drivers/mtd/maps/tsunami_flash.c
··· 76 76 struct mtd_info *mtd; 77 77 mtd = tsunami_flash_mtd; 78 78 if (mtd) { 79 - del_mtd_device(mtd); 79 + mtd_device_unregister(mtd); 80 80 map_destroy(mtd); 81 81 } 82 82 tsunami_flash_mtd = 0; ··· 97 97 } 98 98 if (tsunami_flash_mtd) { 99 99 tsunami_flash_mtd->owner = THIS_MODULE; 100 - add_mtd_device(tsunami_flash_mtd); 100 + mtd_device_register(tsunami_flash_mtd, NULL, 0); 101 101 return 0; 102 102 } 103 103 return -ENXIO;
+2 -2
drivers/mtd/maps/vmax301.c
··· 138 138 139 139 for (i=0; i<2; i++) { 140 140 if (vmax_mtd[i]) { 141 - del_mtd_device(vmax_mtd[i]); 141 + mtd_device_unregister(vmax_mtd[i]); 142 142 map_destroy(vmax_mtd[i]); 143 143 } 144 144 } ··· 176 176 vmax_mtd[i] = do_map_probe("map_rom", &vmax_map[i]); 177 177 if (vmax_mtd[i]) { 178 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
+2 -2
drivers/mtd/maps/vmu-flash.c
··· 563 563 goto fail_cache_create; 564 564 part_cur->pcache = pcache; 565 565 566 - error = add_mtd_device(mtd_cur); 566 + error = mtd_device_register(mtd_cur, NULL, 0); 567 567 if (error) 568 568 goto fail_mtd_register; 569 569 ··· 709 709 for (x = 0; x < card->partitions; x++) { 710 710 mpart = ((card->mtd)[x]).priv; 711 711 mpart->mdev = NULL; 712 - del_mtd_device(&((card->mtd)[x])); 712 + mtd_device_unregister(&((card->mtd)[x])); 713 713 kfree(((card->parts)[x]).name); 714 714 } 715 715 kfree(card->parts);
+9 -6
drivers/mtd/maps/wr_sbc82xx_flash.c
··· 132 132 nr_parts = parse_mtd_partitions(sbcmtd[i], part_probes, 133 133 &sbcmtd_parts[i], 0); 134 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 137 continue; 137 138 } 138 139 139 140 /* No partitioning detected. Use default */ 140 141 if (i == 2) { 141 - add_mtd_device(sbcmtd[i]); 142 + mtd_device_register(sbcmtd[i], NULL, 0); 142 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 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 151 return 0; ··· 160 157 continue; 161 158 162 159 if (i<2 || sbcmtd_parts[i]) 163 - del_mtd_partitions(sbcmtd[i]); 160 + mtd_device_unregister(sbcmtd[i]); 164 161 else 165 - del_mtd_device(sbcmtd[i]); 162 + mtd_device_unregister(sbcmtd[i]); 166 163 167 164 kfree(sbcmtd_parts[i]); 168 165 map_destroy(sbcmtd[i]);
+2 -2
drivers/mtd/nand/alauda.c
··· 120 120 struct alauda *al = container_of(kref, struct alauda, kref); 121 121 122 122 if (al->mtd) { 123 - del_mtd_device(al->mtd); 123 + mtd_device_unregister(al->mtd); 124 124 kfree(al->mtd); 125 125 } 126 126 usb_put_dev(al->dev); ··· 592 592 mtd->priv = al; 593 593 mtd->owner = THIS_MODULE; 594 594 595 - err = add_mtd_device(mtd); 595 + err = mtd_device_register(mtd, NULL, 0); 596 596 if (err) { 597 597 err = -ENFILE; 598 598 goto error;
+2 -2
drivers/mtd/nand/ams-delta.c
··· 235 235 } 236 236 237 237 /* Register the partitions */ 238 - add_mtd_partitions(ams_delta_mtd, partition_info, 239 - ARRAY_SIZE(partition_info)); 238 + mtd_device_register(ams_delta_mtd, partition_info, 239 + ARRAY_SIZE(partition_info)); 240 240 241 241 goto out; 242 242
+2 -1
drivers/mtd/nand/au1550nd.c
··· 580 580 } 581 581 582 582 /* Register the partitions */ 583 - add_mtd_partitions(au1550_mtd, partition_info, ARRAY_SIZE(partition_info)); 583 + mtd_device_register(au1550_mtd, partition_info, 584 + ARRAY_SIZE(partition_info)); 584 585 585 586 return 0; 586 587
+8 -8
drivers/mtd/nand/autcpu12.c
··· 185 185 /* Register the partitions */ 186 186 switch (autcpu12_mtd->size) { 187 187 case SZ_16M: 188 - add_mtd_partitions(autcpu12_mtd, partition_info16k, 189 - NUM_PARTITIONS16K); 188 + mtd_device_register(autcpu12_mtd, partition_info16k, 189 + NUM_PARTITIONS16K); 190 190 break; 191 191 case SZ_32M: 192 - add_mtd_partitions(autcpu12_mtd, partition_info32k, 193 - NUM_PARTITIONS32K); 192 + mtd_device_register(autcpu12_mtd, partition_info32k, 193 + NUM_PARTITIONS32K); 194 194 break; 195 195 case SZ_64M: 196 - add_mtd_partitions(autcpu12_mtd, partition_info64k, 197 - NUM_PARTITIONS64K); 196 + mtd_device_register(autcpu12_mtd, partition_info64k, 197 + NUM_PARTITIONS64K); 198 198 break; 199 199 case SZ_128M: 200 - add_mtd_partitions(autcpu12_mtd, partition_info128k, 201 - NUM_PARTITIONS128K); 200 + mtd_device_register(autcpu12_mtd, partition_info128k, 201 + NUM_PARTITIONS128K); 202 202 break; 203 203 default: 204 204 printk("Unsupported SmartMedia device\n");
+1 -1
drivers/mtd/nand/cmx270_nand.c
··· 238 238 239 239 /* Register the partitions */ 240 240 pr_notice("Using %s partition definition\n", part_type); 241 - ret = add_mtd_partitions(cmx270_nand_mtd, mtd_parts, mtd_parts_nb); 241 + ret = mtd_device_register(cmx270_nand_mtd, mtd_parts, mtd_parts_nb); 242 242 if (ret) 243 243 goto err_scan; 244 244
+2 -2
drivers/mtd/nand/denali.c
··· 1644 1644 goto failed_req_irq; 1645 1645 } 1646 1646 1647 - ret = add_mtd_device(&denali->mtd); 1647 + ret = mtd_device_register(&denali->mtd, NULL, 0); 1648 1648 if (ret) { 1649 1649 dev_err(&dev->dev, "Spectra: Failed to register MTD: %d\n", 1650 1650 ret); ··· 1676 1676 struct denali_nand_info *denali = pci_get_drvdata(dev); 1677 1677 1678 1678 nand_release(&denali->mtd); 1679 - del_mtd_device(&denali->mtd); 1679 + mtd_device_unregister(&denali->mtd); 1680 1680 1681 1681 denali_irq_cleanup(dev->irq, denali); 1682 1682
+2 -2
drivers/mtd/nand/gpio.c
··· 316 316 gpiomtd->plat.adjust_parts(&gpiomtd->plat, 317 317 gpiomtd->mtd_info.size); 318 318 319 - add_mtd_partitions(&gpiomtd->mtd_info, gpiomtd->plat.parts, 320 - gpiomtd->plat.num_parts); 319 + mtd_device_register(&gpiomtd->mtd_info, gpiomtd->plat.parts, 320 + gpiomtd->plat.num_parts); 321 321 platform_set_drvdata(dev, gpiomtd); 322 322 323 323 return 0;
+3 -1
drivers/mtd/nand/nandsim.c
··· 2383 2383 goto err_exit; 2384 2384 2385 2385 /* Register NAND partitions */ 2386 - if ((retval = add_mtd_partitions(nsmtd, &nand->partitions[0], nand->nbparts)) != 0) 2386 + retval = mtd_device_register(nsmtd, &nand->partitions[0], 2387 + nand->nbparts); 2388 + if (retval != 0) 2387 2389 goto err_exit; 2388 2390 2389 2391 return 0;
+2 -2
drivers/mtd/nand/nuc900_nand.c
··· 321 321 goto fail3; 322 322 } 323 323 324 - add_mtd_partitions(&(nuc900_nand->mtd), partitions, 325 - ARRAY_SIZE(partitions)); 324 + mtd_device_register(&(nuc900_nand->mtd), partitions, 325 + ARRAY_SIZE(partitions)); 326 326 327 327 platform_set_drvdata(pdev, nuc900_nand); 328 328
+1 -1
drivers/mtd/nand/pasemi_nand.c
··· 163 163 goto out_lpc; 164 164 } 165 165 166 - if (add_mtd_device(pasemi_nand_mtd)) { 166 + if (mtd_device_register(pasemi_nand_mtd, NULL, 0)) { 167 167 printk(KERN_ERR "pasemi_nand: Unable to register MTD device\n"); 168 168 err = -ENODEV; 169 169 goto out_lpc;
+2 -1
drivers/mtd/nand/rtc_from4.c
··· 580 580 #endif 581 581 582 582 /* Register the partitions */ 583 - ret = add_mtd_partitions(rtc_from4_mtd, partition_info, NUM_PARTITIONS); 583 + ret = mtd_device_register(rtc_from4_mtd, partition_info, 584 + NUM_PARTITIONS); 584 585 if (ret) 585 586 goto err_3; 586 587
+1 -1
drivers/mtd/nand/sh_flctl.c
··· 867 867 if (ret) 868 868 goto err; 869 869 870 - add_mtd_partitions(flctl_mtd, pdata->parts, pdata->nr_parts); 870 + mtd_device_register(flctl_mtd, pdata->parts, pdata->nr_parts); 871 871 872 872 return 0; 873 873
+1 -1
drivers/mtd/nand/sm_common.c
··· 139 139 if (ret) 140 140 return ret; 141 141 142 - return add_mtd_device(mtd); 142 + return mtd_device_register(mtd, NULL, 0); 143 143 } 144 144 EXPORT_SYMBOL_GPL(sm_register_device); 145 145
+1 -1
drivers/mtd/nand/spia.c
··· 149 149 } 150 150 151 151 /* Register the partitions */ 152 - add_mtd_partitions(spia_mtd, partition_info, NUM_PARTITIONS); 152 + mtd_device_register(spia_mtd, partition_info, NUM_PARTITIONS); 153 153 154 154 /* Return happy */ 155 155 return 0;
+2 -1
drivers/mtd/onenand/onenand_sim.c
··· 539 539 return -ENXIO; 540 540 } 541 541 542 - add_mtd_partitions(&info->mtd, info->parts, ARRAY_SIZE(os_partitions)); 542 + mtd_device_register(&info->mtd, info->parts, 543 + ARRAY_SIZE(os_partitions)); 543 544 544 545 return 0; 545 546 }
+3 -3
drivers/mtd/ubi/gluebi.c
··· 365 365 vi->vol_id); 366 366 mutex_unlock(&devices_mutex); 367 367 368 - if (add_mtd_device(mtd)) { 368 + if (mtd_device_register(mtd, NULL, 0)) { 369 369 err_msg("cannot add MTD device"); 370 370 kfree(mtd->name); 371 371 kfree(gluebi); ··· 407 407 return err; 408 408 409 409 mtd = &gluebi->mtd; 410 - err = del_mtd_device(mtd); 410 + err = mtd_device_unregister(mtd); 411 411 if (err) { 412 412 err_msg("cannot remove fake MTD device %d, UBI device %d, " 413 413 "volume %d, error %d", mtd->index, gluebi->ubi_num, ··· 524 524 int err; 525 525 struct mtd_info *mtd = &gluebi->mtd; 526 526 527 - err = del_mtd_device(mtd); 527 + err = mtd_device_unregister(mtd); 528 528 if (err) 529 529 err_msg("error %d while removing gluebi MTD device %d, " 530 530 "UBI device %d, volume %d - ignoring", err,
+3 -3
drivers/net/sfc/mtd.c
··· 216 216 int rc; 217 217 218 218 for (;;) { 219 - rc = del_mtd_device(&part->mtd); 219 + rc = mtd_device_unregister(&part->mtd); 220 220 if (rc != -EBUSY) 221 221 break; 222 222 ssleep(1); ··· 268 268 part->mtd.write = efx_mtd->ops->write; 269 269 part->mtd.sync = efx_mtd_sync; 270 270 271 - if (add_mtd_device(&part->mtd)) 271 + if (mtd_device_register(&part->mtd, NULL, 0)) 272 272 goto fail; 273 273 } 274 274 ··· 280 280 --part; 281 281 efx_mtd_remove_partition(part); 282 282 } 283 - /* add_mtd_device() returns 1 if the MTD table is full */ 283 + /* mtd_device_register() returns 1 if the MTD table is full */ 284 284 return -ENOMEM; 285 285 } 286 286