aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound/memalloc.h
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-10-11 15:39:35 -0400
committerDavid S. Miller <davem@davemloft.net>2008-10-11 15:39:35 -0400
commit56c5d900dbb8e042bfad035d18433476931d8f93 (patch)
tree00b793965beeef10db03e0ff021d2d965c410759 /include/sound/memalloc.h
parent4dd95b63ae25c5cad6986829b5e8788e9faa0330 (diff)
parentead9d23d803ea3a73766c3cb27bf7563ac8d7266 (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts: sound/core/memalloc.c
Diffstat (limited to 'include/sound/memalloc.h')
-rw-r--r--include/sound/memalloc.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/include/sound/memalloc.h b/include/sound/memalloc.h
index 6a3e7558a7e6..7ccce94a5255 100644
--- a/include/sound/memalloc.h
+++ b/include/sound/memalloc.h
@@ -63,6 +63,11 @@ struct snd_dma_buffer {
63/* 63/*
64 * Scatter-Gather generic device pages 64 * Scatter-Gather generic device pages
65 */ 65 */
66void *snd_malloc_sgbuf_pages(struct device *device,
67 size_t size, struct snd_dma_buffer *dmab,
68 size_t *res_size);
69int snd_free_sgbuf_pages(struct snd_dma_buffer *dmab);
70
66struct snd_sg_page { 71struct snd_sg_page {
67 void *buf; 72 void *buf;
68 dma_addr_t addr; 73 dma_addr_t addr;
@@ -90,9 +95,18 @@ static inline unsigned int snd_sgbuf_aligned_pages(size_t size)
90 */ 95 */
91static inline dma_addr_t snd_sgbuf_get_addr(struct snd_sg_buf *sgbuf, size_t offset) 96static inline dma_addr_t snd_sgbuf_get_addr(struct snd_sg_buf *sgbuf, size_t offset)
92{ 97{
93 return sgbuf->table[offset >> PAGE_SHIFT].addr + offset % PAGE_SIZE; 98 dma_addr_t addr = sgbuf->table[offset >> PAGE_SHIFT].addr;
99 addr &= PAGE_MASK;
100 return addr + offset % PAGE_SIZE;
94} 101}
95 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}
96 110
97/* allocate/release a buffer */ 111/* allocate/release a buffer */
98int 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,