linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] spi: xilinx: Handle errors from platform_get_irq()
@ 2016-07-12 13:24 Lars-Peter Clausen
       [not found] ` <1468329881-5894-1-git-send-email-lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Lars-Peter Clausen @ 2016-07-12 13:24 UTC (permalink / raw)
  To: Mark Brown
  Cc: Michal Simek, Sören Brinkmann, Ricardo Ribalda Delgado,
	linux-spi-u79uwXL29TY76Z2rM5mHXA, Lars-Peter Clausen

The Xilinx SPI driver can operate without an IRQ, but not every error
returned by platform_get_irq() means that no IRQ was specified. It will
also return an error if the IRQ specification is invalid or the IRQ
provider is not yet available (EPROBE_DEFER).

So instead of ignoring all errors only ignore ENXIO, which means no IRQ was
specified, and propagate all other errors to device driver core.

Signed-off-by: Lars-Peter Clausen <lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>
---
 drivers/spi/spi-xilinx.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c
index 3009121..334f423 100644
--- a/drivers/spi/spi-xilinx.c
+++ b/drivers/spi/spi-xilinx.c
@@ -455,6 +455,9 @@ static int xilinx_spi_probe(struct platform_device *pdev)
 	xspi->buffer_size = xilinx_spi_find_buffer_size(xspi);
 
 	xspi->irq = platform_get_irq(pdev, 0);
+	if (xspi->irq < 0 && xspi->irq != -ENXIO)
+		return xspi->irq;
+
 	if (xspi->irq >= 0) {
 		/* Register for SPI Interrupt */
 		ret = devm_request_irq(&pdev->dev, xspi->irq, xilinx_spi_irq, 0,
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 2/2] spi: xilinx: Return IRQ_NONE if no interrupts were detected
       [not found] ` <1468329881-5894-1-git-send-email-lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>
@ 2016-07-12 13:24   ` Lars-Peter Clausen
       [not found]     ` <1468329881-5894-2-git-send-email-lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>
  2016-07-12 13:31   ` [PATCH 1/2] spi: xilinx: Handle errors from platform_get_irq() Ricardo Ribalda Delgado
  2016-07-12 13:48   ` Lars-Peter Clausen
  2 siblings, 1 reply; 6+ messages in thread
From: Lars-Peter Clausen @ 2016-07-12 13:24 UTC (permalink / raw)
  To: Mark Brown
  Cc: Michal Simek, Sören Brinkmann, Ricardo Ribalda Delgado,
	linux-spi-u79uwXL29TY76Z2rM5mHXA, Lars-Peter Clausen

Return IRQ_NONE from the interrupt handler if the handler is running, but
no interrupt was detected. This allows the system to recover in case of an
interrupt storm due to an invalid interrupt configuration or faulty
hardware.

Signed-off-by: Lars-Peter Clausen <lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>
---
 drivers/spi/spi-xilinx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c
index 334f423..f8280f3 100644
--- a/drivers/spi/spi-xilinx.c
+++ b/drivers/spi/spi-xilinx.c
@@ -341,9 +341,10 @@ static irqreturn_t xilinx_spi_irq(int irq, void *dev_id)
 
 	if (ipif_isr & XSPI_INTR_TX_EMPTY) {	/* Transmission completed */
 		complete(&xspi->done);
+		return IRQ_HANDLED;
 	}
 
-	return IRQ_HANDLED;
+	return IRQ_NONE;
 }
 
 static int xilinx_spi_find_buffer_size(struct xilinx_spi *xspi)
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 1/2] spi: xilinx: Handle errors from platform_get_irq()
       [not found] ` <1468329881-5894-1-git-send-email-lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>
  2016-07-12 13:24   ` [PATCH 2/2] spi: xilinx: Return IRQ_NONE if no interrupts were detected Lars-Peter Clausen
@ 2016-07-12 13:31   ` Ricardo Ribalda Delgado
  2016-07-12 13:48   ` Lars-Peter Clausen
  2 siblings, 0 replies; 6+ messages in thread
From: Ricardo Ribalda Delgado @ 2016-07-12 13:31 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Mark Brown, Michal Simek, Sören Brinkmann, linux-spi

A good one. I did not think about it.

Thanks!

Acked-by: Ricardo Ribalda Delgado <ricardo.ribalda-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

On Tue, Jul 12, 2016 at 3:24 PM, Lars-Peter Clausen <lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org> wrote:
> The Xilinx SPI driver can operate without an IRQ, but not every error
> returned by platform_get_irq() means that no IRQ was specified. It will
> also return an error if the IRQ specification is invalid or the IRQ
> provider is not yet available (EPROBE_DEFER).
>
> So instead of ignoring all errors only ignore ENXIO, which means no IRQ was
> specified, and propagate all other errors to device driver core.
>
> Signed-off-by: Lars-Peter Clausen <lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>
> ---
>  drivers/spi/spi-xilinx.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c
> index 3009121..334f423 100644
> --- a/drivers/spi/spi-xilinx.c
> +++ b/drivers/spi/spi-xilinx.c
> @@ -455,6 +455,9 @@ static int xilinx_spi_probe(struct platform_device *pdev)
>         xspi->buffer_size = xilinx_spi_find_buffer_size(xspi);
>
>         xspi->irq = platform_get_irq(pdev, 0);
> +       if (xspi->irq < 0 && xspi->irq != -ENXIO)
> +               return xspi->irq;
> +
>         if (xspi->irq >= 0) {
>                 /* Register for SPI Interrupt */
>                 ret = devm_request_irq(&pdev->dev, xspi->irq, xilinx_spi_irq, 0,
> --
> 2.1.4
>



-- 
Ricardo Ribalda
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 2/2] spi: xilinx: Return IRQ_NONE if no interrupts were detected
       [not found]     ` <1468329881-5894-2-git-send-email-lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>
@ 2016-07-12 13:31       ` Ricardo Ribalda Delgado
  2016-07-15 11:57       ` Applied "spi: xilinx: Return IRQ_NONE if no interrupts were detected" to the spi tree Mark Brown
  1 sibling, 0 replies; 6+ messages in thread
From: Ricardo Ribalda Delgado @ 2016-07-12 13:31 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Mark Brown, Michal Simek, Sören Brinkmann, linux-spi

Acked-by: Ricardo Ribalda Delgado <ricardo.ribalda-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

On Tue, Jul 12, 2016 at 3:24 PM, Lars-Peter Clausen <lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org> wrote:
> Return IRQ_NONE from the interrupt handler if the handler is running, but
> no interrupt was detected. This allows the system to recover in case of an
> interrupt storm due to an invalid interrupt configuration or faulty
> hardware.
>
> Signed-off-by: Lars-Peter Clausen <lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>
> ---
>  drivers/spi/spi-xilinx.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c
> index 334f423..f8280f3 100644
> --- a/drivers/spi/spi-xilinx.c
> +++ b/drivers/spi/spi-xilinx.c
> @@ -341,9 +341,10 @@ static irqreturn_t xilinx_spi_irq(int irq, void *dev_id)
>
>         if (ipif_isr & XSPI_INTR_TX_EMPTY) {    /* Transmission completed */
>                 complete(&xspi->done);
> +               return IRQ_HANDLED;
>         }
>
> -       return IRQ_HANDLED;
> +       return IRQ_NONE;
>  }
>
>  static int xilinx_spi_find_buffer_size(struct xilinx_spi *xspi)
> --
> 2.1.4
>



-- 
Ricardo Ribalda
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 1/2] spi: xilinx: Handle errors from platform_get_irq()
       [not found] ` <1468329881-5894-1-git-send-email-lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>
  2016-07-12 13:24   ` [PATCH 2/2] spi: xilinx: Return IRQ_NONE if no interrupts were detected Lars-Peter Clausen
  2016-07-12 13:31   ` [PATCH 1/2] spi: xilinx: Handle errors from platform_get_irq() Ricardo Ribalda Delgado
@ 2016-07-12 13:48   ` Lars-Peter Clausen
  2 siblings, 0 replies; 6+ messages in thread
From: Lars-Peter Clausen @ 2016-07-12 13:48 UTC (permalink / raw)
  To: Mark Brown
  Cc: Michal Simek, Sören Brinkmann, Ricardo Ribalda Delgado,
	linux-spi-u79uwXL29TY76Z2rM5mHXA

On 07/12/2016 03:24 PM, Lars-Peter Clausen wrote:
[...]
>  	xspi->irq = platform_get_irq(pdev, 0);
> +	if (xspi->irq < 0 && xspi->irq != -ENXIO)
> +		return xspi->irq;

Sorry, I messed up the error path handling here. Will fix it in v2.

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Applied "spi: xilinx: Return IRQ_NONE if no interrupts were detected" to the spi tree
       [not found]     ` <1468329881-5894-2-git-send-email-lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>
  2016-07-12 13:31       ` Ricardo Ribalda Delgado
@ 2016-07-15 11:57       ` Mark Brown
  1 sibling, 0 replies; 6+ messages in thread
From: Mark Brown @ 2016-07-15 11:57 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Ricardo Ribalda Delgado, Mark Brown, Mark Brown, Michal Simek,
	Sören Brinkmann, Ricardo Ribalda Delgado,
	linux-spi-u79uwXL29TY76Z2rM5mHXA

The patch

   spi: xilinx: Return IRQ_NONE if no interrupts were detected

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From d33648478501407267557b1bf6897169625f4178 Mon Sep 17 00:00:00 2001
From: Lars-Peter Clausen <lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>
Date: Fri, 15 Jul 2016 11:04:19 +0200
Subject: [PATCH] spi: xilinx: Return IRQ_NONE if no interrupts were detected

Return IRQ_NONE from the interrupt handler if the handler is running, but
no interrupt was detected. This allows the system to recover in case of an
interrupt storm due to an invalid interrupt configuration or faulty
hardware.

Signed-off-by: Lars-Peter Clausen <lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>
Acked-by: Ricardo Ribalda Delgado <ricardo.ribalda-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Signed-off-by: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
 drivers/spi/spi-xilinx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c
index e62eb9ace825..bc7100b93dfc 100644
--- a/drivers/spi/spi-xilinx.c
+++ b/drivers/spi/spi-xilinx.c
@@ -341,9 +341,10 @@ static irqreturn_t xilinx_spi_irq(int irq, void *dev_id)
 
 	if (ipif_isr & XSPI_INTR_TX_EMPTY) {	/* Transmission completed */
 		complete(&xspi->done);
+		return IRQ_HANDLED;
 	}
 
-	return IRQ_HANDLED;
+	return IRQ_NONE;
 }
 
 static int xilinx_spi_find_buffer_size(struct xilinx_spi *xspi)
-- 
2.8.1

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2016-07-15 11:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-12 13:24 [PATCH 1/2] spi: xilinx: Handle errors from platform_get_irq() Lars-Peter Clausen
     [not found] ` <1468329881-5894-1-git-send-email-lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>
2016-07-12 13:24   ` [PATCH 2/2] spi: xilinx: Return IRQ_NONE if no interrupts were detected Lars-Peter Clausen
     [not found]     ` <1468329881-5894-2-git-send-email-lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>
2016-07-12 13:31       ` Ricardo Ribalda Delgado
2016-07-15 11:57       ` Applied "spi: xilinx: Return IRQ_NONE if no interrupts were detected" to the spi tree Mark Brown
2016-07-12 13:31   ` [PATCH 1/2] spi: xilinx: Handle errors from platform_get_irq() Ricardo Ribalda Delgado
2016-07-12 13:48   ` Lars-Peter Clausen

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).