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>,
"S-k, Shyam-sundar" <Shyam-sundar.S-k@amd.com>
Subject: [PATCH net-next v3 3/4] net: phy: start interrupts in phy_start
Date: Wed, 23 Jan 2019 07:31:23 +0100 [thread overview]
Message-ID: <79ccd85e-e568-2d1b-dbc0-dbafac9405d7@gmail.com> (raw)
In-Reply-To: <bddac7b8-a4be-196e-f75e-32a2f44d8807@gmail.com>
Interrupts don't have to be enabled before calling phy_start().
Therefore let's enable them in phy_start(). In a subsequent step
we'll remove enabling interrupts from phy_connect_direct().
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/net/phy/phy.c | 34 ++++++++++++++--------------------
1 file changed, 14 insertions(+), 20 deletions(-)
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index fd928979b..30ba650bb 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -857,7 +857,7 @@ EXPORT_SYMBOL(phy_stop);
*/
void phy_start(struct phy_device *phydev)
{
- int err = 0;
+ int err;
mutex_lock(&phydev->lock);
@@ -867,28 +867,22 @@ void phy_start(struct phy_device *phydev)
goto out;
}
- switch (phydev->state) {
- case PHY_READY:
- phydev->state = PHY_UP;
- phy_start_machine(phydev);
- break;
- case PHY_HALTED:
- /* if phy was suspended, bring the physical link up again */
- __phy_resume(phydev);
+ /* 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;
- }
+ /* make sure interrupts are enabled for the PHY */
+ if (phy_interrupt_is_valid(phydev)) {
+ err = phy_enable_interrupts(phydev);
+ if (err < 0)
+ goto out;
+ }
+ if (phydev->state == PHY_READY)
+ phydev->state = PHY_UP;
+ else
phydev->state = PHY_RESUMING;
- phy_start_machine(phydev);
- break;
- default:
- break;
- }
+
+ phy_start_machine(phydev);
out:
mutex_unlock(&phydev->lock);
}
--
2.20.1
next prev parent reply other threads:[~2019-01-23 6:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-23 6:25 [PATCH net-next v3 0/4] net: phy: improve starting PHY Heiner Kallweit
2019-01-23 6:27 ` [PATCH net-next v3 1/4] net: phy: start state machine in phy_start only Heiner Kallweit
2019-01-23 6:30 ` [PATCH net-next v3 2/4] net: phy: warn if phy_start is called from invalid state Heiner Kallweit
2019-01-23 6:31 ` Heiner Kallweit [this message]
2019-01-23 6:31 ` [PATCH net-next v3 4/4] net: phy: change phy_start_interrupts to phy_request_interrupt Heiner Kallweit
2019-01-24 7:14 ` [PATCH net-next v3 0/4] net: phy: improve starting PHY S-k, Shyam-sundar
2019-01-25 6:19 ` David Miller
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=79ccd85e-e568-2d1b-dbc0-dbafac9405d7@gmail.com \
--to=hkallweit1@gmail.com \
--cc=Shyam-sundar.S-k@amd.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 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).