diff options
Diffstat (limited to 'include/sound/memalloc.h')
| -rw-r--r-- | include/sound/memalloc.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/include/sound/memalloc.h b/include/sound/memalloc.h index ae2921d9ddcc..d787a6b4a101 100644 --- a/include/sound/memalloc.h +++ b/include/sound/memalloc.h | |||
| @@ -65,6 +65,11 @@ struct snd_dma_buffer { | |||
| 65 | /* | 65 | /* |
| 66 | * Scatter-Gather generic device pages | 66 | * Scatter-Gather generic device pages |
| 67 | */ | 67 | */ |
| 68 | void *snd_malloc_sgbuf_pages(struct device *device, | ||
| 69 | size_t size, struct snd_dma_buffer *dmab, | ||
| 70 | size_t *res_size); | ||
| 71 | int snd_free_sgbuf_pages(struct snd_dma_buffer *dmab); | ||
| 72 | |||
| 68 | struct snd_sg_page { | 73 | struct snd_sg_page { |
| 69 | void *buf; | 74 | void *buf; |
| 70 | dma_addr_t addr; | 75 | dma_addr_t addr; |
| @@ -92,9 +97,18 @@ static inline unsigned int snd_sgbuf_aligned_pages(size_t size) | |||
| 92 | */ | 97 | */ |
| 93 | static inline dma_addr_t snd_sgbuf_get_addr(struct snd_sg_buf *sgbuf, size_t offset) | 98 | static inline dma_addr_t snd_sgbuf_get_addr(struct snd_sg_buf *sgbuf, size_t offset) |
| 94 | { | 99 | { |
| 95 | return sgbuf->table[offset >> PAGE_SHIFT].addr + offset % PAGE_SIZE; | 100 | dma_addr_t addr = sgbuf->table[offset >> PAGE_SHIFT].addr; |
| 101 | addr &= PAGE_MASK; | ||
| 102 | return addr + offset % PAGE_SIZE; | ||
| 96 | } | 103 | } |
| 97 | 104 | ||
| 105 | /* | ||
| 106 | * return the virtual address at the corresponding offset | ||
| 107 | */ | ||
| 108 | static inline void *snd_sgbuf_get_ptr(struct snd_sg_buf *sgbuf, size_t offset) | ||
| 109 | { | ||
| 110 | return sgbuf->table[offset >> PAGE_SHIFT].buf + offset % PAGE_SIZE; | ||
| 111 | } | ||
| 98 | 112 | ||
| 99 | /* allocate/release a buffer */ | 113 | /* allocate/release a buffer */ |
| 100 | int snd_dma_alloc_pages(int type, struct device *dev, size_t size, | 114 | int snd_dma_alloc_pages(int type, struct device *dev, size_t size, |
