Skip to content

Commit

Permalink
net: ethernet: ave: Preserve wol state in suspend/resume sequence
Browse files Browse the repository at this point in the history
Since the wol state forces to be initialized after reset, the state should
be preserved in suspend/resume sequence.

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Kunihiko Hayashi authored and David S. Miller committed Nov 29, 2018
1 parent 7200f2e commit 8d1283b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions drivers/net/ethernet/socionext/sni_ave.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ struct ave_private {
struct regmap *regmap;
unsigned int pinmode_mask;
unsigned int pinmode_val;
u32 wolopts;

/* stats */
struct ave_stats stats_rx;
Expand Down Expand Up @@ -1741,6 +1742,7 @@ static int ave_remove(struct platform_device *pdev)
#ifdef CONFIG_PM_SLEEP
static int ave_suspend(struct device *dev)
{
struct ethtool_wolinfo wol = { .cmd = ETHTOOL_GWOL };
struct net_device *ndev = dev_get_drvdata(dev);
struct ave_private *priv = netdev_priv(ndev);
int ret = 0;
Expand All @@ -1750,17 +1752,25 @@ static int ave_suspend(struct device *dev)
netif_device_detach(ndev);
}

ave_ethtool_get_wol(ndev, &wol);
priv->wolopts = wol.wolopts;

return ret;
}

static int ave_resume(struct device *dev)
{
struct ethtool_wolinfo wol = { .cmd = ETHTOOL_GWOL };
struct net_device *ndev = dev_get_drvdata(dev);
struct ave_private *priv = netdev_priv(ndev);
int ret = 0;

ave_global_reset(ndev);

ave_ethtool_get_wol(ndev, &wol);
wol.wolopts = priv->wolopts;
ave_ethtool_set_wol(ndev, &wol);

if (ndev->phydev) {
ret = phy_resume(ndev->phydev);
if (ret)
Expand Down

0 comments on commit 8d1283b

Please sign in to comment.