diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2015-10-20 05:46:29 -0400 |
---|---|---|
committer | Vinod Koul <vinod.koul@intel.com> | 2015-11-15 21:58:52 -0500 |
commit | 2ed086296e60c3ca9a63a025701f4d104f4ced85 (patch) | |
tree | 207a0607ec8caac6657d070d5dc1033750849299 | |
parent | b36f09c3c441a6e59eab9315032e7d546571de3f (diff) |
dmaengine: virt-dma: Add synchronization helper function
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>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
-rw-r--r-- | drivers/dma/virt-dma.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/dma/virt-dma.h b/drivers/dma/virt-dma.h index 2fa47745a41f..edbb5751572b 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) | |||
151 | vchan_dma_desc_free_list(vc, &head); | 151 | vchan_dma_desc_free_list(vc, &head); |
152 | } | 152 | } |
153 | 153 | ||
154 | /** | ||
155 | * vchan_synchronize() - synchronize callback execution to the current context | ||
156 | * @vc: virtual channel to synchronize | ||
157 | * | ||
158 | * Makes sure that all scheduled or active callbacks have finished running. For | ||
159 | * proper operation the caller has to ensure that no new callbacks are scheduled | ||
160 | * after the invocation of this function started. | ||
161 | */ | ||
162 | static inline void vchan_synchronize(struct virt_dma_chan *vc) | ||
163 | { | ||
164 | tasklet_kill(&vc->task); | ||
165 | } | ||
166 | |||
154 | #endif | 167 | #endif |