[PATCH] net: stmmac: remove ptpaddr/mmcaddr/estaddr "safe" initialization

Jisheng Zhang posted 1 patch 1 month, 4 weeks ago
drivers/net/ethernet/stmicro/stmmac/hwif.c | 12 ------------
1 file changed, 12 deletions(-)
[PATCH] net: stmmac: remove ptpaddr/mmcaddr/estaddr "safe" initialization
Posted by Jisheng Zhang 1 month, 4 weeks ago
These so called "safe" initializations aren't needed any more from
sometime, but the unnecessaries are obvious after recent clean up
by Russell. The code will correctly initialize them after getting
the correct stmmac_hwif_entry by calling stmmac_hwif_find().

Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
---
 drivers/net/ethernet/stmicro/stmmac/hwif.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.c b/drivers/net/ethernet/stmicro/stmmac/hwif.c
index 511b0fd5e834..265671170bf6 100644
--- a/drivers/net/ethernet/stmicro/stmmac/hwif.c
+++ b/drivers/net/ethernet/stmicro/stmmac/hwif.c
@@ -328,18 +328,6 @@ int stmmac_hwif_init(struct stmmac_priv *priv)
 	/* Save ID for later use */
 	priv->synopsys_id = version.snpsver;
 
-	/* Lets assume some safe values first */
-	if (core_type == DWMAC_CORE_GMAC4) {
-		priv->ptpaddr = priv->ioaddr + PTP_GMAC4_OFFSET;
-		priv->mmcaddr = priv->ioaddr + MMC_GMAC4_OFFSET;
-		priv->estaddr = priv->ioaddr + EST_GMAC4_OFFSET;
-	} else {
-		priv->ptpaddr = priv->ioaddr + PTP_GMAC3_X_OFFSET;
-		priv->mmcaddr = priv->ioaddr + MMC_GMAC3_X_OFFSET;
-		if (core_type == DWMAC_CORE_XGMAC)
-			priv->estaddr = priv->ioaddr + EST_XGMAC_OFFSET;
-	}
-
 	mac = devm_kzalloc(priv->device, sizeof(*mac), GFP_KERNEL);
 	if (!mac)
 		return -ENOMEM;
-- 
2.53.0
Re: [PATCH] net: stmmac: remove ptpaddr/mmcaddr/estaddr "safe" initialization
Posted by Maxime Chevallier 1 month, 4 weeks ago
Hi,

Don't forget to put the tree name in the subject please :

https://docs.kernel.org/process/maintainer-netdev.html

That one's for net-next, thanks for the cleanup

On 8/3/26 15:57, Jisheng Zhang wrote:
> These so called "safe" initializations aren't needed any more from
> sometime, but the unnecessaries are obvious after recent clean up
> by Russell. The code will correctly initialize them after getting
> the correct stmmac_hwif_entry by calling stmmac_hwif_find().
> 
> Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
> ---
>  drivers/net/ethernet/stmicro/stmmac/hwif.c | 12 ------------
>  1 file changed, 12 deletions(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.c b/drivers/net/ethernet/stmicro/stmmac/hwif.c
> index 511b0fd5e834..265671170bf6 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/hwif.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.c
> @@ -328,18 +328,6 @@ int stmmac_hwif_init(struct stmmac_priv *priv)
>  	/* Save ID for later use */
>  	priv->synopsys_id = version.snpsver;
>  
> -	/* Lets assume some safe values first */
> -	if (core_type == DWMAC_CORE_GMAC4) {
> -		priv->ptpaddr = priv->ioaddr + PTP_GMAC4_OFFSET;
> -		priv->mmcaddr = priv->ioaddr + MMC_GMAC4_OFFSET;
> -		priv->estaddr = priv->ioaddr + EST_GMAC4_OFFSET;
> -	} else {
> -		priv->ptpaddr = priv->ioaddr + PTP_GMAC3_X_OFFSET;
> -		priv->mmcaddr = priv->ioaddr + MMC_GMAC3_X_OFFSET;
> -		if (core_type == DWMAC_CORE_XGMAC)
> -			priv->estaddr = priv->ioaddr + EST_XGMAC_OFFSET;
> -	}
> -
>  	mac = devm_kzalloc(priv->device, sizeof(*mac), GFP_KERNEL);
>  	if (!mac)
>  		return -ENOMEM;

Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>

Maxime