Commit f4f9dcc3 authored by Jisheng Zhang's avatar Jisheng Zhang Committed by David S. Miller

net: phy: marvell: Use phy_read_paged() instead of open coding it

Convert m88e1318_get_wol() to use the well implemented phy_read_paged()
instead of open coding it.
Signed-off-by: default avatarJisheng Zhang <Jisheng.Zhang@synaptics.com>
Reviewed-by: default avatarMarek Behún <kabel@kernel.org>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2e554a7a
...@@ -1598,21 +1598,15 @@ static int m88e1121_did_interrupt(struct phy_device *phydev) ...@@ -1598,21 +1598,15 @@ static int m88e1121_did_interrupt(struct phy_device *phydev)
static void m88e1318_get_wol(struct phy_device *phydev, static void m88e1318_get_wol(struct phy_device *phydev,
struct ethtool_wolinfo *wol) struct ethtool_wolinfo *wol)
{ {
int oldpage, ret = 0; int ret;
wol->supported = WAKE_MAGIC; wol->supported = WAKE_MAGIC;
wol->wolopts = 0; wol->wolopts = 0;
oldpage = phy_select_page(phydev, MII_MARVELL_WOL_PAGE); ret = phy_read_paged(phydev, MII_MARVELL_WOL_PAGE,
if (oldpage < 0) MII_88E1318S_PHY_WOL_CTRL);
goto error; if (ret >= 0 && ret & MII_88E1318S_PHY_WOL_CTRL_MAGIC_PACKET_MATCH_ENABLE)
ret = __phy_read(phydev, MII_88E1318S_PHY_WOL_CTRL);
if (ret & MII_88E1318S_PHY_WOL_CTRL_MAGIC_PACKET_MATCH_ENABLE)
wol->wolopts |= WAKE_MAGIC; wol->wolopts |= WAKE_MAGIC;
error:
phy_restore_page(phydev, oldpage, ret);
} }
static int m88e1318_set_wol(struct phy_device *phydev, static int m88e1318_set_wol(struct phy_device *phydev,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment