diff options
author | Vivien Didelot <vivien.didelot@gmail.com> | 2019-08-19 16:00:49 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-08-20 12:33:49 -0700 |
commit | 74be4babe72fd1ed1bba6b52d0bdc0d1e13f7af8 (patch) | |
tree | 1e0bf529fdcd8013cc0c88fcd214002e0587ca04 /drivers/net/dsa/mv88e6xxx | |
parent | 955222ca5281ee7ded6b899605c055b147a15c73 (diff) | |
download | linux-stable-74be4babe72fd1ed1bba6b52d0bdc0d1e13f7af8.tar.gz linux-stable-74be4babe72fd1ed1bba6b52d0bdc0d1e13f7af8.tar.bz2 linux-stable-74be4babe72fd1ed1bba6b52d0bdc0d1e13f7af8.zip |
net: dsa: do not enable or disable non user ports
The .port_enable and .port_disable operations are currently only
called for user ports, hence assuming they have a slave device. In
preparation for using these operations for other port types as well,
simply guard all implementations against non user ports and return
directly in such case.
Note that bcm_sf2_sw_suspend() currently calls bcm_sf2_port_disable()
(and thus b53_disable_port()) against the user and CPU ports, so do
not guards those functions. They will be called for unused ports in
the future, but that was expected by those drivers anyway.
Signed-off-by: Vivien Didelot <vivien.didelot@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/dsa/mv88e6xxx')
-rw-r--r-- | drivers/net/dsa/mv88e6xxx/chip.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index 9b3ad22a5b98..5e557545df6d 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -2267,6 +2267,9 @@ static int mv88e6xxx_port_enable(struct dsa_switch *ds, int port, struct mv88e6xxx_chip *chip = ds->priv; int err; + if (!dsa_is_user_port(ds, port)) + return 0; + mv88e6xxx_reg_lock(chip); err = mv88e6xxx_serdes_power(chip, port, true); @@ -2283,6 +2286,9 @@ static void mv88e6xxx_port_disable(struct dsa_switch *ds, int port) { struct mv88e6xxx_chip *chip = ds->priv; + if (!dsa_is_user_port(ds, port)) + return; + mv88e6xxx_reg_lock(chip); if (mv88e6xxx_port_set_state(chip, port, BR_STATE_DISABLED)) |