From mboxrd@z Thu Jan 1 00:00:00 1970 From: Heiner Kallweit Subject: [PATCH net-next 5/5] net: phy: use phy_check_link_status in more places in the state machine Date: Wed, 7 Nov 2018 20:47:53 +0100 Message-ID: <2ba58709-aab9-f0ac-e141-ea2cc7f1cb2c@gmail.com> 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-wm1-f67.google.com ([209.85.128.67]:32875 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725945AbeKHFUF (ORCPT ); Thu, 8 Nov 2018 00:20:05 -0500 Received: by mail-wm1-f67.google.com with SMTP id f19-v6so12115919wmb.0 for ; Wed, 07 Nov 2018 11:48:13 -0800 (PST) In-Reply-To: <922c223b-7bc0-e0ec-345d-2034b796af91@gmail.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: Use phy_check_link_status in more places in the state machine. Signed-off-by: Heiner Kallweit --- drivers/net/phy/phy.c | 53 ++++--------------------------------------- 1 file changed, 5 insertions(+), 48 deletions(-) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 226824804..dd5bff955 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -945,17 +945,13 @@ void phy_state_machine(struct work_struct *work) break; case PHY_NOLINK: + case PHY_RUNNING: if (!phy_polling_mode(phydev)) break; - - err = phy_read_status(phydev); - if (err) - break; - - if (phydev->link) { - phydev->state = PHY_RUNNING; - phy_link_up(phydev); - } + /* fall through */ + case PHY_CHANGELINK: + case PHY_RESUMING: + err = phy_check_link_status(phydev); break; case PHY_FORCING: err = genphy_update_link(phydev); @@ -971,32 +967,6 @@ void phy_state_machine(struct work_struct *work) phy_link_down(phydev, false); } break; - case PHY_RUNNING: - if (!phy_polling_mode(phydev)) - break; - - err = phy_read_status(phydev); - if (err) - break; - - if (!phydev->link) { - phydev->state = PHY_NOLINK; - phy_link_down(phydev, true); - } - break; - case PHY_CHANGELINK: - err = phy_read_status(phydev); - if (err) - break; - - if (phydev->link) { - phydev->state = PHY_RUNNING; - phy_link_up(phydev); - } else { - phydev->state = PHY_NOLINK; - phy_link_down(phydev, true); - } - break; case PHY_HALTED: if (phydev->link) { phydev->link = 0; @@ -1004,19 +974,6 @@ void phy_state_machine(struct work_struct *work) do_suspend = true; } break; - case PHY_RESUMING: - err = phy_read_status(phydev); - if (err) - break; - - if (phydev->link) { - phydev->state = PHY_RUNNING; - phy_link_up(phydev); - } else { - phydev->state = PHY_NOLINK; - phy_link_down(phydev, true); - } - break; } mutex_unlock(&phydev->lock); -- 2.19.1