]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/dma/stm32-dma.c
Merge branch 'linus' into perf/urgent, to pick up fixes
[linux.git] / drivers / dma / stm32-dma.c
index 8c5807362a257422ea89c805f92dc411bf8ded8e..4903a408fc146eae9c5b3ac00a6e00e87046b4d6 100644 (file)
@@ -308,20 +308,12 @@ static bool stm32_dma_fifo_threshold_is_allowed(u32 burst, u32 threshold,
 
 static bool stm32_dma_is_burst_possible(u32 buf_len, u32 threshold)
 {
-       switch (threshold) {
-       case STM32_DMA_FIFO_THRESHOLD_FULL:
-               if (buf_len >= STM32_DMA_MAX_BURST)
-                       return true;
-               else
-                       return false;
-       case STM32_DMA_FIFO_THRESHOLD_HALFFULL:
-               if (buf_len >= STM32_DMA_MAX_BURST / 2)
-                       return true;
-               else
-                       return false;
-       default:
-               return false;
-       }
+       /*
+        * Buffer or period length has to be aligned on FIFO depth.
+        * Otherwise bytes may be stuck within FIFO at buffer or period
+        * length.
+        */
+       return ((buf_len % ((threshold + 1) * 4)) == 0);
 }
 
 static u32 stm32_dma_get_best_burst(u32 buf_len, u32 max_burst, u32 threshold,
@@ -594,7 +586,7 @@ static void stm32_dma_start_transfer(struct stm32_dma_chan *chan)
 
        chan->busy = true;
 
-       dev_dbg(chan2dev(chan), "vchan %p: started\n", &chan->vchan);
+       dev_dbg(chan2dev(chan), "vchan %pK: started\n", &chan->vchan);
 }
 
 static void stm32_dma_configure_next_sg(struct stm32_dma_chan *chan)
@@ -693,7 +685,7 @@ static void stm32_dma_issue_pending(struct dma_chan *c)
 
        spin_lock_irqsave(&chan->vchan.lock, flags);
        if (vchan_issue_pending(&chan->vchan) && !chan->desc && !chan->busy) {
-               dev_dbg(chan2dev(chan), "vchan %p: issued\n", &chan->vchan);
+               dev_dbg(chan2dev(chan), "vchan %pK: issued\n", &chan->vchan);
                stm32_dma_start_transfer(chan);
 
        }