Russell King - ARM Linux | d2ebfb3 | 2012-03-06 22:34:26 +0000 | [diff] [blame] | 1 | /* |
| 2 | * The contents of this file are private to DMA engine drivers, and is not |
| 3 | * part of the API to be used by DMA engine users. |
| 4 | */ |
| 5 | #ifndef DMAENGINE_H |
| 6 | #define DMAENGINE_H |
| 7 | |
| 8 | #include <linux/dmaengine.h> |
| 9 | |
Russell King - ARM Linux | 884485e | 2012-03-06 22:34:46 +0000 | [diff] [blame^] | 10 | /** |
| 11 | * dma_cookie_assign - assign a DMA engine cookie to the descriptor |
| 12 | * @tx: descriptor needing cookie |
| 13 | * |
| 14 | * Assign a unique non-zero per-channel cookie to the descriptor. |
| 15 | * Note: caller is expected to hold a lock to prevent concurrency. |
| 16 | */ |
| 17 | static inline dma_cookie_t dma_cookie_assign(struct dma_async_tx_descriptor *tx) |
| 18 | { |
| 19 | struct dma_chan *chan = tx->chan; |
| 20 | dma_cookie_t cookie; |
| 21 | |
| 22 | cookie = chan->cookie + 1; |
| 23 | if (cookie < DMA_MIN_COOKIE) |
| 24 | cookie = DMA_MIN_COOKIE; |
| 25 | tx->cookie = chan->cookie = cookie; |
| 26 | |
| 27 | return cookie; |
| 28 | } |
| 29 | |
Russell King - ARM Linux | d2ebfb3 | 2012-03-06 22:34:26 +0000 | [diff] [blame] | 30 | #endif |