Commit 39076b04 authored by Ezequiel Garcia's avatar Ezequiel Garcia Committed by David S. Miller

net: mvmdio: Check for a valid interrupt instead of an error

The following commit:

commit 9ec36caf
Author: Rob Herring <robh@kernel.org>
Date:   Wed Apr 23 17:57:41 2014 -0500

    of/irq: do irq resolution in platform_get_irq

changed platform_get_irq() which now returns EINVAL and EPROBE_DEFER,
in addition to ENXIO. If there's no interrupt for mvmdio, platform_get_irq()
returns EINVAL, but we currently check only for ENXIO.

Fix this by looking for a positive integer, which is the proper way of
validating a virtual interrupt number.

While at it, add a proper handling for the deferral probe case.
Signed-off-by: default avatarEzequiel Garcia <ezequiel.garcia@free-electrons.com>
Reviewed-by: default avatarSebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e46e08b8
...@@ -232,7 +232,7 @@ static int orion_mdio_probe(struct platform_device *pdev) ...@@ -232,7 +232,7 @@ static int orion_mdio_probe(struct platform_device *pdev)
clk_prepare_enable(dev->clk); clk_prepare_enable(dev->clk);
dev->err_interrupt = platform_get_irq(pdev, 0); dev->err_interrupt = platform_get_irq(pdev, 0);
if (dev->err_interrupt != -ENXIO) { if (dev->err_interrupt > 0) {
ret = devm_request_irq(&pdev->dev, dev->err_interrupt, ret = devm_request_irq(&pdev->dev, dev->err_interrupt,
orion_mdio_err_irq, orion_mdio_err_irq,
IRQF_SHARED, pdev->name, dev); IRQF_SHARED, pdev->name, dev);
...@@ -241,6 +241,9 @@ static int orion_mdio_probe(struct platform_device *pdev) ...@@ -241,6 +241,9 @@ static int orion_mdio_probe(struct platform_device *pdev)
writel(MVMDIO_ERR_INT_SMI_DONE, writel(MVMDIO_ERR_INT_SMI_DONE,
dev->regs + MVMDIO_ERR_INT_MASK); dev->regs + MVMDIO_ERR_INT_MASK);
} else if (dev->err_interrupt == -EPROBE_DEFER) {
return -EPROBE_DEFER;
} }
mutex_init(&dev->lock); mutex_init(&dev->lock);
......
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