[PATCH RFC net-next v2 09/19] net: stmmac: simplify stmmac_check_pcs_mode()
Russell King (Oracle)
rmk+kernel at armlinux.org.uk
Sun Sep 28 02:20:49 PDT 2025
Now that we only support one mode, simplify stmmac_check_pcs_mode().
Signed-off-by: Russell King (Oracle) <rmk+kernel at armlinux.org.uk>
---
.../net/ethernet/stmicro/stmmac/stmmac_main.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 414a00ab5012..94b615444734 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1086,22 +1086,23 @@ static const struct phylink_mac_ops stmmac_phylink_mac_ops = {
static void stmmac_check_pcs_mode(struct stmmac_priv *priv)
{
int interface = priv->plat->phy_interface;
+ int speed = priv->plat->mac_port_sel_speed;
if (priv->dma_cap.pcs && interface == PHY_INTERFACE_MODE_SGMII) {
netdev_dbg(priv->dev, "PCS SGMII support enabled\n");
priv->hw->pcs = STMMAC_PCS_SGMII;
- }
-
- /* PS and related bits will be programmed according to the speed */
- if (priv->hw->pcs) {
- int speed = priv->plat->mac_port_sel_speed;
- if ((speed == SPEED_10) || (speed == SPEED_100) ||
- (speed == SPEED_1000)) {
+ switch (speed) {
+ case SPEED_10:
+ case SPEED_100:
+ case SPEED_1000:
priv->hw->ps = speed;
- } else {
+ break;
+
+ default:
dev_warn(priv->device, "invalid port speed\n");
priv->hw->ps = 0;
+ break;
}
}
}
--
2.47.3
More information about the linux-arm-kernel
mailing list