diff options
author | Florian Fainelli <f.fainelli@gmail.com> | 2013-12-18 00:38:12 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-12-18 00:49:02 -0500 |
commit | e109374f6b695fc988b8d4a964792e9ba7953dad (patch) | |
tree | 35177fb739eba324711383e56430d1fa4508ab8c /drivers/net/phy/phy.c | |
parent | 756b50895f8d47499b38b3f7328347f46f10a673 (diff) |
net: phy: fix checkpatch errors
checkpatch spotted a few checkpatch errors such as whitespace damages
and switch/case labels not being on the same column, fix them.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy/phy.c')
-rw-r--r-- | drivers/net/phy/phy.c | 264 |
1 files changed, 132 insertions, 132 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index dea609f86aee..20908865709f 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c | |||
@@ -332,7 +332,7 @@ int phy_mii_ioctl(struct phy_device *phydev, | |||
332 | 332 | ||
333 | case SIOCSMIIREG: | 333 | case SIOCSMIIREG: |
334 | if (mii_data->phy_id == phydev->addr) { | 334 | if (mii_data->phy_id == phydev->addr) { |
335 | switch(mii_data->reg_num) { | 335 | switch (mii_data->reg_num) { |
336 | case MII_BMCR: | 336 | case MII_BMCR: |
337 | if ((val & (BMCR_RESET|BMCR_ANENABLE)) == 0) | 337 | if ((val & (BMCR_RESET|BMCR_ANENABLE)) == 0) |
338 | phydev->autoneg = AUTONEG_DISABLE; | 338 | phydev->autoneg = AUTONEG_DISABLE; |
@@ -714,16 +714,16 @@ void phy_start(struct phy_device *phydev) | |||
714 | mutex_lock(&phydev->lock); | 714 | mutex_lock(&phydev->lock); |
715 | 715 | ||
716 | switch (phydev->state) { | 716 | switch (phydev->state) { |
717 | case PHY_STARTING: | 717 | case PHY_STARTING: |
718 | phydev->state = PHY_PENDING; | 718 | phydev->state = PHY_PENDING; |
719 | break; | 719 | break; |
720 | case PHY_READY: | 720 | case PHY_READY: |
721 | phydev->state = PHY_UP; | 721 | phydev->state = PHY_UP; |
722 | break; | 722 | break; |
723 | case PHY_HALTED: | 723 | case PHY_HALTED: |
724 | phydev->state = PHY_RESUMING; | 724 | phydev->state = PHY_RESUMING; |
725 | default: | 725 | default: |
726 | break; | 726 | break; |
727 | } | 727 | } |
728 | mutex_unlock(&phydev->lock); | 728 | mutex_unlock(&phydev->lock); |
729 | } | 729 | } |
@@ -747,153 +747,138 @@ void phy_state_machine(struct work_struct *work) | |||
747 | if (phydev->adjust_state) | 747 | if (phydev->adjust_state) |
748 | phydev->adjust_state(phydev->attached_dev); | 748 | phydev->adjust_state(phydev->attached_dev); |
749 | 749 | ||
750 | switch(phydev->state) { | 750 | switch (phydev->state) { |
751 | case PHY_DOWN: | 751 | case PHY_DOWN: |
752 | case PHY_STARTING: | 752 | case PHY_STARTING: |
753 | case PHY_READY: | 753 | case PHY_READY: |
754 | case PHY_PENDING: | 754 | case PHY_PENDING: |
755 | break; | 755 | break; |
756 | case PHY_UP: | 756 | case PHY_UP: |
757 | needs_aneg = 1; | 757 | needs_aneg = 1; |
758 | 758 | ||
759 | phydev->link_timeout = PHY_AN_TIMEOUT; | 759 | phydev->link_timeout = PHY_AN_TIMEOUT; |
760 | |||
761 | break; | ||
762 | case PHY_AN: | ||
763 | err = phy_read_status(phydev); | ||
760 | 764 | ||
765 | if (err < 0) | ||
761 | break; | 766 | break; |
762 | case PHY_AN: | ||
763 | err = phy_read_status(phydev); | ||
764 | 767 | ||
765 | if (err < 0) | 768 | /* If the link is down, give up on |
766 | break; | 769 | * negotiation for now */ |
770 | if (!phydev->link) { | ||
771 | phydev->state = PHY_NOLINK; | ||
772 | netif_carrier_off(phydev->attached_dev); | ||
773 | phydev->adjust_link(phydev->attached_dev); | ||
774 | break; | ||
775 | } | ||
767 | 776 | ||
768 | /* If the link is down, give up on | 777 | /* Check if negotiation is done. Break |
769 | * negotiation for now */ | 778 | * if there's an error */ |
770 | if (!phydev->link) { | 779 | err = phy_aneg_done(phydev); |
771 | phydev->state = PHY_NOLINK; | 780 | if (err < 0) |
772 | netif_carrier_off(phydev->attached_dev); | 781 | break; |
773 | phydev->adjust_link(phydev->attached_dev); | ||
774 | break; | ||
775 | } | ||
776 | 782 | ||
777 | /* Check if negotiation is done. Break | 783 | /* If AN is done, we're running */ |
778 | * if there's an error */ | 784 | if (err > 0) { |
779 | err = phy_aneg_done(phydev); | 785 | phydev->state = PHY_RUNNING; |
780 | if (err < 0) | 786 | netif_carrier_on(phydev->attached_dev); |
781 | break; | 787 | phydev->adjust_link(phydev->attached_dev); |
782 | 788 | ||
783 | /* If AN is done, we're running */ | 789 | } else if (0 == phydev->link_timeout--) { |
784 | if (err > 0) { | 790 | needs_aneg = 1; |
785 | phydev->state = PHY_RUNNING; | 791 | /* If we have the magic_aneg bit, |
786 | netif_carrier_on(phydev->attached_dev); | 792 | * we try again */ |
787 | phydev->adjust_link(phydev->attached_dev); | 793 | if (phydev->drv->flags & PHY_HAS_MAGICANEG) |
794 | break; | ||
795 | } | ||
796 | break; | ||
797 | case PHY_NOLINK: | ||
798 | err = phy_read_status(phydev); | ||
788 | 799 | ||
789 | } else if (0 == phydev->link_timeout--) { | 800 | if (err) |
790 | needs_aneg = 1; | ||
791 | /* If we have the magic_aneg bit, | ||
792 | * we try again */ | ||
793 | if (phydev->drv->flags & PHY_HAS_MAGICANEG) | ||
794 | break; | ||
795 | } | ||
796 | break; | 801 | break; |
797 | case PHY_NOLINK: | ||
798 | err = phy_read_status(phydev); | ||
799 | 802 | ||
800 | if (err) | 803 | if (phydev->link) { |
801 | break; | 804 | phydev->state = PHY_RUNNING; |
805 | netif_carrier_on(phydev->attached_dev); | ||
806 | phydev->adjust_link(phydev->attached_dev); | ||
807 | } | ||
808 | break; | ||
809 | case PHY_FORCING: | ||
810 | err = genphy_update_link(phydev); | ||
802 | 811 | ||
803 | if (phydev->link) { | 812 | if (err) |
804 | phydev->state = PHY_RUNNING; | ||
805 | netif_carrier_on(phydev->attached_dev); | ||
806 | phydev->adjust_link(phydev->attached_dev); | ||
807 | } | ||
808 | break; | 813 | break; |
809 | case PHY_FORCING: | ||
810 | err = genphy_update_link(phydev); | ||
811 | 814 | ||
812 | if (err) | 815 | if (phydev->link) { |
813 | break; | 816 | phydev->state = PHY_RUNNING; |
817 | netif_carrier_on(phydev->attached_dev); | ||
818 | } else { | ||
819 | if (0 == phydev->link_timeout--) | ||
820 | needs_aneg = 1; | ||
821 | } | ||
814 | 822 | ||
815 | if (phydev->link) { | 823 | phydev->adjust_link(phydev->attached_dev); |
816 | phydev->state = PHY_RUNNING; | 824 | break; |
817 | netif_carrier_on(phydev->attached_dev); | 825 | case PHY_RUNNING: |
818 | } else { | 826 | /* Only register a CHANGE if we are |
819 | if (0 == phydev->link_timeout--) | 827 | * polling or ignoring interrupts |
820 | needs_aneg = 1; | 828 | */ |
821 | } | 829 | if (!phy_interrupt_is_valid(phydev)) |
830 | phydev->state = PHY_CHANGELINK; | ||
831 | break; | ||
832 | case PHY_CHANGELINK: | ||
833 | err = phy_read_status(phydev); | ||
822 | 834 | ||
823 | phydev->adjust_link(phydev->attached_dev); | 835 | if (err) |
824 | break; | 836 | break; |
825 | case PHY_RUNNING: | ||
826 | /* Only register a CHANGE if we are | ||
827 | * polling or ignoring interrupts | ||
828 | */ | ||
829 | if (!phy_interrupt_is_valid(phydev)) | ||
830 | phydev->state = PHY_CHANGELINK; | ||
831 | break; | ||
832 | case PHY_CHANGELINK: | ||
833 | err = phy_read_status(phydev); | ||
834 | 837 | ||
835 | if (err) | 838 | if (phydev->link) { |
836 | break; | 839 | phydev->state = PHY_RUNNING; |
840 | netif_carrier_on(phydev->attached_dev); | ||
841 | } else { | ||
842 | phydev->state = PHY_NOLINK; | ||
843 | netif_carrier_off(phydev->attached_dev); | ||
844 | } | ||
837 | 845 | ||
838 | if (phydev->link) { | 846 | phydev->adjust_link(phydev->attached_dev); |
839 | phydev->state = PHY_RUNNING; | ||
840 | netif_carrier_on(phydev->attached_dev); | ||
841 | } else { | ||
842 | phydev->state = PHY_NOLINK; | ||
843 | netif_carrier_off(phydev->attached_dev); | ||
844 | } | ||
845 | 847 | ||
848 | if (phy_interrupt_is_valid(phydev)) | ||
849 | err = phy_config_interrupt(phydev, | ||
850 | PHY_INTERRUPT_ENABLED); | ||
851 | break; | ||
852 | case PHY_HALTED: | ||
853 | if (phydev->link) { | ||
854 | phydev->link = 0; | ||
855 | netif_carrier_off(phydev->attached_dev); | ||
846 | phydev->adjust_link(phydev->attached_dev); | 856 | phydev->adjust_link(phydev->attached_dev); |
857 | do_suspend = 1; | ||
858 | } | ||
859 | break; | ||
860 | case PHY_RESUMING: | ||
847 | 861 | ||
848 | if (phy_interrupt_is_valid(phydev)) | 862 | err = phy_clear_interrupt(phydev); |
849 | err = phy_config_interrupt(phydev, | ||
850 | PHY_INTERRUPT_ENABLED); | ||
851 | break; | ||
852 | case PHY_HALTED: | ||
853 | if (phydev->link) { | ||
854 | phydev->link = 0; | ||
855 | netif_carrier_off(phydev->attached_dev); | ||
856 | phydev->adjust_link(phydev->attached_dev); | ||
857 | do_suspend = 1; | ||
858 | } | ||
859 | break; | ||
860 | case PHY_RESUMING: | ||
861 | 863 | ||
862 | err = phy_clear_interrupt(phydev); | 864 | if (err) |
865 | break; | ||
863 | 866 | ||
864 | if (err) | 867 | err = phy_config_interrupt(phydev, |
865 | break; | 868 | PHY_INTERRUPT_ENABLED); |
866 | 869 | ||
867 | err = phy_config_interrupt(phydev, | 870 | if (err) |
868 | PHY_INTERRUPT_ENABLED); | 871 | break; |
869 | 872 | ||
870 | if (err) | 873 | if (AUTONEG_ENABLE == phydev->autoneg) { |
874 | err = phy_aneg_done(phydev); | ||
875 | if (err < 0) | ||
871 | break; | 876 | break; |
872 | 877 | ||
873 | if (AUTONEG_ENABLE == phydev->autoneg) { | 878 | /* err > 0 if AN is done. |
874 | err = phy_aneg_done(phydev); | 879 | * Otherwise, it's 0, and we're |
875 | if (err < 0) | 880 | * still waiting for AN */ |
876 | break; | 881 | if (err > 0) { |
877 | |||
878 | /* err > 0 if AN is done. | ||
879 | * Otherwise, it's 0, and we're | ||
880 | * still waiting for AN */ | ||
881 | if (err > 0) { | ||
882 | err = phy_read_status(phydev); | ||
883 | if (err) | ||
884 | break; | ||
885 | |||
886 | if (phydev->link) { | ||
887 | phydev->state = PHY_RUNNING; | ||
888 | netif_carrier_on(phydev->attached_dev); | ||
889 | } else | ||
890 | phydev->state = PHY_NOLINK; | ||
891 | phydev->adjust_link(phydev->attached_dev); | ||
892 | } else { | ||
893 | phydev->state = PHY_AN; | ||
894 | phydev->link_timeout = PHY_AN_TIMEOUT; | ||
895 | } | ||
896 | } else { | ||
897 | err = phy_read_status(phydev); | 882 | err = phy_read_status(phydev); |
898 | if (err) | 883 | if (err) |
899 | break; | 884 | break; |
@@ -904,8 +889,23 @@ void phy_state_machine(struct work_struct *work) | |||
904 | } else | 889 | } else |
905 | phydev->state = PHY_NOLINK; | 890 | phydev->state = PHY_NOLINK; |
906 | phydev->adjust_link(phydev->attached_dev); | 891 | phydev->adjust_link(phydev->attached_dev); |
892 | } else { | ||
893 | phydev->state = PHY_AN; | ||
894 | phydev->link_timeout = PHY_AN_TIMEOUT; | ||
907 | } | 895 | } |
908 | break; | 896 | } else { |
897 | err = phy_read_status(phydev); | ||
898 | if (err) | ||
899 | break; | ||
900 | |||
901 | if (phydev->link) { | ||
902 | phydev->state = PHY_RUNNING; | ||
903 | netif_carrier_on(phydev->attached_dev); | ||
904 | } else | ||
905 | phydev->state = PHY_NOLINK; | ||
906 | phydev->adjust_link(phydev->attached_dev); | ||
907 | } | ||
908 | break; | ||
909 | } | 909 | } |
910 | 910 | ||
911 | mutex_unlock(&phydev->lock); | 911 | mutex_unlock(&phydev->lock); |