aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHeiner Kallweit <hkallweit1@gmail.com>2018-01-10 15:21:31 -0500
committerDavid S. Miller <davem@davemloft.net>2018-01-15 13:45:03 -0500
commit28b2e0d2cd132284ad69fcea4b7cf6b7d0662c2f (patch)
tree78f7165cb7332eafcc5269525f01416de38683d9
parentfebafc8455fdbb0ba53d596075068a683b75f355 (diff)
net: phy: remove parameter new_link from phy_mac_interrupt()
I see two issues with parameter new_link: 1. It's not needed. See also phy_interrupt(), works w/o this parameter. phy_mac_interrupt sets the state to PHY_CHANGELINK and triggers the state machine which then calls phy_read_status. And phy_read_status updates the link state. 2. phy_mac_interrupt is used in interrupt context and getting the link state may sleep (at least when having to access the PHY registers via MDIO bus). So let's remove it. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Tested-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/broadcom/genet/bcmgenet.c7
-rw-r--r--drivers/net/phy/phy.c10
-rw-r--r--include/linux/phy.h2
3 files changed, 8 insertions, 11 deletions
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index 24b4f4ceceef..b1e35a9accf1 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -2527,9 +2527,10 @@ static void bcmgenet_irq_task(struct work_struct *work)
2527 spin_unlock_irq(&priv->lock); 2527 spin_unlock_irq(&priv->lock);
2528 2528
2529 /* Link UP/DOWN event */ 2529 /* Link UP/DOWN event */
2530 if (status & UMAC_IRQ_LINK_EVENT) 2530 if (status & UMAC_IRQ_LINK_EVENT) {
2531 phy_mac_interrupt(priv->dev->phydev, 2531 priv->dev->phydev->link = !!(status & UMAC_IRQ_LINK_UP);
2532 !!(status & UMAC_IRQ_LINK_UP)); 2532 phy_mac_interrupt(priv->dev->phydev);
2533 }
2533} 2534}
2534 2535
2535/* bcmgenet_isr1: handle Rx and Tx priority queues */ 2536/* bcmgenet_isr1: handle Rx and Tx priority queues */
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 0c165ad1d788..f3313a129531 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -1057,16 +1057,12 @@ void phy_state_machine(struct work_struct *work)
1057/** 1057/**
1058 * phy_mac_interrupt - MAC says the link has changed 1058 * phy_mac_interrupt - MAC says the link has changed
1059 * @phydev: phy_device struct with changed link 1059 * @phydev: phy_device struct with changed link
1060 * @new_link: Link is Up/Down.
1061 * 1060 *
1062 * Description: The MAC layer is able indicate there has been a change 1061 * The MAC layer is able to indicate there has been a change in the PHY link
1063 * in the PHY link status. Set the new link status, and trigger the 1062 * status. Trigger the state machine and work a work queue.
1064 * state machine, work a work queue.
1065 */ 1063 */
1066void phy_mac_interrupt(struct phy_device *phydev, int new_link) 1064void phy_mac_interrupt(struct phy_device *phydev)
1067{ 1065{
1068 phydev->link = new_link;
1069
1070 /* Trigger a state machine change */ 1066 /* Trigger a state machine change */
1071 queue_work(system_power_efficient_wq, &phydev->phy_queue); 1067 queue_work(system_power_efficient_wq, &phydev->phy_queue);
1072} 1068}
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 135aba5c3d39..47715a3115b0 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -964,7 +964,7 @@ int phy_drivers_register(struct phy_driver *new_driver, int n,
964void phy_state_machine(struct work_struct *work); 964void phy_state_machine(struct work_struct *work);
965void phy_change(struct phy_device *phydev); 965void phy_change(struct phy_device *phydev);
966void phy_change_work(struct work_struct *work); 966void phy_change_work(struct work_struct *work);
967void phy_mac_interrupt(struct phy_device *phydev, int new_link); 967void phy_mac_interrupt(struct phy_device *phydev);
968void phy_start_machine(struct phy_device *phydev); 968void phy_start_machine(struct phy_device *phydev);
969void phy_stop_machine(struct phy_device *phydev); 969void phy_stop_machine(struct phy_device *phydev);
970void phy_trigger_machine(struct phy_device *phydev, bool sync); 970void phy_trigger_machine(struct phy_device *phydev, bool sync);