Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Marco Felsch <m.felsch@pengutronix.de>
To: davem@davemloft.net, kuba@kernel.org, robh+dt@kernel.org,
	andrew@lunn.ch, f.fainelli@gmail.com, hkallweit1@gmail.com,
	linux@armlinux.org.uk, zhengdejin5@gmail.com,
	richard.leitner@skidata.com
Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org,
	kernel@pengutronix.de
Subject: [PATCH 2/5] net: phy: smsc: simplify config_init callback
Date: Mon, 31 Aug 2020 15:48:33 +0200	[thread overview]
Message-ID: <20200831134836.20189-3-m.felsch@pengutronix.de> (raw)
In-Reply-To: <20200831134836.20189-1-m.felsch@pengutronix.de>

Exit the driver specific config_init hook early if energy detection is
disabled. We can do this because we don't need to clear the interrupt
status here. Clearing the status should be removed anyway since this is
handled by the phy_enable_interrupts().

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
 drivers/net/phy/smsc.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c
index fa539a867de6..79574fcbd880 100644
--- a/drivers/net/phy/smsc.c
+++ b/drivers/net/phy/smsc.c
@@ -62,19 +62,21 @@ static int smsc_phy_ack_interrupt(struct phy_device *phydev)
 static int smsc_phy_config_init(struct phy_device *phydev)
 {
 	struct smsc_phy_priv *priv = phydev->priv;
+	int rc;
+
+	if (!priv->energy_enable)
+		return 0;
 
-	int rc = phy_read(phydev, MII_LAN83C185_CTRL_STATUS);
+	rc = phy_read(phydev, MII_LAN83C185_CTRL_STATUS);
 
 	if (rc < 0)
 		return rc;
 
-	if (priv->energy_enable) {
-		/* Enable energy detect mode for this SMSC Transceivers */
-		rc = phy_write(phydev, MII_LAN83C185_CTRL_STATUS,
-			       rc | MII_LAN83C185_EDPWRDOWN);
-		if (rc < 0)
-			return rc;
-	}
+	/* Enable energy detect mode for this SMSC Transceivers */
+	rc = phy_write(phydev, MII_LAN83C185_CTRL_STATUS,
+		       rc | MII_LAN83C185_EDPWRDOWN);
+	if (rc < 0)
+		return rc;
 
 	return smsc_phy_ack_interrupt(phydev);
 }
-- 
2.20.1


  parent reply	other threads:[~2020-08-31 13:49 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-31 13:48 [PATCH 0/5] SMSC: Cleanups and clock setup Marco Felsch
2020-08-31 13:48 ` [PATCH 1/5] net: phy: smsc: skip ENERGYON interrupt if disabled Marco Felsch
2020-08-31 14:02   ` Andrew Lunn
2020-09-01  7:59     ` Marco Felsch
2020-08-31 13:48 ` Marco Felsch [this message]
2020-08-31 13:48 ` [PATCH 3/5] dt-bindings: net: phy: smsc: document reference clock Marco Felsch
2020-08-31 13:48 ` [PATCH 4/5] net: phy: smsc: add phy refclk in support Marco Felsch
2020-08-31 14:08   ` Andrew Lunn
2020-09-01  8:04     ` Marco Felsch
2020-08-31 16:32   ` Florian Fainelli
2020-09-01  8:24     ` Marco Felsch
2020-09-01 12:30       ` Andrew Lunn
2020-09-02  5:05       ` Florian Fainelli
2020-08-31 13:48 ` [PATCH 5/5] net: phy: smsc: LAN8710/LAN8720: remove PHY_RST_AFTER_CLK_EN flag Marco Felsch
2020-08-31 14:11   ` Andrew Lunn
2020-09-01  8:01     ` Marco Felsch

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=20200831134836.20189-3-m.felsch@pengutronix.de \
    --to=m.felsch@pengutronix.de \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=richard.leitner@skidata.com \
    --cc=robh+dt@kernel.org \
    --cc=zhengdejin5@gmail.com \
    --subject='Re: [PATCH 2/5] net: phy: smsc: simplify config_init callback' \
    /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

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).