netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Heiner Kallweit <hkallweit1@gmail.com>
To: Florian Fainelli <f.fainelli@gmail.com>,
	Andrew Lunn <andrew@lunn.ch>,
	Geert Uytterhoeven <geert+renesas@glider.be>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: [PATCH RFC v2 1/7] net: phy: unconditionally resume and re-enable interrupts, in phy_start
Date: Fri, 16 Mar 2018 22:14:52 +0100	[thread overview]
Message-ID: <ac941075-aee7-1d02-a3a8-7db538de92d7@gmail.com> (raw)
In-Reply-To: <6618f53c-778a-cb12-deb4-c618a728b43e@gmail.com>

In subsequent patches of this series interrupts will be disabled during
system suspend, also we will have to resume the PHY in states other than
PHY_HALTED. To prepare for this unconditionally resume and re-enable
interrupts in phy_start().

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
v2:
- no changes
---
 drivers/net/phy/phy.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 05c1e8ef..0aef35ef 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -791,10 +791,16 @@ EXPORT_SYMBOL(phy_stop);
  */
 void phy_start(struct phy_device *phydev)
 {
-	int err = 0;
+	/* if phy was suspended, bring the physical link up again */
+	phy_resume(phydev);
 
-	mutex_lock(&phydev->lock);
+	/* make sure interrupts are re-enabled for the PHY */
+	if (phy_interrupt_is_valid(phydev) && phy_enable_interrupts(phydev)) {
+		phy_error(phydev);
+		return;
+	}
 
+	mutex_lock(&phydev->lock);
 	switch (phydev->state) {
 	case PHY_STARTING:
 		phydev->state = PHY_PENDING;
@@ -803,16 +809,6 @@ void phy_start(struct phy_device *phydev)
 		phydev->state = PHY_UP;
 		break;
 	case PHY_HALTED:
-		/* if phy was suspended, bring the physical link up again */
-		__phy_resume(phydev);
-
-		/* make sure interrupts are re-enabled for the PHY */
-		if (phy_interrupt_is_valid(phydev)) {
-			err = phy_enable_interrupts(phydev);
-			if (err < 0)
-				break;
-		}
-
 		phydev->state = PHY_RESUMING;
 		break;
 	default:
-- 
2.16.2

  reply	other threads:[~2018-03-16 21:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-16 21:04 [PATCH RFC v2 0/7] net: phy: patch series aiming to improve few aspects of phylib Heiner Kallweit
2018-03-16 21:14 ` Heiner Kallweit [this message]
2018-03-16 21:14 ` [PATCH RFC v2 2/7] net: phy: improve checking for when PHY is allowed to, suspend Heiner Kallweit
2018-03-16 21:15 ` [PATCH RFC v2 3/7] net: phy: resume PHY only if needed in mdio_bus_phy_suspend Heiner Kallweit
2018-03-16 21:15 ` [PATCH RFC v2 4/7] net: phy: remove phy_start_machine Heiner Kallweit
2018-03-16 21:23 ` [PATCH RFC v2 5/7] net: phy: make phy_stop synchronous Heiner Kallweit
2018-03-16 21:24 ` [PATCH RFC v2 6/7] net: phy: use new function phy_stop_suspending in mdio_bus_phy_suspend Heiner Kallweit
2018-03-16 21:25 ` [PATCH RFC v2 7/7] net: phy: remove phy_stop_machine 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=ac941075-aee7-1d02-a3a8-7db538de92d7@gmail.com \
    --to=hkallweit1@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=f.fainelli@gmail.com \
    --cc=geert+renesas@glider.be \
    --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).