lkml.org 
[lkml]   [2024]   [Feb]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH net 2/3] net: lan743x: support WOL in MAC even when PHY does not
    Date
    Allow WOL support if MAC supports it, even if the PHY does not support it

    Fixes: e9e13b6adc338 ("lan743x: fix for potential NULL pointer dereference
    with bare card")

    Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microchip.com>
    ---
    drivers/net/ethernet/microchip/lan743x_ethtool.c | 14 ++++++++++++--
    1 file changed, 12 insertions(+), 2 deletions(-)

    diff --git a/drivers/net/ethernet/microchip/lan743x_ethtool.c b/drivers/net/ethernet/microchip/lan743x_ethtool.c
    index a2b3f4433ca8..4899582b3d1d 100644
    --- a/drivers/net/ethernet/microchip/lan743x_ethtool.c
    +++ b/drivers/net/ethernet/microchip/lan743x_ethtool.c
    @@ -1163,6 +1163,17 @@ static int lan743x_ethtool_set_wol(struct net_device *netdev,
    struct ethtool_wolinfo *wol)
    {
    struct lan743x_adapter *adapter = netdev_priv(netdev);
    + int ret;
    +
    + if (netdev->phydev) {
    + ret = phy_ethtool_set_wol(netdev->phydev, wol);
    + if (ret != -EOPNOTSUPP && ret != 0)
    + return ret;
    +
    + if (ret == -EOPNOTSUPP)
    + netif_info(adapter, drv, adapter->netdev,
    + "phy does not support WOL\n");
    + }

    adapter->wolopts = 0;
    if (wol->wolopts & WAKE_UCAST)
    @@ -1187,8 +1198,7 @@ static int lan743x_ethtool_set_wol(struct net_device *netdev,

    device_set_wakeup_enable(&adapter->pdev->dev, (bool)wol->wolopts);

    - return netdev->phydev ? phy_ethtool_set_wol(netdev->phydev, wol)
    - : -ENETDOWN;
    + return 0;
    }
    #endif /* CONFIG_PM */

    --
    2.34.1

    \
     
     \ /
      Last update: 2024-05-27 15:21    [W:4.392 / U:0.064 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site