]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: stmmac: avoid passing pci_dev
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Thu, 12 Mar 2026 12:13:52 +0000 (12:13 +0000)
committerJakub Kicinski <kuba@kernel.org>
Sat, 14 Mar 2026 16:42:58 +0000 (09:42 -0700)
The pci_dev is only used to provide the ethtool bus_info using
pci_name(priv->plat->pdev). This is the same as dev_name(priv->device).
Thus, rather than passing the pci_dev, make use of what we already
have.

To avoid unexpectedly exposing the device name through ethtool where
it wasn't provided before, add a flag priv->plat->provide_bus_info
to enable this, which only dwmac-intel needs to set.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/E1w0evI-0000000CzY7-1fyo@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
include/linux/stmmac.h

index 421c6c81ca5ebef3cfeeddefe5035c6818b9235a..f621077c30a406ce9fda9fa14ddba34b7b8a49b5 100644 (file)
@@ -589,7 +589,7 @@ static int intel_mgbe_common_data(struct pci_dev *pdev,
        int ret;
        int i;
 
-       plat->pdev = pdev;
+       plat->provide_bus_info = true;
        plat->phy_addr = -1;
        plat->clk_csr = STMMAC_CSR_250_300M;
        plat->core_type = DWMAC_CORE_GMAC4;
index c1e26965d9b5d3f8d6262742644dc8ad10889404..92585d27ab88364678cb5bcce7506c5d50f946b4 100644 (file)
@@ -312,10 +312,9 @@ static void stmmac_ethtool_getdrvinfo(struct net_device *dev,
                strscpy(info->driver, MAC100_ETHTOOL_NAME,
                        sizeof(info->driver));
 
-       if (priv->plat->pdev) {
-               strscpy(info->bus_info, pci_name(priv->plat->pdev),
+       if (priv->plat->provide_bus_info)
+               strscpy(info->bus_info, dev_name(priv->device),
                        sizeof(info->bus_info));
-       }
 }
 
 static int stmmac_ethtool_get_link_ksettings(struct net_device *dev,
index 937985276e6b4c90e8434ab1ceb01ba602aff131..72febd246bdbf459066567e978d87541339f1d4b 100644 (file)
@@ -348,7 +348,7 @@ struct plat_stmmacenet_data {
        int rss_en;
        int mac_port_sel_speed;
        u8 vlan_fail_q;
-       struct pci_dev *pdev;
+       bool provide_bus_info;
        int int_snapshot_num;
        int msi_mac_vec;
        int msi_wol_vec;