aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMurali Karicheri <m-karicheri2@ti.com>2012-12-21 15:13:26 -0500
committerGrant Likely <grant.likely@secretlab.ca>2013-02-05 12:12:26 -0500
commit32310aaf5c410dd3dc701556cc9bbeff0847c7c9 (patch)
tree6f6a84b3dc6a244e9d4bf5bd0a22702ba55b2903
parent41ab724aac00cae42e649496c2567e9ef45dd753 (diff)
spi/davinci: use request_threaded_irq() to fix deadlock
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>
-rw-r--r--drivers/spi/spi-davinci.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c
index 50bd2cdc52de..8234d2259722 100644
--- a/drivers/spi/spi-davinci.c
+++ b/drivers/spi/spi-davinci.c
@@ -702,6 +702,19 @@ err_alloc_dummy_buf:
702} 702}
703 703
704/** 704/**
705 * dummy_thread_fn - dummy thread function
706 * @irq: IRQ number for this SPI Master
707 * @context_data: structure for SPI Master controller davinci_spi
708 *
709 * This is to satisfy the request_threaded_irq() API so that the irq
710 * handler is called in interrupt context.
711 */
712static irqreturn_t dummy_thread_fn(s32 irq, void *data)
713{
714 return IRQ_HANDLED;
715}
716
717/**
705 * davinci_spi_irq - Interrupt handler for SPI Master Controller 718 * davinci_spi_irq - Interrupt handler for SPI Master Controller
706 * @irq: IRQ number for this SPI Master 719 * @irq: IRQ number for this SPI Master
707 * @context_data: structure for SPI Master controller davinci_spi 720 * @context_data: structure for SPI Master controller davinci_spi
@@ -899,8 +912,8 @@ static int davinci_spi_probe(struct platform_device *pdev)
899 goto unmap_io; 912 goto unmap_io;
900 } 913 }
901 914
902 ret = request_irq(dspi->irq, davinci_spi_irq, 0, dev_name(&pdev->dev), 915 ret = request_threaded_irq(dspi->irq, davinci_spi_irq, dummy_thread_fn,
903 dspi); 916 0, dev_name(&pdev->dev), dspi);
904 if (ret) 917 if (ret)
905 goto unmap_io; 918 goto unmap_io;
906 919