Skip to content

Commit 209f94e

Browse files
committed
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 <[email protected]>
2 parents 340a6f3 + bb658ab commit 209f94e

File tree

3 files changed

+5
-21
lines changed

3 files changed

+5
-21
lines changed

drivers/net/phy/phy.c

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -818,23 +818,6 @@ int phy_start_interrupts(struct phy_device *phydev)
818818
}
819819
EXPORT_SYMBOL(phy_start_interrupts);
820820

821-
/**
822-
* phy_stop_interrupts - disable interrupts from a PHY device
823-
* @phydev: target phy_device struct
824-
*/
825-
int phy_stop_interrupts(struct phy_device *phydev)
826-
{
827-
int err = phy_disable_interrupts(phydev);
828-
829-
if (err)
830-
phy_error(phydev);
831-
832-
free_irq(phydev->irq, phydev);
833-
834-
return err;
835-
}
836-
EXPORT_SYMBOL(phy_stop_interrupts);
837-
838821
/**
839822
* phy_stop - Bring down the PHY link, and stop checking the status
840823
* @phydev: target phy_device struct
@@ -858,6 +841,7 @@ void phy_stop(struct phy_device *phydev)
858841
mutex_unlock(&phydev->lock);
859842

860843
phy_state_machine(&phydev->state_queue.work);
844+
phy_stop_machine(phydev);
861845

862846
/* Cannot call flush_scheduled_work() here as desired because
863847
* of rtnl_lock(), but PHY_HALTED shall guarantee irq handler

drivers/net/phy/phy_device.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -999,10 +999,11 @@ EXPORT_SYMBOL(phy_connect);
999999
*/
10001000
void phy_disconnect(struct phy_device *phydev)
10011001
{
1002-
if (phydev->irq > 0)
1003-
phy_stop_interrupts(phydev);
1002+
if (phy_is_started(phydev))
1003+
phy_stop(phydev);
10041004

1005-
phy_stop_machine(phydev);
1005+
if (phy_interrupt_is_valid(phydev))
1006+
free_irq(phydev->irq, phydev);
10061007

10071008
phydev->adjust_link = NULL;
10081009

include/linux/phy.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,6 @@ int phy_aneg_done(struct phy_device *phydev);
951951
int phy_speed_down(struct phy_device *phydev, bool sync);
952952
int phy_speed_up(struct phy_device *phydev);
953953

954-
int phy_stop_interrupts(struct phy_device *phydev);
955954
int phy_restart_aneg(struct phy_device *phydev);
956955
int phy_reset_after_clk_enable(struct phy_device *phydev);
957956

0 commit comments

Comments
 (0)