linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: phy: marvell: Use phy_read_paged() instead of open coding it
@ 2020-10-05  9:19 Jisheng Zhang
  2020-10-05  9:50 ` Marek Behún
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jisheng Zhang @ 2020-10-05  9:19 UTC (permalink / raw)
  To: Andrew Lunn, Florian Fainelli, Heiner Kallweit, Russell King,
	David S. Miller, Jakub Kicinski
  Cc: netdev, linux-kernel

Convert m88e1318_get_wol() to use the well implemented phy_read_paged()
instead of open coding it.

Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
---
 drivers/net/phy/marvell.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index bb86ac0bd092..5aec673a0120 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -1598,21 +1598,15 @@ static int m88e1121_did_interrupt(struct phy_device *phydev)
 static void m88e1318_get_wol(struct phy_device *phydev,
 			     struct ethtool_wolinfo *wol)
 {
-	int oldpage, ret = 0;
+	int ret;
 
 	wol->supported = WAKE_MAGIC;
 	wol->wolopts = 0;
 
-	oldpage = phy_select_page(phydev, MII_MARVELL_WOL_PAGE);
-	if (oldpage < 0)
-		goto error;
-
-	ret = __phy_read(phydev, MII_88E1318S_PHY_WOL_CTRL);
-	if (ret & MII_88E1318S_PHY_WOL_CTRL_MAGIC_PACKET_MATCH_ENABLE)
+	ret = phy_read_paged(phydev, MII_MARVELL_WOL_PAGE,
+			     MII_88E1318S_PHY_WOL_CTRL);
+	if (ret >= 0 && ret & MII_88E1318S_PHY_WOL_CTRL_MAGIC_PACKET_MATCH_ENABLE)
 		wol->wolopts |= WAKE_MAGIC;
-
-error:
-	phy_restore_page(phydev, oldpage, ret);
 }
 
 static int m88e1318_set_wol(struct phy_device *phydev,
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: phy: marvell: Use phy_read_paged() instead of open coding it
  2020-10-05  9:19 [PATCH] net: phy: marvell: Use phy_read_paged() instead of open coding it Jisheng Zhang
@ 2020-10-05  9:50 ` Marek Behún
  2020-10-05 13:01 ` Andrew Lunn
  2020-10-05 13:12 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Marek Behún @ 2020-10-05  9:50 UTC (permalink / raw)
  To: Jisheng Zhang
  Cc: Andrew Lunn, Florian Fainelli, Heiner Kallweit, Russell King,
	David S. Miller, Jakub Kicinski, netdev, linux-kernel

Reviewed-by: Marek Behún <kabel@kernel.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: phy: marvell: Use phy_read_paged() instead of open coding it
  2020-10-05  9:19 [PATCH] net: phy: marvell: Use phy_read_paged() instead of open coding it Jisheng Zhang
  2020-10-05  9:50 ` Marek Behún
@ 2020-10-05 13:01 ` Andrew Lunn
  2020-10-05 13:12 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Andrew Lunn @ 2020-10-05 13:01 UTC (permalink / raw)
  To: Jisheng Zhang
  Cc: Florian Fainelli, Heiner Kallweit, Russell King, David S. Miller,
	Jakub Kicinski, netdev, linux-kernel

On Mon, Oct 05, 2020 at 05:19:50PM +0800, Jisheng Zhang wrote:
> Convert m88e1318_get_wol() to use the well implemented phy_read_paged()
> instead of open coding it.
> 
> Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: phy: marvell: Use phy_read_paged() instead of open coding it
  2020-10-05  9:19 [PATCH] net: phy: marvell: Use phy_read_paged() instead of open coding it Jisheng Zhang
  2020-10-05  9:50 ` Marek Behún
  2020-10-05 13:01 ` Andrew Lunn
@ 2020-10-05 13:12 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2020-10-05 13:12 UTC (permalink / raw)
  To: Jisheng.Zhang
  Cc: andrew, f.fainelli, hkallweit1, linux, kuba, netdev, linux-kernel

From: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
Date: Mon, 5 Oct 2020 17:19:50 +0800

> Convert m88e1318_get_wol() to use the well implemented phy_read_paged()
> instead of open coding it.
> 
> Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>

Applied, thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-10-05 13:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-05  9:19 [PATCH] net: phy: marvell: Use phy_read_paged() instead of open coding it Jisheng Zhang
2020-10-05  9:50 ` Marek Behún
2020-10-05 13:01 ` Andrew Lunn
2020-10-05 13:12 ` David Miller

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