Skip to content

Commit 318c194

Browse files
arinc9davem330
authored andcommitted
net: dsa: mt7530: use priv->ds->num_ports instead of MT7530_NUM_PORTS
Use priv->ds->num_ports on all for loops which configure the switch registers. In the future, the value of MT7530_NUM_PORTS will depend on priv->id. Therefore, this change prepares the subdriver for a simpler implementation. Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent aa16e1f commit 318c194

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/net/dsa/mt7530.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1411,7 +1411,7 @@ mt7530_port_set_vlan_unaware(struct dsa_switch *ds, int port)
14111411
mt7530_rmw(priv, MT7530_PPBV1_P(port), G0_PORT_VID_MASK,
14121412
G0_PORT_VID_DEF);
14131413

1414-
for (i = 0; i < MT7530_NUM_PORTS; i++) {
1414+
for (i = 0; i < priv->ds->num_ports; i++) {
14151415
if (dsa_is_user_port(ds, i) &&
14161416
dsa_port_is_vlan_filtering(dsa_to_port(ds, i))) {
14171417
all_user_ports_removed = false;
@@ -2428,7 +2428,7 @@ mt7530_setup(struct dsa_switch *ds)
24282428
/* Enable and reset MIB counters */
24292429
mt7530_mib_reset(ds);
24302430

2431-
for (i = 0; i < MT7530_NUM_PORTS; i++) {
2431+
for (i = 0; i < priv->ds->num_ports; i++) {
24322432
/* Clear link settings and enable force mode to force link down
24332433
* on all ports until they're enabled later.
24342434
*/
@@ -2539,7 +2539,7 @@ mt7531_setup_common(struct dsa_switch *ds)
25392539
mt7530_clear(priv, MT753X_MFC, BC_FFP_MASK | UNM_FFP_MASK |
25402540
UNU_FFP_MASK);
25412541

2542-
for (i = 0; i < MT7530_NUM_PORTS; i++) {
2542+
for (i = 0; i < priv->ds->num_ports; i++) {
25432543
/* Clear link settings and enable force mode to force link down
25442544
* on all ports until they're enabled later.
25452545
*/
@@ -2626,7 +2626,7 @@ mt7531_setup(struct dsa_switch *ds)
26262626
priv->p5_sgmii = !!(val & PAD_DUAL_SGMII_EN);
26272627

26282628
/* Force link down on all ports before internal reset */
2629-
for (i = 0; i < MT7530_NUM_PORTS; i++)
2629+
for (i = 0; i < priv->ds->num_ports; i++)
26302630
mt7530_write(priv, MT753X_PMCR_P(i), MT7531_FORCE_MODE_LNK);
26312631

26322632
/* Reset the switch through internal reset */

0 commit comments

Comments
 (0)