diff options
author | Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> | 2013-12-13 10:20:29 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-12-17 14:42:44 -0500 |
commit | be9dad1f9f26604fb71c0d53ccb39a8f1d425807 (patch) | |
tree | ed294b23c4e02b34473e3c56f6c0d2599d8f2a1d /drivers/net/phy | |
parent | 1211ce53077164e0d34641d0ca5fb4d4a7574498 (diff) | |
download | linux-be9dad1f9f26604fb71c0d53ccb39a8f1d425807.tar.gz linux-be9dad1f9f26604fb71c0d53ccb39a8f1d425807.tar.bz2 linux-be9dad1f9f26604fb71c0d53ccb39a8f1d425807.zip |
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')
-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) struct delayed_work *dwork = to_delayed_work(work); struct phy_device *phydev = container_of(dwork, struct phy_device, state_queue); - int needs_aneg = 0; + int needs_aneg = 0, do_suspend = 0; int err = 0; mutex_lock(&phydev->lock); @@ -854,6 +854,7 @@ void phy_state_machine(struct work_struct *work) phydev->link = 0; netif_carrier_off(phydev->attached_dev); phydev->adjust_link(phydev->attached_dev); + do_suspend = 1; } break; case PHY_RESUMING: @@ -912,6 +913,9 @@ void phy_state_machine(struct work_struct *work) if (needs_aneg) err = phy_start_aneg(phydev); + if (do_suspend) + phy_suspend(phydev); + if (err < 0) phy_error(phydev); |