aboutsummaryrefslogtreecommitdiffstats
path: root/net/dsa/dsa2.c
diff options
context:
space:
mode:
authorVivien Didelot <vivien.didelot@savoirfairelinux.com>2017-01-17 20:41:38 -0500
committerDavid S. Miller <davem@davemloft.net>2017-01-18 16:49:46 -0500
commitb22de490869da354116ea4cbbaa09dcbc260b2b4 (patch)
treef524fe3351c33f6d18ab3c3f9c455f7e9ca8c199 /net/dsa/dsa2.c
parente33c2ef106d17ad8cdb16a0be0ef0daebb2d2c16 (diff)
net: dsa: store CPU switch structure in the tree
Store a dsa_switch pointer to the CPU switch in the tree instead of only its index. This avoids the need to initialize it to -1. Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> 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.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index 42a41d84053c..020e072b4299 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -57,7 +57,6 @@ static struct dsa_switch_tree *dsa_add_dst(u32 tree)
57 if (!dst) 57 if (!dst)
58 return NULL; 58 return NULL;
59 dst->tree = tree; 59 dst->tree = tree;
60 dst->cpu_switch = -1;
61 INIT_LIST_HEAD(&dst->list); 60 INIT_LIST_HEAD(&dst->list);
62 list_add_tail(&dsa_switch_trees, &dst->list); 61 list_add_tail(&dsa_switch_trees, &dst->list);
63 kref_init(&dst->refcount); 62 kref_init(&dst->refcount);
@@ -448,8 +447,8 @@ static int dsa_cpu_parse(struct device_node *port, u32 index,
448 if (!dst->master_netdev) 447 if (!dst->master_netdev)
449 dst->master_netdev = ethernet_dev; 448 dst->master_netdev = ethernet_dev;
450 449
451 if (dst->cpu_switch == -1) { 450 if (!dst->cpu_switch) {
452 dst->cpu_switch = ds->index; 451 dst->cpu_switch = ds;
453 dst->cpu_port = index; 452 dst->cpu_port = index;
454 } 453 }
455 454