aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor_core@ameritech.net>2006-03-22 03:07:53 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-22 10:53:56 -0500
commitd39b6cfe664079ca79ae1cfebac4725a877fd61d (patch)
tree85a4a2784819406ac86d4f30d9764cb363c2c83b
parentf4a641d66c6e135dcfc861521e8008faed2411e1 (diff)
[PATCH] vr41xx: convert to the new platform device interface
The patch does the following for v441xx seris drivers: - stop using platform_device_register_simple() as it is going away - mark ->probe() and ->remove() methods as __devinit and __devexit respectively - initialize "owner" field in driver structure so there is a link from /sys/modules to the driver - mark *_init() and *_exit() functions as __init and __exit Signed-off-by: Dmitry Torokhov <dtor@mail.ru> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/char/vr41xx_giu.c19
-rw-r--r--drivers/char/vr41xx_rtc.c30
-rw-r--r--drivers/serial/vr41xx_siu.c24
3 files changed, 48 insertions, 25 deletions
diff --git a/drivers/char/vr41xx_giu.c b/drivers/char/vr41xx_giu.c
index 2267c7b81799..05e6e814d86f 100644
--- a/drivers/char/vr41xx_giu.c
+++ b/drivers/char/vr41xx_giu.c
@@ -613,7 +613,7 @@ static struct file_operations gpio_fops = {
613 .release = gpio_release, 613 .release = gpio_release,
614}; 614};
615 615
616static int giu_probe(struct platform_device *dev) 616static int __devinit giu_probe(struct platform_device *dev)
617{ 617{
618 unsigned long start, size, flags = 0; 618 unsigned long start, size, flags = 0;
619 unsigned int nr_pins = 0; 619 unsigned int nr_pins = 0;
@@ -697,7 +697,7 @@ static int giu_probe(struct platform_device *dev)
697 return cascade_irq(GIUINT_IRQ, giu_get_irq); 697 return cascade_irq(GIUINT_IRQ, giu_get_irq);
698} 698}
699 699
700static int giu_remove(struct platform_device *dev) 700static int __devexit giu_remove(struct platform_device *dev)
701{ 701{
702 iounmap(giu_base); 702 iounmap(giu_base);
703 703
@@ -712,9 +712,10 @@ static struct platform_device *giu_platform_device;
712 712
713static struct platform_driver giu_device_driver = { 713static struct platform_driver giu_device_driver = {
714 .probe = giu_probe, 714 .probe = giu_probe,
715 .remove = giu_remove, 715 .remove = __devexit_p(giu_remove),
716 .driver = { 716 .driver = {
717 .name = "GIU", 717 .name = "GIU",
718 .owner = THIS_MODULE,
718 }, 719 },
719}; 720};
720 721
@@ -722,9 +723,15 @@ static int __init vr41xx_giu_init(void)
722{ 723{
723 int retval; 724 int retval;
724 725
725 giu_platform_device = platform_device_register_simple("GIU", -1, NULL, 0); 726 giu_platform_device = platform_device_alloc("GIU", -1);
726 if (IS_ERR(giu_platform_device)) 727 if (!giu_platform_device)
727 return PTR_ERR(giu_platform_device); 728 return -ENOMEM;
729
730 retval = platform_device_add(giu_platform_device);
731 if (retval < 0) {
732 platform_device_put(giu_platform_device);
733 return retval;
734 }
728 735
729 retval = platform_driver_register(&giu_device_driver); 736 retval = platform_driver_register(&giu_device_driver);
730 if (retval < 0) 737 if (retval < 0)
diff --git a/drivers/char/vr41xx_rtc.c b/drivers/char/vr41xx_rtc.c
index bc1b4a15212c..b109d9a502d6 100644
--- a/drivers/char/vr41xx_rtc.c
+++ b/drivers/char/vr41xx_rtc.c
@@ -558,7 +558,7 @@ static struct miscdevice rtc_miscdevice = {
558 .fops = &rtc_fops, 558 .fops = &rtc_fops,
559}; 559};
560 560
561static int rtc_probe(struct platform_device *pdev) 561static int __devinit rtc_probe(struct platform_device *pdev)
562{ 562{
563 unsigned int irq; 563 unsigned int irq;
564 int retval; 564 int retval;
@@ -631,7 +631,7 @@ static int rtc_probe(struct platform_device *pdev)
631 return 0; 631 return 0;
632} 632}
633 633
634static int rtc_remove(struct platform_device *dev) 634static int __devexit rtc_remove(struct platform_device *dev)
635{ 635{
636 int retval; 636 int retval;
637 637
@@ -653,13 +653,14 @@ static struct platform_device *rtc_platform_device;
653 653
654static struct platform_driver rtc_device_driver = { 654static struct platform_driver rtc_device_driver = {
655 .probe = rtc_probe, 655 .probe = rtc_probe,
656 .remove = rtc_remove, 656 .remove = __devexit_p(rtc_remove),
657 .driver = { 657 .driver = {
658 .name = rtc_name, 658 .name = rtc_name,
659 .owner = THIS_MODULE,
659 }, 660 },
660}; 661};
661 662
662static int __devinit vr41xx_rtc_init(void) 663static int __init vr41xx_rtc_init(void)
663{ 664{
664 int retval; 665 int retval;
665 666
@@ -684,10 +685,20 @@ static int __devinit vr41xx_rtc_init(void)
684 break; 685 break;
685 } 686 }
686 687
687 rtc_platform_device = platform_device_register_simple("RTC", -1, 688 rtc_platform_device = platform_device_alloc("RTC", -1);
688 rtc_resource, ARRAY_SIZE(rtc_resource)); 689 if (!rtc_platform_device)
689 if (IS_ERR(rtc_platform_device)) 690 return -ENOMEM;
690 return PTR_ERR(rtc_platform_device); 691
692 retval = platform_device_add_resources(rtc_platform_device,
693 rtc_resource, ARRAY_SIZE(rtc_resource));
694
695 if (retval == 0)
696 retval = platform_device_add(rtc_platform_device);
697
698 if (retval < 0) {
699 platform_device_put(rtc_platform_device);
700 return retval;
701 }
691 702
692 retval = platform_driver_register(&rtc_device_driver); 703 retval = platform_driver_register(&rtc_device_driver);
693 if (retval < 0) 704 if (retval < 0)
@@ -696,10 +707,9 @@ static int __devinit vr41xx_rtc_init(void)
696 return retval; 707 return retval;
697} 708}
698 709
699static void __devexit vr41xx_rtc_exit(void) 710static void __exit vr41xx_rtc_exit(void)
700{ 711{
701 platform_driver_unregister(&rtc_device_driver); 712 platform_driver_unregister(&rtc_device_driver);
702
703 platform_device_unregister(rtc_platform_device); 713 platform_device_unregister(rtc_platform_device);
704} 714}
705 715
diff --git a/drivers/serial/vr41xx_siu.c b/drivers/serial/vr41xx_siu.c
index d61494d185cd..bd6294132c18 100644
--- a/drivers/serial/vr41xx_siu.c
+++ b/drivers/serial/vr41xx_siu.c
@@ -919,7 +919,7 @@ static struct uart_driver siu_uart_driver = {
919 .cons = SERIAL_VR41XX_CONSOLE, 919 .cons = SERIAL_VR41XX_CONSOLE,
920}; 920};
921 921
922static int siu_probe(struct platform_device *dev) 922static int __devinit siu_probe(struct platform_device *dev)
923{ 923{
924 struct uart_port *port; 924 struct uart_port *port;
925 int num, i, retval; 925 int num, i, retval;
@@ -953,7 +953,7 @@ static int siu_probe(struct platform_device *dev)
953 return 0; 953 return 0;
954} 954}
955 955
956static int siu_remove(struct platform_device *dev) 956static int __devexit siu_remove(struct platform_device *dev)
957{ 957{
958 struct uart_port *port; 958 struct uart_port *port;
959 int i; 959 int i;
@@ -1006,21 +1006,28 @@ static struct platform_device *siu_platform_device;
1006 1006
1007static struct platform_driver siu_device_driver = { 1007static struct platform_driver siu_device_driver = {
1008 .probe = siu_probe, 1008 .probe = siu_probe,
1009 .remove = siu_remove, 1009 .remove = __devexit_p(siu_remove),
1010 .suspend = siu_suspend, 1010 .suspend = siu_suspend,
1011 .resume = siu_resume, 1011 .resume = siu_resume,
1012 .driver = { 1012 .driver = {
1013 .name = "SIU", 1013 .name = "SIU",
1014 .owner = THIS_MODULE,
1014 }, 1015 },
1015}; 1016};
1016 1017
1017static int __devinit vr41xx_siu_init(void) 1018static int __init vr41xx_siu_init(void)
1018{ 1019{
1019 int retval; 1020 int retval;
1020 1021
1021 siu_platform_device = platform_device_register_simple("SIU", -1, NULL, 0); 1022 siu_platform_device = platform_device_alloc("SIU", -1);
1022 if (IS_ERR(siu_platform_device)) 1023 if (!siu_platform_device)
1023 return PTR_ERR(siu_platform_device); 1024 return -ENOMEM;
1025
1026 retval = platform_device_add(siu_platform_device);
1027 if (retval < 0) {
1028 platform_device_put(siu_platform_device);
1029 return retval;
1030 }
1024 1031
1025 retval = platform_driver_register(&siu_device_driver); 1032 retval = platform_driver_register(&siu_device_driver);
1026 if (retval < 0) 1033 if (retval < 0)
@@ -1029,10 +1036,9 @@ static int __devinit vr41xx_siu_init(void)
1029 return retval; 1036 return retval;
1030} 1037}
1031 1038
1032static void __devexit vr41xx_siu_exit(void) 1039static void __exit vr41xx_siu_exit(void)
1033{ 1040{
1034 platform_driver_unregister(&siu_device_driver); 1041 platform_driver_unregister(&siu_device_driver);
1035
1036 platform_device_unregister(siu_platform_device); 1042 platform_device_unregister(siu_platform_device);
1037} 1043}
1038 1044