Skip to content

Commit ee0e87b

Browse files
jamieilesDavid Woodhouse
authored andcommitted
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>
1 parent 6b57c11 commit ee0e87b

60 files changed

Lines changed: 160 additions & 150 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎drivers/mtd/devices/block2mtd.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ static struct block2mtd_dev *add_device(char *devname, int erase_size)
294294
dev->mtd.priv = dev;
295295
dev->mtd.owner = THIS_MODULE;
296296

297-
if (add_mtd_device(&dev->mtd)) {
297+
if (mtd_device_register(&dev->mtd, NULL, 0)) {
298298
/* Device didn't get added, so free the entry */
299299
goto devinit_err;
300300
}
@@ -465,7 +465,7 @@ static void __devexit block2mtd_exit(void)
465465
list_for_each_safe(pos, next, &blkmtd_device_list) {
466466
struct block2mtd_dev *dev = list_entry(pos, typeof(*dev), list);
467467
block2mtd_sync(&dev->mtd);
468-
del_mtd_device(&dev->mtd);
468+
mtd_device_unregister(&dev->mtd);
469469
INFO("mtd%d: [%s] removed", dev->mtd.index,
470470
dev->mtd.name + strlen("block2mtd: "));
471471
list_del(&dev->list);

‎drivers/mtd/devices/doc2000.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ void DoC2k_init(struct mtd_info *mtd)
597597
doc2klist = mtd;
598598
mtd->size = this->totlen;
599599
mtd->erasesize = this->erasesize;
600-
add_mtd_device(mtd);
600+
mtd_device_register(mtd, NULL, 0);
601601
return;
602602
}
603603
}
@@ -1185,7 +1185,7 @@ static void __exit cleanup_doc2000(void)
11851185
this = mtd->priv;
11861186
doc2klist = this->nextdoc;
11871187

1188-
del_mtd_device(mtd);
1188+
mtd_device_unregister(mtd);
11891189

11901190
iounmap(this->virtadr);
11911191
kfree(this->chips);

‎drivers/mtd/devices/doc2001.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ void DoCMil_init(struct mtd_info *mtd)
376376
this->nextdoc = docmillist;
377377
docmillist = mtd;
378378
mtd->size = this->totlen;
379-
add_mtd_device(mtd);
379+
mtd_device_register(mtd, NULL, 0);
380380
return;
381381
}
382382
}
@@ -826,7 +826,7 @@ static void __exit cleanup_doc2001(void)
826826
this = mtd->priv;
827827
docmillist = this->nextdoc;
828828

829-
del_mtd_device(mtd);
829+
mtd_device_unregister(mtd);
830830

831831
iounmap(this->virtadr);
832832
kfree(this->chips);

‎drivers/mtd/devices/doc2001plus.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ void DoCMilPlus_init(struct mtd_info *mtd)
499499
docmilpluslist = mtd;
500500
mtd->size = this->totlen;
501501
mtd->erasesize = this->erasesize;
502-
add_mtd_device(mtd);
502+
mtd_device_register(mtd, NULL, 0);
503503
return;
504504
}
505505
}
@@ -1091,7 +1091,7 @@ static void __exit cleanup_doc2001plus(void)
10911091
this = mtd->priv;
10921092
docmilpluslist = this->nextdoc;
10931093

1094-
del_mtd_device(mtd);
1094+
mtd_device_unregister(mtd);
10951095

10961096
iounmap(this->virtadr);
10971097
kfree(this->chips);

‎drivers/mtd/devices/lart.c‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -684,9 +684,10 @@ static int __init lart_flash_init (void)
684684
#endif
685685

686686
#ifndef HAVE_PARTITIONS
687-
result = add_mtd_device (&mtd);
687+
result = mtd_device_register(&mtd, NULL, 0);
688688
#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));
690691
#endif
691692

692693
return (result);
@@ -695,9 +696,9 @@ static int __init lart_flash_init (void)
695696
static void __exit lart_flash_exit (void)
696697
{
697698
#ifndef HAVE_PARTITIONS
698-
del_mtd_device (&mtd);
699+
mtd_device_unregister(&mtd);
699700
#else
700-
del_mtd_partitions (&mtd);
701+
mtd_device_unregister(&mtd);
701702
#endif
702703
}
703704

‎drivers/mtd/devices/ms02-nv.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ static int __init ms02nv_init_one(ulong addr)
220220
mtd->writesize = 1;
221221

222222
ret = -EIO;
223-
if (add_mtd_device(mtd)) {
223+
if (mtd_device_register(mtd, NULL, 0)) {
224224
printk(KERN_ERR
225225
"ms02-nv: Unable to register MTD device, aborting!\n");
226226
goto err_out_csr_res;
@@ -262,7 +262,7 @@ static void __exit ms02nv_remove_one(void)
262262

263263
root_ms02nv_mtd = mp->next;
264264

265-
del_mtd_device(mtd);
265+
mtd_device_unregister(mtd);
266266

267267
release_resource(mp->resource.csr);
268268
kfree(mp->resource.csr);

‎drivers/mtd/devices/mtdram.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ static int ram_write(struct mtd_info *mtd, loff_t to, size_t len,
104104
static void __exit cleanup_mtdram(void)
105105
{
106106
if (mtd_info) {
107-
del_mtd_device(mtd_info);
107+
mtd_device_unregister(mtd_info);
108108
vfree(mtd_info->priv);
109109
kfree(mtd_info);
110110
}
@@ -133,9 +133,8 @@ int mtdram_init_device(struct mtd_info *mtd, void *mapped_address,
133133
mtd->read = ram_read;
134134
mtd->write = ram_write;
135135

136-
if (add_mtd_device(mtd)) {
136+
if (mtd_device_register(mtd, NULL, 0))
137137
return -EIO;
138-
}
139138

140139
return 0;
141140
}

‎drivers/mtd/devices/phram.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ static void unregister_devices(void)
115115
struct phram_mtd_list *this, *safe;
116116

117117
list_for_each_entry_safe(this, safe, &phram_list, list) {
118-
del_mtd_device(&this->mtd);
118+
mtd_device_unregister(&this->mtd);
119119
iounmap(this->mtd.priv);
120120
kfree(this->mtd.name);
121121
kfree(this);
@@ -153,7 +153,7 @@ static int register_device(char *name, unsigned long start, unsigned long len)
153153
new->mtd.writesize = 1;
154154

155155
ret = -EAGAIN;
156-
if (add_mtd_device(&new->mtd)) {
156+
if (mtd_device_register(&new->mtd, NULL, 0)) {
157157
pr_err("Failed to register new device\n");
158158
goto out2;
159159
}

‎drivers/mtd/devices/pmc551.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -798,15 +798,15 @@ static int __init init_pmc551(void)
798798
mtd->writesize = 1;
799799
mtd->owner = THIS_MODULE;
800800

801-
if (add_mtd_device(mtd)) {
801+
if (mtd_device_register(mtd, NULL, 0)) {
802802
printk(KERN_NOTICE "pmc551: Failed to register new device\n");
803803
pci_iounmap(PCI_Device, priv->start);
804804
kfree(mtd->priv);
805805
kfree(mtd);
806806
break;
807807
}
808808

809-
/* Keep a reference as the add_mtd_device worked */
809+
/* Keep a reference as the mtd_device_register worked */
810810
pci_dev_get(PCI_Device);
811811

812812
printk(KERN_NOTICE "Registered pmc551 memory device.\n");
@@ -856,7 +856,7 @@ static void __exit cleanup_pmc551(void)
856856
pci_dev_put(priv->dev);
857857

858858
kfree(mtd->priv);
859-
del_mtd_device(mtd);
859+
mtd_device_unregister(mtd);
860860
kfree(mtd);
861861
found++;
862862
}

‎drivers/mtd/devices/slram.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ static int register_device(char *name, unsigned long start, unsigned long length
210210
(*curmtd)->mtdinfo->erasesize = SLRAM_BLK_SZ;
211211
(*curmtd)->mtdinfo->writesize = 1;
212212

213-
if (add_mtd_device((*curmtd)->mtdinfo)) {
213+
if (mtd_device_register((*curmtd)->mtdinfo, NULL, 0)) {
214214
E("slram: Failed to register new device\n");
215215
iounmap(((slram_priv_t *)(*curmtd)->mtdinfo->priv)->start);
216216
kfree((*curmtd)->mtdinfo->priv);
@@ -231,7 +231,7 @@ static void unregister_devices(void)
231231

232232
while (slram_mtdlist) {
233233
nextitem = slram_mtdlist->next;
234-
del_mtd_device(slram_mtdlist->mtdinfo);
234+
mtd_device_unregister(slram_mtdlist->mtdinfo);
235235
iounmap(((slram_priv_t *)slram_mtdlist->mtdinfo->priv)->start);
236236
kfree(slram_mtdlist->mtdinfo->priv);
237237
kfree(slram_mtdlist->mtdinfo);

0 commit comments

Comments
 (0)