Skip to content

Commit 5220ef1

Browse files
viviendavem330
authored andcommitted
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 <[email protected]> Tested-by: Andrew Lunn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 5da9603 commit 5220ef1

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

drivers/net/dsa/mv88e6xxx.c

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1765,16 +1765,21 @@ int mv88e6xxx_port_vlan_filtering(struct dsa_switch *ds, int port,
17651765

17661766
old = ret & PORT_CONTROL_2_8021Q_MASK;
17671767

1768-
ret &= ~PORT_CONTROL_2_8021Q_MASK;
1769-
ret |= new & PORT_CONTROL_2_8021Q_MASK;
1768+
if (new != old) {
1769+
ret &= ~PORT_CONTROL_2_8021Q_MASK;
1770+
ret |= new & PORT_CONTROL_2_8021Q_MASK;
17701771

1771-
ret = _mv88e6xxx_reg_write(ds, REG_PORT(port), PORT_CONTROL_2, ret);
1772-
if (ret < 0)
1773-
goto unlock;
1772+
ret = _mv88e6xxx_reg_write(ds, REG_PORT(port), PORT_CONTROL_2,
1773+
ret);
1774+
if (ret < 0)
1775+
goto unlock;
1776+
1777+
netdev_dbg(ds->ports[port], "802.1Q Mode %s (was %s)\n",
1778+
mv88e6xxx_port_8021q_mode_names[new],
1779+
mv88e6xxx_port_8021q_mode_names[old]);
1780+
}
17741781

1775-
netdev_dbg(ds->ports[port], "802.1Q Mode: %s (was %s)\n",
1776-
mv88e6xxx_port_8021q_mode_names[new],
1777-
mv88e6xxx_port_8021q_mode_names[old]);
1782+
ret = 0;
17781783
unlock:
17791784
mutex_unlock(&ps->smi_mutex);
17801785

0 commit comments

Comments
 (0)