Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 34c8befd authored by Florian Fainelli's avatar Florian Fainelli Committed by David S. Miller
Browse files

net: dsa: b53: Defer port enabling to calling port_enable



There is no need to configure the enabled ports once in b53_setup() and then a
second time around when dsa_switch_ops::port_enable is called, just do it when
port_enable is called which is better in terms of power consumption and
correctness.

Reviewed-by: default avatarVivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 299752a7
Loading
Loading
Loading
Loading
+5 −4
Original line number Original line Diff line number Diff line
@@ -815,12 +815,13 @@ static int b53_setup(struct dsa_switch *ds)
	if (ret)
	if (ret)
		dev_err(ds->dev, "failed to apply configuration\n");
		dev_err(ds->dev, "failed to apply configuration\n");


	/* Configure IMP/CPU port, disable unused ports. Enabled
	 * ports will be configured with .port_enable
	 */
	for (port = 0; port < dev->num_ports; port++) {
	for (port = 0; port < dev->num_ports; port++) {
		if (BIT(port) & ds->enabled_port_mask)
		if (dsa_is_cpu_port(ds, port))
			b53_enable_port(ds, port, NULL);
		else if (dsa_is_cpu_port(ds, port))
			b53_enable_cpu_port(dev, port);
			b53_enable_cpu_port(dev, port);
		else
		else if (!(BIT(port) & ds->enabled_port_mask))
			b53_disable_port(ds, port, NULL);
			b53_disable_port(ds, port, NULL);
	}
	}