[PATCH v3 net-next 1/4] net: phylink: simplify phylink_resolve() -> phylink_major_config() path

Vladimir Oltean posted 4 patches 3 weeks ago
[PATCH v3 net-next 1/4] net: phylink: simplify phylink_resolve() -> phylink_major_config() path
Posted by Vladimir Oltean 3 weeks ago
This is a trivial change with no functional effect which replaces the
pattern:

if (a) {
	if (b) {
		do_stuff();
	}
}

with:

if (a && b) {
	do_stuff();
};

The purpose is to reduce the delta of a subsequent functional change.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 drivers/net/phy/phylink.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 43d8380aaefb..b96ef3d1517a 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -1683,18 +1683,16 @@ static void phylink_resolve(struct work_struct *w)
 	if (pl->act_link_an_mode != MLO_AN_FIXED)
 		phylink_apply_manual_flow(pl, &link_state);
 
-	if (mac_config) {
-		if (link_state.interface != pl->link_config.interface) {
-			/* The interface has changed, force the link down and
-			 * then reconfigure.
-			 */
-			if (cur_link_state) {
-				phylink_link_down(pl);
-				cur_link_state = false;
-			}
-			phylink_major_config(pl, false, &link_state);
-			pl->link_config.interface = link_state.interface;
+	if (mac_config && link_state.interface != pl->link_config.interface) {
+		/* The interface has changed, so force the link down and then
+		 * reconfigure.
+		 */
+		if (cur_link_state) {
+			phylink_link_down(pl);
+			cur_link_state = false;
 		}
+		phylink_major_config(pl, false, &link_state);
+		pl->link_config.interface = link_state.interface;
 	}
 
 	/* If configuration of the interface failed, force the link down
-- 
2.34.1
Re: [PATCH v3 net-next 1/4] net: phylink: simplify phylink_resolve() -> phylink_major_config() path
Posted by Russell King (Oracle) 3 weeks ago
On Mon, Jan 19, 2026 at 02:19:51PM +0200, Vladimir Oltean wrote:
> This is a trivial change with no functional effect which replaces the
> pattern:
> 
> if (a) {
> 	if (b) {
> 		do_stuff();
> 	}
> }
> 
> with:
> 
> if (a && b) {
> 	do_stuff();
> };
> 
> The purpose is to reduce the delta of a subsequent functional change.
> 
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>

Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Thanks!

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!