netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 for v3.15] net: mvmdio: Check for a valid interrupt instead of an error
@ 2014-04-30 16:28 Ezequiel Garcia
  2014-04-30 19:40 ` Sebastian Hesselbarth
  2014-05-02 20:19 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Ezequiel Garcia @ 2014-04-30 16:28 UTC (permalink / raw)
  To: netdev
  Cc: Sebastian Hesselbarth, Thomas Petazzoni, Gregory Clement,
	Tawfik Bayouk, Lior Amsalem, David S. Miller, Ezequiel Garcia

The following commit:

commit 9ec36cafe43bf835f8f29273597a5b0cbc8267ef
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: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
Changes from v1: Handle the deferral probe as well.

 drivers/net/ethernet/marvell/mvmdio.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c
index b161a52..9d5ced2 100644
--- a/drivers/net/ethernet/marvell/mvmdio.c
+++ b/drivers/net/ethernet/marvell/mvmdio.c
@@ -232,7 +232,7 @@ static int orion_mdio_probe(struct platform_device *pdev)
 		clk_prepare_enable(dev->clk);
 
 	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,
 					orion_mdio_err_irq,
 					IRQF_SHARED, pdev->name, dev);
@@ -241,6 +241,9 @@ static int orion_mdio_probe(struct platform_device *pdev)
 
 		writel(MVMDIO_ERR_INT_SMI_DONE,
 			dev->regs + MVMDIO_ERR_INT_MASK);
+
+	} else if (dev->err_interrupt == -EPROBE_DEFER) {
+		return -EPROBE_DEFER;
 	}
 
 	mutex_init(&dev->lock);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 for v3.15] net: mvmdio: Check for a valid interrupt instead of an error
  2014-04-30 16:28 [PATCH v2 for v3.15] net: mvmdio: Check for a valid interrupt instead of an error Ezequiel Garcia
@ 2014-04-30 19:40 ` Sebastian Hesselbarth
  2014-05-02 20:19 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Sebastian Hesselbarth @ 2014-04-30 19:40 UTC (permalink / raw)
  To: Ezequiel Garcia, netdev
  Cc: Thomas Petazzoni, Gregory Clement, Tawfik Bayouk, Lior Amsalem,
	David S. Miller

On 04/30/2014 06:28 PM, Ezequiel Garcia wrote:
> The following commit:
> 
> commit 9ec36cafe43bf835f8f29273597a5b0cbc8267ef
> 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: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>

Reviewed-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>

Thanks!

> ---
> Changes from v1: Handle the deferral probe as well.
> 
>  drivers/net/ethernet/marvell/mvmdio.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c
> index b161a52..9d5ced2 100644
> --- a/drivers/net/ethernet/marvell/mvmdio.c
> +++ b/drivers/net/ethernet/marvell/mvmdio.c
> @@ -232,7 +232,7 @@ static int orion_mdio_probe(struct platform_device *pdev)
>  		clk_prepare_enable(dev->clk);
>  
>  	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,
>  					orion_mdio_err_irq,
>  					IRQF_SHARED, pdev->name, dev);
> @@ -241,6 +241,9 @@ static int orion_mdio_probe(struct platform_device *pdev)
>  
>  		writel(MVMDIO_ERR_INT_SMI_DONE,
>  			dev->regs + MVMDIO_ERR_INT_MASK);
> +
> +	} else if (dev->err_interrupt == -EPROBE_DEFER) {
> +		return -EPROBE_DEFER;
>  	}
>  
>  	mutex_init(&dev->lock);
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 for v3.15] net: mvmdio: Check for a valid interrupt instead of an error
  2014-04-30 16:28 [PATCH v2 for v3.15] net: mvmdio: Check for a valid interrupt instead of an error Ezequiel Garcia
  2014-04-30 19:40 ` Sebastian Hesselbarth
@ 2014-05-02 20:19 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2014-05-02 20:19 UTC (permalink / raw)
  To: ezequiel.garcia
  Cc: netdev, sebastian.hesselbarth, thomas.petazzoni, gregory.clement,
	tawfik, alior

From: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Date: Wed, 30 Apr 2014 13:28:51 -0300

> The following commit:
> 
> commit 9ec36cafe43bf835f8f29273597a5b0cbc8267ef
> 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: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-05-02 20:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-30 16:28 [PATCH v2 for v3.15] net: mvmdio: Check for a valid interrupt instead of an error Ezequiel Garcia
2014-04-30 19:40 ` Sebastian Hesselbarth
2014-05-02 20:19 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).