Re: [PATCH] net: dsa: Fix conditional handling of Wake-on-Lan configuration in dsa_user_set_wol

From: Mohammed Anees
Date: Mon Oct 07 2024 - 18:23:23 EST


Apologies for overlooking the previous code. Based on your
suggestion, I’ve refined the implementation. Below is the
final version, please let me know if this works, and I’ll
send a new patch.

int phy_ret, mac_ret = -EOPNOTSUPP;

phy_ret = phylink_ethtool_set_wol(dp->pl, w);
if (phy_ret != 0 && phy_ret != -EOPNOTSUPP)
return phy_ret;

if (ds->ops->set_wol) {
mac_ret = ds->ops->set_wol(ds, dp->index, w);
if (mac_ret != 0 && mac_ret != -EOPNOTSUPP)
return mac_ret;
}

// Return success if either PHY or MAC succeeded
if (phy_ret == 0 || mac_ret == 0)
return 0;

return -EOPNOTSUPP;

Thanks!