Commit 240b2628 authored by Johan Hovold's avatar Johan Hovold Committed by David S. Miller

net: davinci_emac: fix dev_err use at probe

Use platform device rather than net device in dev_err calls before net
device has been registered to avoid messages such as

	(null): DaVinci EMAC: Failed to get EMAC clock

Also replace remaining printks in probe with dev_{err,warn}.
Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 12e6c419
...@@ -1772,7 +1772,7 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev) ...@@ -1772,7 +1772,7 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev)
/* obtain emac clock from kernel */ /* obtain emac clock from kernel */
emac_clk = clk_get(&pdev->dev, NULL); emac_clk = clk_get(&pdev->dev, NULL);
if (IS_ERR(emac_clk)) { if (IS_ERR(emac_clk)) {
printk(KERN_ERR "DaVinci EMAC: Failed to get EMAC clock\n"); dev_err(&pdev->dev, "failed to get EMAC clock\n");
return -EBUSY; return -EBUSY;
} }
emac_bus_frequency = clk_get_rate(emac_clk); emac_bus_frequency = clk_get_rate(emac_clk);
...@@ -1780,7 +1780,7 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev) ...@@ -1780,7 +1780,7 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev)
ndev = alloc_etherdev(sizeof(struct emac_priv)); ndev = alloc_etherdev(sizeof(struct emac_priv));
if (!ndev) { if (!ndev) {
printk(KERN_ERR "DaVinci EMAC: Error allocating net_device\n"); dev_err(&pdev->dev, "error allocating net_device\n");
clk_put(emac_clk); clk_put(emac_clk);
return -ENOMEM; return -ENOMEM;
} }
...@@ -1795,7 +1795,7 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev) ...@@ -1795,7 +1795,7 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev)
pdata = pdev->dev.platform_data; pdata = pdev->dev.platform_data;
if (!pdata) { if (!pdata) {
printk(KERN_ERR "DaVinci EMAC: No platform data\n"); dev_err(&pdev->dev, "no platform data\n");
return -ENODEV; return -ENODEV;
} }
...@@ -1814,7 +1814,7 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev) ...@@ -1814,7 +1814,7 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev)
/* Get EMAC platform data */ /* Get EMAC platform data */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) { if (!res) {
dev_err(emac_dev, "DaVinci EMAC: Error getting res\n"); dev_err(&pdev->dev,"error getting res\n");
rc = -ENOENT; rc = -ENOENT;
goto probe_quit; goto probe_quit;
} }
...@@ -1822,14 +1822,14 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev) ...@@ -1822,14 +1822,14 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev)
priv->emac_base_phys = res->start + pdata->ctrl_reg_offset; priv->emac_base_phys = res->start + pdata->ctrl_reg_offset;
size = res->end - res->start + 1; size = res->end - res->start + 1;
if (!request_mem_region(res->start, size, ndev->name)) { if (!request_mem_region(res->start, size, ndev->name)) {
dev_err(emac_dev, "DaVinci EMAC: failed request_mem_region() for regs\n"); dev_err(&pdev->dev, "failed request_mem_region() for regs\n");
rc = -ENXIO; rc = -ENXIO;
goto probe_quit; goto probe_quit;
} }
priv->remap_addr = ioremap(res->start, size); priv->remap_addr = ioremap(res->start, size);
if (!priv->remap_addr) { if (!priv->remap_addr) {
dev_err(emac_dev, "Unable to map IO\n"); dev_err(&pdev->dev, "unable to map IO\n");
rc = -ENOMEM; rc = -ENOMEM;
release_mem_region(res->start, size); release_mem_region(res->start, size);
goto probe_quit; goto probe_quit;
...@@ -1863,7 +1863,7 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev) ...@@ -1863,7 +1863,7 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev)
priv->dma = cpdma_ctlr_create(&dma_params); priv->dma = cpdma_ctlr_create(&dma_params);
if (!priv->dma) { if (!priv->dma) {
dev_err(emac_dev, "DaVinci EMAC: Error initializing DMA\n"); dev_err(&pdev->dev, "error initializing DMA\n");
rc = -ENOMEM; rc = -ENOMEM;
goto no_dma; goto no_dma;
} }
...@@ -1879,7 +1879,7 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev) ...@@ -1879,7 +1879,7 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev)
res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (!res) { if (!res) {
dev_err(emac_dev, "DaVinci EMAC: Error getting irq res\n"); dev_err(&pdev->dev, "error getting irq res\n");
rc = -ENOENT; rc = -ENOENT;
goto no_irq_res; goto no_irq_res;
} }
...@@ -1888,8 +1888,8 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev) ...@@ -1888,8 +1888,8 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev)
if (!is_valid_ether_addr(priv->mac_addr)) { if (!is_valid_ether_addr(priv->mac_addr)) {
/* Use random MAC if none passed */ /* Use random MAC if none passed */
random_ether_addr(priv->mac_addr); random_ether_addr(priv->mac_addr);
printk(KERN_WARNING "%s: using random MAC addr: %pM\n", dev_warn(&pdev->dev, "using random MAC addr: %pM\n",
__func__, priv->mac_addr); priv->mac_addr);
} }
ndev->netdev_ops = &emac_netdev_ops; ndev->netdev_ops = &emac_netdev_ops;
...@@ -1902,7 +1902,7 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev) ...@@ -1902,7 +1902,7 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev)
SET_NETDEV_DEV(ndev, &pdev->dev); SET_NETDEV_DEV(ndev, &pdev->dev);
rc = register_netdev(ndev); rc = register_netdev(ndev);
if (rc) { if (rc) {
dev_err(emac_dev, "DaVinci EMAC: Error in register_netdev\n"); dev_err(&pdev->dev, "error in register_netdev\n");
rc = -ENODEV; rc = -ENODEV;
goto netdev_reg_err; goto netdev_reg_err;
} }
......
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