fw-utils/tplink-safeloader.c: Add support for Archer C2600
[openwrt/staging/lynxis/omap.git] / target / linux / ipq806x / patches-3.18 / 154-dmaengine-Add-device_terminate_all-callback.patch
1 From 7fa0cf462daa6f6121b332b87833d7f5bdb515c0 Mon Sep 17 00:00:00 2001
2 From: Maxime Ripard <maxime.ripard@free-electrons.com>
3 Date: Mon, 17 Nov 2014 14:42:02 +0100
4 Subject: [PATCH] dmaengine: Add device_terminate_all callback
5
6 Split out the terminate_all command from device_control to a dma_device
7 callback. In order to preserve backward capability, still rely on
8 device_control if no such callback has been implemented.
9
10 Eventually, this will allow to create a generic dma_slave_caps callback.
11
12 Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
13 Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
14 Signed-off-by: Vinod Koul <vinod.koul@intel.com>
15 ---
16 include/linux/dmaengine.h | 6 ++++++
17 1 file changed, 6 insertions(+)
18
19 --- a/include/linux/dmaengine.h
20 +++ b/include/linux/dmaengine.h
21 @@ -611,6 +611,8 @@ struct dma_tx_state {
22 * code
23 * @device_control: manipulate all pending operations on a channel, returns
24 * zero or error code
25 + * @device_terminate_all: Aborts all transfers on a channel. Returns 0
26 + * or an error code
27 * @device_tx_status: poll for transaction completion, the optional
28 * txstate parameter can be supplied with a pointer to get a
29 * struct with auxiliary transfer status information, otherwise the call
30 @@ -680,6 +682,7 @@ struct dma_device {
31 struct dma_slave_config *config);
32 int (*device_control)(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
33 unsigned long arg);
34 + int (*device_terminate_all)(struct dma_chan *chan);
35
36 enum dma_status (*device_tx_status)(struct dma_chan *chan,
37 dma_cookie_t cookie,
38 @@ -789,6 +792,9 @@ static inline int dma_get_slave_caps(str
39
40 static inline int dmaengine_terminate_all(struct dma_chan *chan)
41 {
42 + if (chan->device->device_terminate_all)
43 + return chan->device->device_terminate_all(chan);
44 +
45 return dmaengine_device_control(chan, DMA_TERMINATE_ALL, 0);
46 }
47