mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
uio: nopage
Convert uio from nopage to fault. Signed-off-by: Nick Piggin <npiggin@suse.de> Acked-by: Hans J Koch <hjk@linutronix.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
a1e096129b
commit
a18b630d1b
1 changed files with 6 additions and 8 deletions
|
@ -417,30 +417,28 @@ static void uio_vma_close(struct vm_area_struct *vma)
|
||||||
idev->vma_count--;
|
idev->vma_count--;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct page *uio_vma_nopage(struct vm_area_struct *vma,
|
static int uio_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
|
||||||
unsigned long address, int *type)
|
|
||||||
{
|
{
|
||||||
struct uio_device *idev = vma->vm_private_data;
|
struct uio_device *idev = vma->vm_private_data;
|
||||||
struct page* page = NOPAGE_SIGBUS;
|
struct page *page;
|
||||||
|
|
||||||
int mi = uio_find_mem_index(vma);
|
int mi = uio_find_mem_index(vma);
|
||||||
if (mi < 0)
|
if (mi < 0)
|
||||||
return page;
|
return VM_FAULT_SIGBUS;
|
||||||
|
|
||||||
if (idev->info->mem[mi].memtype == UIO_MEM_LOGICAL)
|
if (idev->info->mem[mi].memtype == UIO_MEM_LOGICAL)
|
||||||
page = virt_to_page(idev->info->mem[mi].addr);
|
page = virt_to_page(idev->info->mem[mi].addr);
|
||||||
else
|
else
|
||||||
page = vmalloc_to_page((void*)idev->info->mem[mi].addr);
|
page = vmalloc_to_page((void*)idev->info->mem[mi].addr);
|
||||||
get_page(page);
|
get_page(page);
|
||||||
if (type)
|
vmf->page = page;
|
||||||
*type = VM_FAULT_MINOR;
|
return 0;
|
||||||
return page;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct vm_operations_struct uio_vm_ops = {
|
static struct vm_operations_struct uio_vm_ops = {
|
||||||
.open = uio_vma_open,
|
.open = uio_vma_open,
|
||||||
.close = uio_vma_close,
|
.close = uio_vma_close,
|
||||||
.nopage = uio_vma_nopage,
|
.fault = uio_vma_fault,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int uio_mmap_physical(struct vm_area_struct *vma)
|
static int uio_mmap_physical(struct vm_area_struct *vma)
|
||||||
|
|
Loading…
Reference in a new issue