All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heiner Kallweit <hkallweit1@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>,
	Florian Fainelli <f.fainelli@gmail.com>,
	David Miller <davem@davemloft.net>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: [PATCH net-next v2 1/2] net: phy: improve check for when to call phy_resume in mdio_bus_phy_resume
Date: Wed, 23 May 2018 22:16:20 +0200	[thread overview]
Message-ID: <a2dc7726-9327-ac20-ea68-60de64401b1f@gmail.com> (raw)
In-Reply-To: <8fe93623-9d05-6182-fe5f-da0bd32bae0b@gmail.com>

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 <hkallweit1@gmail.com>
---
v2:
- no changes
---
 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

  reply	other threads:[~2018-05-23 20:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-23 20:15 [PATCH net-next v2 0/2] net: phy: improve PHY suspend/resume Heiner Kallweit
2018-05-23 20:16 ` Heiner Kallweit [this message]
2018-05-23 20:17 ` [PATCH net-next v2 2/2] net: phy: improve checks when to suspend the PHY Heiner Kallweit
2018-05-23 22:04 ` [PATCH net-next v2 0/2] net: phy: improve PHY suspend/resume Andrew Lunn
2018-05-24  5:52   ` Heiner Kallweit
2018-05-30 20:22   ` Heiner Kallweit
2018-05-30 20:35     ` Andrew Lunn
2018-05-31 15:58       ` Heiner Kallweit
2018-05-31 18:30         ` Andrew Lunn
2018-05-31 20:28           ` Heiner Kallweit
2018-06-01  0:10             ` Andrew Lunn
2018-06-02 20:27               ` Heiner Kallweit
2018-06-05 19:39                 ` Heiner Kallweit
2018-06-08  6:09                   ` Heiner Kallweit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a2dc7726-9327-ac20-ea68-60de64401b1f@gmail.com \
    --to=hkallweit1@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.