Skip to content

Commit 9beae26

Browse files
montjoiedavem330
authored andcommitted
net: stmmac: split the stmmac_adjust_link 10/100 case
The 10/100 case have too many ifcase. This patch split it for removing an if. Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com> Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com> Reviewed-by: Giuseppe Cavallaro <peppe.cavallaro@st.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 5db1355 commit 9beae26

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -721,15 +721,19 @@ static void stmmac_adjust_link(struct net_device *dev)
721721
ctrl &= ~priv->hw->link.port;
722722
break;
723723
case 100:
724+
if (priv->plat->has_gmac ||
725+
priv->plat->has_gmac4) {
726+
ctrl |= priv->hw->link.port;
727+
ctrl |= priv->hw->link.speed;
728+
} else {
729+
ctrl &= ~priv->hw->link.port;
730+
}
731+
break;
724732
case 10:
725733
if (priv->plat->has_gmac ||
726734
priv->plat->has_gmac4) {
727735
ctrl |= priv->hw->link.port;
728-
if (phydev->speed == SPEED_100) {
729-
ctrl |= priv->hw->link.speed;
730-
} else {
731-
ctrl &= ~(priv->hw->link.speed);
732-
}
736+
ctrl &= ~(priv->hw->link.speed);
733737
} else {
734738
ctrl &= ~priv->hw->link.port;
735739
}

0 commit comments

Comments
 (0)