From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
linux-arm-kernel@lists.infradead.org,
linux-stm32@st-md-mailman.stormreply.com, netdev@vger.kernel.org,
Paolo Abeni <pabeni@redhat.com>
Subject: [PATCH net-next 02/14] net: stmmac: remove plat_dat->port_node
Date: Fri, 27 Feb 2026 09:53:13 +0000 [thread overview]
Message-ID: <E1vvuX3-0000000Avme-3oej@rmk-PC.armlinux.org.uk> (raw)
In-Reply-To: <aaFpZvuIzOLaNM0m@shell.armlinux.org.uk>
There are repeated instances of:
fwnode = priv->plat->port_node;
if (!fwnode)
fwnode = dev_fwnode(priv->device);
However, the only place that ->port_node is set is
stmmac_probe_config_dt():
struct device_node *np = pdev->dev.of_node;
...
/* PHYLINK automatically parses the phy-handle property */
plat->port_node = of_fwnode_handle(np);
which is equivalent to dev_fwnode(&pdev->dev) and, as priv->device
will be &pdev->dev, is also equivalent to dev_fwnode(priv->device).
Thus, plat_dat->port_node doesn't provide any extra benefit over
using dev_fwnode(priv->device) directly.
There is one case where port_node is used directly, which can be
found in stmmac_pcs_setup(). This may cause a change of behaviour
as PCI drivers do not populate plat_dat->port_node, but
dev_fwnode(priv->device) may be valid. PCI-based stmmac should
be tested.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 13 +++----------
drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 7 ++-----
.../net/ethernet/stmicro/stmmac/stmmac_platform.c | 3 ---
include/linux/stmmac.h | 1 -
4 files changed, 5 insertions(+), 19 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 2b21cc839146..3f74766f6e21 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1252,10 +1252,7 @@ static int stmmac_init_phy(struct net_device *dev)
xpcs_get_an_mode(priv->hw->xpcs, mode) == DW_AN_C73)
return 0;
- fwnode = priv->plat->port_node;
- if (!fwnode)
- fwnode = dev_fwnode(priv->device);
-
+ fwnode = dev_fwnode(priv->device);
if (fwnode)
phy_fwnode = fwnode_get_phy_node(fwnode);
else
@@ -1313,7 +1310,6 @@ static int stmmac_phylink_setup(struct stmmac_priv *priv)
{
struct stmmac_mdio_bus_data *mdio_bus_data;
struct phylink_config *config;
- struct fwnode_handle *fwnode;
struct phylink_pcs *pcs;
struct phylink *phylink;
@@ -1405,11 +1401,8 @@ static int stmmac_phylink_setup(struct stmmac_priv *priv)
config->wol_mac_support |= WAKE_MAGIC;
}
- fwnode = priv->plat->port_node;
- if (!fwnode)
- fwnode = dev_fwnode(priv->device);
-
- phylink = phylink_create(config, fwnode, priv->plat->phy_interface,
+ phylink = phylink_create(config, dev_fwnode(priv->device),
+ priv->plat->phy_interface,
&stmmac_phylink_mac_ops);
if (IS_ERR(phylink))
return PTR_ERR(phylink);
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index a7c2496b39f2..485a0d790baa 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -430,7 +430,7 @@ int stmmac_pcs_setup(struct net_device *ndev)
struct dw_xpcs *xpcs = NULL;
int addr, ret;
- devnode = priv->plat->port_node;
+ devnode = dev_fwnode(priv->device);
if (priv->plat->pcs_init) {
ret = priv->plat->pcs_init(priv);
@@ -649,10 +649,7 @@ int stmmac_mdio_register(struct net_device *ndev)
stmmac_xgmac2_mdio_read_c45(new_bus, 0, 0, 0);
/* If fixed-link is set, skip PHY scanning */
- fwnode = priv->plat->port_node;
- if (!fwnode)
- fwnode = dev_fwnode(priv->device);
-
+ fwnode = dev_fwnode(priv->device);
if (fwnode) {
fixed_node = fwnode_get_named_child_node(fwnode, "fixed-link");
if (fixed_node) {
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 5c9fd91a1db9..c34998486293 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -446,9 +446,6 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac)
* they are not converted to phylink. */
plat->phy_node = of_parse_phandle(np, "phy-handle", 0);
- /* PHYLINK automatically parses the phy-handle property */
- plat->port_node = of_fwnode_handle(np);
-
/* Get max speed of operation from device tree */
of_property_read_u32(np, "max-speed", &plat->max_speed);
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index b489e2c6d710..cc6c89769d82 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -226,7 +226,6 @@ struct plat_stmmacenet_data {
phy_interface_t phy_interface;
struct stmmac_mdio_bus_data *mdio_bus_data;
struct device_node *phy_node;
- struct fwnode_handle *port_node;
struct device_node *mdio_node;
struct stmmac_dma_cfg *dma_cfg;
struct stmmac_safety_feature_cfg *safety_feat_cfg;
--
2.47.3
next prev parent reply other threads:[~2026-02-27 9:53 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-27 9:52 [PATCH net-next 00/14] net: stmmac: further cleanups Russell King (Oracle)
2026-02-27 9:53 ` [PATCH net-next 01/14] net: stmmac: clean up formatting in stmmac_mac_finish() Russell King (Oracle)
2026-02-27 9:53 ` Russell King (Oracle) [this message]
2026-02-27 9:53 ` [PATCH net-next 03/14] net: stmmac: remove .get_tx_owner() Russell King (Oracle)
2026-02-27 9:53 ` [PATCH net-next 04/14] net: stmmac: remove .get_tx_ls() Russell King (Oracle)
2026-02-27 9:53 ` [PATCH net-next 05/14] net: stmmac: remove .get_tx_len() Russell King (Oracle)
2026-02-27 9:53 ` [PATCH net-next 06/14] net: stmmac: remove dwmac4 DMA_CHAN_INTR_DEFAULT_[TR]X* Russell King (Oracle)
2026-02-27 9:53 ` [PATCH net-next 07/14] net: stmmac: remove dwmac410_(enable|disable)_dma_irq Russell King (Oracle)
2026-02-27 9:53 ` [PATCH net-next 08/14] net: stmmac: remove mac->xlgmac Russell King (Oracle)
2026-02-27 9:53 ` [PATCH net-next 09/14] net: stmmac: make extend_desc boolean Russell King (Oracle)
2026-02-27 9:53 ` [PATCH net-next 10/14] net: stmmac: make chain_mode a boolean Russell King (Oracle)
2026-02-27 9:53 ` [PATCH net-next 11/14] net: stmmac: make dma_cfg mixed/fixed burst boolean Russell King (Oracle)
2026-02-27 9:54 ` [PATCH net-next 12/14] net: stmmac: move initialisation of dma_cfg->atds Russell King (Oracle)
2026-02-27 9:54 ` [PATCH net-next 13/14] net: stmmac: simplify atds initialisation Russell King (Oracle)
2026-02-27 9:54 ` [PATCH net-next 14/14] net: stmmac: move DMA configuration validation to driver probe Russell King (Oracle)
2026-03-03 4:47 ` [PATCH net-next 00/14] net: stmmac: further cleanups patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1vvuX3-0000000Avme-3oej@rmk-PC.armlinux.org.uk \
--to=rmk+kernel@armlinux.org.uk \
--cc=alexandre.torgue@foss.st.com \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox