]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
dmaengine: hsu: allow more than 3 descriptors
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Fri, 18 Mar 2016 12:26:34 +0000 (14:26 +0200)
committerVinod Koul <vinod.koul@intel.com>
Mon, 4 Apr 2016 16:42:00 +0000 (09:42 -0700)
Current code allows only up to 3 descriptors to be programmed to the hardware
since it is used wrong calculations. Change % to min_t() to allow as many
descriptors as user supplied. At once it could be programmed up to 4
descriptors due to hardware limitations.

The issue was found under stress test, so it might not bother ordinary users.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
drivers/dma/hsu/hsu.c

index eef145edb936816f3686d343742a709392a5dffa..6fce5ed2fc40ef74106856a54c55df691199a7d9 100644 (file)
@@ -77,8 +77,8 @@ static void hsu_dma_chan_start(struct hsu_dma_chan *hsuc)
        hsu_chan_writel(hsuc, HSU_CH_MTSR, mtsr);
 
        /* Set descriptors */
-       count = (desc->nents - desc->active) % HSU_DMA_CHAN_NR_DESC;
-       for (i = 0; i < count; i++) {
+       count = desc->nents - desc->active;
+       for (i = 0; i < count && i < HSU_DMA_CHAN_NR_DESC; i++) {
                hsu_chan_writel(hsuc, HSU_CH_DxSAR(i), desc->sg[i].addr);
                hsu_chan_writel(hsuc, HSU_CH_DxTSR(i), desc->sg[i].len);