From mboxrd@z Thu Jan 1 00:00:00 1970 From: Heiner Kallweit Subject: [PATCH net-next 1/2] net: phy: remove parameter new_link from phy_mac_interrupt() Date: Wed, 10 Jan 2018 21:11:35 +0100 Message-ID: <80e1b32e-8d8a-a6a2-9e44-65fca8ae9cc2@gmail.com> References: <62b422d5-bb33-2802-1467-babea8530537@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: "netdev@vger.kernel.org" To: Andrew Lunn , Florian Fainelli , David Miller , Doug Berger Return-path: Received: from mail-wr0-f193.google.com ([209.85.128.193]:45163 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751238AbeAJULk (ORCPT ); Wed, 10 Jan 2018 15:11:40 -0500 Received: by mail-wr0-f193.google.com with SMTP id 16so180688wry.12 for ; Wed, 10 Jan 2018 12:11:40 -0800 (PST) In-Reply-To: <62b422d5-bb33-2802-1467-babea8530537@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: 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 --- drivers/net/phy/phy.c | 10 +++------- include/linux/phy.h | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 0c165ad1d..f3313a129 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) /** * phy_mac_interrupt - MAC says the link has changed * @phydev: phy_device struct with changed link - * @new_link: Link is Up/Down. * - * Description: The MAC layer is able indicate there has been a change - * in the PHY link status. Set the new link status, and trigger the - * state machine, work a work queue. + * The MAC layer is able to indicate there has been a change in the PHY link + * status. Trigger the state machine and work a work queue. */ -void phy_mac_interrupt(struct phy_device *phydev, int new_link) +void phy_mac_interrupt(struct phy_device *phydev) { - phydev->link = new_link; - /* Trigger a state machine change */ queue_work(system_power_efficient_wq, &phydev->phy_queue); } diff --git a/include/linux/phy.h b/include/linux/phy.h index 135aba5c3..47715a311 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, void phy_state_machine(struct work_struct *work); void phy_change(struct phy_device *phydev); void phy_change_work(struct work_struct *work); -void phy_mac_interrupt(struct phy_device *phydev, int new_link); +void phy_mac_interrupt(struct phy_device *phydev); void phy_start_machine(struct phy_device *phydev); void phy_stop_machine(struct phy_device *phydev); void phy_trigger_machine(struct phy_device *phydev, bool sync); -- 2.15.1