Commit 15ffac73 authored by Joachim Eastwood's avatar Joachim Eastwood Committed by David S. Miller

stmmac: change the stmmac_dvr_probe return type to int

Since stmmac_dvr_probe takes care of setting driver data and
assign resources to the priv structure there is no need to
access the priv structure from the other probe functions.
This mean that this function can be changed into just return
an int and thus simplifying the callers.
Signed-off-by: default avatarJoachim Eastwood <manabian@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e56788cf
...@@ -137,9 +137,9 @@ void stmmac_ptp_unregister(struct stmmac_priv *priv); ...@@ -137,9 +137,9 @@ void stmmac_ptp_unregister(struct stmmac_priv *priv);
int stmmac_resume(struct net_device *ndev); int stmmac_resume(struct net_device *ndev);
int stmmac_suspend(struct net_device *ndev); int stmmac_suspend(struct net_device *ndev);
int stmmac_dvr_remove(struct net_device *ndev); int stmmac_dvr_remove(struct net_device *ndev);
struct stmmac_priv *stmmac_dvr_probe(struct device *device, int stmmac_dvr_probe(struct device *device,
struct plat_stmmacenet_data *plat_dat, struct plat_stmmacenet_data *plat_dat,
struct stmmac_resources *res); struct stmmac_resources *res);
void stmmac_disable_eee_mode(struct stmmac_priv *priv); void stmmac_disable_eee_mode(struct stmmac_priv *priv);
bool stmmac_eee_init(struct stmmac_priv *priv); bool stmmac_eee_init(struct stmmac_priv *priv);
......
...@@ -2801,12 +2801,11 @@ static int stmmac_hw_init(struct stmmac_priv *priv) ...@@ -2801,12 +2801,11 @@ static int stmmac_hw_init(struct stmmac_priv *priv)
* Description: this is the main probe function used to * Description: this is the main probe function used to
* call the alloc_etherdev, allocate the priv structure. * call the alloc_etherdev, allocate the priv structure.
* Return: * Return:
* on success the new private structure is returned, otherwise the error * returns 0 on success, otherwise errno.
* pointer.
*/ */
struct stmmac_priv *stmmac_dvr_probe(struct device *device, int stmmac_dvr_probe(struct device *device,
struct plat_stmmacenet_data *plat_dat, struct plat_stmmacenet_data *plat_dat,
struct stmmac_resources *res) struct stmmac_resources *res)
{ {
int ret = 0; int ret = 0;
struct net_device *ndev = NULL; struct net_device *ndev = NULL;
...@@ -2814,7 +2813,7 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device, ...@@ -2814,7 +2813,7 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device,
ndev = alloc_etherdev(sizeof(struct stmmac_priv)); ndev = alloc_etherdev(sizeof(struct stmmac_priv));
if (!ndev) if (!ndev)
return ERR_PTR(-ENOMEM); return -ENOMEM;
SET_NETDEV_DEV(ndev, device); SET_NETDEV_DEV(ndev, device);
...@@ -2950,7 +2949,7 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device, ...@@ -2950,7 +2949,7 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device,
} }
} }
return priv; return 0;
error_mdio_register: error_mdio_register:
unregister_netdev(ndev); unregister_netdev(ndev);
...@@ -2963,7 +2962,7 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device, ...@@ -2963,7 +2962,7 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device,
error_clk_get: error_clk_get:
free_netdev(ndev); free_netdev(ndev);
return ERR_PTR(ret); return ret;
} }
EXPORT_SYMBOL_GPL(stmmac_dvr_probe); EXPORT_SYMBOL_GPL(stmmac_dvr_probe);
......
...@@ -164,7 +164,6 @@ static int stmmac_pci_probe(struct pci_dev *pdev, ...@@ -164,7 +164,6 @@ static int stmmac_pci_probe(struct pci_dev *pdev,
struct stmmac_pci_info *info = (struct stmmac_pci_info *)id->driver_data; struct stmmac_pci_info *info = (struct stmmac_pci_info *)id->driver_data;
struct plat_stmmacenet_data *plat; struct plat_stmmacenet_data *plat;
struct stmmac_resources res; struct stmmac_resources res;
struct stmmac_priv *priv;
int i; int i;
int ret; int ret;
...@@ -220,15 +219,7 @@ static int stmmac_pci_probe(struct pci_dev *pdev, ...@@ -220,15 +219,7 @@ static int stmmac_pci_probe(struct pci_dev *pdev,
res.wol_irq = pdev->irq; res.wol_irq = pdev->irq;
res.irq = pdev->irq; res.irq = pdev->irq;
priv = stmmac_dvr_probe(&pdev->dev, plat, &res); return stmmac_dvr_probe(&pdev->dev, plat, &res);
if (IS_ERR(priv)) {
dev_err(&pdev->dev, "%s: main driver probe failed\n", __func__);
return PTR_ERR(priv);
}
dev_dbg(&pdev->dev, "STMMAC PCI driver registration completed\n");
return 0;
} }
/** /**
......
...@@ -256,7 +256,6 @@ int stmmac_pltfr_probe(struct platform_device *pdev) ...@@ -256,7 +256,6 @@ int stmmac_pltfr_probe(struct platform_device *pdev)
int ret = 0; int ret = 0;
struct resource *res; struct resource *res;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct stmmac_priv *priv = NULL;
struct plat_stmmacenet_data *plat_dat = NULL; struct plat_stmmacenet_data *plat_dat = NULL;
memset(&stmmac_res, 0, sizeof(stmmac_res)); memset(&stmmac_res, 0, sizeof(stmmac_res));
...@@ -335,15 +334,7 @@ int stmmac_pltfr_probe(struct platform_device *pdev) ...@@ -335,15 +334,7 @@ int stmmac_pltfr_probe(struct platform_device *pdev)
return ret; return ret;
} }
priv = stmmac_dvr_probe(&(pdev->dev), plat_dat, &stmmac_res); return stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
if (IS_ERR(priv)) {
pr_err("%s: main driver probe failed", __func__);
return PTR_ERR(priv);
}
pr_debug("STMMAC platform driver registration completed");
return 0;
} }
EXPORT_SYMBOL_GPL(stmmac_pltfr_probe); EXPORT_SYMBOL_GPL(stmmac_pltfr_probe);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment