plat_dat->dma_cfg is unconditionally required for the operation of the
driver, so it would make sense to allocate it along with the plat_dat.
On Arm64, sizeof(*plat_dat) has recently shrunk from 880 to 816 bytes
and sizeof(*plat_dat->dma_cfg) has shrunk from 32 to 20 bytes.
Given that dma_cfg is required, and it is now less than a cache line,
It doesn't make sense to allocate this separateny, so place it at the
end of struct plat_stmmacenet_data, and set plat_dat->dma_cfg to point
at that to avoid mass changes.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Mohd Ayaan Anwar <mohd.anwar@oss.qualcomm.com>
Tested-by: Mohd Ayaan Anwar <mohd.anwar@oss.qualcomm.com>
Link: https://patch.msgid.link/E1vzX54-0000000CVrw-2jfu@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
if (!plat->mdio_bus_data)
return -ENOMEM;
- plat->dma_cfg = devm_kzalloc(&pdev->dev, sizeof(*plat->dma_cfg),
- GFP_KERNEL);
- if (!plat->dma_cfg)
- return -ENOMEM;
-
plat->safety_feat_cfg = devm_kzalloc(&pdev->dev,
sizeof(*plat->safety_feat_cfg),
GFP_KERNEL);
if (!plat->mdio_bus_data)
return -ENOMEM;
- plat->dma_cfg = devm_kzalloc(&pdev->dev, sizeof(*plat->dma_cfg), GFP_KERNEL);
- if (!plat->dma_cfg)
- return -ENOMEM;
-
ld = devm_kzalloc(&pdev->dev, sizeof(*ld), GFP_KERNEL);
if (!ld)
return -ENOMEM;
if (!plat->mdio_bus_data)
return NULL;
- plat->dma_cfg = devm_kzalloc(dev, sizeof(*plat->dma_cfg), GFP_KERNEL);
- if (!plat->dma_cfg)
- return NULL;
-
plat->axi = devm_kzalloc(dev, sizeof(*plat->axi), GFP_KERNEL);
if (!plat->axi)
return NULL;
if (!plat_dat)
return NULL;
+ plat_dat->dma_cfg = &plat_dat->__dma_cfg;
+
/* Set the defaults:
* - phy autodetection
* - determine GMII_Address CR field from CSR clock
if (!plat->mdio_bus_data)
return -ENOMEM;
- plat->dma_cfg = devm_kzalloc(&pdev->dev, sizeof(*plat->dma_cfg),
- GFP_KERNEL);
- if (!plat->dma_cfg)
- return -ENOMEM;
-
plat->safety_feat_cfg = devm_kzalloc(&pdev->dev,
sizeof(*plat->safety_feat_cfg),
GFP_KERNEL);
&plat->multicast_filter_bins);
}
- dma_cfg = devm_kzalloc(&pdev->dev, sizeof(*dma_cfg),
- GFP_KERNEL);
- if (!dma_cfg) {
- ret = ERR_PTR(-ENOMEM);
- goto error_put_mdio;
- }
- plat->dma_cfg = dma_cfg;
+ dma_cfg = plat->dma_cfg;
of_property_read_u32(np, "snps,pbl", &dma_cfg->pbl);
if (!dma_cfg->pbl)
int msi_tx_base_vec;
const struct dwmac4_addrs *dwmac4_addrs;
unsigned int flags;
+ struct stmmac_dma_cfg __dma_cfg;
};
#endif