aboutsummaryrefslogtreecommitdiffstats
path: root/net/dsa/dsa2.c
diff options
context:
space:
mode:
authorVivien Didelot <vivien.didelot@savoirfairelinux.com>2017-01-17 20:41:39 -0500
committerDavid S. Miller <davem@davemloft.net>2017-01-18 16:49:47 -0500
commit9520ed8fb8410dcb6babf751561a08f73ca03812 (patch)
treeee7e664f866902ca3befac6dc0294c755dfa3b2d /net/dsa/dsa2.c
parentb22de490869da354116ea4cbbaa09dcbc260b2b4 (diff)
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>
Diffstat (limited to 'net/dsa/dsa2.c')
-rw-r--r--net/dsa/dsa2.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index 020e072b4299..866222a8f9bf 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -377,8 +377,8 @@ static int dsa_dst_apply(struct dsa_switch_tree *dst)
377 return err; 377 return err;
378 } 378 }
379 379
380 if (dst->ds[0]) { 380 if (dst->cpu_switch) {
381 err = dsa_cpu_port_ethtool_setup(dst->ds[0]); 381 err = dsa_cpu_port_ethtool_setup(dst->cpu_switch);
382 if (err) 382 if (err)
383 return err; 383 return err;
384 } 384 }
@@ -418,8 +418,8 @@ static void dsa_dst_unapply(struct dsa_switch_tree *dst)
418 dsa_ds_unapply(dst, ds); 418 dsa_ds_unapply(dst, ds);
419 } 419 }
420 420
421 if (dst->ds[0]) 421 if (dst->cpu_switch)
422 dsa_cpu_port_ethtool_restore(dst->ds[0]); 422 dsa_cpu_port_ethtool_restore(dst->cpu_switch);
423 423
424 pr_info("DSA: tree %d unapplied\n", dst->tree); 424 pr_info("DSA: tree %d unapplied\n", dst->tree);
425 dst->applied = false; 425 dst->applied = false;