From mboxrd@z Thu Jan 1 00:00:00 1970 From: Heiner Kallweit Subject: [PATCH net-next 1/2] net: phy: improve check for when to call phy_resume in mdio_bus_phy_resume Date: Wed, 23 May 2018 21:30:00 +0200 Message-ID: <99774234-bb17-68ee-6ea4-27145e89e029@gmail.com> References: 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 Return-path: Received: from mail-wr0-f193.google.com ([209.85.128.193]:46688 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934448AbeEWTbi (ORCPT ); Wed, 23 May 2018 15:31:38 -0400 Received: by mail-wr0-f193.google.com with SMTP id x9-v6so25657685wrl.13 for ; Wed, 23 May 2018 12:31:37 -0700 (PDT) In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: We don't have to do all the checks again which we did in mdio_bus_phy_suspend already. Instead we can simply check whether the PHY is actually suspended and needs to be resumed. Signed-off-by: Heiner Kallweit --- drivers/net/phy/phy_device.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 9e4ba8e80..1662781fb 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -132,14 +132,12 @@ static int mdio_bus_phy_resume(struct device *dev) struct phy_device *phydev = to_phy_device(dev); int ret; - if (!mdio_bus_phy_may_suspend(phydev)) - goto no_resume; - - ret = phy_resume(phydev); - if (ret < 0) - return ret; + if (phydev->suspended) { + ret = phy_resume(phydev); + if (ret < 0) + return ret; + } -no_resume: if (phydev->attached_dev && phydev->adjust_link) phy_start_machine(phydev); -- 2.17.0