aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia
diff options
context:
space:
mode:
authorMing Lei <tom.leiming@gmail.com>2009-02-06 10:40:12 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2009-03-24 19:38:25 -0400
commit7a192ec334cab9fafe3a8665a65af398b0e24730 (patch)
treeeea572863500f94d446cfded69835e188dba3447 /drivers/pcmcia
parent6da2d377bba06c29d0bc41c8dee014164dec82a7 (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/pcmcia')
-rw-r--r--drivers/pcmcia/au1000_generic.c37
-rw-r--r--drivers/pcmcia/i82365.c28
-rw-r--r--drivers/pcmcia/m32r_cfc.c30
-rw-r--r--drivers/pcmcia/m32r_pcc.c30
-rw-r--r--drivers/pcmcia/sa1100_generic.c38
-rw-r--r--drivers/pcmcia/tcic.c30
-rw-r--r--drivers/pcmcia/vrc4171_card.c34
7 files changed, 159 insertions, 68 deletions
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
471int au1x00_drv_pcmcia_remove(struct device *dev) 471int 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
501static int au1x00_drv_pcmcia_probe(struct device *dev) 501static 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
515static 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
521static int au1x00_drv_pcmcia_resume(struct platform_device *dev)
522{
523 return pcmcia_socket_dev_resume(&dev->dev);
524}
515 525
516static struct device_driver au1x00_pcmcia_driver = { 526static 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 = {
533static int __init au1x00_pcmcia_init(void) 545static 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 */
545static void __exit au1x00_pcmcia_exit(void) 556static 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
550module_init(au1x00_pcmcia_init); 561module_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
1241static 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
1247static int i82365_drv_pcmcia_resume(struct platform_device *dev)
1248{
1249 return pcmcia_socket_dev_resume(&dev->dev);
1250}
1241static struct pccard_operations pcic_operations = { 1251static 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
1251static struct device_driver i82365_driver = { 1261static 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
1258static struct platform_device *i82365_device; 1270static 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
1339err_driver_unregister: 1351err_driver_unregister:
1340 driver_unregister(&i82365_driver); 1352 platform_driver_unregister(&i82365_driver);
1341err_out: 1353err_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
1371module_init(init_i82365); 1383module_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
699static 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
705static int cfc_drv_pcmcia_resume(struct platform_device *dev)
706{
707 return pcmcia_socket_dev_resume(&dev->dev);
708}
699/*====================================================================*/ 709/*====================================================================*/
700 710
701static struct device_driver pcc_driver = { 711static 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
708static struct platform_device pcc_device = { 720static 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
808module_init(init_m32r_pcc); 820module_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
675static 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
681static int pcc_drv_pcmcia_resume(struct platform_device *dev)
682{
683 return pcmcia_socket_dev_resume(&dev->dev);
684}
675/*====================================================================*/ 685/*====================================================================*/
676 686
677static struct device_driver pcc_driver = { 687static 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
684static struct platform_device pcc_device = { 696static 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
769module_init(init_m32r_pcc); 781module_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
68static int sa11x0_drv_pcmcia_probe(struct device *dev) 68static 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
84static struct device_driver sa11x0_pcmcia_driver = { 84static int sa11x0_drv_pcmcia_remove(struct platform_device *dev)
85{
86 return soc_common_drv_pcmcia_remove(&dev->dev);
87}
88
89static 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
95static int sa11x0_drv_pcmcia_resume(struct platform_device *dev)
96{
97 return pcmcia_socket_dev_resume(&dev->dev);
98}
99
100static 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 */
101static int __init sa11x0_pcmcia_init(void) 119static 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 */
111static void __exit sa11x0_pcmcia_exit(void) 129static 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
116MODULE_AUTHOR("John Dorsey <john+@cs.cmu.edu>"); 134MODULE_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
366static 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
372static int tcic_drv_pcmcia_resume(struct platform_device *dev)
373{
374 return pcmcia_socket_dev_resume(&dev->dev);
375}
366/*====================================================================*/ 376/*====================================================================*/
367 377
368static struct device_driver tcic_driver = { 378static 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
375static struct platform_device tcic_device = { 387static 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
707static struct device_driver vrc4171_card_driver = { 707static 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
713static int vrc4171_card_resume(struct platform_device *dev)
714{
715 return pcmcia_socket_dev_resume(&dev->dev);
716}
717
718static 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
714static int __devinit vrc4171_card_init(void) 727static 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
755module_init(vrc4171_card_init); 769module_init(vrc4171_card_init);