| .. | .. |
|---|
| 56 | 56 | return NULL; |
|---|
| 57 | 57 | } |
|---|
| 58 | 58 | |
|---|
| 59 | +static void phy_process_state_change(struct phy_device *phydev, |
|---|
| 60 | + enum phy_state old_state) |
|---|
| 61 | +{ |
|---|
| 62 | + if (old_state != phydev->state) { |
|---|
| 63 | + phydev_dbg(phydev, "PHY state change %s -> %s\n", |
|---|
| 64 | + phy_state_to_str(old_state), |
|---|
| 65 | + phy_state_to_str(phydev->state)); |
|---|
| 66 | + if (phydev->drv && phydev->drv->link_change_notify) |
|---|
| 67 | + phydev->drv->link_change_notify(phydev); |
|---|
| 68 | + } |
|---|
| 69 | +} |
|---|
| 70 | + |
|---|
| 59 | 71 | static void phy_link_up(struct phy_device *phydev) |
|---|
| 60 | 72 | { |
|---|
| 61 | 73 | phydev->phy_link_change(phydev, true); |
|---|
| .. | .. |
|---|
| 1110 | 1122 | void phy_stop(struct phy_device *phydev) |
|---|
| 1111 | 1123 | { |
|---|
| 1112 | 1124 | struct net_device *dev = phydev->attached_dev; |
|---|
| 1125 | + enum phy_state old_state; |
|---|
| 1113 | 1126 | |
|---|
| 1114 | 1127 | if (!phy_is_started(phydev) && phydev->state != PHY_DOWN) { |
|---|
| 1115 | 1128 | WARN(1, "called from state %s\n", |
|---|
| .. | .. |
|---|
| 1118 | 1131 | } |
|---|
| 1119 | 1132 | |
|---|
| 1120 | 1133 | mutex_lock(&phydev->lock); |
|---|
| 1134 | + old_state = phydev->state; |
|---|
| 1121 | 1135 | |
|---|
| 1122 | 1136 | if (phydev->state == PHY_CABLETEST) { |
|---|
| 1123 | 1137 | phy_abort_cable_test(phydev); |
|---|
| .. | .. |
|---|
| 1128 | 1142 | sfp_upstream_stop(phydev->sfp_bus); |
|---|
| 1129 | 1143 | |
|---|
| 1130 | 1144 | phydev->state = PHY_HALTED; |
|---|
| 1145 | + phy_process_state_change(phydev, old_state); |
|---|
| 1131 | 1146 | |
|---|
| 1132 | 1147 | mutex_unlock(&phydev->lock); |
|---|
| 1133 | 1148 | |
|---|
| .. | .. |
|---|
| 1242 | 1257 | if (err < 0) |
|---|
| 1243 | 1258 | phy_error(phydev); |
|---|
| 1244 | 1259 | |
|---|
| 1245 | | - if (old_state != phydev->state) { |
|---|
| 1246 | | - phydev_dbg(phydev, "PHY state change %s -> %s\n", |
|---|
| 1247 | | - phy_state_to_str(old_state), |
|---|
| 1248 | | - phy_state_to_str(phydev->state)); |
|---|
| 1249 | | - if (phydev->drv && phydev->drv->link_change_notify) |
|---|
| 1250 | | - phydev->drv->link_change_notify(phydev); |
|---|
| 1251 | | - } |
|---|
| 1260 | + phy_process_state_change(phydev, old_state); |
|---|
| 1252 | 1261 | |
|---|
| 1253 | 1262 | /* Only re-schedule a PHY state machine change if we are polling the |
|---|
| 1254 | 1263 | * PHY, if PHY_IGNORE_INTERRUPT is set, then we will be moving |
|---|