Re: [PATCH] net: dsa: Fix conditional handling of Wake-on-Lan configuration in dsa_user_set_wol
From: Mohammed Anees
Date: Sun Oct 06 2024 - 12:10:59 EST
Considering the insight you've provided, I've written the code below
static int dsa_user_set_wol(struct net_device *dev, struct ethtool_wolinfo *w)
{
struct dsa_port *dp = dsa_user_to_port(dev);
struct dsa_switch *ds = dp->ds;
int ret;
ret = phylink_ethtool_set_wol(dp->pl, w);
if (ret != -EOPNOTSUPP)
return ret;
if (ds->ops->set_wol)
ret = ds->ops->set_wol(ds, dp->index, w);
if (ret != -EOPNOTSUPP)
return ret;
return -EOPNOTSUPP;
}
Does this approach address the issue, or do you think it would
be better to pass a struct that explicitly contains only the
options supported by each function (phylink_ethtool_set_wol()
and ds->ops->set_wol())? That way we don't have to check for
-EOPNOTSUPP as we are giving valid options to each function.