Thread (20 messages) flat view 20 messages, 4 authors, 2026-02-13

Re: [PATCH net-next v5 02/13] net: phy: phy_port: Cleanup the of-parsing logic for phy_port

From: "Christophe Leroy (CS GROUP)" <chleroy@kernel.org>
Date: 2026-02-11 09:38:48
Also in: lkml


Le 05/02/2026 à 10:23, Maxime Chevallier a écrit :
We don't need to maintain a mediums bitfield, let's drop it and drop a
bogus check for empty mediums, as we already check it above.

Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Reviewed-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
quoted hunk ↗ jump to hunk
---
  drivers/net/phy/phy_port.c | 9 ++-------
  1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/net/phy/phy_port.c b/drivers/net/phy/phy_port.c
index ec93c8ca051e..a269e9ea12c4 100644
--- a/drivers/net/phy/phy_port.c
+++ b/drivers/net/phy/phy_port.c
@@ -53,7 +53,7 @@ struct phy_port *phy_of_parse_port(struct device_node *dn)
  	enum ethtool_link_medium medium;
  	struct phy_port *port;
  	const char *med_str;
-	u32 pairs = 0, mediums = 0;
+	u32 pairs = 0;
  	int ret;
  
  	ret = fwnode_property_read_string(fwnode, "media", &med_str);
@@ -85,17 +85,12 @@ struct phy_port *phy_of_parse_port(struct device_node *dn)
  		return ERR_PTR(-EINVAL);
  	}
  
-	mediums |= BIT(medium);
-
-	if (!mediums)
-		return ERR_PTR(-EINVAL);
-
  	port = phy_port_alloc();
  	if (!port)
  		return ERR_PTR(-ENOMEM);
  
  	port->pairs = pairs;
-	port->mediums = mediums;
+	port->mediums = BIT(medium);
  
  	return port;
  }
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help