net: phylink: move test for ovr_an_inband
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Wed, 29 May 2024 13:29:24 +0000 (14:29 +0100)
committerJakub Kicinski <kuba@kernel.org>
Fri, 31 May 2024 01:32:15 +0000 (18:32 -0700)
Of the two users of phylink_config->ovr_an_inband, both manually check
for a fixed link before setting this flag (or clearing it if they find
a fixed link.) This is unnecessary complication.

Test ovr_an_inband before checking for the fixed-link properties, which
will allow ovr_an_inband to be overriden by a fixed link specification.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Andrew Halaney <ahalaney@redhat.com>
Link: https://lore.kernel.org/r/E1sCJMq-00Ecqv-P8@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/phy/phylink.c

index 5abd127135986f04244d1b9893955b61f01f3379..c81f1c1ee67500eb111b3da15fcc7571d433a46d 100644 (file)
@@ -885,14 +885,16 @@ static int phylink_parse_mode(struct phylink *pl,
        const char *managed;
        unsigned long caps;
 
+       if (pl->config->ovr_an_inband)
+               pl->cfg_link_an_mode = MLO_AN_INBAND;
+
        dn = fwnode_get_named_child_node(fwnode, "fixed-link");
        if (dn || fwnode_property_present(fwnode, "fixed-link"))
                pl->cfg_link_an_mode = MLO_AN_FIXED;
        fwnode_handle_put(dn);
 
        if ((fwnode_property_read_string(fwnode, "managed", &managed) == 0 &&
-            strcmp(managed, "in-band-status") == 0) ||
-           pl->config->ovr_an_inband) {
+            strcmp(managed, "in-band-status") == 0)) {
                if (pl->cfg_link_an_mode == MLO_AN_FIXED) {
                        phylink_err(pl,
                                    "can't use both fixed-link and in-band-status\n");