From: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
To: Andrew Lunn <andrew@lunn.ch>,
Florian Fainelli <f.fainelli@gmail.com>,
Heiner Kallweit <hkallweit1@gmail.com>,
"David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Subject: [RFC PATCH net] net: phy: fix the issue that netif always links up after resuming
Date: Thu, 29 Nov 2018 17:12:11 +0900 [thread overview]
Message-ID: <1543479131-14097-1-git-send-email-hayashi.kunihiko@socionext.com> (raw)
Even though the link is down before entering hibernation,
there is an issue that the network interface always links up after resuming
from hibernation.
The phydev->state is PHY_READY before enabling the network interface, so
the link is down. After resuming from hibernation, the phydev->state is
forcibly set to PHY_UP in mdio_bus_phy_restore(), and the link becomes up.
This patch expects to solve the issue by changing phydev->state to PHY_UP
only when the link is up.
Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
---
drivers/net/phy/phy_device.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index ab33d17..d5bba0f 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -309,8 +309,10 @@ static int mdio_bus_phy_restore(struct device *dev)
return ret;
/* The PHY needs to renegotiate. */
- phydev->link = 0;
- phydev->state = PHY_UP;
+ if (phydev->link) {
+ phydev->link = 0;
+ phydev->state = PHY_UP;
+ }
phy_start_machine(phydev);
--
2.7.4
next reply other threads:[~2018-11-29 8:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-29 8:12 Kunihiko Hayashi [this message]
2018-11-29 22:47 ` [RFC PATCH net] net: phy: fix the issue that netif always links up after resuming Heiner Kallweit
2018-11-30 0:37 ` Florian Fainelli
2018-11-30 4:37 ` Kunihiko Hayashi
2018-11-30 6:20 ` Heiner Kallweit
2018-11-30 6:38 ` Kunihiko Hayashi
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=1543479131-14097-1-git-send-email-hayashi.kunihiko@socionext.com \
--to=hayashi.kunihiko@socionext.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).