Commit 041509db authored by Nick Piggin's avatar Nick Piggin Committed by Greg Kroah-Hartman

USB: mon nopage

Convert USB mon driver from nopage to fault.
Signed-off-by: default avatarNick Piggin <>
Acked-by: default avatarPete Zaitcev <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarGreg Kroah-Hartman <>
parent d0fab0dd
......@@ -1047,33 +1047,31 @@ static void mon_bin_vma_close(struct vm_area_struct *vma)
* Map ring pages to user space.
struct page *mon_bin_vma_nopage(struct vm_area_struct *vma,
unsigned long address, int *type)
static int mon_bin_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
struct mon_reader_bin *rp = vma->vm_private_data;
unsigned long offset, chunk_idx;
struct page *pageptr;
offset = (address - vma->vm_start) + (vma->vm_pgoff << PAGE_SHIFT);
offset = vmf->pgoff << PAGE_SHIFT;
if (offset >= rp->b_size)
chunk_idx = offset / CHUNK_SIZE;
pageptr = rp->b_vec[chunk_idx].pg;
if (type)
return pageptr;
vmf->page = pageptr;
return 0;
struct vm_operations_struct mon_bin_vm_ops = {
.open = mon_bin_vma_open,
.close = mon_bin_vma_close,
.nopage = mon_bin_vma_nopage,
.fault = mon_bin_vma_fault,
int mon_bin_mmap(struct file *filp, struct vm_area_struct *vma)
/* don't do anything here: "nopage" will set up page table entries */
/* don't do anything here: "fault" will set up page table entries */
vma->vm_ops = &mon_bin_vm_ops;
vma->vm_flags |= VM_RESERVED;
vma->vm_private_data = filp->private_data;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment