diff options
author | Florian Fainelli <f.fainelli@gmail.com> | 2017-06-02 15:31:23 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-06-04 20:05:15 -0400 |
commit | 14be36c2c96cd18cfa036f230b57ea78d82a303f (patch) | |
tree | 588f98e84727f296a0383a1e359359017e6704d2 /include/net/dsa.h | |
parent | e41c1b5030e279c6626d3d052c3ca5ce5e2508df (diff) |
net: dsa: Initialize all CPU and enabled ports masks in dsa_ds_parse()
There was no reason for duplicating the code that initializes
ds->enabled_port_mask in both dsa_parse_ports_dn() and
dsa_parse_ports(), instead move this to dsa_ds_parse() which is early
enough before ops->setup() has run.
While at it, we can now make dsa_is_cpu_port() check ds->cpu_port_mask
which is a step towards being multi-CPU port capable.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/dsa.h')
-rw-r--r-- | include/net/dsa.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/net/dsa.h b/include/net/dsa.h index 448d8bc77707..2effb0af9d7c 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h | |||
@@ -254,7 +254,7 @@ struct dsa_switch { | |||
254 | 254 | ||
255 | static inline bool dsa_is_cpu_port(struct dsa_switch *ds, int p) | 255 | static inline bool dsa_is_cpu_port(struct dsa_switch *ds, int p) |
256 | { | 256 | { |
257 | return ds->dst->cpu_dp == &ds->ports[p]; | 257 | return !!(ds->cpu_port_mask & (1 << p)); |
258 | } | 258 | } |
259 | 259 | ||
260 | static inline bool dsa_is_dsa_port(struct dsa_switch *ds, int p) | 260 | static inline bool dsa_is_dsa_port(struct dsa_switch *ds, int p) |