提交 be9dad1f 编写于 作者: S Sebastian Hesselbarth 提交者: David S. Miller

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: NSebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Acked-by: NMugunthan V N <mugunthanvnm@ti.com>
Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 1211ce53
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册