]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: stmmac: remove axi_blen array
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Wed, 19 Nov 2025 10:23:40 +0000 (10:23 +0000)
committerJakub Kicinski <kuba@kernel.org>
Fri, 21 Nov 2025 01:57:40 +0000 (17:57 -0800)
Remove the axi_blen array from struct stmmac_axi as we set this array,
and then immediately convert it ot the register value, never looking at
the array again. Thus, the array can be function local rather than part
of a run-time allocated long-lived struct.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/E1vLfLg-0000000FMbD-1vmh@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c
drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
include/linux/stmmac.h

index bd06f26a27b405a628a305e538a012bf526e015b..d043bad4a8629d5f3f1134a5506f6df2d29ccac1 100644 (file)
@@ -38,8 +38,6 @@ static int dwc_eth_dwmac_config_dt(struct platform_device *pdev,
 {
        struct device *dev = &pdev->dev;
        u32 burst_map = 0;
-       u32 bit_index = 0;
-       u32 a_index = 0;
 
        if (!plat_dat->axi) {
                plat_dat->axi = devm_kzalloc(&pdev->dev,
@@ -83,13 +81,8 @@ static int dwc_eth_dwmac_config_dt(struct platform_device *pdev,
        }
        device_property_read_u32(dev, "snps,burst-map", &burst_map);
 
-       /* converts burst-map bitmask to burst array */
-       for (bit_index = 0; bit_index < 7; bit_index++)
-               if (burst_map & (1 << bit_index))
-                       plat_dat->axi->axi_blen[a_index++] = 4 << bit_index;
-
-       stmmac_axi_blen_to_mask(&plat_dat->axi->axi_blen_regval,
-                               plat_dat->axi->axi_blen, a_index);
+       plat_dat->axi->axi_blen_regval = FIELD_PREP(DMA_AXI_BLEN_MASK,
+                                                   burst_map);
 
        /* dwc-qos needs GMAC4, AAL, TSO and PMT */
        plat_dat->core_type = DWMAC_CORE_GMAC4;
index e94605d3d185f384b426a0a1bd076e83392049ac..aad1be1ec4c11c3da8a1f56cdc200250b7f2d1d9 100644 (file)
@@ -652,9 +652,6 @@ static int intel_mgbe_common_data(struct pci_dev *pdev,
        plat->axi->axi_rd_osr_lmt = 1;
        plat->axi->axi_blen_regval = DMA_AXI_BLEN4 | DMA_AXI_BLEN8 |
                                     DMA_AXI_BLEN16;
-       plat->axi->axi_blen[0] = 4;
-       plat->axi->axi_blen[1] = 8;
-       plat->axi->axi_blen[2] = 16;
 
        plat->ptp_max_adj = plat->clk_ptp_rate;
 
index e1036150fae244bc5e1220c8054341ca5c86f822..afb1c53ca6f87b23f96ec89cd98cb12402ffb278 100644 (file)
@@ -94,10 +94,6 @@ static int snps_gmac5_default_data(struct pci_dev *pdev,
        plat->axi->axi_fb = false;
        plat->axi->axi_blen_regval = DMA_AXI_BLEN4 | DMA_AXI_BLEN8 |
                                     DMA_AXI_BLEN16 | DMA_AXI_BLEN32;
-       plat->axi->axi_blen[0] = 4;
-       plat->axi->axi_blen[1] = 8;
-       plat->axi->axi_blen[2] = 16;
-       plat->axi->axi_blen[3] = 32;
 
        return 0;
 }
index 656d4adedabebc4a0817215650d0d0835299f161..8979a50b550707ec38ea178a37209b7af9dafc66 100644 (file)
@@ -95,6 +95,7 @@ static struct stmmac_axi *stmmac_axi_setup(struct platform_device *pdev)
 {
        struct device_node *np;
        struct stmmac_axi *axi;
+       u32 axi_blen[AXI_BLEN];
 
        np = of_parse_phandle(pdev->dev.of_node, "snps,axi-config", 0);
        if (!np)
@@ -117,8 +118,8 @@ static struct stmmac_axi *stmmac_axi_setup(struct platform_device *pdev)
                axi->axi_wr_osr_lmt = 1;
        if (of_property_read_u32(np, "snps,rd_osr_lmt", &axi->axi_rd_osr_lmt))
                axi->axi_rd_osr_lmt = 1;
-       of_property_read_u32_array(np, "snps,blen", axi->axi_blen, AXI_BLEN);
-       stmmac_axi_blen_to_mask(&axi->axi_blen_regval, axi->axi_blen, AXI_BLEN);
+       of_property_read_u32_array(np, "snps,blen", axi_blen, AXI_BLEN);
+       stmmac_axi_blen_to_mask(&axi->axi_blen_regval, axi_blen, AXI_BLEN);
        of_node_put(np);
 
        return axi;
index d1a41fe0825f95dd89a99a44a2b96c3f3f02d378..f1054b9c2d8acaa15982f37f1b949652d8790770 100644 (file)
@@ -114,7 +114,6 @@ struct stmmac_axi {
        u32 axi_rd_osr_lmt;
        bool axi_kbbe;
        u32 axi_blen_regval;
-       u32 axi_blen[AXI_BLEN];
        bool axi_fb;
        bool axi_mb;
        bool axi_rb;