Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1251537

[PATCH 2/4] dmaengine: virt-dma: Add synchronization helper function

From Lars-Peter Clausen <lars@metafoo.de>
Newsgroups linux.kernel
Subject [PATCH 2/4] dmaengine: virt-dma: Add synchronization helper function
Date 2015-10-20 11:50 +0200
Message-ID <qlBIn-8jI-19@gated-at.bofh.it> (permalink)
References <qlBIm-8jI-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Add a synchronize helper function for the virt-dma library. The function
makes sure that any scheduled descriptor complete callbacks have finished
running before the function returns.

This needs to be called by drivers using virt-dma in their
device_synchronize() callback. Depending on the driver additional
operations might be necessary in addition to calling vchan_synchronize() to
ensure proper synchronization.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 drivers/dma/virt-dma.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/dma/virt-dma.h b/drivers/dma/virt-dma.h
index 181b9526..e93de76 100644
--- a/drivers/dma/virt-dma.h
+++ b/drivers/dma/virt-dma.h
@@ -151,4 +151,17 @@ static inline void vchan_free_chan_resources(struct virt_dma_chan *vc)
 	vchan_dma_desc_free_list(vc, &head);
 }
 
+/**
+ * vchan_synchronize() - synchronize callback execution to the current context
+ * @vc: virtual channel to synchronize
+ *
+ * Makes sure that all scheduled or active callbacks have finished running. For
+ * proper operation the caller has to ensure that no new callbacks are scheduled
+ * after the invocation of this function started.
+ */
+static inline void vchan_synchronize(struct virt_dma_chan *vc)
+{
+	tasklet_kill(&vc->task);
+}
+
 #endif
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/4] dmaengine: Add transfer termination synchronization support Lars-Peter Clausen <lars@metafoo.de> - 2015-10-20 11:50 +0200
  [PATCH 4/4] ALSA: pcm_dmaengine: Properly synchronize DMA on shutdown Lars-Peter Clausen <lars@metafoo.de> - 2015-10-20 11:50 +0200
    Re: [PATCH 4/4] ALSA: pcm_dmaengine: Properly synchronize DMA on shutdown Takashi Iwai <tiwai@suse.de> - 2015-10-20 13:20 +0200
      Re: [PATCH 4/4] ALSA: pcm_dmaengine: Properly synchronize DMA on  shutdown Lars-Peter Clausen <lars@metafoo.de> - 2015-10-20 13:50 +0200
        Re: [PATCH 4/4] ALSA: pcm_dmaengine: Properly synchronize DMA on shutdown Takashi Iwai <tiwai@suse.de> - 2015-10-20 14:40 +0200
        Re: [PATCH 4/4] ALSA: pcm_dmaengine: Properly synchronize DMA on  shutdown Lars-Peter Clausen <lars@metafoo.de> - 2015-10-20 15:10 +0200
  [PATCH 2/4] dmaengine: virt-dma: Add synchronization helper function Lars-Peter Clausen <lars@metafoo.de> - 2015-10-20 11:50 +0200
  [PATCH 1/4] dmaengine: Add transfer termination synchronization support Lars-Peter Clausen <lars@metafoo.de> - 2015-10-20 11:50 +0200
    Re: [PATCH 1/4] dmaengine: Add transfer termination synchronization support Andy Shevchenko <andy.shevchenko@gmail.com> - 2015-10-29 23:10 +0100
      Re: [PATCH 1/4] dmaengine: Add transfer termination synchronization  support Lars-Peter Clausen <lars@metafoo.de> - 2015-10-30 15:20 +0100
  [PATCH 3/4] dmaengine: axi_dmac: Add synchronization support Lars-Peter Clausen <lars@metafoo.de> - 2015-10-20 11:50 +0200
  Re: [PATCH 0/4] dmaengine: Add transfer termination synchronization  support Vinod Koul <vinod.koul@intel.com> - 2015-10-29 02:30 +0100

csiph-web