From mboxrd@z Thu Jan 1 00:00:00 1970 From: Heiner Kallweit Subject: [PATCH net-next 2/5] net: phy: remove useless check in state machine case PHY_RESUMING Date: Wed, 7 Nov 2018 20:44:56 +0100 Message-ID: References: <922c223b-7bc0-e0ec-345d-2034b796af91@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: "netdev@vger.kernel.org" To: Florian Fainelli , Andrew Lunn , David Miller Return-path: Received: from mail-wr1-f66.google.com ([209.85.221.66]:34103 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725945AbeKHFT7 (ORCPT ); Thu, 8 Nov 2018 00:19:59 -0500 Received: by mail-wr1-f66.google.com with SMTP id j26-v6so18731681wre.1 for ; Wed, 07 Nov 2018 11:48:09 -0800 (PST) In-Reply-To: <922c223b-7bc0-e0ec-345d-2034b796af91@gmail.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: If aneg isn't finished yet then the PHY reports the link as down. There's no benefit in setting the state to PHY_AN because the next state machine run would set the status to PHY_NOLINK anyway (except in the meantime aneg has been finished and link is up). Therefore we can set the state to PHY_RUNNING or PHY_NOLINK directly. In addition change the do_carrier parameter in phy_link_down() to true. If carrier was marked as up before (what should never be the case because PHY was in state PHY_HALTED before) then we should mark it as down now. Signed-off-by: Heiner Kallweit --- drivers/net/phy/phy.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 87c6d304c..14dffa0da 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -1022,17 +1022,6 @@ void phy_state_machine(struct work_struct *work) } break; case PHY_RESUMING: - if (AUTONEG_ENABLE == phydev->autoneg) { - err = phy_aneg_done(phydev); - if (err < 0) { - break; - } else if (!err) { - phydev->state = PHY_AN; - phydev->link_timeout = PHY_AN_TIMEOUT; - break; - } - } - err = phy_read_status(phydev); if (err) break; @@ -1042,7 +1031,7 @@ void phy_state_machine(struct work_struct *work) phy_link_up(phydev); } else { phydev->state = PHY_NOLINK; - phy_link_down(phydev, false); + phy_link_down(phydev, true); } break; } -- 2.19.1