diff mbox

[v5,03/14] spi: qup: Add completion timeout

Message ID 1500882445-29008-4-git-send-email-varada@codeaurora.org (mailing list archive)
State Not Applicable, archived
Delegated to: Andy Gross
Headers show

Commit Message

Varadarajan Narayanan July 24, 2017, 7:47 a.m. UTC
Add i/o completion timeout for DMA and PIO modes.

Signed-off-by: Andy Gross <andy.gross@linaro.org>
Signed-off-by: Varadarajan Narayanan <varada@codeaurora.org>
---
 drivers/spi/spi-qup.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

Comments

kernel test robot July 27, 2017, 8:30 a.m. UTC | #1
Hi Varadarajan,

[auto build test ERROR on spi/for-next]
[also build test ERROR on v4.13-rc2 next-20170726]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Varadarajan-Narayanan/spi-qup-Fixes-and-add-support-for-64k-transfers/20170725-033101
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
config: arm64-defconfig (attached as .config)
compiler: aarch64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm64 

Note: the linux-review/Varadarajan-Narayanan/spi-qup-Fixes-and-add-support-for-64k-transfers/20170725-033101 HEAD 88e143f949247832b744d84f5163033eaba09abc builds fine.
      It only hurts bisectibility.

All errors (new ones prefixed by >>):

   drivers//spi/spi-qup.c: In function 'spi_qup_do_dma':
>> drivers//spi/spi-qup.c:361:47: error: 'qup' undeclared (first use in this function)
     if (rx_done && !wait_for_completion_timeout(&qup->done, timeout))
                                                  ^~~
   drivers//spi/spi-qup.c:361:47: note: each undeclared identifier is reported only once for each function it appears in

vim +/qup +361 drivers//spi/spi-qup.c

   333	
   334	static int spi_qup_do_dma(struct spi_master *master, struct spi_transfer *xfer,
   335				  unsigned long timeout)
   336	{
   337		dma_async_tx_callback rx_done = NULL, tx_done = NULL;
   338		int ret;
   339	
   340		if (xfer->rx_buf)
   341			rx_done = spi_qup_dma_done;
   342		else if (xfer->tx_buf)
   343			tx_done = spi_qup_dma_done;
   344	
   345		if (xfer->rx_buf) {
   346			ret = spi_qup_prep_sg(master, xfer, DMA_DEV_TO_MEM, rx_done);
   347			if (ret)
   348				return ret;
   349	
   350			dma_async_issue_pending(master->dma_rx);
   351		}
   352	
   353		if (xfer->tx_buf) {
   354			ret = spi_qup_prep_sg(master, xfer, DMA_MEM_TO_DEV, tx_done);
   355			if (ret)
   356				return ret;
   357	
   358			dma_async_issue_pending(master->dma_tx);
   359		}
   360	
 > 361		if (rx_done && !wait_for_completion_timeout(&qup->done, timeout))
   362			return -ETIMEDOUT;
   363	
   364		if (tx_done && !wait_for_completion_timeout(&qup->done, timeout))
   365			return -ETIMEDOUT;
   366	
   367		return 0;
   368	}
   369	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c
index abe799b..92922b6 100644
--- a/drivers/spi/spi-qup.c
+++ b/drivers/spi/spi-qup.c
@@ -331,7 +331,8 @@  static void spi_qup_dma_terminate(struct spi_master *master,
 		dmaengine_terminate_all(master->dma_rx);
 }
 
-static int spi_qup_do_dma(struct spi_master *master, struct spi_transfer *xfer)
+static int spi_qup_do_dma(struct spi_master *master, struct spi_transfer *xfer,
+			  unsigned long timeout)
 {
 	dma_async_tx_callback rx_done = NULL, tx_done = NULL;
 	int ret;
@@ -357,10 +358,17 @@  static int spi_qup_do_dma(struct spi_master *master, struct spi_transfer *xfer)
 		dma_async_issue_pending(master->dma_tx);
 	}
 
+	if (rx_done && !wait_for_completion_timeout(&qup->done, timeout))
+		return -ETIMEDOUT;
+
+	if (tx_done && !wait_for_completion_timeout(&qup->done, timeout))
+		return -ETIMEDOUT;
+
 	return 0;
 }
 
-static int spi_qup_do_pio(struct spi_master *master, struct spi_transfer *xfer)
+static int spi_qup_do_pio(struct spi_master *master, struct spi_transfer *xfer,
+			  unsigned long timeout)
 {
 	struct spi_qup *qup = spi_master_get_devdata(master);
 	int ret;
@@ -379,6 +387,9 @@  static int spi_qup_do_pio(struct spi_master *master, struct spi_transfer *xfer)
 
 	spi_qup_fifo_write(qup, xfer);
 
+	if (!wait_for_completion_timeout(&qup->done, timeout))
+		return -ETIMEDOUT;
+
 	return 0;
 }
 
@@ -632,9 +643,9 @@  static int spi_qup_transfer_one(struct spi_master *master,
 	spin_unlock_irqrestore(&controller->lock, flags);
 
 	if (spi_qup_is_dma_xfer(controller->mode))
-		ret = spi_qup_do_dma(master, xfer);
+		ret = spi_qup_do_dma(master, xfer, timeout);
 	else
-		ret = spi_qup_do_pio(master, xfer);
+		ret = spi_qup_do_pio(master, xfer, timeout);
 
 	if (ret)
 		goto exit;