Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 327753
b: refs/heads/master
c: 3f8bdec
h: refs/heads/master
i:
  327751: fc6c85d
v: v3
  • Loading branch information
Srinivas Kandagatla authored and David S. Miller committed Aug 31, 2012
1 parent a350cb0 commit 7859aed
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 33 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d56631a66c0d0c9d662abfb38cd1f6326eeebd7c
refs/heads/master: 3f8bdecd32ab8f52bff1d646e2acb7c241d12a8d
40 changes: 8 additions & 32 deletions trunk/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ static int __devinit stmmac_pltfr_probe(struct platform_device *pdev)
{
int ret = 0;
struct resource *res;
struct device *dev = &pdev->dev;
void __iomem *addr = NULL;
struct stmmac_priv *priv = NULL;
struct plat_stmmacenet_data *plat_dat = NULL;
Expand All @@ -87,18 +88,10 @@ static int __devinit stmmac_pltfr_probe(struct platform_device *pdev)
if (!res)
return -ENODEV;

if (!request_mem_region(res->start, resource_size(res), pdev->name)) {
pr_err("%s: ERROR: memory allocation failed"
"cannot get the I/O addr 0x%x\n",
__func__, (unsigned int)res->start);
return -EBUSY;
}

addr = ioremap(res->start, resource_size(res));
addr = devm_request_and_ioremap(dev, res);
if (!addr) {
pr_err("%s: ERROR: memory mapping failed", __func__);
ret = -ENOMEM;
goto out_release_region;
return -ENOMEM;
}

if (pdev->dev.of_node) {
Expand All @@ -107,14 +100,13 @@ static int __devinit stmmac_pltfr_probe(struct platform_device *pdev)
GFP_KERNEL);
if (!plat_dat) {
pr_err("%s: ERROR: no memory", __func__);
ret = -ENOMEM;
goto out_unmap;
return -ENOMEM;
}

ret = stmmac_probe_config_dt(pdev, plat_dat, &mac);
if (ret) {
pr_err("%s: main dt probe failed", __func__);
goto out_unmap;
return ret;
}
} else {
plat_dat = pdev->dev.platform_data;
Expand All @@ -124,13 +116,13 @@ static int __devinit stmmac_pltfr_probe(struct platform_device *pdev)
if (plat_dat->init) {
ret = plat_dat->init(pdev);
if (unlikely(ret))
goto out_unmap;
return ret;
}

priv = stmmac_dvr_probe(&(pdev->dev), plat_dat, addr);
if (!priv) {
pr_err("%s: main driver probe failed", __func__);
goto out_unmap;
return -ENODEV;
}

/* Get MAC address if available (DT) */
Expand All @@ -142,8 +134,7 @@ static int __devinit stmmac_pltfr_probe(struct platform_device *pdev)
if (priv->dev->irq == -ENXIO) {
pr_err("%s: ERROR: MAC IRQ configuration "
"information not found\n", __func__);
ret = -ENXIO;
goto out_unmap;
return -ENXIO;
}

/*
Expand All @@ -165,15 +156,6 @@ static int __devinit stmmac_pltfr_probe(struct platform_device *pdev)
pr_debug("STMMAC platform driver registration completed");

return 0;

out_unmap:
iounmap(addr);
platform_set_drvdata(pdev, NULL);

out_release_region:
release_mem_region(res->start, resource_size(res));

return ret;
}

/**
Expand All @@ -186,19 +168,13 @@ static int stmmac_pltfr_remove(struct platform_device *pdev)
{
struct net_device *ndev = platform_get_drvdata(pdev);
struct stmmac_priv *priv = netdev_priv(ndev);
void __iomem *addr = priv->ioaddr;
struct resource *res;
int ret = stmmac_dvr_remove(ndev);

if (priv->plat->exit)
priv->plat->exit(pdev);

platform_set_drvdata(pdev, NULL);

iounmap(addr);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
release_mem_region(res->start, resource_size(res));

return ret;
}

Expand Down

0 comments on commit 7859aed

Please sign in to comment.