]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: dsa: lantiq: clean up phylink_get_caps switch statement
authorDaniel Golle <daniel@makrotopia.org>
Thu, 22 Jan 2026 16:39:16 +0000 (16:39 +0000)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 27 Jan 2026 10:52:44 +0000 (11:52 +0100)
Use case ranges for phylink_get_caps and remove the redundant "port N:"
from the comments.

Suggested-by: Vladimir Oltean <olteanv@gmail.com>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Link: https://patch.msgid.link/423daf99b3d60f510ff048a261c62d3de7d39321.1769099517.git.daniel@makrotopia.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/dsa/lantiq/lantiq_gswip.c
drivers/net/dsa/lantiq/mxl-gsw1xx.c

index 0377fc0079b54c08aaa0818f6c1cc181424d5653..4d699d8c16f91257cd603e127edb60fff4f6fb2f 100644 (file)
@@ -33,8 +33,7 @@ static void gswip_xrx200_phylink_get_caps(struct dsa_switch *ds, int port,
                                          struct phylink_config *config)
 {
        switch (port) {
-       case 0:
-       case 1:
+       case 0 ... 1:
                phy_interface_set_rgmii(config->supported_interfaces);
                __set_bit(PHY_INTERFACE_MODE_MII,
                          config->supported_interfaces);
@@ -44,9 +43,7 @@ static void gswip_xrx200_phylink_get_caps(struct dsa_switch *ds, int port,
                          config->supported_interfaces);
                break;
 
-       case 2:
-       case 3:
-       case 4:
+       case 2 ... 4:
        case 6:
                __set_bit(PHY_INTERFACE_MODE_INTERNAL,
                          config->supported_interfaces);
@@ -75,10 +72,7 @@ static void gswip_xrx300_phylink_get_caps(struct dsa_switch *ds, int port,
                          config->supported_interfaces);
                break;
 
-       case 1:
-       case 2:
-       case 3:
-       case 4:
+       case 1 ... 4:
        case 6:
                __set_bit(PHY_INTERFACE_MODE_INTERNAL,
                          config->supported_interfaces);
index c9cc277e382c2644da429e38abe533358659117f..ba72111a53ad0e49a8f7bb76b44b0caada7eef8e 100644 (file)
@@ -511,14 +511,12 @@ static void gsw1xx_phylink_get_caps(struct dsa_switch *ds, int port,
                                   MAC_10 | MAC_100 | MAC_1000;
 
        switch (port) {
-       case 0:
-       case 1:
-       case 2:
-       case 3:
+       case 0 ... 3: /* built-in PHYs */
                __set_bit(PHY_INTERFACE_MODE_INTERNAL,
                          config->supported_interfaces);
                break;
-       case 4: /* port 4: SGMII */
+
+       case 4: /* SGMII */
                __set_bit(PHY_INTERFACE_MODE_SGMII,
                          config->supported_interfaces);
                __set_bit(PHY_INTERFACE_MODE_1000BASEX,
@@ -529,7 +527,8 @@ static void gsw1xx_phylink_get_caps(struct dsa_switch *ds, int port,
                        config->mac_capabilities |= MAC_2500FD;
                }
                return; /* no support for EEE on SGMII port */
-       case 5: /* port 5: RGMII or RMII */
+
+       case 5: /* RGMII or RMII */
                __set_bit(PHY_INTERFACE_MODE_RMII,
                          config->supported_interfaces);
                phy_interface_set_rgmii(config->supported_interfaces);