Skip to content

Commit

Permalink
net: phy: suspend phydev when going to HALTED
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Mugunthan V N <[email protected]>
Reviewed-by: Florian Fainelli <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
shesselba authored and davem330 committed Dec 17, 2013
1 parent 1211ce5 commit be9dad1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/net/phy/phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit be9dad1

Please sign in to comment.