diff options
author | Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> | 2013-12-13 04:20:29 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-12-17 14:42:44 -0500 |
commit | be9dad1f9f26604fb71c0d53ccb39a8f1d425807 (patch) | |
tree | ed294b23c4e02b34473e3c56f6c0d2599d8f2a1d /drivers/net/phy/phy.c | |
parent | 1211ce53077164e0d34641d0ca5fb4d4a7574498 (diff) |
net: phy: suspend phydev when going to HALTED
When phydev is going to HALTED state, we can try to suspend it to
safe more power. phy_suspend helper will check if PHY can be suspended,
so just call it when entering HALTED state.
Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Acked-by: Mugunthan V N <mugunthanvnm@ti.com>
Reviewed-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 | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index e3dd69100da8..dea609f86aee 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c | |||
@@ -739,7 +739,7 @@ void phy_state_machine(struct work_struct *work) | |||
739 | struct delayed_work *dwork = to_delayed_work(work); | 739 | struct delayed_work *dwork = to_delayed_work(work); |
740 | struct phy_device *phydev = | 740 | struct phy_device *phydev = |
741 | container_of(dwork, struct phy_device, state_queue); | 741 | container_of(dwork, struct phy_device, state_queue); |
742 | int needs_aneg = 0; | 742 | int needs_aneg = 0, do_suspend = 0; |
743 | int err = 0; | 743 | int err = 0; |
744 | 744 | ||
745 | mutex_lock(&phydev->lock); | 745 | mutex_lock(&phydev->lock); |
@@ -854,6 +854,7 @@ void phy_state_machine(struct work_struct *work) | |||
854 | phydev->link = 0; | 854 | phydev->link = 0; |
855 | netif_carrier_off(phydev->attached_dev); | 855 | netif_carrier_off(phydev->attached_dev); |
856 | phydev->adjust_link(phydev->attached_dev); | 856 | phydev->adjust_link(phydev->attached_dev); |
857 | do_suspend = 1; | ||
857 | } | 858 | } |
858 | break; | 859 | break; |
859 | case PHY_RESUMING: | 860 | case PHY_RESUMING: |
@@ -912,6 +913,9 @@ void phy_state_machine(struct work_struct *work) | |||
912 | if (needs_aneg) | 913 | if (needs_aneg) |
913 | err = phy_start_aneg(phydev); | 914 | err = phy_start_aneg(phydev); |
914 | 915 | ||
916 | if (do_suspend) | ||
917 | phy_suspend(phydev); | ||
918 | |||
915 | if (err < 0) | 919 | if (err < 0) |
916 | phy_error(phydev); | 920 | phy_error(phydev); |
917 | 921 | ||