diff options
author | Vivien Didelot <vivien.didelot@savoirfairelinux.com> | 2016-03-08 00:24:52 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-03-10 22:10:31 +0100 |
commit | 5220ef1e39577fbe20989e97eac708d8896966f3 (patch) | |
tree | 1d64bf42cc32a4544467eb207c021b785c574946 /drivers | |
parent | net: dsa: mv88e6xxx: read then write PVID (diff) | |
download | linux-5220ef1e39577fbe20989e97eac708d8896966f3.tar.xz linux-5220ef1e39577fbe20989e97eac708d8896966f3.zip |
net: dsa: mv88e6xxx: avoid writing the same mode
There is no need to change the 802.1Q port mode for the same value.
Thus avoid such message:
[ 401.954836] dsa dsa@0 lan0: 802.1Q Mode: Disabled (was Disabled)
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Tested-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/dsa/mv88e6xxx.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/drivers/net/dsa/mv88e6xxx.c b/drivers/net/dsa/mv88e6xxx.c index 1aee42d1c5f2..5f07524083c3 100644 --- a/drivers/net/dsa/mv88e6xxx.c +++ b/drivers/net/dsa/mv88e6xxx.c @@ -1765,16 +1765,21 @@ int mv88e6xxx_port_vlan_filtering(struct dsa_switch *ds, int port, old = ret & PORT_CONTROL_2_8021Q_MASK; - ret &= ~PORT_CONTROL_2_8021Q_MASK; - ret |= new & PORT_CONTROL_2_8021Q_MASK; + if (new != old) { + ret &= ~PORT_CONTROL_2_8021Q_MASK; + ret |= new & PORT_CONTROL_2_8021Q_MASK; - ret = _mv88e6xxx_reg_write(ds, REG_PORT(port), PORT_CONTROL_2, ret); - if (ret < 0) - goto unlock; + ret = _mv88e6xxx_reg_write(ds, REG_PORT(port), PORT_CONTROL_2, + ret); + if (ret < 0) + goto unlock; + + netdev_dbg(ds->ports[port], "802.1Q Mode %s (was %s)\n", + mv88e6xxx_port_8021q_mode_names[new], + mv88e6xxx_port_8021q_mode_names[old]); + } - netdev_dbg(ds->ports[port], "802.1Q Mode: %s (was %s)\n", - mv88e6xxx_port_8021q_mode_names[new], - mv88e6xxx_port_8021q_mode_names[old]); + ret = 0; unlock: mutex_unlock(&ps->smi_mutex); |