Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: stmmac: remove axi_blen array

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>

authored by

Russell King (Oracle) and committed by
Jakub Kicinski
efd3c8cc e676cc85

+5 -19
+2 -9
drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
··· 38 38 { 39 39 struct device *dev = &pdev->dev; 40 40 u32 burst_map = 0; 41 - u32 bit_index = 0; 42 - u32 a_index = 0; 43 41 44 42 if (!plat_dat->axi) { 45 43 plat_dat->axi = devm_kzalloc(&pdev->dev, ··· 81 83 } 82 84 device_property_read_u32(dev, "snps,burst-map", &burst_map); 83 85 84 - /* converts burst-map bitmask to burst array */ 85 - for (bit_index = 0; bit_index < 7; bit_index++) 86 - if (burst_map & (1 << bit_index)) 87 - plat_dat->axi->axi_blen[a_index++] = 4 << bit_index; 88 - 89 - stmmac_axi_blen_to_mask(&plat_dat->axi->axi_blen_regval, 90 - plat_dat->axi->axi_blen, a_index); 86 + plat_dat->axi->axi_blen_regval = FIELD_PREP(DMA_AXI_BLEN_MASK, 87 + burst_map); 91 88 92 89 /* dwc-qos needs GMAC4, AAL, TSO and PMT */ 93 90 plat_dat->core_type = DWMAC_CORE_GMAC4;
-3
drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c
··· 652 652 plat->axi->axi_rd_osr_lmt = 1; 653 653 plat->axi->axi_blen_regval = DMA_AXI_BLEN4 | DMA_AXI_BLEN8 | 654 654 DMA_AXI_BLEN16; 655 - plat->axi->axi_blen[0] = 4; 656 - plat->axi->axi_blen[1] = 8; 657 - plat->axi->axi_blen[2] = 16; 658 655 659 656 plat->ptp_max_adj = plat->clk_ptp_rate; 660 657
-4
drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
··· 94 94 plat->axi->axi_fb = false; 95 95 plat->axi->axi_blen_regval = DMA_AXI_BLEN4 | DMA_AXI_BLEN8 | 96 96 DMA_AXI_BLEN16 | DMA_AXI_BLEN32; 97 - plat->axi->axi_blen[0] = 4; 98 - plat->axi->axi_blen[1] = 8; 99 - plat->axi->axi_blen[2] = 16; 100 - plat->axi->axi_blen[3] = 32; 101 97 102 98 return 0; 103 99 }
+3 -2
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
··· 95 95 { 96 96 struct device_node *np; 97 97 struct stmmac_axi *axi; 98 + u32 axi_blen[AXI_BLEN]; 98 99 99 100 np = of_parse_phandle(pdev->dev.of_node, "snps,axi-config", 0); 100 101 if (!np) ··· 118 117 axi->axi_wr_osr_lmt = 1; 119 118 if (of_property_read_u32(np, "snps,rd_osr_lmt", &axi->axi_rd_osr_lmt)) 120 119 axi->axi_rd_osr_lmt = 1; 121 - of_property_read_u32_array(np, "snps,blen", axi->axi_blen, AXI_BLEN); 122 - stmmac_axi_blen_to_mask(&axi->axi_blen_regval, axi->axi_blen, AXI_BLEN); 120 + of_property_read_u32_array(np, "snps,blen", axi_blen, AXI_BLEN); 121 + stmmac_axi_blen_to_mask(&axi->axi_blen_regval, axi_blen, AXI_BLEN); 123 122 of_node_put(np); 124 123 125 124 return axi;
-1
include/linux/stmmac.h
··· 114 114 u32 axi_rd_osr_lmt; 115 115 bool axi_kbbe; 116 116 u32 axi_blen_regval; 117 - u32 axi_blen[AXI_BLEN]; 118 117 bool axi_fb; 119 118 bool axi_mb; 120 119 bool axi_rb;