summaryrefslogtreecommitdiffstats
path: root/net/dsa/dsa2.c
diff options
context:
space:
mode:
authorVivien Didelot <vivien.didelot@savoirfairelinux.com>2017-01-27 15:29:37 -0500
committerDavid S. Miller <davem@davemloft.net>2017-01-29 18:42:46 -0500
commit26895e299cfb583d304553e9c259e694a7e83397 (patch)
tree84efe62291aa646b75bb4778db06644e2062fb74 /net/dsa/dsa2.c
parenta0c02161ecfc2f40a0837926efac5376bc6fd6d3 (diff)
downloadlinux-26895e299cfb583d304553e9c259e694a7e83397.tar.bz2
net: dsa: use ds->num_ports when possible
The dsa_switch structure contains the number of ports. Use it where the structure is valid instead of the DSA_MAX_PORTS value. Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa/dsa2.c')
-rw-r--r--net/dsa/dsa2.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index 4b3a44bec5c8..6e7b3e88b778 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -98,7 +98,7 @@ static bool dsa_ds_find_port_dn(struct dsa_switch *ds,
{
u32 index;
- for (index = 0; index < DSA_MAX_PORTS; index++)
+ for (index = 0; index < ds->num_ports; index++)
if (ds->ports[index].dn == port)
return true;
return false;
@@ -159,7 +159,7 @@ static int dsa_ds_complete(struct dsa_switch_tree *dst, struct dsa_switch *ds)
u32 index;
int err;
- for (index = 0; index < DSA_MAX_PORTS; index++) {
+ for (index = 0; index < ds->num_ports; index++) {
port = &ds->ports[index];
if (!dsa_port_is_valid(port))
continue;
@@ -312,7 +312,7 @@ static int dsa_ds_apply(struct dsa_switch_tree *dst, struct dsa_switch *ds)
return err;
}
- for (index = 0; index < DSA_MAX_PORTS; index++) {
+ for (index = 0; index < ds->num_ports; index++) {
port = &ds->ports[index];
if (!dsa_port_is_valid(port))
continue;
@@ -344,7 +344,7 @@ static void dsa_ds_unapply(struct dsa_switch_tree *dst, struct dsa_switch *ds)
struct dsa_port *port;
u32 index;
- for (index = 0; index < DSA_MAX_PORTS; index++) {
+ for (index = 0; index < ds->num_ports; index++) {
port = &ds->ports[index];
if (!dsa_port_is_valid(port))
continue;
@@ -475,7 +475,7 @@ static int dsa_ds_parse(struct dsa_switch_tree *dst, struct dsa_switch *ds)
u32 index;
int err;
- for (index = 0; index < DSA_MAX_PORTS; index++) {
+ for (index = 0; index < ds->num_ports; index++) {
port = &ds->ports[index];
if (!dsa_port_is_valid(port))
continue;
@@ -529,7 +529,7 @@ static int dsa_parse_ports_dn(struct device_node *ports, struct dsa_switch *ds)
if (err)
return err;
- if (reg >= DSA_MAX_PORTS)
+ if (reg >= ds->num_ports)
return -EINVAL;
ds->ports[reg].dn = port;