All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gerhard Engleder <gerhard@engleder-embedded.com>
To: andrew@lunn.ch
Cc: netdev@vger.kernel.org, Gerhard Engleder <gerhard@engleder-embedded.com>
Subject: [PATCH net-next v2 1/3] net: phy: Support set_loopback override
Date: Thu, 19 Aug 2021 15:11:52 +0200	[thread overview]
Message-ID: <20210819131154.6586-2-gerhard@engleder-embedded.com> (raw)
In-Reply-To: <20210819131154.6586-1-gerhard@engleder-embedded.com>

phy_read_status and various other PHY functions support PHY specific
overriding of driver functions by using a PHY specific pointer to the
PHY driver. Add support of PHY specific override to phy_loopback too.

Signed-off-by: Gerhard Engleder <gerhard@engleder-embedded.com>
---
 drivers/net/phy/phy_device.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 107aa6d7bc6b..ba5ad86ec826 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -1821,11 +1821,10 @@ EXPORT_SYMBOL(phy_resume);
 
 int phy_loopback(struct phy_device *phydev, bool enable)
 {
-	struct phy_driver *phydrv = to_phy_driver(phydev->mdio.dev.driver);
 	int ret = 0;
 
-	if (!phydrv)
-		return -ENODEV;
+	if (!phydev->drv)
+		return -EIO;
 
 	mutex_lock(&phydev->lock);
 
@@ -1839,8 +1838,8 @@ int phy_loopback(struct phy_device *phydev, bool enable)
 		goto out;
 	}
 
-	if (phydrv->set_loopback)
-		ret = phydrv->set_loopback(phydev, enable);
+	if (phydev->drv->set_loopback)
+		ret = phydev->drv->set_loopback(phydev, enable);
 	else
 		ret = genphy_loopback(phydev, enable);
 
-- 
2.20.1


  reply	other threads:[~2021-08-19 13:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-19 13:11 [PATCH net-next v2 0/3] Add Xilinx GMII2RGMII loopback support Gerhard Engleder
2021-08-19 13:11 ` Gerhard Engleder [this message]
2021-08-19 13:11 ` [PATCH net-next v2 2/3] net: phy: Uniform PHY driver access Gerhard Engleder
2021-08-19 13:11 ` [PATCH net-next v2 3/3] net: phy: gmii2rgmii: Support PHY loopback Gerhard Engleder
2021-08-20 13:40 ` [PATCH net-next v2 0/3] Add Xilinx GMII2RGMII loopback support patchwork-bot+netdevbpf

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=20210819131154.6586-2-gerhard@engleder-embedded.com \
    --to=gerhard@engleder-embedded.com \
    --cc=andrew@lunn.ch \
    --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.