Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 170085
b: refs/heads/master
c: 9eb4a06
h: refs/heads/master
i:
  170083: acc370d
v: v3
  • Loading branch information
Takashi Iwai committed Nov 26, 2009
1 parent 88267e0 commit 451ad69
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 657b1989dacf58e83e7a76bca6d4a91a9f294cf6
refs/heads/master: 9eb4a06788a598573c751af1a7e46639afc89513
20 changes: 12 additions & 8 deletions trunk/sound/core/pcm_native.c
Original file line number Diff line number Diff line change
Expand Up @@ -3062,6 +3062,13 @@ static int snd_pcm_mmap_control(struct snd_pcm_substream *substream, struct file
}
#endif /* coherent mmap */

static inline struct page *
snd_pcm_default_page_ops(struct snd_pcm_substream *substream, unsigned long ofs)
{
void *vaddr = substream->runtime->dma_area + ofs;
return virt_to_page(vaddr);
}

/*
* fault callback for mmapping a RAM page
*/
Expand All @@ -3072,7 +3079,6 @@ static int snd_pcm_mmap_data_fault(struct vm_area_struct *area,
struct snd_pcm_runtime *runtime;
unsigned long offset;
struct page * page;
void *vaddr;
size_t dma_bytes;

if (substream == NULL)
Expand All @@ -3082,14 +3088,12 @@ static int snd_pcm_mmap_data_fault(struct vm_area_struct *area,
dma_bytes = PAGE_ALIGN(runtime->dma_bytes);
if (offset > dma_bytes - PAGE_SIZE)
return VM_FAULT_SIGBUS;
if (substream->ops->page) {
if (substream->ops->page)
page = substream->ops->page(substream, offset);
if (!page)
return VM_FAULT_SIGBUS;
} else {
vaddr = runtime->dma_area + offset;
page = virt_to_page(vaddr);
}
else
page = snd_pcm_default_page_ops(substream, offset);
if (!page)
return VM_FAULT_SIGBUS;
get_page(page);
vmf->page = page;
return 0;
Expand Down

0 comments on commit 451ad69

Please sign in to comment.