dmaengine: add helper function for slave_single
For clients which require a single slave transfer and dont want to be bothered about the scatterlist api, this helper gives simple API for this transfer and creates single scatterlist for DMA API Idea from Russell King Signed-off-by: Vinod Koul <vinod.koul@intel.com>
This commit is contained in:
		
					parent
					
						
							
								322a8b0340
							
						
					
				
			
			
				commit
				
					
						90b44f8ffd
					
				
			
		
					 1 changed files with 11 additions and 0 deletions
				
			
		|  | @ -24,6 +24,7 @@ | ||||||
| #include <linux/device.h> | #include <linux/device.h> | ||||||
| #include <linux/uio.h> | #include <linux/uio.h> | ||||||
| #include <linux/dma-direction.h> | #include <linux/dma-direction.h> | ||||||
|  | #include <linux/scatterlist.h> | ||||||
| 
 | 
 | ||||||
| struct scatterlist; | struct scatterlist; | ||||||
| 
 | 
 | ||||||
|  | @ -519,6 +520,16 @@ static inline int dmaengine_slave_config(struct dma_chan *chan, | ||||||
| 			(unsigned long)config); | 			(unsigned long)config); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | static inline struct dma_async_tx_descriptor *dmaengine_prep_slave_single( | ||||||
|  | 	struct dma_chan *chan, void *buf, size_t len, | ||||||
|  | 	enum dma_data_direction dir, unsigned long flags) | ||||||
|  | { | ||||||
|  | 	struct scatterlist sg; | ||||||
|  | 	sg_init_one(&sg, buf, len); | ||||||
|  | 
 | ||||||
|  | 	return chan->device->device_prep_slave_sg(chan, &sg, 1, dir, flags); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| static inline int dmaengine_terminate_all(struct dma_chan *chan) | static inline int dmaengine_terminate_all(struct dma_chan *chan) | ||||||
| { | { | ||||||
| 	return dmaengine_device_control(chan, DMA_TERMINATE_ALL, 0); | 	return dmaengine_device_control(chan, DMA_TERMINATE_ALL, 0); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Vinod Koul
				Vinod Koul