Skip to content

Commit d7ec858

Browse files
wensdavem330
authored andcommitted
net: stmmac: Handle different error codes from platform_get_irq_byname
The following patch moved device tree interrupt resolution into platform_get_irq_byname: ad69674 of/irq: do irq resolution in platform_get_irq_byname() As a result, the function no longer only return -ENXIO on error. This breaks DT based probing of stmmac, as seen in test runs of linux-next next-20140526 cubie2-sunxi_defconfig: http://lists.linaro.org/pipermail/kernel-build-reports/2014-May/003659.html This patch makes the stmmac_platform probe function properly handle error codes, such as returning for deferred probing, and other codes returned by of_irq_get_by_name. Signed-off-by: Chen-Yu Tsai <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 31595de commit d7ec858

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1753,7 +1753,7 @@ static int stmmac_open(struct net_device *dev)
17531753
}
17541754

17551755
/* Request the IRQ lines */
1756-
if (priv->lpi_irq != -ENXIO) {
1756+
if (priv->lpi_irq > 0) {
17571757
ret = request_irq(priv->lpi_irq, stmmac_interrupt, IRQF_SHARED,
17581758
dev->name, dev);
17591759
if (unlikely(ret < 0)) {
@@ -1813,7 +1813,7 @@ static int stmmac_release(struct net_device *dev)
18131813
free_irq(dev->irq, dev);
18141814
if (priv->wol_irq != dev->irq)
18151815
free_irq(priv->wol_irq, dev);
1816-
if (priv->lpi_irq != -ENXIO)
1816+
if (priv->lpi_irq > 0)
18171817
free_irq(priv->lpi_irq, dev);
18181818

18191819
/* Stop TX/RX DMA and clear the descriptors */

drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,10 +237,12 @@ static int stmmac_pltfr_probe(struct platform_device *pdev)
237237

238238
/* Get the MAC information */
239239
priv->dev->irq = platform_get_irq_byname(pdev, "macirq");
240-
if (priv->dev->irq == -ENXIO) {
241-
pr_err("%s: ERROR: MAC IRQ configuration "
242-
"information not found\n", __func__);
243-
return -ENXIO;
240+
if (priv->dev->irq < 0) {
241+
if (priv->dev->irq != -EPROBE_DEFER) {
242+
netdev_err(priv->dev,
243+
"MAC IRQ configuration information not found\n");
244+
}
245+
return priv->dev->irq;
244246
}
245247

246248
/*
@@ -252,10 +254,15 @@ static int stmmac_pltfr_probe(struct platform_device *pdev)
252254
* so the driver will continue to use the mac irq (ndev->irq)
253255
*/
254256
priv->wol_irq = platform_get_irq_byname(pdev, "eth_wake_irq");
255-
if (priv->wol_irq == -ENXIO)
257+
if (priv->wol_irq < 0) {
258+
if (priv->wol_irq == -EPROBE_DEFER)
259+
return -EPROBE_DEFER;
256260
priv->wol_irq = priv->dev->irq;
261+
}
257262

258263
priv->lpi_irq = platform_get_irq_byname(pdev, "eth_lpi");
264+
if (priv->lpi_irq == -EPROBE_DEFER)
265+
return -EPROBE_DEFER;
259266

260267
platform_set_drvdata(pdev, priv->dev);
261268

0 commit comments

Comments
 (0)