diff options
author | Ming Lei <tom.leiming@gmail.com> | 2009-02-06 10:40:12 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-03-24 19:38:25 -0400 |
commit | 7a192ec334cab9fafe3a8665a65af398b0e24730 (patch) | |
tree | eea572863500f94d446cfded69835e188dba3447 /drivers | |
parent | 6da2d377bba06c29d0bc41c8dee014164dec82a7 (diff) |
platform driver: fix incorrect use of 'platform_bus_type' with 'struct device_driver'
This patch fixes the bug reported in
http://bugzilla.kernel.org/show_bug.cgi?id=11681.
"Lots of device drivers register a 'struct device_driver' with
the '.bus' member set to '&platform_bus_type'. This is wrong,
since the platform_bus functions expect the 'struct device_driver'
to be wrapped up in a 'struct platform_driver' which provides
some additional callbacks (like suspend_late, resume_early).
The effect may be that platform_suspend_late() uses bogus data
outside the device_driver struct as a pointer pointer to the
device driver's suspend_late() function or other hard to
reproduce failures."(Lothar Wassmann)
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/char/tpm/tpm_atmel.c | 28 | ||||
-rw-r--r-- | drivers/char/tpm/tpm_tis.c | 28 | ||||
-rw-r--r-- | drivers/ide/au1xxx-ide.c | 36 | ||||
-rw-r--r-- | drivers/mtd/maps/pxa2xx-flash.c | 37 | ||||
-rw-r--r-- | drivers/mtd/nand/excite_nandflash.c | 25 | ||||
-rw-r--r-- | drivers/mtd/onenand/generic.c | 26 | ||||
-rw-r--r-- | drivers/net/mipsnet.c | 26 | ||||
-rw-r--r-- | drivers/pcmcia/au1000_generic.c | 37 | ||||
-rw-r--r-- | drivers/pcmcia/i82365.c | 28 | ||||
-rw-r--r-- | drivers/pcmcia/m32r_cfc.c | 30 | ||||
-rw-r--r-- | drivers/pcmcia/m32r_pcc.c | 30 | ||||
-rw-r--r-- | drivers/pcmcia/sa1100_generic.c | 38 | ||||
-rw-r--r-- | drivers/pcmcia/tcic.c | 30 | ||||
-rw-r--r-- | drivers/pcmcia/vrc4171_card.c | 34 | ||||
-rw-r--r-- | drivers/scsi/a4000t.c | 26 | ||||
-rw-r--r-- | drivers/scsi/bvme6000_scsi.c | 26 | ||||
-rw-r--r-- | drivers/scsi/mvme16x_scsi.c | 26 | ||||
-rw-r--r-- | drivers/video/au1100fb.c | 31 | ||||
-rw-r--r-- | drivers/video/au1200fb.c | 25 | ||||
-rw-r--r-- | drivers/watchdog/rm9k_wdt.c | 27 |
20 files changed, 358 insertions, 236 deletions
diff --git a/drivers/char/tpm/tpm_atmel.c b/drivers/char/tpm/tpm_atmel.c index d0e7926eb486..c64a1bc65349 100644 --- a/drivers/char/tpm/tpm_atmel.c +++ b/drivers/char/tpm/tpm_atmel.c | |||
@@ -168,12 +168,22 @@ static void atml_plat_remove(void) | |||
168 | } | 168 | } |
169 | } | 169 | } |
170 | 170 | ||
171 | static struct device_driver atml_drv = { | 171 | static int tpm_atml_suspend(struct platform_device *dev, pm_message_t msg) |
172 | .name = "tpm_atmel", | 172 | { |
173 | .bus = &platform_bus_type, | 173 | return tpm_pm_suspend(&dev->dev, msg); |
174 | .owner = THIS_MODULE, | 174 | } |
175 | .suspend = tpm_pm_suspend, | 175 | |
176 | .resume = tpm_pm_resume, | 176 | static int tpm_atml_resume(struct platform_device *dev) |
177 | { | ||
178 | return tpm_pm_resume(&dev->dev); | ||
179 | } | ||
180 | static struct platform_driver atml_drv = { | ||
181 | .driver = { | ||
182 | .name = "tpm_atmel", | ||
183 | .owner = THIS_MODULE, | ||
184 | }, | ||
185 | .suspend = tpm_atml_suspend, | ||
186 | .resume = tpm_atml_resume, | ||
177 | }; | 187 | }; |
178 | 188 | ||
179 | static int __init init_atmel(void) | 189 | static int __init init_atmel(void) |
@@ -184,7 +194,7 @@ static int __init init_atmel(void) | |||
184 | unsigned long base; | 194 | unsigned long base; |
185 | struct tpm_chip *chip; | 195 | struct tpm_chip *chip; |
186 | 196 | ||
187 | rc = driver_register(&atml_drv); | 197 | rc = platform_driver_register(&atml_drv); |
188 | if (rc) | 198 | if (rc) |
189 | return rc; | 199 | return rc; |
190 | 200 | ||
@@ -223,13 +233,13 @@ err_rel_reg: | |||
223 | atmel_release_region(base, | 233 | atmel_release_region(base, |
224 | region_size); | 234 | region_size); |
225 | err_unreg_drv: | 235 | err_unreg_drv: |
226 | driver_unregister(&atml_drv); | 236 | platform_driver_unregister(&atml_drv); |
227 | return rc; | 237 | return rc; |
228 | } | 238 | } |
229 | 239 | ||
230 | static void __exit cleanup_atmel(void) | 240 | static void __exit cleanup_atmel(void) |
231 | { | 241 | { |
232 | driver_unregister(&atml_drv); | 242 | platform_driver_unregister(&atml_drv); |
233 | atml_plat_remove(); | 243 | atml_plat_remove(); |
234 | } | 244 | } |
235 | 245 | ||
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c index 717af7ad1bdf..aec1931608aa 100644 --- a/drivers/char/tpm/tpm_tis.c +++ b/drivers/char/tpm/tpm_tis.c | |||
@@ -654,12 +654,22 @@ module_param_string(hid, tpm_pnp_tbl[TIS_HID_USR_IDX].id, | |||
654 | sizeof(tpm_pnp_tbl[TIS_HID_USR_IDX].id), 0444); | 654 | sizeof(tpm_pnp_tbl[TIS_HID_USR_IDX].id), 0444); |
655 | MODULE_PARM_DESC(hid, "Set additional specific HID for this driver to probe"); | 655 | MODULE_PARM_DESC(hid, "Set additional specific HID for this driver to probe"); |
656 | 656 | ||
657 | static struct device_driver tis_drv = { | 657 | static int tpm_tis_suspend(struct platform_device *dev, pm_message_t msg) |
658 | .name = "tpm_tis", | 658 | { |
659 | .bus = &platform_bus_type, | 659 | return tpm_pm_suspend(&dev->dev, msg); |
660 | .owner = THIS_MODULE, | 660 | } |
661 | .suspend = tpm_pm_suspend, | 661 | |
662 | .resume = tpm_pm_resume, | 662 | static int tpm_tis_resume(struct platform_device *dev) |
663 | { | ||
664 | return tpm_pm_resume(&dev->dev); | ||
665 | } | ||
666 | static struct platform_driver tis_drv = { | ||
667 | .driver = { | ||
668 | .name = "tpm_tis", | ||
669 | .owner = THIS_MODULE, | ||
670 | }, | ||
671 | .suspend = tpm_tis_suspend, | ||
672 | .resume = tpm_tis_resume, | ||
663 | }; | 673 | }; |
664 | 674 | ||
665 | static struct platform_device *pdev; | 675 | static struct platform_device *pdev; |
@@ -672,14 +682,14 @@ static int __init init_tis(void) | |||
672 | int rc; | 682 | int rc; |
673 | 683 | ||
674 | if (force) { | 684 | if (force) { |
675 | rc = driver_register(&tis_drv); | 685 | rc = platform_driver_register(&tis_drv); |
676 | if (rc < 0) | 686 | if (rc < 0) |
677 | return rc; | 687 | return rc; |
678 | if (IS_ERR(pdev=platform_device_register_simple("tpm_tis", -1, NULL, 0))) | 688 | if (IS_ERR(pdev=platform_device_register_simple("tpm_tis", -1, NULL, 0))) |
679 | return PTR_ERR(pdev); | 689 | return PTR_ERR(pdev); |
680 | if((rc=tpm_tis_init(&pdev->dev, TIS_MEM_BASE, TIS_MEM_LEN, 0)) != 0) { | 690 | if((rc=tpm_tis_init(&pdev->dev, TIS_MEM_BASE, TIS_MEM_LEN, 0)) != 0) { |
681 | platform_device_unregister(pdev); | 691 | platform_device_unregister(pdev); |
682 | driver_unregister(&tis_drv); | 692 | platform_driver_unregister(&tis_drv); |
683 | } | 693 | } |
684 | return rc; | 694 | return rc; |
685 | } | 695 | } |
@@ -711,7 +721,7 @@ static void __exit cleanup_tis(void) | |||
711 | 721 | ||
712 | if (force) { | 722 | if (force) { |
713 | platform_device_unregister(pdev); | 723 | platform_device_unregister(pdev); |
714 | driver_unregister(&tis_drv); | 724 | platform_driver_unregister(&tis_drv); |
715 | } else | 725 | } else |
716 | pnp_unregister_driver(&tis_pnp_driver); | 726 | pnp_unregister_driver(&tis_pnp_driver); |
717 | } | 727 | } |
diff --git a/drivers/ide/au1xxx-ide.c b/drivers/ide/au1xxx-ide.c index 79a2dfed8eb7..154ec2cf734f 100644 --- a/drivers/ide/au1xxx-ide.c +++ b/drivers/ide/au1xxx-ide.c | |||
@@ -536,9 +536,8 @@ static const struct ide_port_info au1xxx_port_info = { | |||
536 | #endif | 536 | #endif |
537 | }; | 537 | }; |
538 | 538 | ||
539 | static int au_ide_probe(struct device *dev) | 539 | static int au_ide_probe(struct platform_device *dev) |
540 | { | 540 | { |
541 | struct platform_device *pdev = to_platform_device(dev); | ||
542 | _auide_hwif *ahwif = &auide_hwif; | 541 | _auide_hwif *ahwif = &auide_hwif; |
543 | struct resource *res; | 542 | struct resource *res; |
544 | struct ide_host *host; | 543 | struct ide_host *host; |
@@ -552,23 +551,23 @@ static int au_ide_probe(struct device *dev) | |||
552 | #endif | 551 | #endif |
553 | 552 | ||
554 | memset(&auide_hwif, 0, sizeof(_auide_hwif)); | 553 | memset(&auide_hwif, 0, sizeof(_auide_hwif)); |
555 | ahwif->irq = platform_get_irq(pdev, 0); | 554 | ahwif->irq = platform_get_irq(dev, 0); |
556 | 555 | ||
557 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 556 | res = platform_get_resource(dev, IORESOURCE_MEM, 0); |
558 | 557 | ||
559 | if (res == NULL) { | 558 | if (res == NULL) { |
560 | pr_debug("%s %d: no base address\n", DRV_NAME, pdev->id); | 559 | pr_debug("%s %d: no base address\n", DRV_NAME, dev->id); |
561 | ret = -ENODEV; | 560 | ret = -ENODEV; |
562 | goto out; | 561 | goto out; |
563 | } | 562 | } |
564 | if (ahwif->irq < 0) { | 563 | if (ahwif->irq < 0) { |
565 | pr_debug("%s %d: no IRQ\n", DRV_NAME, pdev->id); | 564 | pr_debug("%s %d: no IRQ\n", DRV_NAME, dev->id); |
566 | ret = -ENODEV; | 565 | ret = -ENODEV; |
567 | goto out; | 566 | goto out; |
568 | } | 567 | } |
569 | 568 | ||
570 | if (!request_mem_region(res->start, res->end - res->start + 1, | 569 | if (!request_mem_region(res->start, res->end - res->start + 1, |
571 | pdev->name)) { | 570 | dev->name)) { |
572 | pr_debug("%s: request_mem_region failed\n", DRV_NAME); | 571 | pr_debug("%s: request_mem_region failed\n", DRV_NAME); |
573 | ret = -EBUSY; | 572 | ret = -EBUSY; |
574 | goto out; | 573 | goto out; |
@@ -583,7 +582,7 @@ static int au_ide_probe(struct device *dev) | |||
583 | memset(&hw, 0, sizeof(hw)); | 582 | memset(&hw, 0, sizeof(hw)); |
584 | auide_setup_ports(&hw, ahwif); | 583 | auide_setup_ports(&hw, ahwif); |
585 | hw.irq = ahwif->irq; | 584 | hw.irq = ahwif->irq; |
586 | hw.dev = dev; | 585 | hw.dev = &dev->dev; |
587 | hw.chipset = ide_au1xxx; | 586 | hw.chipset = ide_au1xxx; |
588 | 587 | ||
589 | ret = ide_host_add(&au1xxx_port_info, hws, &host); | 588 | ret = ide_host_add(&au1xxx_port_info, hws, &host); |
@@ -592,7 +591,7 @@ static int au_ide_probe(struct device *dev) | |||
592 | 591 | ||
593 | auide_hwif.hwif = host->ports[0]; | 592 | auide_hwif.hwif = host->ports[0]; |
594 | 593 | ||
595 | dev_set_drvdata(dev, host); | 594 | platform_set_drvdata(dev, host); |
596 | 595 | ||
597 | printk(KERN_INFO "Au1xxx IDE(builtin) configured for %s\n", mode ); | 596 | printk(KERN_INFO "Au1xxx IDE(builtin) configured for %s\n", mode ); |
598 | 597 | ||
@@ -600,38 +599,39 @@ static int au_ide_probe(struct device *dev) | |||
600 | return ret; | 599 | return ret; |
601 | } | 600 | } |
602 | 601 | ||
603 | static int au_ide_remove(struct device *dev) | 602 | static int au_ide_remove(struct platform_device *dev) |
604 | { | 603 | { |
605 | struct platform_device *pdev = to_platform_device(dev); | ||
606 | struct resource *res; | 604 | struct resource *res; |
607 | struct ide_host *host = dev_get_drvdata(dev); | 605 | struct ide_host *host = platform_get_drvdata(dev); |
608 | _auide_hwif *ahwif = &auide_hwif; | 606 | _auide_hwif *ahwif = &auide_hwif; |
609 | 607 | ||
610 | ide_host_remove(host); | 608 | ide_host_remove(host); |
611 | 609 | ||
612 | iounmap((void *)ahwif->regbase); | 610 | iounmap((void *)ahwif->regbase); |
613 | 611 | ||
614 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 612 | res = platform_get_resource(dev, IORESOURCE_MEM, 0); |
615 | release_mem_region(res->start, res->end - res->start + 1); | 613 | release_mem_region(res->start, res->end - res->start + 1); |
616 | 614 | ||
617 | return 0; | 615 | return 0; |
618 | } | 616 | } |
619 | 617 | ||
620 | static struct device_driver au1200_ide_driver = { | 618 | static struct platform_driver au1200_ide_driver = { |
621 | .name = "au1200-ide", | 619 | .driver = { |
622 | .bus = &platform_bus_type, | 620 | .name = "au1200-ide", |
621 | .owner = THIS_MODULE, | ||
622 | }, | ||
623 | .probe = au_ide_probe, | 623 | .probe = au_ide_probe, |
624 | .remove = au_ide_remove, | 624 | .remove = au_ide_remove, |
625 | }; | 625 | }; |
626 | 626 | ||
627 | static int __init au_ide_init(void) | 627 | static int __init au_ide_init(void) |
628 | { | 628 | { |
629 | return driver_register(&au1200_ide_driver); | 629 | return platform_driver_register(&au1200_ide_driver); |
630 | } | 630 | } |
631 | 631 | ||
632 | static void __exit au_ide_exit(void) | 632 | static void __exit au_ide_exit(void) |
633 | { | 633 | { |
634 | driver_unregister(&au1200_ide_driver); | 634 | platform_driver_unregister(&au1200_ide_driver); |
635 | } | 635 | } |
636 | 636 | ||
637 | MODULE_LICENSE("GPL"); | 637 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/mtd/maps/pxa2xx-flash.c b/drivers/mtd/maps/pxa2xx-flash.c index 771139c5bf87..e9026cb1c5b2 100644 --- a/drivers/mtd/maps/pxa2xx-flash.c +++ b/drivers/mtd/maps/pxa2xx-flash.c | |||
@@ -41,9 +41,8 @@ struct pxa2xx_flash_info { | |||
41 | static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; | 41 | static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; |
42 | 42 | ||
43 | 43 | ||
44 | static int __init pxa2xx_flash_probe(struct device *dev) | 44 | static int __init pxa2xx_flash_probe(struct platform_device *pdev) |
45 | { | 45 | { |
46 | struct platform_device *pdev = to_platform_device(dev); | ||
47 | struct flash_platform_data *flash = pdev->dev.platform_data; | 46 | struct flash_platform_data *flash = pdev->dev.platform_data; |
48 | struct pxa2xx_flash_info *info; | 47 | struct pxa2xx_flash_info *info; |
49 | struct mtd_partition *parts; | 48 | struct mtd_partition *parts; |
@@ -114,15 +113,15 @@ static int __init pxa2xx_flash_probe(struct device *dev) | |||
114 | add_mtd_device(info->mtd); | 113 | add_mtd_device(info->mtd); |
115 | } | 114 | } |
116 | 115 | ||
117 | dev_set_drvdata(dev, info); | 116 | platform_set_drvdata(pdev, info); |
118 | return 0; | 117 | return 0; |
119 | } | 118 | } |
120 | 119 | ||
121 | static int __exit pxa2xx_flash_remove(struct device *dev) | 120 | static int __exit pxa2xx_flash_remove(struct platform_device *dev) |
122 | { | 121 | { |
123 | struct pxa2xx_flash_info *info = dev_get_drvdata(dev); | 122 | struct pxa2xx_flash_info *info = platform_get_drvdata(dev); |
124 | 123 | ||
125 | dev_set_drvdata(dev, NULL); | 124 | platform_set_drvdata(dev, NULL); |
126 | 125 | ||
127 | #ifdef CONFIG_MTD_PARTITIONS | 126 | #ifdef CONFIG_MTD_PARTITIONS |
128 | if (info->nr_parts) | 127 | if (info->nr_parts) |
@@ -141,9 +140,9 @@ static int __exit pxa2xx_flash_remove(struct device *dev) | |||
141 | } | 140 | } |
142 | 141 | ||
143 | #ifdef CONFIG_PM | 142 | #ifdef CONFIG_PM |
144 | static int pxa2xx_flash_suspend(struct device *dev, pm_message_t state) | 143 | static int pxa2xx_flash_suspend(struct platform_device *dev, pm_message_t state) |
145 | { | 144 | { |
146 | struct pxa2xx_flash_info *info = dev_get_drvdata(dev); | 145 | struct pxa2xx_flash_info *info = platform_get_drvdata(dev); |
147 | int ret = 0; | 146 | int ret = 0; |
148 | 147 | ||
149 | if (info->mtd && info->mtd->suspend) | 148 | if (info->mtd && info->mtd->suspend) |
@@ -151,17 +150,17 @@ static int pxa2xx_flash_suspend(struct device *dev, pm_message_t state) | |||
151 | return ret; | 150 | return ret; |
152 | } | 151 | } |
153 | 152 | ||
154 | static int pxa2xx_flash_resume(struct device *dev) | 153 | static int pxa2xx_flash_resume(struct platform_device *dev) |
155 | { | 154 | { |
156 | struct pxa2xx_flash_info *info = dev_get_drvdata(dev); | 155 | struct pxa2xx_flash_info *info = platform_get_drvdata(dev); |
157 | 156 | ||
158 | if (info->mtd && info->mtd->resume) | 157 | if (info->mtd && info->mtd->resume) |
159 | info->mtd->resume(info->mtd); | 158 | info->mtd->resume(info->mtd); |
160 | return 0; | 159 | return 0; |
161 | } | 160 | } |
162 | static void pxa2xx_flash_shutdown(struct device *dev) | 161 | static void pxa2xx_flash_shutdown(struct platform_device *dev) |
163 | { | 162 | { |
164 | struct pxa2xx_flash_info *info = dev_get_drvdata(dev); | 163 | struct pxa2xx_flash_info *info = platform_get_drvdata(dev); |
165 | 164 | ||
166 | if (info && info->mtd->suspend(info->mtd) == 0) | 165 | if (info && info->mtd->suspend(info->mtd) == 0) |
167 | info->mtd->resume(info->mtd); | 166 | info->mtd->resume(info->mtd); |
@@ -172,11 +171,13 @@ static void pxa2xx_flash_shutdown(struct device *dev) | |||
172 | #define pxa2xx_flash_shutdown NULL | 171 | #define pxa2xx_flash_shutdown NULL |
173 | #endif | 172 | #endif |
174 | 173 | ||
175 | static struct device_driver pxa2xx_flash_driver = { | 174 | static struct platform_driver pxa2xx_flash_driver = { |
176 | .name = "pxa2xx-flash", | 175 | .driver = { |
177 | .bus = &platform_bus_type, | 176 | .name = "pxa2xx-flash", |
177 | .owner = THIS_MODULE, | ||
178 | }, | ||
178 | .probe = pxa2xx_flash_probe, | 179 | .probe = pxa2xx_flash_probe, |
179 | .remove = __exit_p(pxa2xx_flash_remove), | 180 | .remove = __devexit_p(pxa2xx_flash_remove), |
180 | .suspend = pxa2xx_flash_suspend, | 181 | .suspend = pxa2xx_flash_suspend, |
181 | .resume = pxa2xx_flash_resume, | 182 | .resume = pxa2xx_flash_resume, |
182 | .shutdown = pxa2xx_flash_shutdown, | 183 | .shutdown = pxa2xx_flash_shutdown, |
@@ -184,12 +185,12 @@ static struct device_driver pxa2xx_flash_driver = { | |||
184 | 185 | ||
185 | static int __init init_pxa2xx_flash(void) | 186 | static int __init init_pxa2xx_flash(void) |
186 | { | 187 | { |
187 | return driver_register(&pxa2xx_flash_driver); | 188 | return platform_driver_register(&pxa2xx_flash_driver); |
188 | } | 189 | } |
189 | 190 | ||
190 | static void __exit cleanup_pxa2xx_flash(void) | 191 | static void __exit cleanup_pxa2xx_flash(void) |
191 | { | 192 | { |
192 | driver_unregister(&pxa2xx_flash_driver); | 193 | platform_driver_unregister(&pxa2xx_flash_driver); |
193 | } | 194 | } |
194 | 195 | ||
195 | module_init(init_pxa2xx_flash); | 196 | module_init(init_pxa2xx_flash); |
diff --git a/drivers/mtd/nand/excite_nandflash.c b/drivers/mtd/nand/excite_nandflash.c index ced14b5294d5..72446fb48d4b 100644 --- a/drivers/mtd/nand/excite_nandflash.c +++ b/drivers/mtd/nand/excite_nandflash.c | |||
@@ -128,11 +128,11 @@ static int excite_nand_devready(struct mtd_info *mtd) | |||
128 | * The binding to the mtd and all allocated | 128 | * The binding to the mtd and all allocated |
129 | * resources are released. | 129 | * resources are released. |
130 | */ | 130 | */ |
131 | static int __exit excite_nand_remove(struct device *dev) | 131 | static int __exit excite_nand_remove(struct platform_device *dev) |
132 | { | 132 | { |
133 | struct excite_nand_drvdata * const this = dev_get_drvdata(dev); | 133 | struct excite_nand_drvdata * const this = platform_get_drvdata(dev); |
134 | 134 | ||
135 | dev_set_drvdata(dev, NULL); | 135 | platform_set_drvdata(dev, NULL); |
136 | 136 | ||
137 | if (unlikely(!this)) { | 137 | if (unlikely(!this)) { |
138 | printk(KERN_ERR "%s: called %s without private data!!", | 138 | printk(KERN_ERR "%s: called %s without private data!!", |
@@ -159,9 +159,8 @@ static int __exit excite_nand_remove(struct device *dev) | |||
159 | * it can allocate all necessary resources then calls the | 159 | * it can allocate all necessary resources then calls the |
160 | * nand layer to look for devices. | 160 | * nand layer to look for devices. |
161 | */ | 161 | */ |
162 | static int __init excite_nand_probe(struct device *dev) | 162 | static int __init excite_nand_probe(struct platform_device *pdev) |
163 | { | 163 | { |
164 | struct platform_device * const pdev = to_platform_device(dev); | ||
165 | struct excite_nand_drvdata *drvdata; /* private driver data */ | 164 | struct excite_nand_drvdata *drvdata; /* private driver data */ |
166 | struct nand_chip *board_chip; /* private flash chip data */ | 165 | struct nand_chip *board_chip; /* private flash chip data */ |
167 | struct mtd_info *board_mtd; /* mtd info for this board */ | 166 | struct mtd_info *board_mtd; /* mtd info for this board */ |
@@ -175,7 +174,7 @@ static int __init excite_nand_probe(struct device *dev) | |||
175 | } | 174 | } |
176 | 175 | ||
177 | /* bind private data into driver */ | 176 | /* bind private data into driver */ |
178 | dev_set_drvdata(dev, drvdata); | 177 | platform_set_drvdata(pdev, drvdata); |
179 | 178 | ||
180 | /* allocate and map the resource */ | 179 | /* allocate and map the resource */ |
181 | drvdata->regs = | 180 | drvdata->regs = |
@@ -219,23 +218,25 @@ static int __init excite_nand_probe(struct device *dev) | |||
219 | return 0; | 218 | return 0; |
220 | } | 219 | } |
221 | 220 | ||
222 | static struct device_driver excite_nand_driver = { | 221 | static struct platform_driver excite_nand_driver = { |
223 | .name = "excite_nand", | 222 | .driver = { |
224 | .bus = &platform_bus_type, | 223 | .name = "excite_nand", |
224 | .owner = THIS_MODULE, | ||
225 | }, | ||
225 | .probe = excite_nand_probe, | 226 | .probe = excite_nand_probe, |
226 | .remove = __exit_p(excite_nand_remove) | 227 | .remove = __devexit_p(excite_nand_remove) |
227 | }; | 228 | }; |
228 | 229 | ||
229 | static int __init excite_nand_init(void) | 230 | static int __init excite_nand_init(void) |
230 | { | 231 | { |
231 | pr_info("Basler eXcite nand flash driver Version " | 232 | pr_info("Basler eXcite nand flash driver Version " |
232 | EXCITE_NANDFLASH_VERSION "\n"); | 233 | EXCITE_NANDFLASH_VERSION "\n"); |
233 | return driver_register(&excite_nand_driver); | 234 | return platform_driver_register(&excite_nand_driver); |
234 | } | 235 | } |
235 | 236 | ||
236 | static void __exit excite_nand_exit(void) | 237 | static void __exit excite_nand_exit(void) |
237 | { | 238 | { |
238 | driver_unregister(&excite_nand_driver); | 239 | platform_driver_unregister(&excite_nand_driver); |
239 | } | 240 | } |
240 | 241 | ||
241 | module_init(excite_nand_init); | 242 | module_init(excite_nand_init); |
diff --git a/drivers/mtd/onenand/generic.c b/drivers/mtd/onenand/generic.c index 5b69e7773c6c..3a496c33fb52 100644 --- a/drivers/mtd/onenand/generic.c +++ b/drivers/mtd/onenand/generic.c | |||
@@ -36,10 +36,9 @@ struct onenand_info { | |||
36 | struct onenand_chip onenand; | 36 | struct onenand_chip onenand; |
37 | }; | 37 | }; |
38 | 38 | ||
39 | static int __devinit generic_onenand_probe(struct device *dev) | 39 | static int __devinit generic_onenand_probe(struct platform_device *pdev) |
40 | { | 40 | { |
41 | struct onenand_info *info; | 41 | struct onenand_info *info; |
42 | struct platform_device *pdev = to_platform_device(dev); | ||
43 | struct flash_platform_data *pdata = pdev->dev.platform_data; | 42 | struct flash_platform_data *pdata = pdev->dev.platform_data; |
44 | struct resource *res = pdev->resource; | 43 | struct resource *res = pdev->resource; |
45 | unsigned long size = res->end - res->start + 1; | 44 | unsigned long size = res->end - res->start + 1; |
@@ -49,7 +48,7 @@ static int __devinit generic_onenand_probe(struct device *dev) | |||
49 | if (!info) | 48 | if (!info) |
50 | return -ENOMEM; | 49 | return -ENOMEM; |
51 | 50 | ||
52 | if (!request_mem_region(res->start, size, dev->driver->name)) { | 51 | if (!request_mem_region(res->start, size, pdev->dev.driver->name)) { |
53 | err = -EBUSY; | 52 | err = -EBUSY; |
54 | goto out_free_info; | 53 | goto out_free_info; |
55 | } | 54 | } |
@@ -82,7 +81,7 @@ static int __devinit generic_onenand_probe(struct device *dev) | |||
82 | #endif | 81 | #endif |
83 | err = add_mtd_device(&info->mtd); | 82 | err = add_mtd_device(&info->mtd); |
84 | 83 | ||
85 | dev_set_drvdata(&pdev->dev, info); | 84 | platform_set_drvdata(pdev, info); |
86 | 85 | ||
87 | return 0; | 86 | return 0; |
88 | 87 | ||
@@ -96,14 +95,13 @@ out_free_info: | |||
96 | return err; | 95 | return err; |
97 | } | 96 | } |
98 | 97 | ||
99 | static int __devexit generic_onenand_remove(struct device *dev) | 98 | static int __devexit generic_onenand_remove(struct platform_device *pdev) |
100 | { | 99 | { |
101 | struct platform_device *pdev = to_platform_device(dev); | 100 | struct onenand_info *info = platform_get_drvdata(pdev); |
102 | struct onenand_info *info = dev_get_drvdata(&pdev->dev); | ||
103 | struct resource *res = pdev->resource; | 101 | struct resource *res = pdev->resource; |
104 | unsigned long size = res->end - res->start + 1; | 102 | unsigned long size = res->end - res->start + 1; |
105 | 103 | ||
106 | dev_set_drvdata(&pdev->dev, NULL); | 104 | platform_set_drvdata(pdev, NULL); |
107 | 105 | ||
108 | if (info) { | 106 | if (info) { |
109 | if (info->parts) | 107 | if (info->parts) |
@@ -120,9 +118,11 @@ static int __devexit generic_onenand_remove(struct device *dev) | |||
120 | return 0; | 118 | return 0; |
121 | } | 119 | } |
122 | 120 | ||
123 | static struct device_driver generic_onenand_driver = { | 121 | static struct platform_driver generic_onenand_driver = { |
124 | .name = DRIVER_NAME, | 122 | .driver = { |
125 | .bus = &platform_bus_type, | 123 | .name = DRIVER_NAME, |
124 | .owner = THIS_MODULE, | ||
125 | }, | ||
126 | .probe = generic_onenand_probe, | 126 | .probe = generic_onenand_probe, |
127 | .remove = __devexit_p(generic_onenand_remove), | 127 | .remove = __devexit_p(generic_onenand_remove), |
128 | }; | 128 | }; |
@@ -131,12 +131,12 @@ MODULE_ALIAS(DRIVER_NAME); | |||
131 | 131 | ||
132 | static int __init generic_onenand_init(void) | 132 | static int __init generic_onenand_init(void) |
133 | { | 133 | { |
134 | return driver_register(&generic_onenand_driver); | 134 | return platform_driver_register(&generic_onenand_driver); |
135 | } | 135 | } |
136 | 136 | ||
137 | static void __exit generic_onenand_exit(void) | 137 | static void __exit generic_onenand_exit(void) |
138 | { | 138 | { |
139 | driver_unregister(&generic_onenand_driver); | 139 | platform_driver_unregister(&generic_onenand_driver); |
140 | } | 140 | } |
141 | 141 | ||
142 | module_init(generic_onenand_init); | 142 | module_init(generic_onenand_init); |
diff --git a/drivers/net/mipsnet.c b/drivers/net/mipsnet.c index 4e7a5faf0351..664835b822fb 100644 --- a/drivers/net/mipsnet.c +++ b/drivers/net/mipsnet.c | |||
@@ -237,7 +237,7 @@ static void mipsnet_set_mclist(struct net_device *dev) | |||
237 | { | 237 | { |
238 | } | 238 | } |
239 | 239 | ||
240 | static int __init mipsnet_probe(struct device *dev) | 240 | static int __init mipsnet_probe(struct platform_device *dev) |
241 | { | 241 | { |
242 | struct net_device *netdev; | 242 | struct net_device *netdev; |
243 | int err; | 243 | int err; |
@@ -248,7 +248,7 @@ static int __init mipsnet_probe(struct device *dev) | |||
248 | goto out; | 248 | goto out; |
249 | } | 249 | } |
250 | 250 | ||
251 | dev_set_drvdata(dev, netdev); | 251 | platform_set_drvdata(dev, netdev); |
252 | 252 | ||
253 | netdev->open = mipsnet_open; | 253 | netdev->open = mipsnet_open; |
254 | netdev->stop = mipsnet_close; | 254 | netdev->stop = mipsnet_close; |
@@ -293,23 +293,25 @@ out: | |||
293 | return err; | 293 | return err; |
294 | } | 294 | } |
295 | 295 | ||
296 | static int __devexit mipsnet_device_remove(struct device *device) | 296 | static int __devexit mipsnet_device_remove(struct platform_device *device) |
297 | { | 297 | { |
298 | struct net_device *dev = dev_get_drvdata(device); | 298 | struct net_device *dev = platform_get_drvdata(device); |
299 | 299 | ||
300 | unregister_netdev(dev); | 300 | unregister_netdev(dev); |
301 | release_region(dev->base_addr, sizeof(struct mipsnet_regs)); | 301 | release_region(dev->base_addr, sizeof(struct mipsnet_regs)); |
302 | free_netdev(dev); | 302 | free_netdev(dev); |
303 | dev_set_drvdata(device, NULL); | 303 | platform_set_drvdata(device, NULL); |
304 | 304 | ||
305 | return 0; | 305 | return 0; |
306 | } | 306 | } |
307 | 307 | ||
308 | static struct device_driver mipsnet_driver = { | 308 | static struct platform_driver mipsnet_driver = { |
309 | .name = mipsnet_string, | 309 | .driver = { |
310 | .bus = &platform_bus_type, | 310 | .name = mipsnet_string, |
311 | .probe = mipsnet_probe, | 311 | .owner = THIS_MODULE, |
312 | .remove = __devexit_p(mipsnet_device_remove), | 312 | }, |
313 | .probe = mipsnet_probe, | ||
314 | .remove = __devexit_p(mipsnet_device_remove), | ||
313 | }; | 315 | }; |
314 | 316 | ||
315 | static int __init mipsnet_init_module(void) | 317 | static int __init mipsnet_init_module(void) |
@@ -319,7 +321,7 @@ static int __init mipsnet_init_module(void) | |||
319 | printk(KERN_INFO "MIPSNet Ethernet driver. Version: %s. " | 321 | printk(KERN_INFO "MIPSNet Ethernet driver. Version: %s. " |
320 | "(c)2005 MIPS Technologies, Inc.\n", MIPSNET_VERSION); | 322 | "(c)2005 MIPS Technologies, Inc.\n", MIPSNET_VERSION); |
321 | 323 | ||
322 | err = driver_register(&mipsnet_driver); | 324 | err = platform_driver_register(&mipsnet_driver); |
323 | if (err) | 325 | if (err) |
324 | printk(KERN_ERR "Driver registration failed\n"); | 326 | printk(KERN_ERR "Driver registration failed\n"); |
325 | 327 | ||
@@ -328,7 +330,7 @@ static int __init mipsnet_init_module(void) | |||
328 | 330 | ||
329 | static void __exit mipsnet_exit_module(void) | 331 | static void __exit mipsnet_exit_module(void) |
330 | { | 332 | { |
331 | driver_unregister(&mipsnet_driver); | 333 | platform_driver_unregister(&mipsnet_driver); |
332 | } | 334 | } |
333 | 335 | ||
334 | module_init(mipsnet_init_module); | 336 | module_init(mipsnet_init_module); |
diff --git a/drivers/pcmcia/au1000_generic.c b/drivers/pcmcia/au1000_generic.c index fc1de46fd20a..90013341cd5f 100644 --- a/drivers/pcmcia/au1000_generic.c +++ b/drivers/pcmcia/au1000_generic.c | |||
@@ -468,13 +468,13 @@ out: | |||
468 | return ret; | 468 | return ret; |
469 | } | 469 | } |
470 | 470 | ||
471 | int au1x00_drv_pcmcia_remove(struct device *dev) | 471 | int au1x00_drv_pcmcia_remove(struct platform_device *dev) |
472 | { | 472 | { |
473 | struct skt_dev_info *sinfo = dev_get_drvdata(dev); | 473 | struct skt_dev_info *sinfo = platform_get_drvdata(dev); |
474 | int i; | 474 | int i; |
475 | 475 | ||
476 | mutex_lock(&pcmcia_sockets_lock); | 476 | mutex_lock(&pcmcia_sockets_lock); |
477 | dev_set_drvdata(dev, NULL); | 477 | platform_set_drvdata(dev, NULL); |
478 | 478 | ||
479 | for (i = 0; i < sinfo->nskt; i++) { | 479 | for (i = 0; i < sinfo->nskt; i++) { |
480 | struct au1000_pcmcia_socket *skt = PCMCIA_SOCKET(i); | 480 | struct au1000_pcmcia_socket *skt = PCMCIA_SOCKET(i); |
@@ -498,13 +498,13 @@ int au1x00_drv_pcmcia_remove(struct device *dev) | |||
498 | * PCMCIA "Driver" API | 498 | * PCMCIA "Driver" API |
499 | */ | 499 | */ |
500 | 500 | ||
501 | static int au1x00_drv_pcmcia_probe(struct device *dev) | 501 | static int au1x00_drv_pcmcia_probe(struct platform_device *dev) |
502 | { | 502 | { |
503 | int i, ret = -ENODEV; | 503 | int i, ret = -ENODEV; |
504 | 504 | ||
505 | mutex_lock(&pcmcia_sockets_lock); | 505 | mutex_lock(&pcmcia_sockets_lock); |
506 | for (i=0; i < ARRAY_SIZE(au1x00_pcmcia_hw_init); i++) { | 506 | for (i=0; i < ARRAY_SIZE(au1x00_pcmcia_hw_init); i++) { |
507 | ret = au1x00_pcmcia_hw_init[i](dev); | 507 | ret = au1x00_pcmcia_hw_init[i](&dev->dev); |
508 | if (ret == 0) | 508 | if (ret == 0) |
509 | break; | 509 | break; |
510 | } | 510 | } |
@@ -512,14 +512,26 @@ static int au1x00_drv_pcmcia_probe(struct device *dev) | |||
512 | return ret; | 512 | return ret; |
513 | } | 513 | } |
514 | 514 | ||
515 | static int au1x00_drv_pcmcia_suspend(struct platform_device *dev, | ||
516 | pm_message_t state) | ||
517 | { | ||
518 | return pcmcia_socket_dev_suspend(&dev->dev, state); | ||
519 | } | ||
520 | |||
521 | static int au1x00_drv_pcmcia_resume(struct platform_device *dev) | ||
522 | { | ||
523 | return pcmcia_socket_dev_resume(&dev->dev); | ||
524 | } | ||
515 | 525 | ||
516 | static struct device_driver au1x00_pcmcia_driver = { | 526 | static struct platform_driver au1x00_pcmcia_driver = { |
527 | .driver = { | ||
528 | .name = "au1x00-pcmcia", | ||
529 | .owner = THIS_MODULE, | ||
530 | }, | ||
517 | .probe = au1x00_drv_pcmcia_probe, | 531 | .probe = au1x00_drv_pcmcia_probe, |
518 | .remove = au1x00_drv_pcmcia_remove, | 532 | .remove = au1x00_drv_pcmcia_remove, |
519 | .name = "au1x00-pcmcia", | 533 | .suspend = au1x00_drv_pcmcia_suspend, |
520 | .bus = &platform_bus_type, | 534 | .resume = au1x00_drv_pcmcia_resume, |
521 | .suspend = pcmcia_socket_dev_suspend, | ||
522 | .resume = pcmcia_socket_dev_resume, | ||
523 | }; | 535 | }; |
524 | 536 | ||
525 | 537 | ||
@@ -533,8 +545,7 @@ static struct device_driver au1x00_pcmcia_driver = { | |||
533 | static int __init au1x00_pcmcia_init(void) | 545 | static int __init au1x00_pcmcia_init(void) |
534 | { | 546 | { |
535 | int error = 0; | 547 | int error = 0; |
536 | if ((error = driver_register(&au1x00_pcmcia_driver))) | 548 | error = platform_driver_register(&au1x00_pcmcia_driver); |
537 | return error; | ||
538 | return error; | 549 | return error; |
539 | } | 550 | } |
540 | 551 | ||
@@ -544,7 +555,7 @@ static int __init au1x00_pcmcia_init(void) | |||
544 | */ | 555 | */ |
545 | static void __exit au1x00_pcmcia_exit(void) | 556 | static void __exit au1x00_pcmcia_exit(void) |
546 | { | 557 | { |
547 | driver_unregister(&au1x00_pcmcia_driver); | 558 | platform_driver_unregister(&au1x00_pcmcia_driver); |
548 | } | 559 | } |
549 | 560 | ||
550 | module_init(au1x00_pcmcia_init); | 561 | module_init(au1x00_pcmcia_init); |
diff --git a/drivers/pcmcia/i82365.c b/drivers/pcmcia/i82365.c index 71653ab84890..40d4953e4b12 100644 --- a/drivers/pcmcia/i82365.c +++ b/drivers/pcmcia/i82365.c | |||
@@ -1238,6 +1238,16 @@ static int pcic_init(struct pcmcia_socket *s) | |||
1238 | return 0; | 1238 | return 0; |
1239 | } | 1239 | } |
1240 | 1240 | ||
1241 | static int i82365_drv_pcmcia_suspend(struct platform_device *dev, | ||
1242 | pm_message_t state) | ||
1243 | { | ||
1244 | return pcmcia_socket_dev_suspend(&dev->dev, state); | ||
1245 | } | ||
1246 | |||
1247 | static int i82365_drv_pcmcia_resume(struct platform_device *dev) | ||
1248 | { | ||
1249 | return pcmcia_socket_dev_resume(&dev->dev); | ||
1250 | } | ||
1241 | static struct pccard_operations pcic_operations = { | 1251 | static struct pccard_operations pcic_operations = { |
1242 | .init = pcic_init, | 1252 | .init = pcic_init, |
1243 | .get_status = pcic_get_status, | 1253 | .get_status = pcic_get_status, |
@@ -1248,11 +1258,13 @@ static struct pccard_operations pcic_operations = { | |||
1248 | 1258 | ||
1249 | /*====================================================================*/ | 1259 | /*====================================================================*/ |
1250 | 1260 | ||
1251 | static struct device_driver i82365_driver = { | 1261 | static struct platform_driver i82365_driver = { |
1252 | .name = "i82365", | 1262 | .driver = { |
1253 | .bus = &platform_bus_type, | 1263 | .name = "i82365", |
1254 | .suspend = pcmcia_socket_dev_suspend, | 1264 | .owner = THIS_MODULE, |
1255 | .resume = pcmcia_socket_dev_resume, | 1265 | }, |
1266 | .suspend = i82365_drv_pcmcia_suspend, | ||
1267 | .resume = i82365_drv_pcmcia_resume, | ||
1256 | }; | 1268 | }; |
1257 | 1269 | ||
1258 | static struct platform_device *i82365_device; | 1270 | static struct platform_device *i82365_device; |
@@ -1261,7 +1273,7 @@ static int __init init_i82365(void) | |||
1261 | { | 1273 | { |
1262 | int i, ret; | 1274 | int i, ret; |
1263 | 1275 | ||
1264 | ret = driver_register(&i82365_driver); | 1276 | ret = platform_driver_register(&i82365_driver); |
1265 | if (ret) | 1277 | if (ret) |
1266 | goto err_out; | 1278 | goto err_out; |
1267 | 1279 | ||
@@ -1337,7 +1349,7 @@ err_dev_unregister: | |||
1337 | pnp_disable_dev(i82365_pnpdev); | 1349 | pnp_disable_dev(i82365_pnpdev); |
1338 | #endif | 1350 | #endif |
1339 | err_driver_unregister: | 1351 | err_driver_unregister: |
1340 | driver_unregister(&i82365_driver); | 1352 | platform_driver_unregister(&i82365_driver); |
1341 | err_out: | 1353 | err_out: |
1342 | return ret; | 1354 | return ret; |
1343 | } /* init_i82365 */ | 1355 | } /* init_i82365 */ |
@@ -1365,7 +1377,7 @@ static void __exit exit_i82365(void) | |||
1365 | if (i82365_pnpdev) | 1377 | if (i82365_pnpdev) |
1366 | pnp_disable_dev(i82365_pnpdev); | 1378 | pnp_disable_dev(i82365_pnpdev); |
1367 | #endif | 1379 | #endif |
1368 | driver_unregister(&i82365_driver); | 1380 | platform_driver_unregister(&i82365_driver); |
1369 | } /* exit_i82365 */ | 1381 | } /* exit_i82365 */ |
1370 | 1382 | ||
1371 | module_init(init_i82365); | 1383 | module_init(init_i82365); |
diff --git a/drivers/pcmcia/m32r_cfc.c b/drivers/pcmcia/m32r_cfc.c index 2ab4f22c21de..62b4ecc97c46 100644 --- a/drivers/pcmcia/m32r_cfc.c +++ b/drivers/pcmcia/m32r_cfc.c | |||
@@ -696,13 +696,25 @@ static struct pccard_operations pcc_operations = { | |||
696 | .set_mem_map = pcc_set_mem_map, | 696 | .set_mem_map = pcc_set_mem_map, |
697 | }; | 697 | }; |
698 | 698 | ||
699 | static int cfc_drv_pcmcia_suspend(struct platform_device *dev, | ||
700 | pm_message_t state) | ||
701 | { | ||
702 | return pcmcia_socket_dev_suspend(&dev->dev, state); | ||
703 | } | ||
704 | |||
705 | static int cfc_drv_pcmcia_resume(struct platform_device *dev) | ||
706 | { | ||
707 | return pcmcia_socket_dev_resume(&dev->dev); | ||
708 | } | ||
699 | /*====================================================================*/ | 709 | /*====================================================================*/ |
700 | 710 | ||
701 | static struct device_driver pcc_driver = { | 711 | static struct platform_driver pcc_driver = { |
702 | .name = "cfc", | 712 | .driver = { |
703 | .bus = &platform_bus_type, | 713 | .name = "cfc", |
704 | .suspend = pcmcia_socket_dev_suspend, | 714 | .owner = THIS_MODULE, |
705 | .resume = pcmcia_socket_dev_resume, | 715 | }, |
716 | .suspend = cfc_drv_pcmcia_suspend, | ||
717 | .resume = cfc_drv_pcmcia_resume, | ||
706 | }; | 718 | }; |
707 | 719 | ||
708 | static struct platform_device pcc_device = { | 720 | static struct platform_device pcc_device = { |
@@ -716,13 +728,13 @@ static int __init init_m32r_pcc(void) | |||
716 | { | 728 | { |
717 | int i, ret; | 729 | int i, ret; |
718 | 730 | ||
719 | ret = driver_register(&pcc_driver); | 731 | ret = platform_driver_register(&pcc_driver); |
720 | if (ret) | 732 | if (ret) |
721 | return ret; | 733 | return ret; |
722 | 734 | ||
723 | ret = platform_device_register(&pcc_device); | 735 | ret = platform_device_register(&pcc_device); |
724 | if (ret){ | 736 | if (ret){ |
725 | driver_unregister(&pcc_driver); | 737 | platform_driver_unregister(&pcc_driver); |
726 | return ret; | 738 | return ret; |
727 | } | 739 | } |
728 | 740 | ||
@@ -754,7 +766,7 @@ static int __init init_m32r_pcc(void) | |||
754 | if (pcc_sockets == 0) { | 766 | if (pcc_sockets == 0) { |
755 | printk("socket is not found.\n"); | 767 | printk("socket is not found.\n"); |
756 | platform_device_unregister(&pcc_device); | 768 | platform_device_unregister(&pcc_device); |
757 | driver_unregister(&pcc_driver); | 769 | platform_driver_unregister(&pcc_driver); |
758 | return -ENODEV; | 770 | return -ENODEV; |
759 | } | 771 | } |
760 | 772 | ||
@@ -802,7 +814,7 @@ static void __exit exit_m32r_pcc(void) | |||
802 | if (poll_interval != 0) | 814 | if (poll_interval != 0) |
803 | del_timer_sync(&poll_timer); | 815 | del_timer_sync(&poll_timer); |
804 | 816 | ||
805 | driver_unregister(&pcc_driver); | 817 | platform_driver_unregister(&pcc_driver); |
806 | } /* exit_m32r_pcc */ | 818 | } /* exit_m32r_pcc */ |
807 | 819 | ||
808 | module_init(init_m32r_pcc); | 820 | module_init(init_m32r_pcc); |
diff --git a/drivers/pcmcia/m32r_pcc.c b/drivers/pcmcia/m32r_pcc.c index 2f108c23dbd9..12034b41d196 100644 --- a/drivers/pcmcia/m32r_pcc.c +++ b/drivers/pcmcia/m32r_pcc.c | |||
@@ -672,13 +672,25 @@ static struct pccard_operations pcc_operations = { | |||
672 | .set_mem_map = pcc_set_mem_map, | 672 | .set_mem_map = pcc_set_mem_map, |
673 | }; | 673 | }; |
674 | 674 | ||
675 | static int pcc_drv_pcmcia_suspend(struct platform_device *dev, | ||
676 | pm_message_t state) | ||
677 | { | ||
678 | return pcmcia_socket_dev_suspend(&dev->dev, state); | ||
679 | } | ||
680 | |||
681 | static int pcc_drv_pcmcia_resume(struct platform_device *dev) | ||
682 | { | ||
683 | return pcmcia_socket_dev_resume(&dev->dev); | ||
684 | } | ||
675 | /*====================================================================*/ | 685 | /*====================================================================*/ |
676 | 686 | ||
677 | static struct device_driver pcc_driver = { | 687 | static struct platform_driver pcc_driver = { |
678 | .name = "pcc", | 688 | .driver = { |
679 | .bus = &platform_bus_type, | 689 | .name = "pcc", |
680 | .suspend = pcmcia_socket_dev_suspend, | 690 | .owner = THIS_MODULE, |
681 | .resume = pcmcia_socket_dev_resume, | 691 | }, |
692 | .suspend = pcc_drv_pcmcia_suspend, | ||
693 | .resume = pcc_drv_pcmcia_resume, | ||
682 | }; | 694 | }; |
683 | 695 | ||
684 | static struct platform_device pcc_device = { | 696 | static struct platform_device pcc_device = { |
@@ -692,13 +704,13 @@ static int __init init_m32r_pcc(void) | |||
692 | { | 704 | { |
693 | int i, ret; | 705 | int i, ret; |
694 | 706 | ||
695 | ret = driver_register(&pcc_driver); | 707 | ret = platform_driver_register(&pcc_driver); |
696 | if (ret) | 708 | if (ret) |
697 | return ret; | 709 | return ret; |
698 | 710 | ||
699 | ret = platform_device_register(&pcc_device); | 711 | ret = platform_device_register(&pcc_device); |
700 | if (ret){ | 712 | if (ret){ |
701 | driver_unregister(&pcc_driver); | 713 | platform_driver_unregister(&pcc_driver); |
702 | return ret; | 714 | return ret; |
703 | } | 715 | } |
704 | 716 | ||
@@ -715,7 +727,7 @@ static int __init init_m32r_pcc(void) | |||
715 | if (pcc_sockets == 0) { | 727 | if (pcc_sockets == 0) { |
716 | printk("socket is not found.\n"); | 728 | printk("socket is not found.\n"); |
717 | platform_device_unregister(&pcc_device); | 729 | platform_device_unregister(&pcc_device); |
718 | driver_unregister(&pcc_driver); | 730 | platform_driver_unregister(&pcc_driver); |
719 | return -ENODEV; | 731 | return -ENODEV; |
720 | } | 732 | } |
721 | 733 | ||
@@ -763,7 +775,7 @@ static void __exit exit_m32r_pcc(void) | |||
763 | if (poll_interval != 0) | 775 | if (poll_interval != 0) |
764 | del_timer_sync(&poll_timer); | 776 | del_timer_sync(&poll_timer); |
765 | 777 | ||
766 | driver_unregister(&pcc_driver); | 778 | platform_driver_unregister(&pcc_driver); |
767 | } /* exit_m32r_pcc */ | 779 | } /* exit_m32r_pcc */ |
768 | 780 | ||
769 | module_init(init_m32r_pcc); | 781 | module_init(init_m32r_pcc); |
diff --git a/drivers/pcmcia/sa1100_generic.c b/drivers/pcmcia/sa1100_generic.c index c5b2a44b4c37..d8da5ac844e9 100644 --- a/drivers/pcmcia/sa1100_generic.c +++ b/drivers/pcmcia/sa1100_generic.c | |||
@@ -65,7 +65,7 @@ static int (*sa11x0_pcmcia_hw_init[])(struct device *dev) = { | |||
65 | #endif | 65 | #endif |
66 | }; | 66 | }; |
67 | 67 | ||
68 | static int sa11x0_drv_pcmcia_probe(struct device *dev) | 68 | static int sa11x0_drv_pcmcia_probe(struct platform_device *dev) |
69 | { | 69 | { |
70 | int i, ret = -ENODEV; | 70 | int i, ret = -ENODEV; |
71 | 71 | ||
@@ -73,7 +73,7 @@ static int sa11x0_drv_pcmcia_probe(struct device *dev) | |||
73 | * Initialise any "on-board" PCMCIA sockets. | 73 | * Initialise any "on-board" PCMCIA sockets. |
74 | */ | 74 | */ |
75 | for (i = 0; i < ARRAY_SIZE(sa11x0_pcmcia_hw_init); i++) { | 75 | for (i = 0; i < ARRAY_SIZE(sa11x0_pcmcia_hw_init); i++) { |
76 | ret = sa11x0_pcmcia_hw_init[i](dev); | 76 | ret = sa11x0_pcmcia_hw_init[i](&dev->dev); |
77 | if (ret == 0) | 77 | if (ret == 0) |
78 | break; | 78 | break; |
79 | } | 79 | } |
@@ -81,13 +81,31 @@ static int sa11x0_drv_pcmcia_probe(struct device *dev) | |||
81 | return ret; | 81 | return ret; |
82 | } | 82 | } |
83 | 83 | ||
84 | static struct device_driver sa11x0_pcmcia_driver = { | 84 | static int sa11x0_drv_pcmcia_remove(struct platform_device *dev) |
85 | { | ||
86 | return soc_common_drv_pcmcia_remove(&dev->dev); | ||
87 | } | ||
88 | |||
89 | static int sa11x0_drv_pcmcia_suspend(struct platform_device *dev, | ||
90 | pm_message_t state) | ||
91 | { | ||
92 | return pcmcia_socket_dev_suspend(&dev->dev, state); | ||
93 | } | ||
94 | |||
95 | static int sa11x0_drv_pcmcia_resume(struct platform_device *dev) | ||
96 | { | ||
97 | return pcmcia_socket_dev_resume(&dev->dev); | ||
98 | } | ||
99 | |||
100 | static struct platform_driver sa11x0_pcmcia_driver = { | ||
101 | .driver = { | ||
102 | .name = "sa11x0-pcmcia", | ||
103 | .owner = THIS_MODULE, | ||
104 | }, | ||
85 | .probe = sa11x0_drv_pcmcia_probe, | 105 | .probe = sa11x0_drv_pcmcia_probe, |
86 | .remove = soc_common_drv_pcmcia_remove, | 106 | .remove = sa11x0_drv_pcmcia_remove, |
87 | .name = "sa11x0-pcmcia", | 107 | .suspend = sa11x0_drv_pcmcia_suspend, |
88 | .bus = &platform_bus_type, | 108 | .resume = sa11x0_drv_pcmcia_resume, |
89 | .suspend = pcmcia_socket_dev_suspend, | ||
90 | .resume = pcmcia_socket_dev_resume, | ||
91 | }; | 109 | }; |
92 | 110 | ||
93 | /* sa11x0_pcmcia_init() | 111 | /* sa11x0_pcmcia_init() |
@@ -100,7 +118,7 @@ static struct device_driver sa11x0_pcmcia_driver = { | |||
100 | */ | 118 | */ |
101 | static int __init sa11x0_pcmcia_init(void) | 119 | static int __init sa11x0_pcmcia_init(void) |
102 | { | 120 | { |
103 | return driver_register(&sa11x0_pcmcia_driver); | 121 | return platform_driver_register(&sa11x0_pcmcia_driver); |
104 | } | 122 | } |
105 | 123 | ||
106 | /* sa11x0_pcmcia_exit() | 124 | /* sa11x0_pcmcia_exit() |
@@ -110,7 +128,7 @@ static int __init sa11x0_pcmcia_init(void) | |||
110 | */ | 128 | */ |
111 | static void __exit sa11x0_pcmcia_exit(void) | 129 | static void __exit sa11x0_pcmcia_exit(void) |
112 | { | 130 | { |
113 | driver_unregister(&sa11x0_pcmcia_driver); | 131 | platform_driver_unregister(&sa11x0_pcmcia_driver); |
114 | } | 132 | } |
115 | 133 | ||
116 | MODULE_AUTHOR("John Dorsey <john+@cs.cmu.edu>"); | 134 | MODULE_AUTHOR("John Dorsey <john+@cs.cmu.edu>"); |
diff --git a/drivers/pcmcia/tcic.c b/drivers/pcmcia/tcic.c index 2a613e920fd4..9ad97ea836e8 100644 --- a/drivers/pcmcia/tcic.c +++ b/drivers/pcmcia/tcic.c | |||
@@ -363,13 +363,25 @@ static int __init get_tcic_id(void) | |||
363 | return id; | 363 | return id; |
364 | } | 364 | } |
365 | 365 | ||
366 | static int tcic_drv_pcmcia_suspend(struct platform_device *dev, | ||
367 | pm_message_t state) | ||
368 | { | ||
369 | return pcmcia_socket_dev_suspend(&dev->dev, state); | ||
370 | } | ||
371 | |||
372 | static int tcic_drv_pcmcia_resume(struct platform_device *dev) | ||
373 | { | ||
374 | return pcmcia_socket_dev_resume(&dev->dev); | ||
375 | } | ||
366 | /*====================================================================*/ | 376 | /*====================================================================*/ |
367 | 377 | ||
368 | static struct device_driver tcic_driver = { | 378 | static struct platform_driver tcic_driver = { |
369 | .name = "tcic-pcmcia", | 379 | .driver = { |
370 | .bus = &platform_bus_type, | 380 | .name = "tcic-pcmcia", |
371 | .suspend = pcmcia_socket_dev_suspend, | 381 | .owner = THIS_MODULE, |
372 | .resume = pcmcia_socket_dev_resume, | 382 | }, |
383 | .suspend = tcic_drv_pcmcia_suspend, | ||
384 | .resume = tcic_drv_pcmcia_resume, | ||
373 | }; | 385 | }; |
374 | 386 | ||
375 | static struct platform_device tcic_device = { | 387 | static struct platform_device tcic_device = { |
@@ -383,7 +395,7 @@ static int __init init_tcic(void) | |||
383 | int i, sock, ret = 0; | 395 | int i, sock, ret = 0; |
384 | u_int mask, scan; | 396 | u_int mask, scan; |
385 | 397 | ||
386 | if (driver_register(&tcic_driver)) | 398 | if (platform_driver_register(&tcic_driver)) |
387 | return -1; | 399 | return -1; |
388 | 400 | ||
389 | printk(KERN_INFO "Databook TCIC-2 PCMCIA probe: "); | 401 | printk(KERN_INFO "Databook TCIC-2 PCMCIA probe: "); |
@@ -391,7 +403,7 @@ static int __init init_tcic(void) | |||
391 | 403 | ||
392 | if (!request_region(tcic_base, 16, "tcic-2")) { | 404 | if (!request_region(tcic_base, 16, "tcic-2")) { |
393 | printk("could not allocate ports,\n "); | 405 | printk("could not allocate ports,\n "); |
394 | driver_unregister(&tcic_driver); | 406 | platform_driver_unregister(&tcic_driver); |
395 | return -ENODEV; | 407 | return -ENODEV; |
396 | } | 408 | } |
397 | else { | 409 | else { |
@@ -414,7 +426,7 @@ static int __init init_tcic(void) | |||
414 | if (sock == 0) { | 426 | if (sock == 0) { |
415 | printk("not found.\n"); | 427 | printk("not found.\n"); |
416 | release_region(tcic_base, 16); | 428 | release_region(tcic_base, 16); |
417 | driver_unregister(&tcic_driver); | 429 | platform_driver_unregister(&tcic_driver); |
418 | return -ENODEV; | 430 | return -ENODEV; |
419 | } | 431 | } |
420 | 432 | ||
@@ -542,7 +554,7 @@ static void __exit exit_tcic(void) | |||
542 | } | 554 | } |
543 | 555 | ||
544 | platform_device_unregister(&tcic_device); | 556 | platform_device_unregister(&tcic_device); |
545 | driver_unregister(&tcic_driver); | 557 | platform_driver_unregister(&tcic_driver); |
546 | } /* exit_tcic */ | 558 | } /* exit_tcic */ |
547 | 559 | ||
548 | /*====================================================================*/ | 560 | /*====================================================================*/ |
diff --git a/drivers/pcmcia/vrc4171_card.c b/drivers/pcmcia/vrc4171_card.c index b2c412419059..659421d0ca46 100644 --- a/drivers/pcmcia/vrc4171_card.c +++ b/drivers/pcmcia/vrc4171_card.c | |||
@@ -704,24 +704,37 @@ static int __devinit vrc4171_card_setup(char *options) | |||
704 | 704 | ||
705 | __setup("vrc4171_card=", vrc4171_card_setup); | 705 | __setup("vrc4171_card=", vrc4171_card_setup); |
706 | 706 | ||
707 | static struct device_driver vrc4171_card_driver = { | 707 | static int vrc4171_card_suspend(struct platform_device *dev, |
708 | .name = vrc4171_card_name, | 708 | pm_message_t state) |
709 | .bus = &platform_bus_type, | 709 | { |
710 | .suspend = pcmcia_socket_dev_suspend, | 710 | return pcmcia_socket_dev_suspend(&dev->dev, state); |
711 | .resume = pcmcia_socket_dev_resume, | 711 | } |
712 | |||
713 | static int vrc4171_card_resume(struct platform_device *dev) | ||
714 | { | ||
715 | return pcmcia_socket_dev_resume(&dev->dev); | ||
716 | } | ||
717 | |||
718 | static struct platform_driver vrc4171_card_driver = { | ||
719 | .driver = { | ||
720 | .name = vrc4171_card_name, | ||
721 | .owner = THIS_MODULE, | ||
722 | }, | ||
723 | .suspend = vrc4171_card_suspend, | ||
724 | .resume = vrc4171_card_resume, | ||
712 | }; | 725 | }; |
713 | 726 | ||
714 | static int __devinit vrc4171_card_init(void) | 727 | static int __devinit vrc4171_card_init(void) |
715 | { | 728 | { |
716 | int retval; | 729 | int retval; |
717 | 730 | ||
718 | retval = driver_register(&vrc4171_card_driver); | 731 | retval = platform_driver_register(&vrc4171_card_driver); |
719 | if (retval < 0) | 732 | if (retval < 0) |
720 | return retval; | 733 | return retval; |
721 | 734 | ||
722 | retval = platform_device_register(&vrc4171_card_device); | 735 | retval = platform_device_register(&vrc4171_card_device); |
723 | if (retval < 0) { | 736 | if (retval < 0) { |
724 | driver_unregister(&vrc4171_card_driver); | 737 | platform_driver_unregister(&vrc4171_card_driver); |
725 | return retval; | 738 | return retval; |
726 | } | 739 | } |
727 | 740 | ||
@@ -735,11 +748,12 @@ static int __devinit vrc4171_card_init(void) | |||
735 | if (retval < 0) { | 748 | if (retval < 0) { |
736 | vrc4171_remove_sockets(); | 749 | vrc4171_remove_sockets(); |
737 | platform_device_unregister(&vrc4171_card_device); | 750 | platform_device_unregister(&vrc4171_card_device); |
738 | driver_unregister(&vrc4171_card_driver); | 751 | platform_driver_unregister(&vrc4171_card_driver); |
739 | return retval; | 752 | return retval; |
740 | } | 753 | } |
741 | 754 | ||
742 | printk(KERN_INFO "%s, connected to IRQ %d\n", vrc4171_card_driver.name, vrc4171_irq); | 755 | printk(KERN_INFO "%s, connected to IRQ %d\n", |
756 | vrc4171_card_driver.driver.name, vrc4171_irq); | ||
743 | 757 | ||
744 | return 0; | 758 | return 0; |
745 | } | 759 | } |
@@ -749,7 +763,7 @@ static void __devexit vrc4171_card_exit(void) | |||
749 | free_irq(vrc4171_irq, vrc4171_sockets); | 763 | free_irq(vrc4171_irq, vrc4171_sockets); |
750 | vrc4171_remove_sockets(); | 764 | vrc4171_remove_sockets(); |
751 | platform_device_unregister(&vrc4171_card_device); | 765 | platform_device_unregister(&vrc4171_card_device); |
752 | driver_unregister(&vrc4171_card_driver); | 766 | platform_driver_unregister(&vrc4171_card_driver); |
753 | } | 767 | } |
754 | 768 | ||
755 | module_init(vrc4171_card_init); | 769 | module_init(vrc4171_card_init); |
diff --git a/drivers/scsi/a4000t.c b/drivers/scsi/a4000t.c index d4bda2017746..6d25aca7b412 100644 --- a/drivers/scsi/a4000t.c +++ b/drivers/scsi/a4000t.c | |||
@@ -35,7 +35,7 @@ static struct platform_device *a4000t_scsi_device; | |||
35 | 35 | ||
36 | #define A4000T_SCSI_ADDR 0xdd0040 | 36 | #define A4000T_SCSI_ADDR 0xdd0040 |
37 | 37 | ||
38 | static int __devinit a4000t_probe(struct device *dev) | 38 | static int __devinit a4000t_probe(struct platform_device *dev) |
39 | { | 39 | { |
40 | struct Scsi_Host *host; | 40 | struct Scsi_Host *host; |
41 | struct NCR_700_Host_Parameters *hostdata; | 41 | struct NCR_700_Host_Parameters *hostdata; |
@@ -78,7 +78,7 @@ static int __devinit a4000t_probe(struct device *dev) | |||
78 | goto out_put_host; | 78 | goto out_put_host; |
79 | } | 79 | } |
80 | 80 | ||
81 | dev_set_drvdata(dev, host); | 81 | platform_set_drvdata(dev, host); |
82 | scsi_scan_host(host); | 82 | scsi_scan_host(host); |
83 | 83 | ||
84 | return 0; | 84 | return 0; |
@@ -93,9 +93,9 @@ static int __devinit a4000t_probe(struct device *dev) | |||
93 | return -ENODEV; | 93 | return -ENODEV; |
94 | } | 94 | } |
95 | 95 | ||
96 | static __devexit int a4000t_device_remove(struct device *dev) | 96 | static __devexit int a4000t_device_remove(struct platform_device *dev) |
97 | { | 97 | { |
98 | struct Scsi_Host *host = dev_get_drvdata(dev); | 98 | struct Scsi_Host *host = platform_get_drvdata(dev); |
99 | struct NCR_700_Host_Parameters *hostdata = shost_priv(host); | 99 | struct NCR_700_Host_Parameters *hostdata = shost_priv(host); |
100 | 100 | ||
101 | scsi_remove_host(host); | 101 | scsi_remove_host(host); |
@@ -108,25 +108,27 @@ static __devexit int a4000t_device_remove(struct device *dev) | |||
108 | return 0; | 108 | return 0; |
109 | } | 109 | } |
110 | 110 | ||
111 | static struct device_driver a4000t_scsi_driver = { | 111 | static struct platform_driver a4000t_scsi_driver = { |
112 | .name = "a4000t-scsi", | 112 | .driver = { |
113 | .bus = &platform_bus_type, | 113 | .name = "a4000t-scsi", |
114 | .probe = a4000t_probe, | 114 | .owner = THIS_MODULE, |
115 | .remove = __devexit_p(a4000t_device_remove), | 115 | }, |
116 | .probe = a4000t_probe, | ||
117 | .remove = __devexit_p(a4000t_device_remove), | ||
116 | }; | 118 | }; |
117 | 119 | ||
118 | static int __init a4000t_scsi_init(void) | 120 | static int __init a4000t_scsi_init(void) |
119 | { | 121 | { |
120 | int err; | 122 | int err; |
121 | 123 | ||
122 | err = driver_register(&a4000t_scsi_driver); | 124 | err = platform_driver_register(&a4000t_scsi_driver); |
123 | if (err) | 125 | if (err) |
124 | return err; | 126 | return err; |
125 | 127 | ||
126 | a4000t_scsi_device = platform_device_register_simple("a4000t-scsi", | 128 | a4000t_scsi_device = platform_device_register_simple("a4000t-scsi", |
127 | -1, NULL, 0); | 129 | -1, NULL, 0); |
128 | if (IS_ERR(a4000t_scsi_device)) { | 130 | if (IS_ERR(a4000t_scsi_device)) { |
129 | driver_unregister(&a4000t_scsi_driver); | 131 | platform_driver_register(&a4000t_scsi_driver); |
130 | return PTR_ERR(a4000t_scsi_device); | 132 | return PTR_ERR(a4000t_scsi_device); |
131 | } | 133 | } |
132 | 134 | ||
@@ -136,7 +138,7 @@ static int __init a4000t_scsi_init(void) | |||
136 | static void __exit a4000t_scsi_exit(void) | 138 | static void __exit a4000t_scsi_exit(void) |
137 | { | 139 | { |
138 | platform_device_unregister(a4000t_scsi_device); | 140 | platform_device_unregister(a4000t_scsi_device); |
139 | driver_unregister(&a4000t_scsi_driver); | 141 | platform_driver_unregister(&a4000t_scsi_driver); |
140 | } | 142 | } |
141 | 143 | ||
142 | module_init(a4000t_scsi_init); | 144 | module_init(a4000t_scsi_init); |
diff --git a/drivers/scsi/bvme6000_scsi.c b/drivers/scsi/bvme6000_scsi.c index d858f3d41274..9e9a82b03f2d 100644 --- a/drivers/scsi/bvme6000_scsi.c +++ b/drivers/scsi/bvme6000_scsi.c | |||
@@ -34,7 +34,7 @@ static struct scsi_host_template bvme6000_scsi_driver_template = { | |||
34 | static struct platform_device *bvme6000_scsi_device; | 34 | static struct platform_device *bvme6000_scsi_device; |
35 | 35 | ||
36 | static __devinit int | 36 | static __devinit int |
37 | bvme6000_probe(struct device *dev) | 37 | bvme6000_probe(struct platform_device *dev) |
38 | { | 38 | { |
39 | struct Scsi_Host *host; | 39 | struct Scsi_Host *host; |
40 | struct NCR_700_Host_Parameters *hostdata; | 40 | struct NCR_700_Host_Parameters *hostdata; |
@@ -73,7 +73,7 @@ bvme6000_probe(struct device *dev) | |||
73 | goto out_put_host; | 73 | goto out_put_host; |
74 | } | 74 | } |
75 | 75 | ||
76 | dev_set_drvdata(dev, host); | 76 | platform_set_drvdata(dev, host); |
77 | scsi_scan_host(host); | 77 | scsi_scan_host(host); |
78 | 78 | ||
79 | return 0; | 79 | return 0; |
@@ -87,9 +87,9 @@ bvme6000_probe(struct device *dev) | |||
87 | } | 87 | } |
88 | 88 | ||
89 | static __devexit int | 89 | static __devexit int |
90 | bvme6000_device_remove(struct device *dev) | 90 | bvme6000_device_remove(struct platform_device *dev) |
91 | { | 91 | { |
92 | struct Scsi_Host *host = dev_get_drvdata(dev); | 92 | struct Scsi_Host *host = platform_get_drvdata(dev); |
93 | struct NCR_700_Host_Parameters *hostdata = shost_priv(host); | 93 | struct NCR_700_Host_Parameters *hostdata = shost_priv(host); |
94 | 94 | ||
95 | scsi_remove_host(host); | 95 | scsi_remove_host(host); |
@@ -100,25 +100,27 @@ bvme6000_device_remove(struct device *dev) | |||
100 | return 0; | 100 | return 0; |
101 | } | 101 | } |
102 | 102 | ||
103 | static struct device_driver bvme6000_scsi_driver = { | 103 | static struct platform_driver bvme6000_scsi_driver = { |
104 | .name = "bvme6000-scsi", | 104 | .driver = { |
105 | .bus = &platform_bus_type, | 105 | .name = "bvme6000-scsi", |
106 | .probe = bvme6000_probe, | 106 | .owner = THIS_MODULE, |
107 | .remove = __devexit_p(bvme6000_device_remove), | 107 | }, |
108 | .probe = bvme6000_probe, | ||
109 | .remove = __devexit_p(bvme6000_device_remove), | ||
108 | }; | 110 | }; |
109 | 111 | ||
110 | static int __init bvme6000_scsi_init(void) | 112 | static int __init bvme6000_scsi_init(void) |
111 | { | 113 | { |
112 | int err; | 114 | int err; |
113 | 115 | ||
114 | err = driver_register(&bvme6000_scsi_driver); | 116 | err = platform_driver_register(&bvme6000_scsi_driver); |
115 | if (err) | 117 | if (err) |
116 | return err; | 118 | return err; |
117 | 119 | ||
118 | bvme6000_scsi_device = platform_device_register_simple("bvme6000-scsi", | 120 | bvme6000_scsi_device = platform_device_register_simple("bvme6000-scsi", |
119 | -1, NULL, 0); | 121 | -1, NULL, 0); |
120 | if (IS_ERR(bvme6000_scsi_device)) { | 122 | if (IS_ERR(bvme6000_scsi_device)) { |
121 | driver_unregister(&bvme6000_scsi_driver); | 123 | platform_driver_unregister(&bvme6000_scsi_driver); |
122 | return PTR_ERR(bvme6000_scsi_device); | 124 | return PTR_ERR(bvme6000_scsi_device); |
123 | } | 125 | } |
124 | 126 | ||
@@ -128,7 +130,7 @@ static int __init bvme6000_scsi_init(void) | |||
128 | static void __exit bvme6000_scsi_exit(void) | 130 | static void __exit bvme6000_scsi_exit(void) |
129 | { | 131 | { |
130 | platform_device_unregister(bvme6000_scsi_device); | 132 | platform_device_unregister(bvme6000_scsi_device); |
131 | driver_unregister(&bvme6000_scsi_driver); | 133 | platform_driver_unregister(&bvme6000_scsi_driver); |
132 | } | 134 | } |
133 | 135 | ||
134 | module_init(bvme6000_scsi_init); | 136 | module_init(bvme6000_scsi_init); |
diff --git a/drivers/scsi/mvme16x_scsi.c b/drivers/scsi/mvme16x_scsi.c index b264b499d982..7794fc158b17 100644 --- a/drivers/scsi/mvme16x_scsi.c +++ b/drivers/scsi/mvme16x_scsi.c | |||
@@ -34,7 +34,7 @@ static struct scsi_host_template mvme16x_scsi_driver_template = { | |||
34 | static struct platform_device *mvme16x_scsi_device; | 34 | static struct platform_device *mvme16x_scsi_device; |
35 | 35 | ||
36 | static __devinit int | 36 | static __devinit int |
37 | mvme16x_probe(struct device *dev) | 37 | mvme16x_probe(struct platform_device *dev) |
38 | { | 38 | { |
39 | struct Scsi_Host * host = NULL; | 39 | struct Scsi_Host * host = NULL; |
40 | struct NCR_700_Host_Parameters *hostdata; | 40 | struct NCR_700_Host_Parameters *hostdata; |
@@ -88,7 +88,7 @@ mvme16x_probe(struct device *dev) | |||
88 | out_be32(0xfff4202c, v); | 88 | out_be32(0xfff4202c, v); |
89 | } | 89 | } |
90 | 90 | ||
91 | dev_set_drvdata(dev, host); | 91 | platform_set_drvdata(dev, host); |
92 | scsi_scan_host(host); | 92 | scsi_scan_host(host); |
93 | 93 | ||
94 | return 0; | 94 | return 0; |
@@ -102,9 +102,9 @@ mvme16x_probe(struct device *dev) | |||
102 | } | 102 | } |
103 | 103 | ||
104 | static __devexit int | 104 | static __devexit int |
105 | mvme16x_device_remove(struct device *dev) | 105 | mvme16x_device_remove(struct platform_device *dev) |
106 | { | 106 | { |
107 | struct Scsi_Host *host = dev_get_drvdata(dev); | 107 | struct Scsi_Host *host = platform_get_drvdata(dev); |
108 | struct NCR_700_Host_Parameters *hostdata = shost_priv(host); | 108 | struct NCR_700_Host_Parameters *hostdata = shost_priv(host); |
109 | 109 | ||
110 | /* Disable scsi chip ints */ | 110 | /* Disable scsi chip ints */ |
@@ -123,25 +123,27 @@ mvme16x_device_remove(struct device *dev) | |||
123 | return 0; | 123 | return 0; |
124 | } | 124 | } |
125 | 125 | ||
126 | static struct device_driver mvme16x_scsi_driver = { | 126 | static struct platform_driver mvme16x_scsi_driver = { |
127 | .name = "mvme16x-scsi", | 127 | .driver = { |
128 | .bus = &platform_bus_type, | 128 | .name = "mvme16x-scsi", |
129 | .probe = mvme16x_probe, | 129 | .owner = THIS_MODULE, |
130 | .remove = __devexit_p(mvme16x_device_remove), | 130 | }, |
131 | .probe = mvme16x_probe, | ||
132 | .remove = __devexit_p(mvme16x_device_remove), | ||
131 | }; | 133 | }; |
132 | 134 | ||
133 | static int __init mvme16x_scsi_init(void) | 135 | static int __init mvme16x_scsi_init(void) |
134 | { | 136 | { |
135 | int err; | 137 | int err; |
136 | 138 | ||
137 | err = driver_register(&mvme16x_scsi_driver); | 139 | err = platform_driver_register(&mvme16x_scsi_driver); |
138 | if (err) | 140 | if (err) |
139 | return err; | 141 | return err; |
140 | 142 | ||
141 | mvme16x_scsi_device = platform_device_register_simple("mvme16x-scsi", | 143 | mvme16x_scsi_device = platform_device_register_simple("mvme16x-scsi", |
142 | -1, NULL, 0); | 144 | -1, NULL, 0); |
143 | if (IS_ERR(mvme16x_scsi_device)) { | 145 | if (IS_ERR(mvme16x_scsi_device)) { |
144 | driver_unregister(&mvme16x_scsi_driver); | 146 | platform_driver_unregister(&mvme16x_scsi_driver); |
145 | return PTR_ERR(mvme16x_scsi_device); | 147 | return PTR_ERR(mvme16x_scsi_device); |
146 | } | 148 | } |
147 | 149 | ||
@@ -151,7 +153,7 @@ static int __init mvme16x_scsi_init(void) | |||
151 | static void __exit mvme16x_scsi_exit(void) | 153 | static void __exit mvme16x_scsi_exit(void) |
152 | { | 154 | { |
153 | platform_device_unregister(mvme16x_scsi_device); | 155 | platform_device_unregister(mvme16x_scsi_device); |
154 | driver_unregister(&mvme16x_scsi_driver); | 156 | platform_driver_unregister(&mvme16x_scsi_driver); |
155 | } | 157 | } |
156 | 158 | ||
157 | module_init(mvme16x_scsi_init); | 159 | module_init(mvme16x_scsi_init); |
diff --git a/drivers/video/au1100fb.c b/drivers/video/au1100fb.c index 62bd4441b5e0..378f27745a1d 100644 --- a/drivers/video/au1100fb.c +++ b/drivers/video/au1100fb.c | |||
@@ -457,7 +457,7 @@ static struct fb_ops au1100fb_ops = | |||
457 | 457 | ||
458 | /* AU1100 LCD controller device driver */ | 458 | /* AU1100 LCD controller device driver */ |
459 | 459 | ||
460 | static int __init au1100fb_drv_probe(struct device *dev) | 460 | static int __init au1100fb_drv_probe(struct platform_device *dev) |
461 | { | 461 | { |
462 | struct au1100fb_device *fbdev = NULL; | 462 | struct au1100fb_device *fbdev = NULL; |
463 | struct resource *regs_res; | 463 | struct resource *regs_res; |
@@ -475,7 +475,7 @@ static int __init au1100fb_drv_probe(struct device *dev) | |||
475 | 475 | ||
476 | fbdev->panel = &known_lcd_panels[drv_info.panel_idx]; | 476 | fbdev->panel = &known_lcd_panels[drv_info.panel_idx]; |
477 | 477 | ||
478 | dev_set_drvdata(dev, (void*)fbdev); | 478 | platform_set_drvdata(dev, (void *)fbdev); |
479 | 479 | ||
480 | /* Allocate region for our registers and map them */ | 480 | /* Allocate region for our registers and map them */ |
481 | if (!(regs_res = platform_get_resource(to_platform_device(dev), | 481 | if (!(regs_res = platform_get_resource(to_platform_device(dev), |
@@ -583,19 +583,19 @@ failed: | |||
583 | fb_dealloc_cmap(&fbdev->info.cmap); | 583 | fb_dealloc_cmap(&fbdev->info.cmap); |
584 | } | 584 | } |
585 | kfree(fbdev); | 585 | kfree(fbdev); |
586 | dev_set_drvdata(dev, NULL); | 586 | platform_set_drvdata(dev, NULL); |
587 | 587 | ||
588 | return 0; | 588 | return 0; |
589 | } | 589 | } |
590 | 590 | ||
591 | int au1100fb_drv_remove(struct device *dev) | 591 | int au1100fb_drv_remove(struct platform_device *dev) |
592 | { | 592 | { |
593 | struct au1100fb_device *fbdev = NULL; | 593 | struct au1100fb_device *fbdev = NULL; |
594 | 594 | ||
595 | if (!dev) | 595 | if (!dev) |
596 | return -ENODEV; | 596 | return -ENODEV; |
597 | 597 | ||
598 | fbdev = (struct au1100fb_device*) dev_get_drvdata(dev); | 598 | fbdev = (struct au1100fb_device *) platform_get_drvdata(dev); |
599 | 599 | ||
600 | #if !defined(CONFIG_FRAMEBUFFER_CONSOLE) && defined(CONFIG_LOGO) | 600 | #if !defined(CONFIG_FRAMEBUFFER_CONSOLE) && defined(CONFIG_LOGO) |
601 | au1100fb_fb_blank(VESA_POWERDOWN, &fbdev->info); | 601 | au1100fb_fb_blank(VESA_POWERDOWN, &fbdev->info); |
@@ -620,9 +620,9 @@ int au1100fb_drv_remove(struct device *dev) | |||
620 | static u32 sys_clksrc; | 620 | static u32 sys_clksrc; |
621 | static struct au1100fb_regs fbregs; | 621 | static struct au1100fb_regs fbregs; |
622 | 622 | ||
623 | int au1100fb_drv_suspend(struct device *dev, pm_message_t state) | 623 | int au1100fb_drv_suspend(struct platform_device *dev, pm_message_t state) |
624 | { | 624 | { |
625 | struct au1100fb_device *fbdev = dev_get_drvdata(dev); | 625 | struct au1100fb_device *fbdev = platform_get_drvdata(dev); |
626 | 626 | ||
627 | if (!fbdev) | 627 | if (!fbdev) |
628 | return 0; | 628 | return 0; |
@@ -641,9 +641,9 @@ int au1100fb_drv_suspend(struct device *dev, pm_message_t state) | |||
641 | return 0; | 641 | return 0; |
642 | } | 642 | } |
643 | 643 | ||
644 | int au1100fb_drv_resume(struct device *dev) | 644 | int au1100fb_drv_resume(struct platform_device *dev) |
645 | { | 645 | { |
646 | struct au1100fb_device *fbdev = dev_get_drvdata(dev); | 646 | struct au1100fb_device *fbdev = platform_get_drvdata(dev); |
647 | 647 | ||
648 | if (!fbdev) | 648 | if (!fbdev) |
649 | return 0; | 649 | return 0; |
@@ -663,10 +663,11 @@ int au1100fb_drv_resume(struct device *dev) | |||
663 | #define au1100fb_drv_resume NULL | 663 | #define au1100fb_drv_resume NULL |
664 | #endif | 664 | #endif |
665 | 665 | ||
666 | static struct device_driver au1100fb_driver = { | 666 | static struct platform_driver au1100fb_driver = { |
667 | .name = "au1100-lcd", | 667 | .driver = { |
668 | .bus = &platform_bus_type, | 668 | .name = "au1100-lcd", |
669 | 669 | .owner = THIS_MODULE, | |
670 | }, | ||
670 | .probe = au1100fb_drv_probe, | 671 | .probe = au1100fb_drv_probe, |
671 | .remove = au1100fb_drv_remove, | 672 | .remove = au1100fb_drv_remove, |
672 | .suspend = au1100fb_drv_suspend, | 673 | .suspend = au1100fb_drv_suspend, |
@@ -753,12 +754,12 @@ int __init au1100fb_init(void) | |||
753 | return ret; | 754 | return ret; |
754 | } | 755 | } |
755 | 756 | ||
756 | return driver_register(&au1100fb_driver); | 757 | return platform_driver_register(&au1100fb_driver); |
757 | } | 758 | } |
758 | 759 | ||
759 | void __exit au1100fb_cleanup(void) | 760 | void __exit au1100fb_cleanup(void) |
760 | { | 761 | { |
761 | driver_unregister(&au1100fb_driver); | 762 | platform_driver_unregister(&au1100fb_driver); |
762 | 763 | ||
763 | kfree(drv_info.opt_mode); | 764 | kfree(drv_info.opt_mode); |
764 | } | 765 | } |
diff --git a/drivers/video/au1200fb.c b/drivers/video/au1200fb.c index 03e57ef88378..0d96f1d2d4c5 100644 --- a/drivers/video/au1200fb.c +++ b/drivers/video/au1200fb.c | |||
@@ -1622,7 +1622,7 @@ static int au1200fb_init_fbinfo(struct au1200fb_device *fbdev) | |||
1622 | 1622 | ||
1623 | /* AU1200 LCD controller device driver */ | 1623 | /* AU1200 LCD controller device driver */ |
1624 | 1624 | ||
1625 | static int au1200fb_drv_probe(struct device *dev) | 1625 | static int au1200fb_drv_probe(struct platform_device *dev) |
1626 | { | 1626 | { |
1627 | struct au1200fb_device *fbdev; | 1627 | struct au1200fb_device *fbdev; |
1628 | unsigned long page; | 1628 | unsigned long page; |
@@ -1645,7 +1645,7 @@ static int au1200fb_drv_probe(struct device *dev) | |||
1645 | /* Allocate the framebuffer to the maximum screen size */ | 1645 | /* Allocate the framebuffer to the maximum screen size */ |
1646 | fbdev->fb_len = (win->w[plane].xres * win->w[plane].yres * bpp) / 8; | 1646 | fbdev->fb_len = (win->w[plane].xres * win->w[plane].yres * bpp) / 8; |
1647 | 1647 | ||
1648 | fbdev->fb_mem = dma_alloc_noncoherent(dev, | 1648 | fbdev->fb_mem = dma_alloc_noncoherent(&dev->dev, |
1649 | PAGE_ALIGN(fbdev->fb_len), | 1649 | PAGE_ALIGN(fbdev->fb_len), |
1650 | &fbdev->fb_phys, GFP_KERNEL); | 1650 | &fbdev->fb_phys, GFP_KERNEL); |
1651 | if (!fbdev->fb_mem) { | 1651 | if (!fbdev->fb_mem) { |
@@ -1715,7 +1715,7 @@ failed: | |||
1715 | return ret; | 1715 | return ret; |
1716 | } | 1716 | } |
1717 | 1717 | ||
1718 | static int au1200fb_drv_remove(struct device *dev) | 1718 | static int au1200fb_drv_remove(struct platform_device *dev) |
1719 | { | 1719 | { |
1720 | struct au1200fb_device *fbdev; | 1720 | struct au1200fb_device *fbdev; |
1721 | int plane; | 1721 | int plane; |
@@ -1733,7 +1733,8 @@ static int au1200fb_drv_remove(struct device *dev) | |||
1733 | /* Clean up all probe data */ | 1733 | /* Clean up all probe data */ |
1734 | unregister_framebuffer(&fbdev->fb_info); | 1734 | unregister_framebuffer(&fbdev->fb_info); |
1735 | if (fbdev->fb_mem) | 1735 | if (fbdev->fb_mem) |
1736 | dma_free_noncoherent(dev, PAGE_ALIGN(fbdev->fb_len), | 1736 | dma_free_noncoherent(&dev->dev, |
1737 | PAGE_ALIGN(fbdev->fb_len), | ||
1737 | fbdev->fb_mem, fbdev->fb_phys); | 1738 | fbdev->fb_mem, fbdev->fb_phys); |
1738 | if (fbdev->fb_info.cmap.len != 0) | 1739 | if (fbdev->fb_info.cmap.len != 0) |
1739 | fb_dealloc_cmap(&fbdev->fb_info.cmap); | 1740 | fb_dealloc_cmap(&fbdev->fb_info.cmap); |
@@ -1747,22 +1748,24 @@ static int au1200fb_drv_remove(struct device *dev) | |||
1747 | } | 1748 | } |
1748 | 1749 | ||
1749 | #ifdef CONFIG_PM | 1750 | #ifdef CONFIG_PM |
1750 | static int au1200fb_drv_suspend(struct device *dev, u32 state, u32 level) | 1751 | static int au1200fb_drv_suspend(struct platform_device *dev, u32 state) |
1751 | { | 1752 | { |
1752 | /* TODO */ | 1753 | /* TODO */ |
1753 | return 0; | 1754 | return 0; |
1754 | } | 1755 | } |
1755 | 1756 | ||
1756 | static int au1200fb_drv_resume(struct device *dev, u32 level) | 1757 | static int au1200fb_drv_resume(struct platform_device *dev) |
1757 | { | 1758 | { |
1758 | /* TODO */ | 1759 | /* TODO */ |
1759 | return 0; | 1760 | return 0; |
1760 | } | 1761 | } |
1761 | #endif /* CONFIG_PM */ | 1762 | #endif /* CONFIG_PM */ |
1762 | 1763 | ||
1763 | static struct device_driver au1200fb_driver = { | 1764 | static struct platform_driver au1200fb_driver = { |
1764 | .name = "au1200-lcd", | 1765 | .driver = { |
1765 | .bus = &platform_bus_type, | 1766 | .name = "au1200-lcd", |
1767 | .owner = THIS_MODULE, | ||
1768 | }, | ||
1766 | .probe = au1200fb_drv_probe, | 1769 | .probe = au1200fb_drv_probe, |
1767 | .remove = au1200fb_drv_remove, | 1770 | .remove = au1200fb_drv_remove, |
1768 | #ifdef CONFIG_PM | 1771 | #ifdef CONFIG_PM |
@@ -1906,12 +1909,12 @@ static int __init au1200fb_init(void) | |||
1906 | printk(KERN_INFO "Power management device entry for the au1200fb loaded.\n"); | 1909 | printk(KERN_INFO "Power management device entry for the au1200fb loaded.\n"); |
1907 | #endif | 1910 | #endif |
1908 | 1911 | ||
1909 | return driver_register(&au1200fb_driver); | 1912 | return platform_driver_register(&au1200fb_driver); |
1910 | } | 1913 | } |
1911 | 1914 | ||
1912 | static void __exit au1200fb_cleanup(void) | 1915 | static void __exit au1200fb_cleanup(void) |
1913 | { | 1916 | { |
1914 | driver_unregister(&au1200fb_driver); | 1917 | platform_driver_unregister(&au1200fb_driver); |
1915 | } | 1918 | } |
1916 | 1919 | ||
1917 | module_init(au1200fb_init); | 1920 | module_init(au1200fb_init); |
diff --git a/drivers/watchdog/rm9k_wdt.c b/drivers/watchdog/rm9k_wdt.c index f1ae3729a19e..cce1982a1b58 100644 --- a/drivers/watchdog/rm9k_wdt.c +++ b/drivers/watchdog/rm9k_wdt.c | |||
@@ -59,8 +59,8 @@ static long wdt_gpi_ioctl(struct file *, unsigned int, unsigned long); | |||
59 | static int wdt_gpi_notify(struct notifier_block *, unsigned long, void *); | 59 | static int wdt_gpi_notify(struct notifier_block *, unsigned long, void *); |
60 | static const struct resource *wdt_gpi_get_resource(struct platform_device *, | 60 | static const struct resource *wdt_gpi_get_resource(struct platform_device *, |
61 | const char *, unsigned int); | 61 | const char *, unsigned int); |
62 | static int __init wdt_gpi_probe(struct device *); | 62 | static int __init wdt_gpi_probe(struct platform_device *); |
63 | static int __exit wdt_gpi_remove(struct device *); | 63 | static int __exit wdt_gpi_remove(struct platform_device *); |
64 | 64 | ||
65 | 65 | ||
66 | static const char wdt_gpi_name[] = "wdt_gpi"; | 66 | static const char wdt_gpi_name[] = "wdt_gpi"; |
@@ -346,10 +346,9 @@ static const struct resource *wdt_gpi_get_resource(struct platform_device *pdv, | |||
346 | } | 346 | } |
347 | 347 | ||
348 | /* No hotplugging on the platform bus - use __init */ | 348 | /* No hotplugging on the platform bus - use __init */ |
349 | static int __init wdt_gpi_probe(struct device *dev) | 349 | static int __init wdt_gpi_probe(struct platform_device *pdv) |
350 | { | 350 | { |
351 | int res; | 351 | int res; |
352 | struct platform_device * const pdv = to_platform_device(dev); | ||
353 | const struct resource | 352 | const struct resource |
354 | * const rr = wdt_gpi_get_resource(pdv, WDT_RESOURCE_REGS, | 353 | * const rr = wdt_gpi_get_resource(pdv, WDT_RESOURCE_REGS, |
355 | IORESOURCE_MEM), | 354 | IORESOURCE_MEM), |
@@ -374,7 +373,7 @@ static int __init wdt_gpi_probe(struct device *dev) | |||
374 | return res; | 373 | return res; |
375 | } | 374 | } |
376 | 375 | ||
377 | static int __exit wdt_gpi_remove(struct device *dev) | 376 | static int __exit wdt_gpi_remove(struct platform_device *dev) |
378 | { | 377 | { |
379 | int res; | 378 | int res; |
380 | 379 | ||
@@ -387,15 +386,13 @@ static int __exit wdt_gpi_remove(struct device *dev) | |||
387 | 386 | ||
388 | 387 | ||
389 | /* Device driver init & exit */ | 388 | /* Device driver init & exit */ |
390 | static struct device_driver wdt_gpi_driver = { | 389 | static struct platform_driver wgt_gpi_driver = { |
391 | .name = (char *) wdt_gpi_name, | 390 | .driver = { |
392 | .bus = &platform_bus_type, | 391 | .name = wdt_gpi_name, |
393 | .owner = THIS_MODULE, | 392 | .owner = THIS_MODULE, |
393 | }, | ||
394 | .probe = wdt_gpi_probe, | 394 | .probe = wdt_gpi_probe, |
395 | .remove = __exit_p(wdt_gpi_remove), | 395 | .remove = __devexit_p(wdt_gpi_remove), |
396 | .shutdown = NULL, | ||
397 | .suspend = NULL, | ||
398 | .resume = NULL, | ||
399 | }; | 396 | }; |
400 | 397 | ||
401 | static int __init wdt_gpi_init_module(void) | 398 | static int __init wdt_gpi_init_module(void) |
@@ -403,12 +400,12 @@ static int __init wdt_gpi_init_module(void) | |||
403 | atomic_set(&opencnt, 1); | 400 | atomic_set(&opencnt, 1); |
404 | if (timeout > MAX_TIMEOUT_SECONDS) | 401 | if (timeout > MAX_TIMEOUT_SECONDS) |
405 | timeout = MAX_TIMEOUT_SECONDS; | 402 | timeout = MAX_TIMEOUT_SECONDS; |
406 | return driver_register(&wdt_gpi_driver); | 403 | return platform_driver_register(&wdt_gpi_driver); |
407 | } | 404 | } |
408 | 405 | ||
409 | static void __exit wdt_gpi_cleanup_module(void) | 406 | static void __exit wdt_gpi_cleanup_module(void) |
410 | { | 407 | { |
411 | driver_unregister(&wdt_gpi_driver); | 408 | platform_driver_unregister(&wdt_gpi_driver); |
412 | } | 409 | } |
413 | 410 | ||
414 | module_init(wdt_gpi_init_module); | 411 | module_init(wdt_gpi_init_module); |