bbe09f2b5dd838af1272cff130919a22c23a4b4f
[openwrt/openwrt.git] / target / linux / generic / patches-3.14 / 073-net-phy-resume-phydev-when-going-to-RESUMING.patch
1 --- a/drivers/net/phy/phy.c
2 +++ b/drivers/net/phy/phy.c
3 @@ -690,7 +690,7 @@ void phy_state_machine(struct work_struc
4 struct delayed_work *dwork = to_delayed_work(work);
5 struct phy_device *phydev =
6 container_of(dwork, struct phy_device, state_queue);
7 - int needs_aneg = 0, do_suspend = 0;
8 + bool needs_aneg = false, do_suspend = false, do_resume = false;
9 int err = 0;
10
11 mutex_lock(&phydev->lock);
12 @@ -702,7 +702,7 @@ void phy_state_machine(struct work_struc
13 case PHY_PENDING:
14 break;
15 case PHY_UP:
16 - needs_aneg = 1;
17 + needs_aneg = true;
18
19 phydev->link_timeout = PHY_AN_TIMEOUT;
20
21 @@ -732,7 +732,7 @@ void phy_state_machine(struct work_struc
22 phydev->adjust_link(phydev->attached_dev);
23
24 } else if (0 == phydev->link_timeout--) {
25 - needs_aneg = 1;
26 + needs_aneg = true;
27 /* If we have the magic_aneg bit, we try again */
28 if (phydev->drv->flags & PHY_HAS_MAGICANEG)
29 break;
30 @@ -770,7 +770,7 @@ void phy_state_machine(struct work_struc
31 netif_carrier_on(phydev->attached_dev);
32 } else {
33 if (0 == phydev->link_timeout--)
34 - needs_aneg = 1;
35 + needs_aneg = true;
36 }
37
38 phydev->adjust_link(phydev->attached_dev);
39 @@ -806,7 +806,7 @@ void phy_state_machine(struct work_struc
40 phydev->link = 0;
41 netif_carrier_off(phydev->attached_dev);
42 phydev->adjust_link(phydev->attached_dev);
43 - do_suspend = 1;
44 + do_suspend = true;
45 }
46 break;
47 case PHY_RESUMING:
48 @@ -855,6 +855,7 @@ void phy_state_machine(struct work_struc
49 }
50 phydev->adjust_link(phydev->attached_dev);
51 }
52 + do_resume = true;
53 break;
54 }
55
56 @@ -862,9 +863,10 @@ void phy_state_machine(struct work_struc
57
58 if (needs_aneg)
59 err = phy_start_aneg(phydev);
60 -
61 - if (do_suspend)
62 + else if (do_suspend)
63 phy_suspend(phydev);
64 + else if (do_resume)
65 + phy_resume(phydev);
66
67 if (err < 0)
68 phy_error(phydev);