From: Andrew Lunn <andrew@lunn.ch>
To: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel@savoirfairelinux.com,
"David S. Miller" <davem@davemloft.net>,
Florian Fainelli <f.fainelli@gmail.com>
Subject: Re: [PATCH net-next 01/11] net: dsa: make EEE ops optional
Date: Tue, 1 Aug 2017 16:07:20 +0200 [thread overview]
Message-ID: <20170801140720.GD23157@lunn.ch> (raw)
In-Reply-To: <20170731221719.16695-2-vivien.didelot@savoirfairelinux.com>
Hi Vivien
> @@ -646,38 +646,42 @@ static int dsa_slave_set_eee(struct net_device *dev, struct ethtool_eee *e)
> {
> struct dsa_slave_priv *p = netdev_priv(dev);
> struct dsa_switch *ds = p->dp->ds;
> - int ret;
> + int err = -ENODEV;
>
> - if (!ds->ops->set_eee)
> - return -EOPNOTSUPP;
> + if (ds->ops->set_eee) {
> + err = ds->ops->set_eee(ds, p->dp->index, p->phy, e);
> + if (err)
> + return err;
> + }
>
> - ret = ds->ops->set_eee(ds, p->dp->index, p->phy, e);
> - if (ret)
> - return ret;
> + if (p->phy) {
> + err = phy_ethtool_set_eee(p->phy, e);
> + if (err)
> + return err;
I don't think you need this if (err). You unconditionally return err
as you exit the function.
> + }
>
> - if (p->phy)
> - ret = phy_ethtool_set_eee(p->phy, e);
> -
> - return ret;
> + return err;
> }
>
> static int dsa_slave_get_eee(struct net_device *dev, struct ethtool_eee *e)
> {
> struct dsa_slave_priv *p = netdev_priv(dev);
> struct dsa_switch *ds = p->dp->ds;
> - int ret;
> + int err = -ENODEV;
>
> - if (!ds->ops->get_eee)
> - return -EOPNOTSUPP;
> + if (ds->ops->get_eee) {
> + err = ds->ops->get_eee(ds, p->dp->index, e);
> + if (err)
> + return err;
> + }
>
> - ret = ds->ops->get_eee(ds, p->dp->index, e);
> - if (ret)
> - return ret;
> + if (p->phy) {
> + err = phy_ethtool_get_eee(p->phy, e);
> + if (err)
> + return err;
Same here.
> + }
>
> - if (p->phy)
> - ret = phy_ethtool_get_eee(p->phy, e);
> -
> - return ret;
> + return err;
> }
>
> #ifdef CONFIG_NET_POLL_CONTROLLER
> --
> 2.13.3
>
next prev parent reply other threads:[~2017-08-01 14:07 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-31 22:17 [PATCH net-next 00/11] net: dsa: rework EEE support Vivien Didelot
2017-07-31 22:17 ` [PATCH net-next 01/11] net: dsa: make EEE ops optional Vivien Didelot
2017-08-01 14:07 ` Andrew Lunn [this message]
2017-07-31 22:17 ` [PATCH net-next 02/11] net: dsa: qca8k: fix EEE init Vivien Didelot
2017-07-31 22:17 ` [PATCH net-next 03/11] net: dsa: qca8k: enable EEE once Vivien Didelot
2017-07-31 22:17 ` [PATCH net-next 04/11] net: dsa: qca8k: do not cache unneeded EEE fields Vivien Didelot
2017-07-31 22:17 ` [PATCH net-next 05/11] net: dsa: qca8k: remove qca8k_get_eee Vivien Didelot
2017-07-31 22:17 ` [PATCH net-next 06/11] net: dsa: bcm_sf2: remove unneeded supported flags Vivien Didelot
2017-07-31 22:17 ` [PATCH net-next 07/11] net: dsa: mv88e6xxx: call phy_init_eee Vivien Didelot
2017-07-31 22:17 ` [PATCH net-next 08/11] net: dsa: call phy_init_eee in DSA layer Vivien Didelot
2017-07-31 22:17 ` [PATCH net-next 09/11] net: dsa: remove PHY device argument from .set_eee Vivien Didelot
2017-07-31 22:17 ` [PATCH net-next 10/11] net: dsa: mv88e6xxx: remove EEE support Vivien Didelot
2017-08-01 14:28 ` Andrew Lunn
2017-08-01 15:36 ` Vivien Didelot
2017-08-01 16:06 ` Andrew Lunn
2017-08-01 16:33 ` Florian Fainelli
2017-08-01 17:27 ` Andrew Lunn
2017-08-01 18:53 ` Florian Fainelli
2017-08-01 16:34 ` Vivien Didelot
2017-08-01 20:08 ` Vivien Didelot
2017-07-31 22:17 ` [PATCH net-next 11/11] net: dsa: rename switch EEE ops Vivien Didelot
2017-08-01 14:31 ` [PATCH net-next 00/11] net: dsa: rework EEE support Andrew Lunn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170801140720.GD23157@lunn.ch \
--to=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=kernel@savoirfairelinux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=vivien.didelot@savoirfairelinux.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.