From dac18ff0c3f815cc874168dd9cb0cc67b0909f21 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Mon, 3 Jan 2011 20:21:53 +0100 Subject: scullv: Change to new page fault API --- scullv/mmap.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'scullv/mmap.c') diff --git a/scullv/mmap.c b/scullv/mmap.c index a6cad95..4b6f48c 100644 --- a/scullv/mmap.c +++ b/scullv/mmap.c @@ -57,16 +57,16 @@ void scullv_vma_close(struct vm_area_struct *vma) * is individually decreased, and would drop to 0. */ -struct page *scullv_vma_nopage(struct vm_area_struct *vma, - unsigned long address, int *type) +static int scullv_vma_nopage(struct vm_area_struct *vma, struct vm_fault *vmf) { unsigned long offset; struct scullv_dev *ptr, *dev = vma->vm_private_data; - struct page *page = VM_FAULT_SIGBUS; + struct page *page = NULL; void *pageptr = NULL; /* default to "missing" */ + int retval = VM_FAULT_NOPAGE; down(&dev->sem); - offset = (address - vma->vm_start) + (vma->vm_pgoff << PAGE_SHIFT); + offset = (unsigned long)(vmf->virtual_address - vma->vm_start) + (vma->vm_pgoff << PAGE_SHIFT); if (offset >= dev->size) goto out; /* out of range */ /* @@ -91,11 +91,12 @@ struct page *scullv_vma_nopage(struct vm_area_struct *vma, /* got it, now increment the count */ get_page(page); - if (type) - *type = VM_FAULT_MINOR; + vmf->page = page; + retval = 0; + out: up(&dev->sem); - return page; + return retval; } -- cgit v1.2.1-18-gbd029