From 7c3b8b3d2608bb4b1a97749c607440785b60ef7f Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Wed, 14 Oct 2015 14:43:02 +0300 Subject: [PATCH] dmaengine: edma: Move the pending error check into helper function In the ccerr interrupt handler the code checks for pending errors in the error status registers in two different places. Move the check out to a helper function. Signed-off-by: Peter Ujfalusi Signed-off-by: Vinod Koul --- drivers/dma/edma.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c index daa94a4bbe11..84b98a01993a 100644 --- a/drivers/dma/edma.c +++ b/drivers/dma/edma.c @@ -1626,6 +1626,16 @@ static void edma_error_handler(struct edma_chan *echan) spin_unlock(&echan->vchan.lock); } +static inline bool edma_error_pending(struct edma_cc *ecc) +{ + if (edma_read_array(ecc, EDMA_EMR, 0) || + edma_read_array(ecc, EDMA_EMR, 1) || + edma_read(ecc, EDMA_QEMR) || edma_read(ecc, EDMA_CCERR)) + return true; + + return false; +} + /* eDMA error interrupt handler */ static irqreturn_t dma_ccerr_handler(int irq, void *data) { @@ -1640,10 +1650,7 @@ static irqreturn_t dma_ccerr_handler(int irq, void *data) dev_vdbg(ecc->dev, "dma_ccerr_handler\n"); - if ((edma_read_array(ecc, EDMA_EMR, 0) == 0) && - (edma_read_array(ecc, EDMA_EMR, 1) == 0) && - (edma_read(ecc, EDMA_QEMR) == 0) && - (edma_read(ecc, EDMA_CCERR) == 0)) + if (!edma_error_pending(ecc)) return IRQ_NONE; while (1) { @@ -1698,10 +1705,7 @@ static irqreturn_t dma_ccerr_handler(int irq, void *data) } } } - if ((edma_read_array(ecc, EDMA_EMR, 0) == 0) && - (edma_read_array(ecc, EDMA_EMR, 1) == 0) && - (edma_read(ecc, EDMA_QEMR) == 0) && - (edma_read(ecc, EDMA_CCERR) == 0)) + if (!edma_error_pending(ecc)) break; cnt++; if (cnt > 10) -- 2.39.5