aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorFlorian Fainelli <f.fainelli@gmail.com>2013-12-18 00:38:12 -0500
committerDavid S. Miller <davem@davemloft.net>2013-12-18 00:49:02 -0500
commite109374f6b695fc988b8d4a964792e9ba7953dad (patch)
tree35177fb739eba324711383e56430d1fa4508ab8c /drivers/net
parent756b50895f8d47499b38b3f7328347f46f10a673 (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')
-rw-r--r--drivers/net/phy/phy.c264
-rw-r--r--drivers/net/phy/phy_device.c14
2 files changed, 139 insertions, 139 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);
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 4eb5bba1db5e..d53242449c90 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -162,7 +162,7 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id,
162 dev = kzalloc(sizeof(*dev), GFP_KERNEL); 162 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
163 163
164 if (NULL == dev) 164 if (NULL == dev)
165 return (struct phy_device*) PTR_ERR((void*)-ENOMEM); 165 return (struct phy_device *)PTR_ERR((void *)-ENOMEM);
166 166
167 dev->dev.release = phy_device_release; 167 dev->dev.release = phy_device_release;
168 168
@@ -459,7 +459,7 @@ EXPORT_SYMBOL(phy_connect_direct);
459 * choose to call only the subset of functions which provide 459 * choose to call only the subset of functions which provide
460 * the desired functionality. 460 * the desired functionality.
461 */ 461 */
462struct phy_device * phy_connect(struct net_device *dev, const char *bus_id, 462struct phy_device *phy_connect(struct net_device *dev, const char *bus_id,
463 void (*handler)(struct net_device *), 463 void (*handler)(struct net_device *),
464 phy_interface_t interface) 464 phy_interface_t interface)
465{ 465{
@@ -494,7 +494,7 @@ void phy_disconnect(struct phy_device *phydev)
494 phy_stop_interrupts(phydev); 494 phy_stop_interrupts(phydev);
495 495
496 phy_stop_machine(phydev); 496 phy_stop_machine(phydev);
497 497
498 phydev->adjust_link = NULL; 498 phydev->adjust_link = NULL;
499 499
500 phy_detach(phydev); 500 phy_detach(phydev);
@@ -792,7 +792,7 @@ int genphy_setup_forced(struct phy_device *phydev)
792 792
793 if (DUPLEX_FULL == phydev->duplex) 793 if (DUPLEX_FULL == phydev->duplex)
794 ctl |= BMCR_FULLDPLX; 794 ctl |= BMCR_FULLDPLX;
795 795
796 err = phy_write(phydev, MII_BMCR, ctl); 796 err = phy_write(phydev, MII_BMCR, ctl);
797 797
798 return err; 798 return err;
@@ -965,14 +965,14 @@ int genphy_read_status(struct phy_device *phydev)
965 phydev->duplex = DUPLEX_FULL; 965 phydev->duplex = DUPLEX_FULL;
966 } else if (lpa & (LPA_100FULL | LPA_100HALF)) { 966 } else if (lpa & (LPA_100FULL | LPA_100HALF)) {
967 phydev->speed = SPEED_100; 967 phydev->speed = SPEED_100;
968 968
969 if (lpa & LPA_100FULL) 969 if (lpa & LPA_100FULL)
970 phydev->duplex = DUPLEX_FULL; 970 phydev->duplex = DUPLEX_FULL;
971 } else 971 } else
972 if (lpa & LPA_10FULL) 972 if (lpa & LPA_10FULL)
973 phydev->duplex = DUPLEX_FULL; 973 phydev->duplex = DUPLEX_FULL;
974 974
975 if (phydev->duplex == DUPLEX_FULL){ 975 if (phydev->duplex == DUPLEX_FULL) {
976 phydev->pause = lpa & LPA_PAUSE_CAP ? 1 : 0; 976 phydev->pause = lpa & LPA_PAUSE_CAP ? 1 : 0;
977 phydev->asym_pause = lpa & LPA_PAUSE_ASYM ? 1 : 0; 977 phydev->asym_pause = lpa & LPA_PAUSE_ASYM ? 1 : 0;
978 } 978 }
@@ -1213,7 +1213,7 @@ static struct phy_driver genphy_driver = {
1213 .read_status = genphy_read_status, 1213 .read_status = genphy_read_status,
1214 .suspend = genphy_suspend, 1214 .suspend = genphy_suspend,
1215 .resume = genphy_resume, 1215 .resume = genphy_resume,
1216 .driver = {.owner= THIS_MODULE, }, 1216 .driver = { .owner = THIS_MODULE, },
1217}; 1217};
1218 1218
1219static int __init phy_init(void) 1219static int __init phy_init(void)