summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2019-01-18 14:12:25 -0800
committerDavid S. Miller <davem@davemloft.net>2019-01-18 14:12:25 -0800
commit209f94e6185465a18328f07dc332ea7cee0b72fc (patch)
tree36132c101bee7156226713c6038de55babc073ea
parent340a6f3d2d52a1b72f3454818e53293807f8f127 (diff)
parentbb658ab7b8f2828b35c207a95cb0c05965721022 (diff)
Merge branch 'phy-improve-stopping-PHY'
Heiner Kallweit says: ==================== net: phy: improve stopping PHY This patchset improves and simplifies stopping the PHY. Heiner Kallweit (3): net: phy: stop PHY if needed when entering phy_disconnect net: phy: ensure phylib state machine is stopped after calling phy_stop net: phy: remove phy_stop_interrupts v2: - break down the patch to a patchset v3: - don't warn if driver didn't call phy_stop before phy_disconnect ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/phy/phy.c18
-rw-r--r--drivers/net/phy/phy_device.c7
-rw-r--r--include/linux/phy.h1
3 files changed, 5 insertions, 21 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index b0632e859564..f7a92e7edff7 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -819,23 +819,6 @@ int phy_start_interrupts(struct phy_device *phydev)
EXPORT_SYMBOL(phy_start_interrupts);
/**
- * phy_stop_interrupts - disable interrupts from a PHY device
- * @phydev: target phy_device struct
- */
-int phy_stop_interrupts(struct phy_device *phydev)
-{
- int err = phy_disable_interrupts(phydev);
-
- if (err)
- phy_error(phydev);
-
- free_irq(phydev->irq, phydev);
-
- return err;
-}
-EXPORT_SYMBOL(phy_stop_interrupts);
-
-/**
* phy_stop - Bring down the PHY link, and stop checking the status
* @phydev: target phy_device struct
*/
@@ -858,6 +841,7 @@ void phy_stop(struct phy_device *phydev)
mutex_unlock(&phydev->lock);
phy_state_machine(&phydev->state_queue.work);
+ phy_stop_machine(phydev);
/* Cannot call flush_scheduled_work() here as desired because
* of rtnl_lock(), but PHY_HALTED shall guarantee irq handler
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 3860dd85d097..7b3164174251 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -999,10 +999,11 @@ EXPORT_SYMBOL(phy_connect);
*/
void phy_disconnect(struct phy_device *phydev)
{
- if (phydev->irq > 0)
- phy_stop_interrupts(phydev);
+ if (phy_is_started(phydev))
+ phy_stop(phydev);
- phy_stop_machine(phydev);
+ if (phy_interrupt_is_valid(phydev))
+ free_irq(phydev->irq, phydev);
phydev->adjust_link = NULL;
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 232d93b9cea4..0990f913d649 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -951,7 +951,6 @@ int phy_aneg_done(struct phy_device *phydev);
int phy_speed_down(struct phy_device *phydev, bool sync);
int phy_speed_up(struct phy_device *phydev);
-int phy_stop_interrupts(struct phy_device *phydev);
int phy_restart_aneg(struct phy_device *phydev);
int phy_reset_after_clk_enable(struct phy_device *phydev);