]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
spi/davinci: use request_threaded_irq() to fix deadlock
authorMurali Karicheri <m-karicheri2@ti.com>
Fri, 21 Dec 2012 20:13:26 +0000 (15:13 -0500)
committerGrant Likely <grant.likely@secretlab.ca>
Tue, 5 Feb 2013 17:12:26 +0000 (17:12 +0000)
With RT pre-empt patch applied to Linux kernel, the irq handler will be
force converted to an irq thread. spi driver can get back to back messages
from the slave device. In such cases, IRQ thread doesn't get a chance to
run to read the slave data. Hence the irq handler must be run in hard irq
context to read/write data from slave device. Otherwise, the kernel goes
into a deadlock. This patch fixes this issue when PREEMPT_RT_FULL is
enabled in the kernel. A dummy thread function is provided to satisfy the
request_threaded_irq() API. Passing a NULL for function also causes the
irq handler to be executed in the thread context.

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
drivers/spi/spi-davinci.c

index 50bd2cdc52de0b19702c56689bebaeb1f395e041..8234d2259722f08401b0caf916c1e1fb2b15a5cc 100644 (file)
@@ -701,6 +701,19 @@ err_alloc_dummy_buf:
        return ret;
 }
 
+/**
+ * dummy_thread_fn - dummy thread function
+ * @irq: IRQ number for this SPI Master
+ * @context_data: structure for SPI Master controller davinci_spi
+ *
+ * This is to satisfy the request_threaded_irq() API so that the irq
+ * handler is called in interrupt context.
+ */
+static irqreturn_t dummy_thread_fn(s32 irq, void *data)
+{
+       return IRQ_HANDLED;
+}
+
 /**
  * davinci_spi_irq - Interrupt handler for SPI Master Controller
  * @irq: IRQ number for this SPI Master
@@ -899,8 +912,8 @@ static int davinci_spi_probe(struct platform_device *pdev)
                goto unmap_io;
        }
 
-       ret = request_irq(dspi->irq, davinci_spi_irq, 0, dev_name(&pdev->dev),
-                                                                       dspi);
+       ret = request_threaded_irq(dspi->irq, davinci_spi_irq, dummy_thread_fn,
+                                0, dev_name(&pdev->dev), dspi);
        if (ret)
                goto unmap_io;