OSDN Git Service

dpaa2-mac: remove an unnecessary check
authorIoana Ciornei <ioana.ciornei@nxp.com>
Fri, 8 Jan 2021 09:07:26 +0000 (11:07 +0200)
committerJakub Kicinski <kuba@kernel.org>
Sun, 10 Jan 2021 00:21:30 +0000 (16:21 -0800)
The dpaa2-eth driver has phylink integration only if the connected dpmac
object is in TYPE_PHY (aka the PCS/PHY etc link status is managed by
Linux instead of the firmware). The check is thus unnecessary because
the code path that reaches the .mac_link_up() callback is only with
TYPE_PHY dpmac objects.

Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c

index 81b2822..3869c38 100644 (file)
@@ -174,30 +174,25 @@ static void dpaa2_mac_link_up(struct phylink_config *config,
 
        dpmac_state->up = 1;
 
-       if (mac->if_link_type == DPMAC_LINK_TYPE_PHY) {
-               /* If the DPMAC is configured for PHY mode, we need
-                * to pass the link parameters to the MC firmware.
-                */
-               dpmac_state->rate = speed;
-
-               if (duplex == DUPLEX_HALF)
-                       dpmac_state->options |= DPMAC_LINK_OPT_HALF_DUPLEX;
-               else if (duplex == DUPLEX_FULL)
-                       dpmac_state->options &= ~DPMAC_LINK_OPT_HALF_DUPLEX;
-
-               /* This is lossy; the firmware really should take the pause
-                * enablement status rather than pause/asym pause status.
-                */
-               if (rx_pause)
-                       dpmac_state->options |= DPMAC_LINK_OPT_PAUSE;
-               else
-                       dpmac_state->options &= ~DPMAC_LINK_OPT_PAUSE;
-
-               if (rx_pause ^ tx_pause)
-                       dpmac_state->options |= DPMAC_LINK_OPT_ASYM_PAUSE;
-               else
-                       dpmac_state->options &= ~DPMAC_LINK_OPT_ASYM_PAUSE;
-       }
+       dpmac_state->rate = speed;
+
+       if (duplex == DUPLEX_HALF)
+               dpmac_state->options |= DPMAC_LINK_OPT_HALF_DUPLEX;
+       else if (duplex == DUPLEX_FULL)
+               dpmac_state->options &= ~DPMAC_LINK_OPT_HALF_DUPLEX;
+
+       /* This is lossy; the firmware really should take the pause
+        * enablement status rather than pause/asym pause status.
+        */
+       if (rx_pause)
+               dpmac_state->options |= DPMAC_LINK_OPT_PAUSE;
+       else
+               dpmac_state->options &= ~DPMAC_LINK_OPT_PAUSE;
+
+       if (rx_pause ^ tx_pause)
+               dpmac_state->options |= DPMAC_LINK_OPT_ASYM_PAUSE;
+       else
+               dpmac_state->options &= ~DPMAC_LINK_OPT_ASYM_PAUSE;
 
        err = dpmac_set_link_state(mac->mc_io, 0,
                                   mac->mc_dev->mc_handle, dpmac_state);