net: phylink: remove use of pl->pcs in phylink_validate_mac_and_pcs()
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Wed, 16 Oct 2024 09:58:39 +0000 (10:58 +0100)
committerAndrew Lunn <andrew@lunn.ch>
Thu, 17 Oct 2024 23:15:15 +0000 (18:15 -0500)
When the mac_select_pcs() method is not implemented, there is no way
for pl->pcs to be set to a non-NULL value. This was here to support
the old phylink_set_pcs() method which has been removed a few years
ago. Simplify the code in phylink_validate_mac_and_pcs().

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
drivers/net/phy/phylink.c

index aa1139efc7e4253407b17fc26f565f419797953f..94f3c5fd09ed793f988c32779e01286b147f681a 100644 (file)
@@ -649,8 +649,8 @@ static int phylink_validate_mac_and_pcs(struct phylink *pl,
                                        unsigned long *supported,
                                        struct phylink_link_state *state)
 {
+       struct phylink_pcs *pcs = NULL;
        unsigned long capabilities;
-       struct phylink_pcs *pcs;
        int ret;
 
        /* Get the PCS for this interface mode */
@@ -658,8 +658,6 @@ static int phylink_validate_mac_and_pcs(struct phylink *pl,
                pcs = pl->mac_ops->mac_select_pcs(pl->config, state->interface);
                if (IS_ERR(pcs))
                        return PTR_ERR(pcs);
-       } else {
-               pcs = pl->pcs;
        }
 
        if (pcs) {