[Sound-open-firmware] [PATCH] dma: dw: improve IRQ handler reload handling.

Liam Girdwood liam.r.girdwood at linux.intel.com
Thu Oct 12 23:31:05 CEST 2017


The reload handling code has 3 outcomes that are better represented in
a switch statement. Remove unreachable if statement too.

Signed-off-by: Liam Girdwood <liam.r.girdwood at linux.intel.com>
---
 src/drivers/dw-dma.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/drivers/dw-dma.c b/src/drivers/dw-dma.c
index 2289787..e9d584f 100644
--- a/src/drivers/dw-dma.c
+++ b/src/drivers/dw-dma.c
@@ -746,17 +746,17 @@ static void dw_dma_irq_handler(void *data)
 			 * if we are waiting for pause, pause it;
 			 * otherwise, reload lli
 			 */
-			if (next.size == DMA_RELOAD_END) {
+			switch (next.size) {
+			case DMA_RELOAD_END:
 				p->chan[i].status = COMP_STATE_PREPARE;
-				continue;
-			}
-			else if (next.size != DMA_RELOAD_LLI)
-				dw_dma_chan_reload_next(dma, i, &next);
-			/* reload lli, but let's check if we are pausing first */
-			else if (p->chan[i].status == COMP_STATE_PAUSED) {
-				continue;
-			} else
+				break;
+			case DMA_RELOAD_LLI:
 				dw_dma_chan_reload_lli(dma, i);
+				break;
+			default:
+				dw_dma_chan_reload_next(dma, i, &next);
+				break;
+			}
 		}
 #if DW_USE_HW_LLI
 		/* end of a LLI block */
-- 
2.11.0



More information about the Sound-open-firmware mailing list