blob: 7692c864404539ea61bcc26fcf2a4bf59516bfeb [file] [log] [blame]
Russell King - ARM Linuxd2ebfb32012-03-06 22:34:26 +00001/*
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 Linux884485e2012-03-06 22:34:46 +000010/**
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 */
17static 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 Linuxd2ebfb32012-03-06 22:34:26 +000030#endif