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

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

There is no need to configure the enabled ports once in bcm_sf2_sw_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
e85ec74a 34c8befd

+3 -6
+3 -6
drivers/net/dsa/bcm_sf2.c
··· 890 890 struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds); 891 891 unsigned int port; 892 892 893 - /* Enable all valid ports and disable those unused */ 893 + /* Disable unused ports and configure IMP port */ 894 894 for (port = 0; port < priv->hw_params.num_ports; port++) { 895 - /* IMP port receives special treatment */ 896 - if ((1 << port) & ds->enabled_port_mask) 897 - bcm_sf2_port_setup(ds, port, NULL); 898 - else if (dsa_is_cpu_port(ds, port)) 895 + if (dsa_is_cpu_port(ds, port)) 899 896 bcm_sf2_imp_setup(ds, port); 900 - else 897 + else if (!((1 << port) & ds->enabled_port_mask)) 901 898 bcm_sf2_port_disable(ds, port, NULL); 902 899 } 903 900