Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Florian Fainelli and committed by
David S. Miller
34c8befd 299752a7

+5 -4
+5 -4
drivers/net/dsa/b53/b53_common.c
··· 815 815 if (ret) 816 816 dev_err(ds->dev, "failed to apply configuration\n"); 817 817 818 + /* Configure IMP/CPU port, disable unused ports. Enabled 819 + * ports will be configured with .port_enable 820 + */ 818 821 for (port = 0; port < dev->num_ports; port++) { 819 - if (BIT(port) & ds->enabled_port_mask) 820 - b53_enable_port(ds, port, NULL); 821 - else if (dsa_is_cpu_port(ds, port)) 822 + if (dsa_is_cpu_port(ds, port)) 822 823 b53_enable_cpu_port(dev, port); 823 - else 824 + else if (!(BIT(port) & ds->enabled_port_mask)) 824 825 b53_disable_port(ds, port, NULL); 825 826 } 826 827