Skip to content

Commit

Permalink
net: dsa: mv88e6xxx: avoid writing the same mode
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Vivien Didelot authored and David S. Miller committed Mar 10, 2016
1 parent 5da9603 commit 5220ef1
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions drivers/net/dsa/mv88e6xxx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 5220ef1

Please sign in to comment.