From: Russell King (Oracle) Date: Fri, 14 Nov 2025 15:28:29 +0000 (+0000) Subject: net: stmmac: move initialisation of phy_addr to stmmac_plat_dat_alloc() X-Git-Tag: v6.19-rc1~170^2~147^2~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=99e6ddaabdb4a4562d18eb7d2225f98801235904;p=thirdparty%2Fkernel%2Flinux.git net: stmmac: move initialisation of phy_addr to stmmac_plat_dat_alloc() Move the default initialisation of plat_dat->phy_addr to stmmac_plat_dat_alloc(). Signed-off-by: Russell King (Oracle) Link: https://patch.msgid.link/E1vJviv-0000000EVjV-1CLF@rmk-PC.armlinux.org.uk Signed-off-by: Jakub Kicinski --- diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c index 2d803fa37e212..8593411844bce 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c @@ -114,9 +114,6 @@ static void loongson_default_data(struct pci_dev *pdev, plat->clk_ref_rate = 125000000; plat->clk_ptp_rate = 125000000; - /* Default to phy auto-detection */ - plat->phy_addr = -1; - plat->dma_cfg->pbl = 32; plat->dma_cfg->pblx8 = true; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 400b4b9558207..1851f7d0702dc 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -7563,6 +7563,11 @@ struct plat_stmmacenet_data *stmmac_plat_dat_alloc(struct device *dev) if (!plat_dat) return NULL; + /* Set the defaults: + * - phy autodetection + */ + plat_dat->phy_addr = -1; + return plat_dat; } EXPORT_SYMBOL_GPL(stmmac_plat_dat_alloc); diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c index 622cdbeca20fe..b981a9dd511df 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c @@ -112,7 +112,6 @@ static int snps_gmac5_default_data(struct pci_dev *pdev, } plat->bus_id = 1; - plat->phy_addr = -1; plat->phy_interface = PHY_INTERFACE_MODE_GMII; plat->dma_cfg->pbl = 32; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 38d574907a044..745032fd46ce7 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -480,8 +480,6 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac) plat->bus_id = ++bus_id; } - /* Default to phy auto-detection */ - plat->phy_addr = -1; /* Default to get clk_csr from stmmac_clk_csr_set(), * or get clk_csr from device tree.