diff options
Diffstat (limited to 'sound/usb')
-rw-r--r-- | sound/usb/usx2y/usX2Yhwdep.c | 23 | ||||
-rw-r--r-- | sound/usb/usx2y/usx2yhwdeppcm.c | 20 |
2 files changed, 17 insertions, 26 deletions
diff --git a/sound/usb/usx2y/usX2Yhwdep.c b/sound/usb/usx2y/usX2Yhwdep.c index b76b3dd9df25..a1dca3441319 100644 --- a/sound/usb/usx2y/usX2Yhwdep.c +++ b/sound/usb/usx2y/usX2Yhwdep.c | |||
@@ -34,34 +34,31 @@ | |||
34 | int usX2Y_hwdep_pcm_new(struct snd_card *card); | 34 | int usX2Y_hwdep_pcm_new(struct snd_card *card); |
35 | 35 | ||
36 | 36 | ||
37 | static struct page * snd_us428ctls_vm_nopage(struct vm_area_struct *area, unsigned long address, int *type) | 37 | static int snd_us428ctls_vm_fault(struct vm_area_struct *area, |
38 | struct vm_fault *vmf) | ||
38 | { | 39 | { |
39 | unsigned long offset; | 40 | unsigned long offset; |
40 | struct page * page; | 41 | struct page * page; |
41 | void *vaddr; | 42 | void *vaddr; |
42 | 43 | ||
43 | snd_printdd("ENTER, start %lXh, ofs %lXh, pgoff %ld, addr %lXh\n", | 44 | snd_printdd("ENTER, start %lXh, pgoff %ld\n", |
44 | area->vm_start, | 45 | area->vm_start, |
45 | address - area->vm_start, | 46 | vmf->pgoff); |
46 | (address - area->vm_start) >> PAGE_SHIFT, | ||
47 | address); | ||
48 | 47 | ||
49 | offset = area->vm_pgoff << PAGE_SHIFT; | 48 | offset = vmf->pgoff << PAGE_SHIFT; |
50 | offset += address - area->vm_start; | ||
51 | snd_assert((offset % PAGE_SIZE) == 0, return NOPAGE_SIGBUS); | ||
52 | vaddr = (char*)((struct usX2Ydev *)area->vm_private_data)->us428ctls_sharedmem + offset; | 49 | vaddr = (char*)((struct usX2Ydev *)area->vm_private_data)->us428ctls_sharedmem + offset; |
53 | page = virt_to_page(vaddr); | 50 | page = virt_to_page(vaddr); |
54 | get_page(page); | 51 | get_page(page); |
55 | snd_printdd( "vaddr=%p made us428ctls_vm_nopage() return %p; offset=%lX\n", vaddr, page, offset); | 52 | vmf->page = page; |
56 | 53 | ||
57 | if (type) | 54 | snd_printdd("vaddr=%p made us428ctls_vm_fault() page %p\n", |
58 | *type = VM_FAULT_MINOR; | 55 | vaddr, page); |
59 | 56 | ||
60 | return page; | 57 | return 0; |
61 | } | 58 | } |
62 | 59 | ||
63 | static struct vm_operations_struct us428ctls_vm_ops = { | 60 | static struct vm_operations_struct us428ctls_vm_ops = { |
64 | .nopage = snd_us428ctls_vm_nopage, | 61 | .fault = snd_us428ctls_vm_fault, |
65 | }; | 62 | }; |
66 | 63 | ||
67 | static int snd_us428ctls_mmap(struct snd_hwdep * hw, struct file *filp, struct vm_area_struct *area) | 64 | static int snd_us428ctls_mmap(struct snd_hwdep * hw, struct file *filp, struct vm_area_struct *area) |
diff --git a/sound/usb/usx2y/usx2yhwdeppcm.c b/sound/usb/usx2y/usx2yhwdeppcm.c index a5e7bcd7ca2e..800b5cecfc80 100644 --- a/sound/usb/usx2y/usx2yhwdeppcm.c +++ b/sound/usb/usx2y/usx2yhwdeppcm.c | |||
@@ -683,30 +683,24 @@ static void snd_usX2Y_hwdep_pcm_vm_close(struct vm_area_struct *area) | |||
683 | } | 683 | } |
684 | 684 | ||
685 | 685 | ||
686 | static struct page * snd_usX2Y_hwdep_pcm_vm_nopage(struct vm_area_struct *area, unsigned long address, int *type) | 686 | static int snd_usX2Y_hwdep_pcm_vm_fault(struct vm_area_struct *area, |
687 | struct vm_fault *vmf) | ||
687 | { | 688 | { |
688 | unsigned long offset; | 689 | unsigned long offset; |
689 | struct page *page; | ||
690 | void *vaddr; | 690 | void *vaddr; |
691 | 691 | ||
692 | offset = area->vm_pgoff << PAGE_SHIFT; | 692 | offset = vmf->pgoff << PAGE_SHIFT; |
693 | offset += address - area->vm_start; | ||
694 | snd_assert((offset % PAGE_SIZE) == 0, return NOPAGE_OOM); | ||
695 | vaddr = (char*)((struct usX2Ydev *)area->vm_private_data)->hwdep_pcm_shm + offset; | 693 | vaddr = (char*)((struct usX2Ydev *)area->vm_private_data)->hwdep_pcm_shm + offset; |
696 | page = virt_to_page(vaddr); | 694 | vmf->page = virt_to_page(vaddr); |
697 | get_page(page); | 695 | get_page(vmf->page); |
698 | 696 | return 0; | |
699 | if (type) | ||
700 | *type = VM_FAULT_MINOR; | ||
701 | |||
702 | return page; | ||
703 | } | 697 | } |
704 | 698 | ||
705 | 699 | ||
706 | static struct vm_operations_struct snd_usX2Y_hwdep_pcm_vm_ops = { | 700 | static struct vm_operations_struct snd_usX2Y_hwdep_pcm_vm_ops = { |
707 | .open = snd_usX2Y_hwdep_pcm_vm_open, | 701 | .open = snd_usX2Y_hwdep_pcm_vm_open, |
708 | .close = snd_usX2Y_hwdep_pcm_vm_close, | 702 | .close = snd_usX2Y_hwdep_pcm_vm_close, |
709 | .nopage = snd_usX2Y_hwdep_pcm_vm_nopage, | 703 | .fault = snd_usX2Y_hwdep_pcm_vm_fault, |
710 | }; | 704 | }; |
711 | 705 | ||
712 | 706 | ||