Thread (6 messages) flat view 6 messages, 2 authors, 2021-08-18

Re: [PATCH net-next 1/2] net: phy: Support set_loopback override

From: Andrew Lunn <andrew@lunn.ch>
Date: 2021-08-18 15:03:42

On Wed, Aug 18, 2021 at 02:27:35PM +0200, Gerhard Engleder wrote:
quoted hunk ↗ jump to hunk
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 <redacted>
---
 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;
Humm, we need to take a closer look at what uses to_phy_driver() and
what uses phydev->drv. Do they need to be different? Can we make it
uniform?

	Andrew
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help