mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
net: stmmac: add stmmac_plat_dat_alloc()
Add a function to allocate and initialise the plat_stmmacenet_data structure with default values. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Link: https://patch.msgid.link/E1vJviq-0000000EVjP-0c0l@rmk-PC.armlinux.org.uk Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
7cf3ac8a9c
commit
511171e47f
@@ -1286,7 +1286,7 @@ static int intel_eth_pci_probe(struct pci_dev *pdev,
|
||||
if (!intel_priv)
|
||||
return -ENOMEM;
|
||||
|
||||
plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL);
|
||||
plat = stmmac_plat_dat_alloc(&pdev->dev);
|
||||
if (!plat)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
@@ -559,7 +559,7 @@ static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id
|
||||
struct loongson_data *ld;
|
||||
int ret;
|
||||
|
||||
plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL);
|
||||
plat = stmmac_plat_dat_alloc(&pdev->dev);
|
||||
if (!plat)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
@@ -408,6 +408,8 @@ int stmmac_reinit_ringparam(struct net_device *dev, u32 rx_size, u32 tx_size);
|
||||
int stmmac_set_clk_tx_rate(void *bsp_priv, struct clk *clk_tx_i,
|
||||
phy_interface_t interface, int speed);
|
||||
|
||||
struct plat_stmmacenet_data *stmmac_plat_dat_alloc(struct device *dev);
|
||||
|
||||
static inline bool stmmac_xdp_is_enabled(struct stmmac_priv *priv)
|
||||
{
|
||||
return !!priv->xdp_prog;
|
||||
|
||||
@@ -7555,6 +7555,18 @@ static void stmmac_unregister_devlink(struct stmmac_priv *priv)
|
||||
devlink_free(priv->devlink);
|
||||
}
|
||||
|
||||
struct plat_stmmacenet_data *stmmac_plat_dat_alloc(struct device *dev)
|
||||
{
|
||||
struct plat_stmmacenet_data *plat_dat;
|
||||
|
||||
plat_dat = devm_kzalloc(dev, sizeof(*plat_dat), GFP_KERNEL);
|
||||
if (!plat_dat)
|
||||
return NULL;
|
||||
|
||||
return plat_dat;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(stmmac_plat_dat_alloc);
|
||||
|
||||
/**
|
||||
* stmmac_dvr_probe
|
||||
* @device: device pointer
|
||||
|
||||
@@ -191,7 +191,7 @@ static int stmmac_pci_probe(struct pci_dev *pdev,
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL);
|
||||
plat = stmmac_plat_dat_alloc(&pdev->dev);
|
||||
if (!plat)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
@@ -436,7 +436,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac)
|
||||
void *ret;
|
||||
int rc;
|
||||
|
||||
plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL);
|
||||
plat = stmmac_plat_dat_alloc(&pdev->dev);
|
||||
if (!plat)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user