154-dmaengine-Add-device_terminate_all-callback.patch 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. Split out the terminate_all command from device_control to a dma_device
  6. callback. In order to preserve backward capability, still rely on
  7. device_control if no such callback has been implemented.
  8. Eventually, this will allow to create a generic dma_slave_caps callback.
  9. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
  10. Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
  11. Signed-off-by: Vinod Koul <vinod.koul@intel.com>
  12. ---
  13. include/linux/dmaengine.h | 6 ++++++
  14. 1 file changed, 6 insertions(+)
  15. --- a/include/linux/dmaengine.h
  16. +++ b/include/linux/dmaengine.h
  17. @@ -611,6 +611,8 @@ struct dma_tx_state {
  18. * code
  19. * @device_control: manipulate all pending operations on a channel, returns
  20. * zero or error code
  21. + * @device_terminate_all: Aborts all transfers on a channel. Returns 0
  22. + * or an error code
  23. * @device_tx_status: poll for transaction completion, the optional
  24. * txstate parameter can be supplied with a pointer to get a
  25. * struct with auxiliary transfer status information, otherwise the call
  26. @@ -680,6 +682,7 @@ struct dma_device {
  27. struct dma_slave_config *config);
  28. int (*device_control)(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
  29. unsigned long arg);
  30. + int (*device_terminate_all)(struct dma_chan *chan);
  31. enum dma_status (*device_tx_status)(struct dma_chan *chan,
  32. dma_cookie_t cookie,
  33. @@ -789,6 +792,9 @@ static inline int dma_get_slave_caps(str
  34. static inline int dmaengine_terminate_all(struct dma_chan *chan)
  35. {
  36. + if (chan->device->device_terminate_all)
  37. + return chan->device->device_terminate_all(chan);
  38. +
  39. return dmaengine_device_control(chan, DMA_TERMINATE_ALL, 0);
  40. }