Commit efd3c8cc authored by Russell King (Oracle)'s avatar Russell King (Oracle) Committed by Jakub Kicinski
Browse files

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: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/E1vLfLg-0000000FMbD-1vmh@rmk-PC.armlinux.org.uk


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent e676cc85
Loading
Loading
Loading
Loading
+2 −9
Original line number Diff line number Diff line
@@ -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;
+0 −3
Original line number Diff line number Diff line
@@ -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;

+0 −4
Original line number Diff line number Diff line
@@ -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;
}
+3 −2
Original line number Diff line number Diff line
@@ -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;
+0 −1
Original line number Diff line number Diff line
@@ -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;