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 /drivers/net/phy/broadcom.c | |
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>
Diffstat (limited to 'drivers/net/phy/broadcom.c')
-rw-r--r-- | drivers/net/phy/broadcom.c | 119 |
1 files changed, 17 insertions, 102 deletions
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); |