From cd476bced39098128e4e24a78d8f5fe2d953f14e Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 7 Dec 2007 18:57:38 -0200 Subject: Subject: v4l: nopage From: Nick Piggin Convert v4l from nopage to fault. Remove redundant vma range checks. Signed-off-by: Nick Piggin Signed-off-by: Andrew Morton Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/videobuf-dma-sg.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'linux/drivers/media') diff --git a/linux/drivers/media/video/videobuf-dma-sg.c b/linux/drivers/media/video/videobuf-dma-sg.c index a99415141..712f59ac2 100644 --- a/linux/drivers/media/video/videobuf-dma-sg.c +++ b/linux/drivers/media/video/videobuf-dma-sg.c @@ -395,6 +395,7 @@ videobuf_vm_close(struct vm_area_struct *vma) * now ...). Bounce buffers don't work very well for the data rates * video capture has. */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24) static struct page* #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,1) videobuf_vm_nopage(struct vm_area_struct *vma, unsigned long vaddr, @@ -424,12 +425,32 @@ videobuf_vm_nopage(struct vm_area_struct *vma, unsigned long vaddr, #endif return page; } +#else +static int +videobuf_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf) +{ + struct page *page; + + dprintk(3,"fault: fault @ %08lx [vma %08lx-%08lx]\n", + (unsigned long)vmf->virtual_address,vma->vm_start,vma->vm_end); + page = alloc_page(GFP_USER | __GFP_DMA32); + if (!page) + return VM_FAULT_OOM; + clear_user_page(page_address(page), vaddr, page); + vmf->page = page; + return 0; +} +#endif static struct vm_operations_struct videobuf_vm_ops = { .open = videobuf_vm_open, .close = videobuf_vm_close, +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24) .nopage = videobuf_vm_nopage, +#else + .fault = videobuf_vm_fault, +#endif }; /* --------------------------------------------------------------------- -- cgit v1.2.3