From mboxrd@z Thu Jan 1 00:00:00 1970 From: Heiner Kallweit Subject: [PATCH net-next resubmit 2/2] net: phy: core: don't disable device interrupts in phy_change Date: Thu, 30 Nov 2017 23:57:00 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: "netdev@vger.kernel.org" , Ard Biesheuvel To: Florian Fainelli , Andrew Lunn , David Miller Return-path: Received: from mail-wm0-f65.google.com ([74.125.82.65]:40274 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751611AbdK3W5H (ORCPT ); Thu, 30 Nov 2017 17:57:07 -0500 Received: by mail-wm0-f65.google.com with SMTP id v19so470849wmh.5 for ; Thu, 30 Nov 2017 14:57:07 -0800 (PST) In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: If state is not PHY_HALTED I see no need to temporarily disable interrupts on the device. As long as the current interrupt isn't acked on the device no new interrupt can happen anyway. In addition remove a unneeded enabling of interrupts in the state machine when handling state PHY_CHANGELINK. Tested on a Odroid-C2 with RTL8211F phy in interrupt mode. Signed-off-by: Heiner Kallweit --- drivers/net/phy/phy.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index b3784c9a2..4a11de8cb 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -727,8 +727,9 @@ void phy_change(struct phy_device *phydev) !phydev->drv->did_interrupt(phydev)) return; - if (phy_disable_interrupts(phydev)) - goto phy_err; + if (phydev->state == PHY_HALTED) + if (phy_disable_interrupts(phydev)) + goto phy_err; } mutex_lock(&phydev->lock); @@ -736,15 +737,11 @@ void phy_change(struct phy_device *phydev) phydev->state = PHY_CHANGELINK; mutex_unlock(&phydev->lock); - if (phy_interrupt_is_valid(phydev)) { - /* Reenable interrupts */ - if (PHY_HALTED != phydev->state && - phy_config_interrupt(phydev, PHY_INTERRUPT_ENABLED)) - goto phy_err; - } - /* reschedule state queue work to run as soon as possible */ phy_trigger_machine(phydev, true); + + if (phy_interrupt_is_valid(phydev) && phy_clear_interrupt(phydev)) + goto phy_err; return; phy_err: @@ -984,10 +981,6 @@ void phy_state_machine(struct work_struct *work) phydev->state = PHY_NOLINK; phy_link_down(phydev, true); } - - if (phy_interrupt_is_valid(phydev)) - err = phy_config_interrupt(phydev, - PHY_INTERRUPT_ENABLED); break; case PHY_HALTED: if (phydev->link) { -- 2.15.0