diff options
author | Finn Thain <fthain@telegraphics.com.au> | 2009-11-03 08:42:02 -0500 |
---|---|---|
committer | Geert Uytterhoeven <geert@linux-m68k.org> | 2010-02-27 12:31:11 -0500 |
commit | eeb9c182a6ad8bc130377adb0a4cd7b95dd15f49 (patch) | |
tree | cf891a3d1dadbb867966aa3b7b1a5be58ac4155b /drivers | |
parent | cff75f1fb1f28eba3facb7dbe9b40a892912578a (diff) |
mac68k: move macsonic and macmace platform devices
Move platform device code from the drivers to the platform init function.
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/macmace.c | 33 | ||||
-rw-r--r-- | drivers/net/macsonic.c | 33 |
2 files changed, 8 insertions, 58 deletions
diff --git a/drivers/net/macmace.c b/drivers/net/macmace.c index 44f3c2896f20..79408c377875 100644 --- a/drivers/net/macmace.c +++ b/drivers/net/macmace.c | |||
@@ -39,7 +39,6 @@ | |||
39 | #include "mace.h" | 39 | #include "mace.h" |
40 | 40 | ||
41 | static char mac_mace_string[] = "macmace"; | 41 | static char mac_mace_string[] = "macmace"; |
42 | static struct platform_device *mac_mace_device; | ||
43 | 42 | ||
44 | #define N_TX_BUFF_ORDER 0 | 43 | #define N_TX_BUFF_ORDER 0 |
45 | #define N_TX_RING (1 << N_TX_BUFF_ORDER) | 44 | #define N_TX_RING (1 << N_TX_BUFF_ORDER) |
@@ -752,6 +751,7 @@ static irqreturn_t mace_dma_intr(int irq, void *dev_id) | |||
752 | 751 | ||
753 | MODULE_LICENSE("GPL"); | 752 | MODULE_LICENSE("GPL"); |
754 | MODULE_DESCRIPTION("Macintosh MACE ethernet driver"); | 753 | MODULE_DESCRIPTION("Macintosh MACE ethernet driver"); |
754 | MODULE_ALIAS("platform:macmace"); | ||
755 | 755 | ||
756 | static int __devexit mac_mace_device_remove (struct platform_device *pdev) | 756 | static int __devexit mac_mace_device_remove (struct platform_device *pdev) |
757 | { | 757 | { |
@@ -777,47 +777,22 @@ static struct platform_driver mac_mace_driver = { | |||
777 | .probe = mace_probe, | 777 | .probe = mace_probe, |
778 | .remove = __devexit_p(mac_mace_device_remove), | 778 | .remove = __devexit_p(mac_mace_device_remove), |
779 | .driver = { | 779 | .driver = { |
780 | .name = mac_mace_string, | 780 | .name = mac_mace_string, |
781 | .owner = THIS_MODULE, | ||
781 | }, | 782 | }, |
782 | }; | 783 | }; |
783 | 784 | ||
784 | static int __init mac_mace_init_module(void) | 785 | static int __init mac_mace_init_module(void) |
785 | { | 786 | { |
786 | int err; | ||
787 | |||
788 | if (!MACH_IS_MAC) | 787 | if (!MACH_IS_MAC) |
789 | return -ENODEV; | 788 | return -ENODEV; |
790 | 789 | ||
791 | if ((err = platform_driver_register(&mac_mace_driver))) { | 790 | return platform_driver_register(&mac_mace_driver); |
792 | printk(KERN_ERR "Driver registration failed\n"); | ||
793 | return err; | ||
794 | } | ||
795 | |||
796 | mac_mace_device = platform_device_alloc(mac_mace_string, 0); | ||
797 | if (!mac_mace_device) | ||
798 | goto out_unregister; | ||
799 | |||
800 | if (platform_device_add(mac_mace_device)) { | ||
801 | platform_device_put(mac_mace_device); | ||
802 | mac_mace_device = NULL; | ||
803 | } | ||
804 | |||
805 | return 0; | ||
806 | |||
807 | out_unregister: | ||
808 | platform_driver_unregister(&mac_mace_driver); | ||
809 | |||
810 | return -ENOMEM; | ||
811 | } | 791 | } |
812 | 792 | ||
813 | static void __exit mac_mace_cleanup_module(void) | 793 | static void __exit mac_mace_cleanup_module(void) |
814 | { | 794 | { |
815 | platform_driver_unregister(&mac_mace_driver); | 795 | platform_driver_unregister(&mac_mace_driver); |
816 | |||
817 | if (mac_mace_device) { | ||
818 | platform_device_unregister(mac_mace_device); | ||
819 | mac_mace_device = NULL; | ||
820 | } | ||
821 | } | 796 | } |
822 | 797 | ||
823 | module_init(mac_mace_init_module); | 798 | module_init(mac_mace_init_module); |
diff --git a/drivers/net/macsonic.c b/drivers/net/macsonic.c index 875d361fb79d..24109c288108 100644 --- a/drivers/net/macsonic.c +++ b/drivers/net/macsonic.c | |||
@@ -62,7 +62,6 @@ | |||
62 | #include <asm/mac_via.h> | 62 | #include <asm/mac_via.h> |
63 | 63 | ||
64 | static char mac_sonic_string[] = "macsonic"; | 64 | static char mac_sonic_string[] = "macsonic"; |
65 | static struct platform_device *mac_sonic_device; | ||
66 | 65 | ||
67 | #include "sonic.h" | 66 | #include "sonic.h" |
68 | 67 | ||
@@ -607,6 +606,7 @@ out: | |||
607 | MODULE_DESCRIPTION("Macintosh SONIC ethernet driver"); | 606 | MODULE_DESCRIPTION("Macintosh SONIC ethernet driver"); |
608 | module_param(sonic_debug, int, 0); | 607 | module_param(sonic_debug, int, 0); |
609 | MODULE_PARM_DESC(sonic_debug, "macsonic debug level (1-4)"); | 608 | MODULE_PARM_DESC(sonic_debug, "macsonic debug level (1-4)"); |
609 | MODULE_ALIAS("platform:macsonic"); | ||
610 | 610 | ||
611 | #include "sonic.c" | 611 | #include "sonic.c" |
612 | 612 | ||
@@ -627,44 +627,19 @@ static struct platform_driver mac_sonic_driver = { | |||
627 | .probe = mac_sonic_probe, | 627 | .probe = mac_sonic_probe, |
628 | .remove = __devexit_p(mac_sonic_device_remove), | 628 | .remove = __devexit_p(mac_sonic_device_remove), |
629 | .driver = { | 629 | .driver = { |
630 | .name = mac_sonic_string, | 630 | .name = mac_sonic_string, |
631 | .owner = THIS_MODULE, | ||
631 | }, | 632 | }, |
632 | }; | 633 | }; |
633 | 634 | ||
634 | static int __init mac_sonic_init_module(void) | 635 | static int __init mac_sonic_init_module(void) |
635 | { | 636 | { |
636 | int err; | 637 | return platform_driver_register(&mac_sonic_driver); |
637 | |||
638 | if ((err = platform_driver_register(&mac_sonic_driver))) { | ||
639 | printk(KERN_ERR "Driver registration failed\n"); | ||
640 | return err; | ||
641 | } | ||
642 | |||
643 | mac_sonic_device = platform_device_alloc(mac_sonic_string, 0); | ||
644 | if (!mac_sonic_device) | ||
645 | goto out_unregister; | ||
646 | |||
647 | if (platform_device_add(mac_sonic_device)) { | ||
648 | platform_device_put(mac_sonic_device); | ||
649 | mac_sonic_device = NULL; | ||
650 | } | ||
651 | |||
652 | return 0; | ||
653 | |||
654 | out_unregister: | ||
655 | platform_driver_unregister(&mac_sonic_driver); | ||
656 | |||
657 | return -ENOMEM; | ||
658 | } | 638 | } |
659 | 639 | ||
660 | static void __exit mac_sonic_cleanup_module(void) | 640 | static void __exit mac_sonic_cleanup_module(void) |
661 | { | 641 | { |
662 | platform_driver_unregister(&mac_sonic_driver); | 642 | platform_driver_unregister(&mac_sonic_driver); |
663 | |||
664 | if (mac_sonic_device) { | ||
665 | platform_device_unregister(mac_sonic_device); | ||
666 | mac_sonic_device = NULL; | ||
667 | } | ||
668 | } | 643 | } |
669 | 644 | ||
670 | module_init(mac_sonic_init_module); | 645 | module_init(mac_sonic_init_module); |