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 1/2] net: phy: Support set_loopback override
Date: Wed, 18 Aug 2021 14:27:35 +0200 [thread overview]
Message-ID: <20210818122736.4877-2-gerhard@engleder-embedded.com> (raw)
In-Reply-To: <20210818122736.4877-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
next prev parent reply other threads:[~2021-08-18 12:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-18 12:27 [PATCH net-next 0/2] Add Xilinx GMII2RGMII loopback support Gerhard Engleder
2021-08-18 12:27 ` Gerhard Engleder [this message]
2021-08-18 15:03 ` [PATCH net-next 1/2] net: phy: Support set_loopback override Andrew Lunn
2021-08-18 20:11 ` Gerhard Engleder
2021-08-18 21:20 ` Andrew Lunn
2021-08-18 12:27 ` [PATCH net-next 2/2] net: phy: gmii2rgmii: Support PHY loopback Gerhard Engleder
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=20210818122736.4877-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 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).