diff options
author | Vivien Didelot <vivien.didelot@savoirfairelinux.com> | 2016-05-09 13:22:44 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-05-09 14:26:09 -0400 |
commit | aadbdb8a0da6c38e8370fb7cd860f38b266c6037 (patch) | |
tree | 77270042520021232a73276e40bcfd3d3457c387 /drivers/net/dsa/mv88e6xxx.c | |
parent | 1d13a06e00bdcde27d4d88e011841ff0924b3dde (diff) | |
download | linux-aadbdb8a0da6c38e8370fb7cd860f38b266c6037.tar.bz2 |
net: dsa: mv88e6xxx: factorize EEE access
Add a MV88E6XXX_FLAG_EEE flag to describe switch models featuring Energy
Efficient Ethernet. Use it to conditionally support such access in the
common code.
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/dsa/mv88e6xxx.c')
-rw-r--r-- | drivers/net/dsa/mv88e6xxx.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/net/dsa/mv88e6xxx.c b/drivers/net/dsa/mv88e6xxx.c index 4f0e047538d2..6aac58b8b78b 100644 --- a/drivers/net/dsa/mv88e6xxx.c +++ b/drivers/net/dsa/mv88e6xxx.c @@ -1105,6 +1105,9 @@ int mv88e6xxx_get_eee(struct dsa_switch *ds, int port, struct ethtool_eee *e) struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); int reg; + if (!mv88e6xxx_has(ps, MV88E6XXX_FLAG_EEE)) + return -EOPNOTSUPP; + mutex_lock(&ps->smi_mutex); reg = _mv88e6xxx_phy_read_indirect(ps, port, 16); @@ -1133,6 +1136,9 @@ int mv88e6xxx_set_eee(struct dsa_switch *ds, int port, int reg; int ret; + if (!mv88e6xxx_has(ps, MV88E6XXX_FLAG_EEE)) + return -EOPNOTSUPP; + mutex_lock(&ps->smi_mutex); ret = _mv88e6xxx_phy_read_indirect(ps, port, 16); |