[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <32b408a4-8b2d-4425-9757-0f8cbfddf21c@lunn.ch>
Date: Sun, 6 Oct 2024 21:57:26 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Mohammed Anees <pvmohammedanees2003@...il.com>
Cc: davem@...emloft.net, edumazet@...gle.com, f.fainelli@...il.com,
kuba@...nel.org, linux-kernel@...r.kernel.org,
linux@...linux.org.uk, netdev@...r.kernel.org, olteanv@...il.com,
pabeni@...hat.com
Subject: Re: [PATCH] net: dsa: Fix conditional handling of Wake-on-Lan
configuration in dsa_user_set_wol
On Sun, Oct 06, 2024 at 09:40:32PM +0530, Mohammed Anees wrote:
> 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;
This can be simplified to just:
> if (ds->ops->set_wol)
> return ds->ops->set_wol(ds, dp->index, w);
>
> return -EOPNOTSUPP;
> }
Andrew
Powered by blists - more mailing lists