diff options
-rw-r--r-- | arch/m68k/mac/config.c | 23 | ||||
-rw-r--r-- | drivers/net/macmace.c | 33 | ||||
-rw-r--r-- | drivers/net/macsonic.c | 33 |
3 files changed, 31 insertions, 58 deletions
diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c index 91245ade2290..816452b3e50f 100644 --- a/arch/m68k/mac/config.c +++ b/arch/m68k/mac/config.c | |||
@@ -921,6 +921,16 @@ static struct platform_device esp_1_pdev = { | |||
921 | .id = 1, | 921 | .id = 1, |
922 | }; | 922 | }; |
923 | 923 | ||
924 | static struct platform_device sonic_pdev = { | ||
925 | .name = "macsonic", | ||
926 | .id = -1, | ||
927 | }; | ||
928 | |||
929 | static struct platform_device mace_pdev = { | ||
930 | .name = "macmace", | ||
931 | .id = -1, | ||
932 | }; | ||
933 | |||
924 | int __init mac_platform_init(void) | 934 | int __init mac_platform_init(void) |
925 | { | 935 | { |
926 | u8 *swim_base; | 936 | u8 *swim_base; |
@@ -971,6 +981,19 @@ int __init mac_platform_init(void) | |||
971 | break; | 981 | break; |
972 | } | 982 | } |
973 | 983 | ||
984 | /* | ||
985 | * Ethernet device | ||
986 | */ | ||
987 | |||
988 | switch (macintosh_config->ether_type) { | ||
989 | case MAC_ETHER_SONIC: | ||
990 | platform_device_register(&sonic_pdev); | ||
991 | break; | ||
992 | case MAC_ETHER_MACE: | ||
993 | platform_device_register(&mace_pdev); | ||
994 | break; | ||
995 | } | ||
996 | |||
974 | return 0; | 997 | return 0; |
975 | } | 998 | } |
976 | 999 | ||
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); |