aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound/memalloc.h
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2008-08-21 07:00:13 -0400
committerJaroslav Kysela <perex@perex.cz>2008-08-25 03:57:18 -0400
commit77a23f2695bb2de0cd74599400dc55109c531b72 (patch)
tree4960195e04016928dea83deb85e0f3bf97024a8a /include/sound/memalloc.h
parent46480b3a5f88f20dbf25d95fe74d7b4798d5bc86 (diff)
ALSA: Clean up SG-buffer helper functions and macros
Clean up SG-buffer helper functions and macros. Helpers take substream as arguments now. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'include/sound/memalloc.h')
-rw-r--r--include/sound/memalloc.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/sound/memalloc.h b/include/sound/memalloc.h
index ae2921d9ddcc..96d0dc171459 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 */
68void *snd_malloc_sgbuf_pages(struct device *device,
69 size_t size, struct snd_dma_buffer *dmab,
70 size_t *res_size);
71int snd_free_sgbuf_pages(struct snd_dma_buffer *dmab);
72
68struct snd_sg_page { 73struct snd_sg_page {
69 void *buf; 74 void *buf;
70 dma_addr_t addr; 75 dma_addr_t addr;
@@ -95,6 +100,13 @@ static inline dma_addr_t snd_sgbuf_get_addr(struct snd_sg_buf *sgbuf, size_t off
95 return sgbuf->table[offset >> PAGE_SHIFT].addr + offset % PAGE_SIZE; 100 return sgbuf->table[offset >> PAGE_SHIFT].addr + offset % PAGE_SIZE;
96} 101}
97 102
103/*
104 * return the virtual address at the corresponding offset
105 */
106static inline void *snd_sgbuf_get_ptr(struct snd_sg_buf *sgbuf, size_t offset)
107{
108 return sgbuf->table[offset >> PAGE_SHIFT].buf + offset % PAGE_SIZE;
109}
98 110
99/* allocate/release a buffer */ 111/* allocate/release a buffer */
100int snd_dma_alloc_pages(int type, struct device *dev, size_t size, 112int snd_dma_alloc_pages(int type, struct device *dev, size_t size,