diff options
author | Christian Hohnstaedt <chohnstaedt@innominate.com> | 2012-07-04 01:44:34 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-07-09 03:10:56 -0400 |
commit | d5bf9071e71a4db85a0eea6236ef94a29fc3eec9 (patch) | |
tree | cf91cd107a5eda19dc8a1024b0c9b2115edf4988 | |
parent | 567990cfccafc580b03b1fb501adf63132c12dcc (diff) |
phylib: Support registering a bunch of drivers
If registering of one of them fails, all already registered drivers
of this module will be unregistered.
Use the new register/unregister functions in all drivers
registering more than one driver.
amd.c, realtek.c: Simplify: directly return registration result.
Tested with broadcom.c
All others compile-tested.
Signed-off-by: Christian Hohnstaedt <chohnstaedt@innominate.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/phy/amd.c | 8 | ||||
-rw-r--r-- | drivers/net/phy/bcm63xx.c | 31 | ||||
-rw-r--r-- | drivers/net/phy/bcm87xx.c | 24 | ||||
-rw-r--r-- | drivers/net/phy/broadcom.c | 119 | ||||
-rw-r--r-- | drivers/net/phy/cicada.c | 35 | ||||
-rw-r--r-- | drivers/net/phy/davicom.c | 41 | ||||
-rw-r--r-- | drivers/net/phy/icplus.c | 31 | ||||
-rw-r--r-- | drivers/net/phy/lxt.c | 47 | ||||
-rw-r--r-- | drivers/net/phy/marvell.c | 22 | ||||
-rw-r--r-- | drivers/net/phy/micrel.c | 62 | ||||
-rw-r--r-- | drivers/net/phy/phy_device.c | 25 | ||||
-rw-r--r-- | drivers/net/phy/realtek.c | 6 | ||||
-rw-r--r-- | drivers/net/phy/smsc.c | 64 | ||||
-rw-r--r-- | drivers/net/phy/ste10Xp.c | 21 | ||||
-rw-r--r-- | drivers/net/phy/vitesse.c | 52 | ||||
-rw-r--r-- | include/linux/phy.h | 2 |
16 files changed, 159 insertions, 431 deletions
diff --git a/drivers/net/phy/amd.c b/drivers/net/phy/amd.c index cfabd5fe5372..a3fb5ceb6487 100644 --- a/drivers/net/phy/amd.c +++ b/drivers/net/phy/amd.c | |||
@@ -77,13 +77,7 @@ static struct phy_driver am79c_driver = { | |||
77 | 77 | ||
78 | static int __init am79c_init(void) | 78 | static int __init am79c_init(void) |
79 | { | 79 | { |
80 | int ret; | 80 | return phy_driver_register(&am79c_driver); |
81 | |||
82 | ret = phy_driver_register(&am79c_driver); | ||
83 | if (ret) | ||
84 | return ret; | ||
85 | |||
86 | return 0; | ||
87 | } | 81 | } |
88 | 82 | ||
89 | static void __exit am79c_exit(void) | 83 | static void __exit am79c_exit(void) |
diff --git a/drivers/net/phy/bcm63xx.c b/drivers/net/phy/bcm63xx.c index cd802eb25fd2..84c7a39b1c65 100644 --- a/drivers/net/phy/bcm63xx.c +++ b/drivers/net/phy/bcm63xx.c | |||
@@ -71,7 +71,8 @@ static int bcm63xx_config_intr(struct phy_device *phydev) | |||
71 | return err; | 71 | return err; |
72 | } | 72 | } |
73 | 73 | ||
74 | static struct phy_driver bcm63xx_1_driver = { | 74 | static struct phy_driver bcm63xx_driver[] = { |
75 | { | ||
75 | .phy_id = 0x00406000, | 76 | .phy_id = 0x00406000, |
76 | .phy_id_mask = 0xfffffc00, | 77 | .phy_id_mask = 0xfffffc00, |
77 | .name = "Broadcom BCM63XX (1)", | 78 | .name = "Broadcom BCM63XX (1)", |
@@ -84,10 +85,8 @@ static struct phy_driver bcm63xx_1_driver = { | |||
84 | .ack_interrupt = bcm63xx_ack_interrupt, | 85 | .ack_interrupt = bcm63xx_ack_interrupt, |
85 | .config_intr = bcm63xx_config_intr, | 86 | .config_intr = bcm63xx_config_intr, |
86 | .driver = { .owner = THIS_MODULE }, | 87 | .driver = { .owner = THIS_MODULE }, |
87 | }; | 88 | }, { |
88 | 89 | /* same phy as above, with just a different OUI */ | |
89 | /* same phy as above, with just a different OUI */ | ||
90 | static struct phy_driver bcm63xx_2_driver = { | ||
91 | .phy_id = 0x002bdc00, | 90 | .phy_id = 0x002bdc00, |
92 | .phy_id_mask = 0xfffffc00, | 91 | .phy_id_mask = 0xfffffc00, |
93 | .name = "Broadcom BCM63XX (2)", | 92 | .name = "Broadcom BCM63XX (2)", |
@@ -99,30 +98,18 @@ static struct phy_driver bcm63xx_2_driver = { | |||
99 | .ack_interrupt = bcm63xx_ack_interrupt, | 98 | .ack_interrupt = bcm63xx_ack_interrupt, |
100 | .config_intr = bcm63xx_config_intr, | 99 | .config_intr = bcm63xx_config_intr, |
101 | .driver = { .owner = THIS_MODULE }, | 100 | .driver = { .owner = THIS_MODULE }, |
102 | }; | 101 | } }; |
103 | 102 | ||
104 | static int __init bcm63xx_phy_init(void) | 103 | static int __init bcm63xx_phy_init(void) |
105 | { | 104 | { |
106 | int ret; | 105 | return phy_drivers_register(bcm63xx_driver, |
107 | 106 | ARRAY_SIZE(bcm63xx_driver)); | |
108 | ret = phy_driver_register(&bcm63xx_1_driver); | ||
109 | if (ret) | ||
110 | goto out_63xx_1; | ||
111 | ret = phy_driver_register(&bcm63xx_2_driver); | ||
112 | if (ret) | ||
113 | goto out_63xx_2; | ||
114 | return ret; | ||
115 | |||
116 | out_63xx_2: | ||
117 | phy_driver_unregister(&bcm63xx_1_driver); | ||
118 | out_63xx_1: | ||
119 | return ret; | ||
120 | } | 107 | } |
121 | 108 | ||
122 | static void __exit bcm63xx_phy_exit(void) | 109 | static void __exit bcm63xx_phy_exit(void) |
123 | { | 110 | { |
124 | phy_driver_unregister(&bcm63xx_1_driver); | 111 | phy_drivers_unregister(bcm63xx_driver, |
125 | phy_driver_unregister(&bcm63xx_2_driver); | 112 | ARRAY_SIZE(bcm63xx_driver)); |
126 | } | 113 | } |
127 | 114 | ||
128 | module_init(bcm63xx_phy_init); | 115 | module_init(bcm63xx_phy_init); |
diff --git a/drivers/net/phy/bcm87xx.c b/drivers/net/phy/bcm87xx.c index 9a90dcf31156..2167ce51818e 100644 --- a/drivers/net/phy/bcm87xx.c +++ b/drivers/net/phy/bcm87xx.c | |||
@@ -187,7 +187,8 @@ static int bcm8727_match_phy_device(struct phy_device *phydev) | |||
187 | return phydev->c45_ids.device_ids[4] == PHY_ID_BCM8727; | 187 | return phydev->c45_ids.device_ids[4] == PHY_ID_BCM8727; |
188 | } | 188 | } |
189 | 189 | ||
190 | static struct phy_driver bcm8706_driver = { | 190 | static struct phy_driver bcm87xx_driver[] = { |
191 | { | ||
191 | .phy_id = PHY_ID_BCM8706, | 192 | .phy_id = PHY_ID_BCM8706, |
192 | .phy_id_mask = 0xffffffff, | 193 | .phy_id_mask = 0xffffffff, |
193 | .name = "Broadcom BCM8706", | 194 | .name = "Broadcom BCM8706", |
@@ -200,9 +201,7 @@ static struct phy_driver bcm8706_driver = { | |||
200 | .did_interrupt = bcm87xx_did_interrupt, | 201 | .did_interrupt = bcm87xx_did_interrupt, |
201 | .match_phy_device = bcm8706_match_phy_device, | 202 | .match_phy_device = bcm8706_match_phy_device, |
202 | .driver = { .owner = THIS_MODULE }, | 203 | .driver = { .owner = THIS_MODULE }, |
203 | }; | 204 | }, { |
204 | |||
205 | static struct phy_driver bcm8727_driver = { | ||
206 | .phy_id = PHY_ID_BCM8727, | 205 | .phy_id = PHY_ID_BCM8727, |
207 | .phy_id_mask = 0xffffffff, | 206 | .phy_id_mask = 0xffffffff, |
208 | .name = "Broadcom BCM8727", | 207 | .name = "Broadcom BCM8727", |
@@ -215,25 +214,18 @@ static struct phy_driver bcm8727_driver = { | |||
215 | .did_interrupt = bcm87xx_did_interrupt, | 214 | .did_interrupt = bcm87xx_did_interrupt, |
216 | .match_phy_device = bcm8727_match_phy_device, | 215 | .match_phy_device = bcm8727_match_phy_device, |
217 | .driver = { .owner = THIS_MODULE }, | 216 | .driver = { .owner = THIS_MODULE }, |
218 | }; | 217 | } }; |
219 | 218 | ||
220 | static int __init bcm87xx_init(void) | 219 | static int __init bcm87xx_init(void) |
221 | { | 220 | { |
222 | int ret; | 221 | return phy_drivers_register(bcm87xx_driver, |
223 | 222 | ARRAY_SIZE(bcm87xx_driver)); | |
224 | ret = phy_driver_register(&bcm8706_driver); | ||
225 | if (ret) | ||
226 | goto err; | ||
227 | |||
228 | ret = phy_driver_register(&bcm8727_driver); | ||
229 | err: | ||
230 | return ret; | ||
231 | } | 223 | } |
232 | module_init(bcm87xx_init); | 224 | module_init(bcm87xx_init); |
233 | 225 | ||
234 | static void __exit bcm87xx_exit(void) | 226 | static void __exit bcm87xx_exit(void) |
235 | { | 227 | { |
236 | phy_driver_unregister(&bcm8706_driver); | 228 | phy_drivers_unregister(bcm87xx_driver, |
237 | phy_driver_unregister(&bcm8727_driver); | 229 | ARRAY_SIZE(bcm87xx_driver)); |
238 | } | 230 | } |
239 | module_exit(bcm87xx_exit); | 231 | module_exit(bcm87xx_exit); |
diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c index 60338ff63092..f8c90ea75108 100644 --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c | |||
@@ -682,7 +682,8 @@ static int brcm_fet_config_intr(struct phy_device *phydev) | |||
682 | return err; | 682 | return err; |
683 | } | 683 | } |
684 | 684 | ||
685 | static struct phy_driver bcm5411_driver = { | 685 | static struct phy_driver broadcom_drivers[] = { |
686 | { | ||
686 | .phy_id = PHY_ID_BCM5411, | 687 | .phy_id = PHY_ID_BCM5411, |
687 | .phy_id_mask = 0xfffffff0, | 688 | .phy_id_mask = 0xfffffff0, |
688 | .name = "Broadcom BCM5411", | 689 | .name = "Broadcom BCM5411", |
@@ -695,9 +696,7 @@ static struct phy_driver bcm5411_driver = { | |||
695 | .ack_interrupt = bcm54xx_ack_interrupt, | 696 | .ack_interrupt = bcm54xx_ack_interrupt, |
696 | .config_intr = bcm54xx_config_intr, | 697 | .config_intr = bcm54xx_config_intr, |
697 | .driver = { .owner = THIS_MODULE }, | 698 | .driver = { .owner = THIS_MODULE }, |
698 | }; | 699 | }, { |
699 | |||
700 | static struct phy_driver bcm5421_driver = { | ||
701 | .phy_id = PHY_ID_BCM5421, | 700 | .phy_id = PHY_ID_BCM5421, |
702 | .phy_id_mask = 0xfffffff0, | 701 | .phy_id_mask = 0xfffffff0, |
703 | .name = "Broadcom BCM5421", | 702 | .name = "Broadcom BCM5421", |
@@ -710,9 +709,7 @@ static struct phy_driver bcm5421_driver = { | |||
710 | .ack_interrupt = bcm54xx_ack_interrupt, | 709 | .ack_interrupt = bcm54xx_ack_interrupt, |
711 | .config_intr = bcm54xx_config_intr, | 710 | .config_intr = bcm54xx_config_intr, |
712 | .driver = { .owner = THIS_MODULE }, | 711 | .driver = { .owner = THIS_MODULE }, |
713 | }; | 712 | }, { |
714 | |||
715 | static struct phy_driver bcm5461_driver = { | ||
716 | .phy_id = PHY_ID_BCM5461, | 713 | .phy_id = PHY_ID_BCM5461, |
717 | .phy_id_mask = 0xfffffff0, | 714 | .phy_id_mask = 0xfffffff0, |
718 | .name = "Broadcom BCM5461", | 715 | .name = "Broadcom BCM5461", |
@@ -725,9 +722,7 @@ static struct phy_driver bcm5461_driver = { | |||
725 | .ack_interrupt = bcm54xx_ack_interrupt, | 722 | .ack_interrupt = bcm54xx_ack_interrupt, |
726 | .config_intr = bcm54xx_config_intr, | 723 | .config_intr = bcm54xx_config_intr, |
727 | .driver = { .owner = THIS_MODULE }, | 724 | .driver = { .owner = THIS_MODULE }, |
728 | }; | 725 | }, { |
729 | |||
730 | static struct phy_driver bcm5464_driver = { | ||
731 | .phy_id = PHY_ID_BCM5464, | 726 | .phy_id = PHY_ID_BCM5464, |
732 | .phy_id_mask = 0xfffffff0, | 727 | .phy_id_mask = 0xfffffff0, |
733 | .name = "Broadcom BCM5464", | 728 | .name = "Broadcom BCM5464", |
@@ -740,9 +735,7 @@ static struct phy_driver bcm5464_driver = { | |||
740 | .ack_interrupt = bcm54xx_ack_interrupt, | 735 | .ack_interrupt = bcm54xx_ack_interrupt, |
741 | .config_intr = bcm54xx_config_intr, | 736 | .config_intr = bcm54xx_config_intr, |
742 | .driver = { .owner = THIS_MODULE }, | 737 | .driver = { .owner = THIS_MODULE }, |
743 | }; | 738 | }, { |
744 | |||
745 | static struct phy_driver bcm5481_driver = { | ||
746 | .phy_id = PHY_ID_BCM5481, | 739 | .phy_id = PHY_ID_BCM5481, |
747 | .phy_id_mask = 0xfffffff0, | 740 | .phy_id_mask = 0xfffffff0, |
748 | .name = "Broadcom BCM5481", | 741 | .name = "Broadcom BCM5481", |
@@ -755,9 +748,7 @@ static struct phy_driver bcm5481_driver = { | |||
755 | .ack_interrupt = bcm54xx_ack_interrupt, | 748 | .ack_interrupt = bcm54xx_ack_interrupt, |
756 | .config_intr = bcm54xx_config_intr, | 749 | .config_intr = bcm54xx_config_intr, |
757 | .driver = { .owner = THIS_MODULE }, | 750 | .driver = { .owner = THIS_MODULE }, |
758 | }; | 751 | }, { |
759 | |||
760 | static struct phy_driver bcm5482_driver = { | ||
761 | .phy_id = PHY_ID_BCM5482, | 752 | .phy_id = PHY_ID_BCM5482, |
762 | .phy_id_mask = 0xfffffff0, | 753 | .phy_id_mask = 0xfffffff0, |
763 | .name = "Broadcom BCM5482", | 754 | .name = "Broadcom BCM5482", |
@@ -770,9 +761,7 @@ static struct phy_driver bcm5482_driver = { | |||
770 | .ack_interrupt = bcm54xx_ack_interrupt, | 761 | .ack_interrupt = bcm54xx_ack_interrupt, |
771 | .config_intr = bcm54xx_config_intr, | 762 | .config_intr = bcm54xx_config_intr, |
772 | .driver = { .owner = THIS_MODULE }, | 763 | .driver = { .owner = THIS_MODULE }, |
773 | }; | 764 | }, { |
774 | |||
775 | static struct phy_driver bcm50610_driver = { | ||
776 | .phy_id = PHY_ID_BCM50610, | 765 | .phy_id = PHY_ID_BCM50610, |
777 | .phy_id_mask = 0xfffffff0, | 766 | .phy_id_mask = 0xfffffff0, |
778 | .name = "Broadcom BCM50610", | 767 | .name = "Broadcom BCM50610", |
@@ -785,9 +774,7 @@ static struct phy_driver bcm50610_driver = { | |||
785 | .ack_interrupt = bcm54xx_ack_interrupt, | 774 | .ack_interrupt = bcm54xx_ack_interrupt, |
786 | .config_intr = bcm54xx_config_intr, | 775 | .config_intr = bcm54xx_config_intr, |
787 | .driver = { .owner = THIS_MODULE }, | 776 | .driver = { .owner = THIS_MODULE }, |
788 | }; | 777 | }, { |
789 | |||
790 | static struct phy_driver bcm50610m_driver = { | ||
791 | .phy_id = PHY_ID_BCM50610M, | 778 | .phy_id = PHY_ID_BCM50610M, |
792 | .phy_id_mask = 0xfffffff0, | 779 | .phy_id_mask = 0xfffffff0, |
793 | .name = "Broadcom BCM50610M", | 780 | .name = "Broadcom BCM50610M", |
@@ -800,9 +787,7 @@ static struct phy_driver bcm50610m_driver = { | |||
800 | .ack_interrupt = bcm54xx_ack_interrupt, | 787 | .ack_interrupt = bcm54xx_ack_interrupt, |
801 | .config_intr = bcm54xx_config_intr, | 788 | .config_intr = bcm54xx_config_intr, |
802 | .driver = { .owner = THIS_MODULE }, | 789 | .driver = { .owner = THIS_MODULE }, |
803 | }; | 790 | }, { |
804 | |||
805 | static struct phy_driver bcm57780_driver = { | ||
806 | .phy_id = PHY_ID_BCM57780, | 791 | .phy_id = PHY_ID_BCM57780, |
807 | .phy_id_mask = 0xfffffff0, | 792 | .phy_id_mask = 0xfffffff0, |
808 | .name = "Broadcom BCM57780", | 793 | .name = "Broadcom BCM57780", |
@@ -815,9 +800,7 @@ static struct phy_driver bcm57780_driver = { | |||
815 | .ack_interrupt = bcm54xx_ack_interrupt, | 800 | .ack_interrupt = bcm54xx_ack_interrupt, |
816 | .config_intr = bcm54xx_config_intr, | 801 | .config_intr = bcm54xx_config_intr, |
817 | .driver = { .owner = THIS_MODULE }, | 802 | .driver = { .owner = THIS_MODULE }, |
818 | }; | 803 | }, { |
819 | |||
820 | static struct phy_driver bcmac131_driver = { | ||
821 | .phy_id = PHY_ID_BCMAC131, | 804 | .phy_id = PHY_ID_BCMAC131, |
822 | .phy_id_mask = 0xfffffff0, | 805 | .phy_id_mask = 0xfffffff0, |
823 | .name = "Broadcom BCMAC131", | 806 | .name = "Broadcom BCMAC131", |
@@ -830,9 +813,7 @@ static struct phy_driver bcmac131_driver = { | |||
830 | .ack_interrupt = brcm_fet_ack_interrupt, | 813 | .ack_interrupt = brcm_fet_ack_interrupt, |
831 | .config_intr = brcm_fet_config_intr, | 814 | .config_intr = brcm_fet_config_intr, |
832 | .driver = { .owner = THIS_MODULE }, | 815 | .driver = { .owner = THIS_MODULE }, |
833 | }; | 816 | }, { |
834 | |||
835 | static struct phy_driver bcm5241_driver = { | ||
836 | .phy_id = PHY_ID_BCM5241, | 817 | .phy_id = PHY_ID_BCM5241, |
837 | .phy_id_mask = 0xfffffff0, | 818 | .phy_id_mask = 0xfffffff0, |
838 | .name = "Broadcom BCM5241", | 819 | .name = "Broadcom BCM5241", |
@@ -845,84 +826,18 @@ static struct phy_driver bcm5241_driver = { | |||
845 | .ack_interrupt = brcm_fet_ack_interrupt, | 826 | .ack_interrupt = brcm_fet_ack_interrupt, |
846 | .config_intr = brcm_fet_config_intr, | 827 | .config_intr = brcm_fet_config_intr, |
847 | .driver = { .owner = THIS_MODULE }, | 828 | .driver = { .owner = THIS_MODULE }, |
848 | }; | 829 | } }; |
849 | 830 | ||
850 | static int __init broadcom_init(void) | 831 | static int __init broadcom_init(void) |
851 | { | 832 | { |
852 | int ret; | 833 | return phy_drivers_register(broadcom_drivers, |
853 | 834 | ARRAY_SIZE(broadcom_drivers)); | |
854 | ret = phy_driver_register(&bcm5411_driver); | ||
855 | if (ret) | ||
856 | goto out_5411; | ||
857 | ret = phy_driver_register(&bcm5421_driver); | ||
858 | if (ret) | ||
859 | goto out_5421; | ||
860 | ret = phy_driver_register(&bcm5461_driver); | ||
861 | if (ret) | ||
862 | goto out_5461; | ||
863 | ret = phy_driver_register(&bcm5464_driver); | ||
864 | if (ret) | ||
865 | goto out_5464; | ||
866 | ret = phy_driver_register(&bcm5481_driver); | ||
867 | if (ret) | ||
868 | goto out_5481; | ||
869 | ret = phy_driver_register(&bcm5482_driver); | ||
870 | if (ret) | ||
871 | goto out_5482; | ||
872 | ret = phy_driver_register(&bcm50610_driver); | ||
873 | if (ret) | ||
874 | goto out_50610; | ||
875 | ret = phy_driver_register(&bcm50610m_driver); | ||
876 | if (ret) | ||
877 | goto out_50610m; | ||
878 | ret = phy_driver_register(&bcm57780_driver); | ||
879 | if (ret) | ||
880 | goto out_57780; | ||
881 | ret = phy_driver_register(&bcmac131_driver); | ||
882 | if (ret) | ||
883 | goto out_ac131; | ||
884 | ret = phy_driver_register(&bcm5241_driver); | ||
885 | if (ret) | ||
886 | goto out_5241; | ||
887 | return ret; | ||
888 | |||
889 | out_5241: | ||
890 | phy_driver_unregister(&bcmac131_driver); | ||
891 | out_ac131: | ||
892 | phy_driver_unregister(&bcm57780_driver); | ||
893 | out_57780: | ||
894 | phy_driver_unregister(&bcm50610m_driver); | ||
895 | out_50610m: | ||
896 | phy_driver_unregister(&bcm50610_driver); | ||
897 | out_50610: | ||
898 | phy_driver_unregister(&bcm5482_driver); | ||
899 | out_5482: | ||
900 | phy_driver_unregister(&bcm5481_driver); | ||
901 | out_5481: | ||
902 | phy_driver_unregister(&bcm5464_driver); | ||
903 | out_5464: | ||
904 | phy_driver_unregister(&bcm5461_driver); | ||
905 | out_5461: | ||
906 | phy_driver_unregister(&bcm5421_driver); | ||
907 | out_5421: | ||
908 | phy_driver_unregister(&bcm5411_driver); | ||
909 | out_5411: | ||
910 | return ret; | ||
911 | } | 835 | } |
912 | 836 | ||
913 | static void __exit broadcom_exit(void) | 837 | static void __exit broadcom_exit(void) |
914 | { | 838 | { |
915 | phy_driver_unregister(&bcm5241_driver); | 839 | phy_drivers_unregister(broadcom_drivers, |
916 | phy_driver_unregister(&bcmac131_driver); | 840 | ARRAY_SIZE(broadcom_drivers)); |
917 | phy_driver_unregister(&bcm57780_driver); | ||
918 | phy_driver_unregister(&bcm50610m_driver); | ||
919 | phy_driver_unregister(&bcm50610_driver); | ||
920 | phy_driver_unregister(&bcm5482_driver); | ||
921 | phy_driver_unregister(&bcm5481_driver); | ||
922 | phy_driver_unregister(&bcm5464_driver); | ||
923 | phy_driver_unregister(&bcm5461_driver); | ||
924 | phy_driver_unregister(&bcm5421_driver); | ||
925 | phy_driver_unregister(&bcm5411_driver); | ||
926 | } | 841 | } |
927 | 842 | ||
928 | module_init(broadcom_init); | 843 | module_init(broadcom_init); |
diff --git a/drivers/net/phy/cicada.c b/drivers/net/phy/cicada.c index d28173161c21..db472ffb6e89 100644 --- a/drivers/net/phy/cicada.c +++ b/drivers/net/phy/cicada.c | |||
@@ -102,7 +102,8 @@ static int cis820x_config_intr(struct phy_device *phydev) | |||
102 | } | 102 | } |
103 | 103 | ||
104 | /* Cicada 8201, a.k.a Vitesse VSC8201 */ | 104 | /* Cicada 8201, a.k.a Vitesse VSC8201 */ |
105 | static struct phy_driver cis8201_driver = { | 105 | static struct phy_driver cis820x_driver[] = { |
106 | { | ||
106 | .phy_id = 0x000fc410, | 107 | .phy_id = 0x000fc410, |
107 | .name = "Cicada Cis8201", | 108 | .name = "Cicada Cis8201", |
108 | .phy_id_mask = 0x000ffff0, | 109 | .phy_id_mask = 0x000ffff0, |
@@ -113,11 +114,8 @@ static struct phy_driver cis8201_driver = { | |||
113 | .read_status = &genphy_read_status, | 114 | .read_status = &genphy_read_status, |
114 | .ack_interrupt = &cis820x_ack_interrupt, | 115 | .ack_interrupt = &cis820x_ack_interrupt, |
115 | .config_intr = &cis820x_config_intr, | 116 | .config_intr = &cis820x_config_intr, |
116 | .driver = { .owner = THIS_MODULE,}, | 117 | .driver = { .owner = THIS_MODULE,}, |
117 | }; | 118 | }, { |
118 | |||
119 | /* Cicada 8204 */ | ||
120 | static struct phy_driver cis8204_driver = { | ||
121 | .phy_id = 0x000fc440, | 119 | .phy_id = 0x000fc440, |
122 | .name = "Cicada Cis8204", | 120 | .name = "Cicada Cis8204", |
123 | .phy_id_mask = 0x000fffc0, | 121 | .phy_id_mask = 0x000fffc0, |
@@ -128,32 +126,19 @@ static struct phy_driver cis8204_driver = { | |||
128 | .read_status = &genphy_read_status, | 126 | .read_status = &genphy_read_status, |
129 | .ack_interrupt = &cis820x_ack_interrupt, | 127 | .ack_interrupt = &cis820x_ack_interrupt, |
130 | .config_intr = &cis820x_config_intr, | 128 | .config_intr = &cis820x_config_intr, |
131 | .driver = { .owner = THIS_MODULE,}, | 129 | .driver = { .owner = THIS_MODULE,}, |
132 | }; | 130 | } }; |
133 | 131 | ||
134 | static int __init cicada_init(void) | 132 | static int __init cicada_init(void) |
135 | { | 133 | { |
136 | int ret; | 134 | return phy_drivers_register(cis820x_driver, |
137 | 135 | ARRAY_SIZE(cis820x_driver)); | |
138 | ret = phy_driver_register(&cis8204_driver); | ||
139 | if (ret) | ||
140 | goto err1; | ||
141 | |||
142 | ret = phy_driver_register(&cis8201_driver); | ||
143 | if (ret) | ||
144 | goto err2; | ||
145 | return 0; | ||
146 | |||
147 | err2: | ||
148 | phy_driver_unregister(&cis8204_driver); | ||
149 | err1: | ||
150 | return ret; | ||
151 | } | 136 | } |
152 | 137 | ||
153 | static void __exit cicada_exit(void) | 138 | static void __exit cicada_exit(void) |
154 | { | 139 | { |
155 | phy_driver_unregister(&cis8204_driver); | 140 | phy_drivers_unregister(cis820x_driver, |
156 | phy_driver_unregister(&cis8201_driver); | 141 | ARRAY_SIZE(cis820x_driver)); |
157 | } | 142 | } |
158 | 143 | ||
159 | module_init(cicada_init); | 144 | module_init(cicada_init); |
diff --git a/drivers/net/phy/davicom.c b/drivers/net/phy/davicom.c index 5f59cc064778..81c7bc010dd8 100644 --- a/drivers/net/phy/davicom.c +++ b/drivers/net/phy/davicom.c | |||
@@ -144,7 +144,8 @@ static int dm9161_ack_interrupt(struct phy_device *phydev) | |||
144 | return (err < 0) ? err : 0; | 144 | return (err < 0) ? err : 0; |
145 | } | 145 | } |
146 | 146 | ||
147 | static struct phy_driver dm9161e_driver = { | 147 | static struct phy_driver dm91xx_driver[] = { |
148 | { | ||
148 | .phy_id = 0x0181b880, | 149 | .phy_id = 0x0181b880, |
149 | .name = "Davicom DM9161E", | 150 | .name = "Davicom DM9161E", |
150 | .phy_id_mask = 0x0ffffff0, | 151 | .phy_id_mask = 0x0ffffff0, |
@@ -153,9 +154,7 @@ static struct phy_driver dm9161e_driver = { | |||
153 | .config_aneg = dm9161_config_aneg, | 154 | .config_aneg = dm9161_config_aneg, |
154 | .read_status = genphy_read_status, | 155 | .read_status = genphy_read_status, |
155 | .driver = { .owner = THIS_MODULE,}, | 156 | .driver = { .owner = THIS_MODULE,}, |
156 | }; | 157 | }, { |
157 | |||
158 | static struct phy_driver dm9161a_driver = { | ||
159 | .phy_id = 0x0181b8a0, | 158 | .phy_id = 0x0181b8a0, |
160 | .name = "Davicom DM9161A", | 159 | .name = "Davicom DM9161A", |
161 | .phy_id_mask = 0x0ffffff0, | 160 | .phy_id_mask = 0x0ffffff0, |
@@ -164,9 +163,7 @@ static struct phy_driver dm9161a_driver = { | |||
164 | .config_aneg = dm9161_config_aneg, | 163 | .config_aneg = dm9161_config_aneg, |
165 | .read_status = genphy_read_status, | 164 | .read_status = genphy_read_status, |
166 | .driver = { .owner = THIS_MODULE,}, | 165 | .driver = { .owner = THIS_MODULE,}, |
167 | }; | 166 | }, { |
168 | |||
169 | static struct phy_driver dm9131_driver = { | ||
170 | .phy_id = 0x00181b80, | 167 | .phy_id = 0x00181b80, |
171 | .name = "Davicom DM9131", | 168 | .name = "Davicom DM9131", |
172 | .phy_id_mask = 0x0ffffff0, | 169 | .phy_id_mask = 0x0ffffff0, |
@@ -177,38 +174,18 @@ static struct phy_driver dm9131_driver = { | |||
177 | .ack_interrupt = dm9161_ack_interrupt, | 174 | .ack_interrupt = dm9161_ack_interrupt, |
178 | .config_intr = dm9161_config_intr, | 175 | .config_intr = dm9161_config_intr, |
179 | .driver = { .owner = THIS_MODULE,}, | 176 | .driver = { .owner = THIS_MODULE,}, |
180 | }; | 177 | } }; |
181 | 178 | ||
182 | static int __init davicom_init(void) | 179 | static int __init davicom_init(void) |
183 | { | 180 | { |
184 | int ret; | 181 | return phy_drivers_register(dm91xx_driver, |
185 | 182 | ARRAY_SIZE(dm91xx_driver)); | |
186 | ret = phy_driver_register(&dm9161e_driver); | ||
187 | if (ret) | ||
188 | goto err1; | ||
189 | |||
190 | ret = phy_driver_register(&dm9161a_driver); | ||
191 | if (ret) | ||
192 | goto err2; | ||
193 | |||
194 | ret = phy_driver_register(&dm9131_driver); | ||
195 | if (ret) | ||
196 | goto err3; | ||
197 | return 0; | ||
198 | |||
199 | err3: | ||
200 | phy_driver_unregister(&dm9161a_driver); | ||
201 | err2: | ||
202 | phy_driver_unregister(&dm9161e_driver); | ||
203 | err1: | ||
204 | return ret; | ||
205 | } | 183 | } |
206 | 184 | ||
207 | static void __exit davicom_exit(void) | 185 | static void __exit davicom_exit(void) |
208 | { | 186 | { |
209 | phy_driver_unregister(&dm9161e_driver); | 187 | phy_drivers_unregister(dm91xx_driver, |
210 | phy_driver_unregister(&dm9161a_driver); | 188 | ARRAY_SIZE(dm91xx_driver)); |
211 | phy_driver_unregister(&dm9131_driver); | ||
212 | } | 189 | } |
213 | 190 | ||
214 | module_init(davicom_init); | 191 | module_init(davicom_init); |
diff --git a/drivers/net/phy/icplus.c b/drivers/net/phy/icplus.c index 47f8e8939266..d5199cb4caec 100644 --- a/drivers/net/phy/icplus.c +++ b/drivers/net/phy/icplus.c | |||
@@ -202,7 +202,8 @@ static int ip101a_g_ack_interrupt(struct phy_device *phydev) | |||
202 | return 0; | 202 | return 0; |
203 | } | 203 | } |
204 | 204 | ||
205 | static struct phy_driver ip175c_driver = { | 205 | static struct phy_driver icplus_driver[] = { |
206 | { | ||
206 | .phy_id = 0x02430d80, | 207 | .phy_id = 0x02430d80, |
207 | .name = "ICPlus IP175C", | 208 | .name = "ICPlus IP175C", |
208 | .phy_id_mask = 0x0ffffff0, | 209 | .phy_id_mask = 0x0ffffff0, |
@@ -213,9 +214,7 @@ static struct phy_driver ip175c_driver = { | |||
213 | .suspend = genphy_suspend, | 214 | .suspend = genphy_suspend, |
214 | .resume = genphy_resume, | 215 | .resume = genphy_resume, |
215 | .driver = { .owner = THIS_MODULE,}, | 216 | .driver = { .owner = THIS_MODULE,}, |
216 | }; | 217 | }, { |
217 | |||
218 | static struct phy_driver ip1001_driver = { | ||
219 | .phy_id = 0x02430d90, | 218 | .phy_id = 0x02430d90, |
220 | .name = "ICPlus IP1001", | 219 | .name = "ICPlus IP1001", |
221 | .phy_id_mask = 0x0ffffff0, | 220 | .phy_id_mask = 0x0ffffff0, |
@@ -227,9 +226,7 @@ static struct phy_driver ip1001_driver = { | |||
227 | .suspend = genphy_suspend, | 226 | .suspend = genphy_suspend, |
228 | .resume = genphy_resume, | 227 | .resume = genphy_resume, |
229 | .driver = { .owner = THIS_MODULE,}, | 228 | .driver = { .owner = THIS_MODULE,}, |
230 | }; | 229 | }, { |
231 | |||
232 | static struct phy_driver ip101a_g_driver = { | ||
233 | .phy_id = 0x02430c54, | 230 | .phy_id = 0x02430c54, |
234 | .name = "ICPlus IP101A/G", | 231 | .name = "ICPlus IP101A/G", |
235 | .phy_id_mask = 0x0ffffff0, | 232 | .phy_id_mask = 0x0ffffff0, |
@@ -243,28 +240,18 @@ static struct phy_driver ip101a_g_driver = { | |||
243 | .suspend = genphy_suspend, | 240 | .suspend = genphy_suspend, |
244 | .resume = genphy_resume, | 241 | .resume = genphy_resume, |
245 | .driver = { .owner = THIS_MODULE,}, | 242 | .driver = { .owner = THIS_MODULE,}, |
246 | }; | 243 | } }; |
247 | 244 | ||
248 | static int __init icplus_init(void) | 245 | static int __init icplus_init(void) |
249 | { | 246 | { |
250 | int ret = 0; | 247 | return phy_drivers_register(icplus_driver, |
251 | 248 | ARRAY_SIZE(icplus_driver)); | |
252 | ret = phy_driver_register(&ip1001_driver); | ||
253 | if (ret < 0) | ||
254 | return -ENODEV; | ||
255 | |||
256 | ret = phy_driver_register(&ip101a_g_driver); | ||
257 | if (ret < 0) | ||
258 | return -ENODEV; | ||
259 | |||
260 | return phy_driver_register(&ip175c_driver); | ||
261 | } | 249 | } |
262 | 250 | ||
263 | static void __exit icplus_exit(void) | 251 | static void __exit icplus_exit(void) |
264 | { | 252 | { |
265 | phy_driver_unregister(&ip1001_driver); | 253 | phy_drivers_unregister(icplus_driver, |
266 | phy_driver_unregister(&ip101a_g_driver); | 254 | ARRAY_SIZE(icplus_driver)); |
267 | phy_driver_unregister(&ip175c_driver); | ||
268 | } | 255 | } |
269 | 256 | ||
270 | module_init(icplus_init); | 257 | module_init(icplus_init); |
diff --git a/drivers/net/phy/lxt.c b/drivers/net/phy/lxt.c index 6f6e8b616a62..6d1e3fcc43e2 100644 --- a/drivers/net/phy/lxt.c +++ b/drivers/net/phy/lxt.c | |||
@@ -149,7 +149,8 @@ static int lxt973_config_aneg(struct phy_device *phydev) | |||
149 | return phydev->priv ? 0 : genphy_config_aneg(phydev); | 149 | return phydev->priv ? 0 : genphy_config_aneg(phydev); |
150 | } | 150 | } |
151 | 151 | ||
152 | static struct phy_driver lxt970_driver = { | 152 | static struct phy_driver lxt97x_driver[] = { |
153 | { | ||
153 | .phy_id = 0x78100000, | 154 | .phy_id = 0x78100000, |
154 | .name = "LXT970", | 155 | .name = "LXT970", |
155 | .phy_id_mask = 0xfffffff0, | 156 | .phy_id_mask = 0xfffffff0, |
@@ -160,10 +161,8 @@ static struct phy_driver lxt970_driver = { | |||
160 | .read_status = genphy_read_status, | 161 | .read_status = genphy_read_status, |
161 | .ack_interrupt = lxt970_ack_interrupt, | 162 | .ack_interrupt = lxt970_ack_interrupt, |
162 | .config_intr = lxt970_config_intr, | 163 | .config_intr = lxt970_config_intr, |
163 | .driver = { .owner = THIS_MODULE,}, | 164 | .driver = { .owner = THIS_MODULE,}, |
164 | }; | 165 | }, { |
165 | |||
166 | static struct phy_driver lxt971_driver = { | ||
167 | .phy_id = 0x001378e0, | 166 | .phy_id = 0x001378e0, |
168 | .name = "LXT971", | 167 | .name = "LXT971", |
169 | .phy_id_mask = 0xfffffff0, | 168 | .phy_id_mask = 0xfffffff0, |
@@ -173,10 +172,8 @@ static struct phy_driver lxt971_driver = { | |||
173 | .read_status = genphy_read_status, | 172 | .read_status = genphy_read_status, |
174 | .ack_interrupt = lxt971_ack_interrupt, | 173 | .ack_interrupt = lxt971_ack_interrupt, |
175 | .config_intr = lxt971_config_intr, | 174 | .config_intr = lxt971_config_intr, |
176 | .driver = { .owner = THIS_MODULE,}, | 175 | .driver = { .owner = THIS_MODULE,}, |
177 | }; | 176 | }, { |
178 | |||
179 | static struct phy_driver lxt973_driver = { | ||
180 | .phy_id = 0x00137a10, | 177 | .phy_id = 0x00137a10, |
181 | .name = "LXT973", | 178 | .name = "LXT973", |
182 | .phy_id_mask = 0xfffffff0, | 179 | .phy_id_mask = 0xfffffff0, |
@@ -185,39 +182,19 @@ static struct phy_driver lxt973_driver = { | |||
185 | .probe = lxt973_probe, | 182 | .probe = lxt973_probe, |
186 | .config_aneg = lxt973_config_aneg, | 183 | .config_aneg = lxt973_config_aneg, |
187 | .read_status = genphy_read_status, | 184 | .read_status = genphy_read_status, |
188 | .driver = { .owner = THIS_MODULE,}, | 185 | .driver = { .owner = THIS_MODULE,}, |
189 | }; | 186 | } }; |
190 | 187 | ||
191 | static int __init lxt_init(void) | 188 | static int __init lxt_init(void) |
192 | { | 189 | { |
193 | int ret; | 190 | return phy_drivers_register(lxt97x_driver, |
194 | 191 | ARRAY_SIZE(lxt97x_driver)); | |
195 | ret = phy_driver_register(&lxt970_driver); | ||
196 | if (ret) | ||
197 | goto err1; | ||
198 | |||
199 | ret = phy_driver_register(&lxt971_driver); | ||
200 | if (ret) | ||
201 | goto err2; | ||
202 | |||
203 | ret = phy_driver_register(&lxt973_driver); | ||
204 | if (ret) | ||
205 | goto err3; | ||
206 | return 0; | ||
207 | |||
208 | err3: | ||
209 | phy_driver_unregister(&lxt971_driver); | ||
210 | err2: | ||
211 | phy_driver_unregister(&lxt970_driver); | ||
212 | err1: | ||
213 | return ret; | ||
214 | } | 192 | } |
215 | 193 | ||
216 | static void __exit lxt_exit(void) | 194 | static void __exit lxt_exit(void) |
217 | { | 195 | { |
218 | phy_driver_unregister(&lxt970_driver); | 196 | phy_drivers_unregister(lxt97x_driver, |
219 | phy_driver_unregister(&lxt971_driver); | 197 | ARRAY_SIZE(lxt97x_driver)); |
220 | phy_driver_unregister(&lxt973_driver); | ||
221 | } | 198 | } |
222 | 199 | ||
223 | module_init(lxt_init); | 200 | module_init(lxt_init); |
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index 418928d644bf..5d2a3f215887 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c | |||
@@ -826,28 +826,14 @@ static struct phy_driver marvell_drivers[] = { | |||
826 | 826 | ||
827 | static int __init marvell_init(void) | 827 | static int __init marvell_init(void) |
828 | { | 828 | { |
829 | int ret; | 829 | return phy_drivers_register(marvell_drivers, |
830 | int i; | 830 | ARRAY_SIZE(marvell_drivers)); |
831 | |||
832 | for (i = 0; i < ARRAY_SIZE(marvell_drivers); i++) { | ||
833 | ret = phy_driver_register(&marvell_drivers[i]); | ||
834 | |||
835 | if (ret) { | ||
836 | while (i-- > 0) | ||
837 | phy_driver_unregister(&marvell_drivers[i]); | ||
838 | return ret; | ||
839 | } | ||
840 | } | ||
841 | |||
842 | return 0; | ||
843 | } | 831 | } |
844 | 832 | ||
845 | static void __exit marvell_exit(void) | 833 | static void __exit marvell_exit(void) |
846 | { | 834 | { |
847 | int i; | 835 | phy_drivers_unregister(marvell_drivers, |
848 | 836 | ARRAY_SIZE(marvell_drivers)); | |
849 | for (i = 0; i < ARRAY_SIZE(marvell_drivers); i++) | ||
850 | phy_driver_unregister(&marvell_drivers[i]); | ||
851 | } | 837 | } |
852 | 838 | ||
853 | module_init(marvell_init); | 839 | module_init(marvell_init); |
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index 9d6c80c8a0cf..cf287e0eb408 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c | |||
@@ -114,7 +114,8 @@ static int ks8051_config_init(struct phy_device *phydev) | |||
114 | return 0; | 114 | return 0; |
115 | } | 115 | } |
116 | 116 | ||
117 | static struct phy_driver ks8737_driver = { | 117 | static struct phy_driver ksphy_driver[] = { |
118 | { | ||
118 | .phy_id = PHY_ID_KS8737, | 119 | .phy_id = PHY_ID_KS8737, |
119 | .phy_id_mask = 0x00fffff0, | 120 | .phy_id_mask = 0x00fffff0, |
120 | .name = "Micrel KS8737", | 121 | .name = "Micrel KS8737", |
@@ -126,9 +127,7 @@ static struct phy_driver ks8737_driver = { | |||
126 | .ack_interrupt = kszphy_ack_interrupt, | 127 | .ack_interrupt = kszphy_ack_interrupt, |
127 | .config_intr = ks8737_config_intr, | 128 | .config_intr = ks8737_config_intr, |
128 | .driver = { .owner = THIS_MODULE,}, | 129 | .driver = { .owner = THIS_MODULE,}, |
129 | }; | 130 | }, { |
130 | |||
131 | static struct phy_driver ks8041_driver = { | ||
132 | .phy_id = PHY_ID_KS8041, | 131 | .phy_id = PHY_ID_KS8041, |
133 | .phy_id_mask = 0x00fffff0, | 132 | .phy_id_mask = 0x00fffff0, |
134 | .name = "Micrel KS8041", | 133 | .name = "Micrel KS8041", |
@@ -141,9 +140,7 @@ static struct phy_driver ks8041_driver = { | |||
141 | .ack_interrupt = kszphy_ack_interrupt, | 140 | .ack_interrupt = kszphy_ack_interrupt, |
142 | .config_intr = kszphy_config_intr, | 141 | .config_intr = kszphy_config_intr, |
143 | .driver = { .owner = THIS_MODULE,}, | 142 | .driver = { .owner = THIS_MODULE,}, |
144 | }; | 143 | }, { |
145 | |||
146 | static struct phy_driver ks8051_driver = { | ||
147 | .phy_id = PHY_ID_KS8051, | 144 | .phy_id = PHY_ID_KS8051, |
148 | .phy_id_mask = 0x00fffff0, | 145 | .phy_id_mask = 0x00fffff0, |
149 | .name = "Micrel KS8051", | 146 | .name = "Micrel KS8051", |
@@ -156,9 +153,7 @@ static struct phy_driver ks8051_driver = { | |||
156 | .ack_interrupt = kszphy_ack_interrupt, | 153 | .ack_interrupt = kszphy_ack_interrupt, |
157 | .config_intr = kszphy_config_intr, | 154 | .config_intr = kszphy_config_intr, |
158 | .driver = { .owner = THIS_MODULE,}, | 155 | .driver = { .owner = THIS_MODULE,}, |
159 | }; | 156 | }, { |
160 | |||
161 | static struct phy_driver ks8001_driver = { | ||
162 | .phy_id = PHY_ID_KS8001, | 157 | .phy_id = PHY_ID_KS8001, |
163 | .name = "Micrel KS8001 or KS8721", | 158 | .name = "Micrel KS8001 or KS8721", |
164 | .phy_id_mask = 0x00ffffff, | 159 | .phy_id_mask = 0x00ffffff, |
@@ -170,9 +165,7 @@ static struct phy_driver ks8001_driver = { | |||
170 | .ack_interrupt = kszphy_ack_interrupt, | 165 | .ack_interrupt = kszphy_ack_interrupt, |
171 | .config_intr = kszphy_config_intr, | 166 | .config_intr = kszphy_config_intr, |
172 | .driver = { .owner = THIS_MODULE,}, | 167 | .driver = { .owner = THIS_MODULE,}, |
173 | }; | 168 | }, { |
174 | |||
175 | static struct phy_driver ksz9021_driver = { | ||
176 | .phy_id = PHY_ID_KSZ9021, | 169 | .phy_id = PHY_ID_KSZ9021, |
177 | .phy_id_mask = 0x000ffffe, | 170 | .phy_id_mask = 0x000ffffe, |
178 | .name = "Micrel KSZ9021 Gigabit PHY", | 171 | .name = "Micrel KSZ9021 Gigabit PHY", |
@@ -185,51 +178,18 @@ static struct phy_driver ksz9021_driver = { | |||
185 | .ack_interrupt = kszphy_ack_interrupt, | 178 | .ack_interrupt = kszphy_ack_interrupt, |
186 | .config_intr = ksz9021_config_intr, | 179 | .config_intr = ksz9021_config_intr, |
187 | .driver = { .owner = THIS_MODULE, }, | 180 | .driver = { .owner = THIS_MODULE, }, |
188 | }; | 181 | } }; |
189 | 182 | ||
190 | static int __init ksphy_init(void) | 183 | static int __init ksphy_init(void) |
191 | { | 184 | { |
192 | int ret; | 185 | return phy_drivers_register(ksphy_driver, |
193 | 186 | ARRAY_SIZE(ksphy_driver)); | |
194 | ret = phy_driver_register(&ks8001_driver); | ||
195 | if (ret) | ||
196 | goto err1; | ||
197 | |||
198 | ret = phy_driver_register(&ksz9021_driver); | ||
199 | if (ret) | ||
200 | goto err2; | ||
201 | |||
202 | ret = phy_driver_register(&ks8737_driver); | ||
203 | if (ret) | ||
204 | goto err3; | ||
205 | ret = phy_driver_register(&ks8041_driver); | ||
206 | if (ret) | ||
207 | goto err4; | ||
208 | ret = phy_driver_register(&ks8051_driver); | ||
209 | if (ret) | ||
210 | goto err5; | ||
211 | |||
212 | return 0; | ||
213 | |||
214 | err5: | ||
215 | phy_driver_unregister(&ks8041_driver); | ||
216 | err4: | ||
217 | phy_driver_unregister(&ks8737_driver); | ||
218 | err3: | ||
219 | phy_driver_unregister(&ksz9021_driver); | ||
220 | err2: | ||
221 | phy_driver_unregister(&ks8001_driver); | ||
222 | err1: | ||
223 | return ret; | ||
224 | } | 187 | } |
225 | 188 | ||
226 | static void __exit ksphy_exit(void) | 189 | static void __exit ksphy_exit(void) |
227 | { | 190 | { |
228 | phy_driver_unregister(&ks8001_driver); | 191 | phy_drivers_unregister(ksphy_driver, |
229 | phy_driver_unregister(&ks8737_driver); | 192 | ARRAY_SIZE(ksphy_driver)); |
230 | phy_driver_unregister(&ksz9021_driver); | ||
231 | phy_driver_unregister(&ks8041_driver); | ||
232 | phy_driver_unregister(&ks8051_driver); | ||
233 | } | 193 | } |
234 | 194 | ||
235 | module_init(ksphy_init); | 195 | module_init(ksphy_init); |
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 47e02e7dc737..8af46e88a181 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c | |||
@@ -1079,12 +1079,37 @@ int phy_driver_register(struct phy_driver *new_driver) | |||
1079 | } | 1079 | } |
1080 | EXPORT_SYMBOL(phy_driver_register); | 1080 | EXPORT_SYMBOL(phy_driver_register); |
1081 | 1081 | ||
1082 | int phy_drivers_register(struct phy_driver *new_driver, int n) | ||
1083 | { | ||
1084 | int i, ret = 0; | ||
1085 | |||
1086 | for (i = 0; i < n; i++) { | ||
1087 | ret = phy_driver_register(new_driver + i); | ||
1088 | if (ret) { | ||
1089 | while (i-- > 0) | ||
1090 | phy_driver_unregister(new_driver + i); | ||
1091 | break; | ||
1092 | } | ||
1093 | } | ||
1094 | return ret; | ||
1095 | } | ||
1096 | EXPORT_SYMBOL(phy_drivers_register); | ||
1097 | |||
1082 | void phy_driver_unregister(struct phy_driver *drv) | 1098 | void phy_driver_unregister(struct phy_driver *drv) |
1083 | { | 1099 | { |
1084 | driver_unregister(&drv->driver); | 1100 | driver_unregister(&drv->driver); |
1085 | } | 1101 | } |
1086 | EXPORT_SYMBOL(phy_driver_unregister); | 1102 | EXPORT_SYMBOL(phy_driver_unregister); |
1087 | 1103 | ||
1104 | void phy_drivers_unregister(struct phy_driver *drv, int n) | ||
1105 | { | ||
1106 | int i; | ||
1107 | for (i = 0; i < n; i++) { | ||
1108 | phy_driver_unregister(drv + i); | ||
1109 | } | ||
1110 | } | ||
1111 | EXPORT_SYMBOL(phy_drivers_unregister); | ||
1112 | |||
1088 | static struct phy_driver genphy_driver = { | 1113 | static struct phy_driver genphy_driver = { |
1089 | .phy_id = 0xffffffff, | 1114 | .phy_id = 0xffffffff, |
1090 | .phy_id_mask = 0xffffffff, | 1115 | .phy_id_mask = 0xffffffff, |
diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c index f414ffb5b728..72f93470ea35 100644 --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c | |||
@@ -65,11 +65,7 @@ static struct phy_driver rtl821x_driver = { | |||
65 | 65 | ||
66 | static int __init realtek_init(void) | 66 | static int __init realtek_init(void) |
67 | { | 67 | { |
68 | int ret; | 68 | return phy_driver_register(&rtl821x_driver); |
69 | |||
70 | ret = phy_driver_register(&rtl821x_driver); | ||
71 | |||
72 | return ret; | ||
73 | } | 69 | } |
74 | 70 | ||
75 | static void __exit realtek_exit(void) | 71 | static void __exit realtek_exit(void) |
diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c index fc3e7e96c88c..c6b06d311fee 100644 --- a/drivers/net/phy/smsc.c +++ b/drivers/net/phy/smsc.c | |||
@@ -61,7 +61,8 @@ static int lan911x_config_init(struct phy_device *phydev) | |||
61 | return smsc_phy_ack_interrupt(phydev); | 61 | return smsc_phy_ack_interrupt(phydev); |
62 | } | 62 | } |
63 | 63 | ||
64 | static struct phy_driver lan83c185_driver = { | 64 | static struct phy_driver smsc_phy_driver[] = { |
65 | { | ||
65 | .phy_id = 0x0007c0a0, /* OUI=0x00800f, Model#=0x0a */ | 66 | .phy_id = 0x0007c0a0, /* OUI=0x00800f, Model#=0x0a */ |
66 | .phy_id_mask = 0xfffffff0, | 67 | .phy_id_mask = 0xfffffff0, |
67 | .name = "SMSC LAN83C185", | 68 | .name = "SMSC LAN83C185", |
@@ -83,9 +84,7 @@ static struct phy_driver lan83c185_driver = { | |||
83 | .resume = genphy_resume, | 84 | .resume = genphy_resume, |
84 | 85 | ||
85 | .driver = { .owner = THIS_MODULE, } | 86 | .driver = { .owner = THIS_MODULE, } |
86 | }; | 87 | }, { |
87 | |||
88 | static struct phy_driver lan8187_driver = { | ||
89 | .phy_id = 0x0007c0b0, /* OUI=0x00800f, Model#=0x0b */ | 88 | .phy_id = 0x0007c0b0, /* OUI=0x00800f, Model#=0x0b */ |
90 | .phy_id_mask = 0xfffffff0, | 89 | .phy_id_mask = 0xfffffff0, |
91 | .name = "SMSC LAN8187", | 90 | .name = "SMSC LAN8187", |
@@ -107,9 +106,7 @@ static struct phy_driver lan8187_driver = { | |||
107 | .resume = genphy_resume, | 106 | .resume = genphy_resume, |
108 | 107 | ||
109 | .driver = { .owner = THIS_MODULE, } | 108 | .driver = { .owner = THIS_MODULE, } |
110 | }; | 109 | }, { |
111 | |||
112 | static struct phy_driver lan8700_driver = { | ||
113 | .phy_id = 0x0007c0c0, /* OUI=0x00800f, Model#=0x0c */ | 110 | .phy_id = 0x0007c0c0, /* OUI=0x00800f, Model#=0x0c */ |
114 | .phy_id_mask = 0xfffffff0, | 111 | .phy_id_mask = 0xfffffff0, |
115 | .name = "SMSC LAN8700", | 112 | .name = "SMSC LAN8700", |
@@ -131,9 +128,7 @@ static struct phy_driver lan8700_driver = { | |||
131 | .resume = genphy_resume, | 128 | .resume = genphy_resume, |
132 | 129 | ||
133 | .driver = { .owner = THIS_MODULE, } | 130 | .driver = { .owner = THIS_MODULE, } |
134 | }; | 131 | }, { |
135 | |||
136 | static struct phy_driver lan911x_int_driver = { | ||
137 | .phy_id = 0x0007c0d0, /* OUI=0x00800f, Model#=0x0d */ | 132 | .phy_id = 0x0007c0d0, /* OUI=0x00800f, Model#=0x0d */ |
138 | .phy_id_mask = 0xfffffff0, | 133 | .phy_id_mask = 0xfffffff0, |
139 | .name = "SMSC LAN911x Internal PHY", | 134 | .name = "SMSC LAN911x Internal PHY", |
@@ -155,9 +150,7 @@ static struct phy_driver lan911x_int_driver = { | |||
155 | .resume = genphy_resume, | 150 | .resume = genphy_resume, |
156 | 151 | ||
157 | .driver = { .owner = THIS_MODULE, } | 152 | .driver = { .owner = THIS_MODULE, } |
158 | }; | 153 | }, { |
159 | |||
160 | static struct phy_driver lan8710_driver = { | ||
161 | .phy_id = 0x0007c0f0, /* OUI=0x00800f, Model#=0x0f */ | 154 | .phy_id = 0x0007c0f0, /* OUI=0x00800f, Model#=0x0f */ |
162 | .phy_id_mask = 0xfffffff0, | 155 | .phy_id_mask = 0xfffffff0, |
163 | .name = "SMSC LAN8710/LAN8720", | 156 | .name = "SMSC LAN8710/LAN8720", |
@@ -179,53 +172,18 @@ static struct phy_driver lan8710_driver = { | |||
179 | .resume = genphy_resume, | 172 | .resume = genphy_resume, |
180 | 173 | ||
181 | .driver = { .owner = THIS_MODULE, } | 174 | .driver = { .owner = THIS_MODULE, } |
182 | }; | 175 | } }; |
183 | 176 | ||
184 | static int __init smsc_init(void) | 177 | static int __init smsc_init(void) |
185 | { | 178 | { |
186 | int ret; | 179 | return phy_drivers_register(smsc_phy_driver, |
187 | 180 | ARRAY_SIZE(smsc_phy_driver)); | |
188 | ret = phy_driver_register (&lan83c185_driver); | ||
189 | if (ret) | ||
190 | goto err1; | ||
191 | |||
192 | ret = phy_driver_register (&lan8187_driver); | ||
193 | if (ret) | ||
194 | goto err2; | ||
195 | |||
196 | ret = phy_driver_register (&lan8700_driver); | ||
197 | if (ret) | ||
198 | goto err3; | ||
199 | |||
200 | ret = phy_driver_register (&lan911x_int_driver); | ||
201 | if (ret) | ||
202 | goto err4; | ||
203 | |||
204 | ret = phy_driver_register (&lan8710_driver); | ||
205 | if (ret) | ||
206 | goto err5; | ||
207 | |||
208 | return 0; | ||
209 | |||
210 | err5: | ||
211 | phy_driver_unregister (&lan911x_int_driver); | ||
212 | err4: | ||
213 | phy_driver_unregister (&lan8700_driver); | ||
214 | err3: | ||
215 | phy_driver_unregister (&lan8187_driver); | ||
216 | err2: | ||
217 | phy_driver_unregister (&lan83c185_driver); | ||
218 | err1: | ||
219 | return ret; | ||
220 | } | 181 | } |
221 | 182 | ||
222 | static void __exit smsc_exit(void) | 183 | static void __exit smsc_exit(void) |
223 | { | 184 | { |
224 | phy_driver_unregister (&lan8710_driver); | 185 | return phy_drivers_unregister(smsc_phy_driver, |
225 | phy_driver_unregister (&lan911x_int_driver); | 186 | ARRAY_SIZE(smsc_phy_driver)); |
226 | phy_driver_unregister (&lan8700_driver); | ||
227 | phy_driver_unregister (&lan8187_driver); | ||
228 | phy_driver_unregister (&lan83c185_driver); | ||
229 | } | 187 | } |
230 | 188 | ||
231 | MODULE_DESCRIPTION("SMSC PHY driver"); | 189 | MODULE_DESCRIPTION("SMSC PHY driver"); |
diff --git a/drivers/net/phy/ste10Xp.c b/drivers/net/phy/ste10Xp.c index 187a2fa814f2..5e1eb138916f 100644 --- a/drivers/net/phy/ste10Xp.c +++ b/drivers/net/phy/ste10Xp.c | |||
@@ -81,7 +81,8 @@ static int ste10Xp_ack_interrupt(struct phy_device *phydev) | |||
81 | return 0; | 81 | return 0; |
82 | } | 82 | } |
83 | 83 | ||
84 | static struct phy_driver ste101p_pdriver = { | 84 | static struct phy_driver ste10xp_pdriver[] = { |
85 | { | ||
85 | .phy_id = STE101P_PHY_ID, | 86 | .phy_id = STE101P_PHY_ID, |
86 | .phy_id_mask = 0xfffffff0, | 87 | .phy_id_mask = 0xfffffff0, |
87 | .name = "STe101p", | 88 | .name = "STe101p", |
@@ -95,9 +96,7 @@ static struct phy_driver ste101p_pdriver = { | |||
95 | .suspend = genphy_suspend, | 96 | .suspend = genphy_suspend, |
96 | .resume = genphy_resume, | 97 | .resume = genphy_resume, |
97 | .driver = {.owner = THIS_MODULE,} | 98 | .driver = {.owner = THIS_MODULE,} |
98 | }; | 99 | }, { |
99 | |||
100 | static struct phy_driver ste100p_pdriver = { | ||
101 | .phy_id = STE100P_PHY_ID, | 100 | .phy_id = STE100P_PHY_ID, |
102 | .phy_id_mask = 0xffffffff, | 101 | .phy_id_mask = 0xffffffff, |
103 | .name = "STe100p", | 102 | .name = "STe100p", |
@@ -111,22 +110,18 @@ static struct phy_driver ste100p_pdriver = { | |||
111 | .suspend = genphy_suspend, | 110 | .suspend = genphy_suspend, |
112 | .resume = genphy_resume, | 111 | .resume = genphy_resume, |
113 | .driver = {.owner = THIS_MODULE,} | 112 | .driver = {.owner = THIS_MODULE,} |
114 | }; | 113 | } }; |
115 | 114 | ||
116 | static int __init ste10Xp_init(void) | 115 | static int __init ste10Xp_init(void) |
117 | { | 116 | { |
118 | int retval; | 117 | return phy_drivers_register(ste10xp_pdriver, |
119 | 118 | ARRAY_SIZE(ste10xp_pdriver)); | |
120 | retval = phy_driver_register(&ste100p_pdriver); | ||
121 | if (retval < 0) | ||
122 | return retval; | ||
123 | return phy_driver_register(&ste101p_pdriver); | ||
124 | } | 119 | } |
125 | 120 | ||
126 | static void __exit ste10Xp_exit(void) | 121 | static void __exit ste10Xp_exit(void) |
127 | { | 122 | { |
128 | phy_driver_unregister(&ste100p_pdriver); | 123 | phy_drivers_unregister(ste10xp_pdriver, |
129 | phy_driver_unregister(&ste101p_pdriver); | 124 | ARRAY_SIZE(ste10xp_pdriver)); |
130 | } | 125 | } |
131 | 126 | ||
132 | module_init(ste10Xp_init); | 127 | module_init(ste10Xp_init); |
diff --git a/drivers/net/phy/vitesse.c b/drivers/net/phy/vitesse.c index 0ec8e09cc2ac..2585c383e623 100644 --- a/drivers/net/phy/vitesse.c +++ b/drivers/net/phy/vitesse.c | |||
@@ -138,21 +138,6 @@ static int vsc82xx_config_intr(struct phy_device *phydev) | |||
138 | return err; | 138 | return err; |
139 | } | 139 | } |
140 | 140 | ||
141 | /* Vitesse 824x */ | ||
142 | static struct phy_driver vsc8244_driver = { | ||
143 | .phy_id = PHY_ID_VSC8244, | ||
144 | .name = "Vitesse VSC8244", | ||
145 | .phy_id_mask = 0x000fffc0, | ||
146 | .features = PHY_GBIT_FEATURES, | ||
147 | .flags = PHY_HAS_INTERRUPT, | ||
148 | .config_init = &vsc824x_config_init, | ||
149 | .config_aneg = &genphy_config_aneg, | ||
150 | .read_status = &genphy_read_status, | ||
151 | .ack_interrupt = &vsc824x_ack_interrupt, | ||
152 | .config_intr = &vsc82xx_config_intr, | ||
153 | .driver = { .owner = THIS_MODULE,}, | ||
154 | }; | ||
155 | |||
156 | static int vsc8221_config_init(struct phy_device *phydev) | 141 | static int vsc8221_config_init(struct phy_device *phydev) |
157 | { | 142 | { |
158 | int err; | 143 | int err; |
@@ -165,8 +150,22 @@ static int vsc8221_config_init(struct phy_device *phydev) | |||
165 | Options are 802.3Z SerDes or SGMII */ | 150 | Options are 802.3Z SerDes or SGMII */ |
166 | } | 151 | } |
167 | 152 | ||
168 | /* Vitesse 8221 */ | 153 | /* Vitesse 824x */ |
169 | static struct phy_driver vsc8221_driver = { | 154 | static struct phy_driver vsc82xx_driver[] = { |
155 | { | ||
156 | .phy_id = PHY_ID_VSC8244, | ||
157 | .name = "Vitesse VSC8244", | ||
158 | .phy_id_mask = 0x000fffc0, | ||
159 | .features = PHY_GBIT_FEATURES, | ||
160 | .flags = PHY_HAS_INTERRUPT, | ||
161 | .config_init = &vsc824x_config_init, | ||
162 | .config_aneg = &genphy_config_aneg, | ||
163 | .read_status = &genphy_read_status, | ||
164 | .ack_interrupt = &vsc824x_ack_interrupt, | ||
165 | .config_intr = &vsc82xx_config_intr, | ||
166 | .driver = { .owner = THIS_MODULE,}, | ||
167 | }, { | ||
168 | /* Vitesse 8221 */ | ||
170 | .phy_id = PHY_ID_VSC8221, | 169 | .phy_id = PHY_ID_VSC8221, |
171 | .phy_id_mask = 0x000ffff0, | 170 | .phy_id_mask = 0x000ffff0, |
172 | .name = "Vitesse VSC8221", | 171 | .name = "Vitesse VSC8221", |
@@ -177,26 +176,19 @@ static struct phy_driver vsc8221_driver = { | |||
177 | .read_status = &genphy_read_status, | 176 | .read_status = &genphy_read_status, |
178 | .ack_interrupt = &vsc824x_ack_interrupt, | 177 | .ack_interrupt = &vsc824x_ack_interrupt, |
179 | .config_intr = &vsc82xx_config_intr, | 178 | .config_intr = &vsc82xx_config_intr, |
180 | .driver = { .owner = THIS_MODULE,}, | 179 | .driver = { .owner = THIS_MODULE,}, |
181 | }; | 180 | } }; |
182 | 181 | ||
183 | static int __init vsc82xx_init(void) | 182 | static int __init vsc82xx_init(void) |
184 | { | 183 | { |
185 | int err; | 184 | return phy_drivers_register(vsc82xx_driver, |
186 | 185 | ARRAY_SIZE(vsc82xx_driver)); | |
187 | err = phy_driver_register(&vsc8244_driver); | ||
188 | if (err < 0) | ||
189 | return err; | ||
190 | err = phy_driver_register(&vsc8221_driver); | ||
191 | if (err < 0) | ||
192 | phy_driver_unregister(&vsc8244_driver); | ||
193 | return err; | ||
194 | } | 186 | } |
195 | 187 | ||
196 | static void __exit vsc82xx_exit(void) | 188 | static void __exit vsc82xx_exit(void) |
197 | { | 189 | { |
198 | phy_driver_unregister(&vsc8244_driver); | 190 | return phy_drivers_unregister(vsc82xx_driver, |
199 | phy_driver_unregister(&vsc8221_driver); | 191 | ARRAY_SIZE(vsc82xx_driver)); |
200 | } | 192 | } |
201 | 193 | ||
202 | module_init(vsc82xx_init); | 194 | module_init(vsc82xx_init); |
diff --git a/include/linux/phy.h b/include/linux/phy.h index c35299e4da8e..93b3cf77f564 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h | |||
@@ -533,7 +533,9 @@ int genphy_read_status(struct phy_device *phydev); | |||
533 | int genphy_suspend(struct phy_device *phydev); | 533 | int genphy_suspend(struct phy_device *phydev); |
534 | int genphy_resume(struct phy_device *phydev); | 534 | int genphy_resume(struct phy_device *phydev); |
535 | void phy_driver_unregister(struct phy_driver *drv); | 535 | void phy_driver_unregister(struct phy_driver *drv); |
536 | void phy_drivers_unregister(struct phy_driver *drv, int n); | ||
536 | int phy_driver_register(struct phy_driver *new_driver); | 537 | int phy_driver_register(struct phy_driver *new_driver); |
538 | int phy_drivers_register(struct phy_driver *new_driver, int n); | ||
537 | void phy_state_machine(struct work_struct *work); | 539 | void phy_state_machine(struct work_struct *work); |
538 | void phy_start_machine(struct phy_device *phydev, | 540 | void phy_start_machine(struct phy_device *phydev, |
539 | void (*handler)(struct net_device *)); | 541 | void (*handler)(struct net_device *)); |