net: dsa: use cpu_switch instead of ds[0]

Now that the DSA Ethernet switches are true Linux devices, the CPU
switch is not necessarily the first one. If its address is higher than
the second switch on the same MDIO bus, its index will be 1, not 0.

Avoid any confusion by using dst->cpu_switch instead of dst->ds[0].

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Vivien Didelot
2017-01-17 20:41:39 -05:00
committed by David S. Miller
parent b22de49086
commit 9520ed8fb8
6 changed files with 11 additions and 11 deletions

View File

@@ -377,8 +377,8 @@ static int dsa_dst_apply(struct dsa_switch_tree *dst)
return err;
}
if (dst->ds[0]) {
err = dsa_cpu_port_ethtool_setup(dst->ds[0]);
if (dst->cpu_switch) {
err = dsa_cpu_port_ethtool_setup(dst->cpu_switch);
if (err)
return err;
}
@@ -418,8 +418,8 @@ static void dsa_dst_unapply(struct dsa_switch_tree *dst)
dsa_ds_unapply(dst, ds);
}
if (dst->ds[0])
dsa_cpu_port_ethtool_restore(dst->ds[0]);
if (dst->cpu_switch)
dsa_cpu_port_ethtool_restore(dst->cpu_switch);
pr_info("DSA: tree %d unapplied\n", dst->tree);
dst->applied = false;