Merge git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6
[pandora-kernel.git] / drivers / media / video / videobuf-dma-sg.c
index 9ab94a7..98efd7a 100644 (file)
@@ -67,8 +67,7 @@ videobuf_vmalloc_to_sg(unsigned char *virt, int nr_pages)
                if (NULL == pg)
                        goto err;
                BUG_ON(PageHighMem(pg));
-               sg_set_page(&sglist[i], pg);
-               sglist[i].length = PAGE_SIZE;
+               sg_set_page(&sglist[i], pg, PAGE_SIZE, 0);
        }
        return sglist;
 
@@ -95,16 +94,13 @@ videobuf_pages_to_sg(struct page **pages, int nr_pages, int offset)
        if (PageHighMem(pages[0]))
                /* DMA to highmem pages might not work */
                goto highmem;
-       sg_set_page(&sglist[0], pages[0]);
-       sglist[0].offset = offset;
-       sglist[0].length = PAGE_SIZE - offset;
+       sg_set_page(&sglist[0], pages[0], PAGE_SIZE - offset, offset);
        for (i = 1; i < nr_pages; i++) {
                if (NULL == pages[i])
                        goto nopage;
                if (PageHighMem(pages[i]))
                        goto highmem;
-               sg_set_page(&sglist[i], pages[i]);
-               sglist[i].length = PAGE_SIZE;
+               sg_set_page(&sglist[i], pages[i], PAGE_SIZE, 0);
        }
        return sglist;
 
@@ -389,30 +385,27 @@ videobuf_vm_close(struct vm_area_struct *vma)
  * now ...).  Bounce buffers don't work very well for the data rates
  * video capture has.
  */
-static struct page*
-videobuf_vm_nopage(struct vm_area_struct *vma, unsigned long vaddr,
-                  int *type)
+static int
+videobuf_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 {
        struct page *page;
 
-       dprintk(3,"nopage: fault @ %08lx [vma %08lx-%08lx]\n",
-               vaddr,vma->vm_start,vma->vm_end);
-       if (vaddr > vma->vm_end)
-               return NOPAGE_SIGBUS;
+       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 NOPAGE_OOM;
-       clear_user_page(page_address(page), vaddr, page);
-       if (type)
-               *type = VM_FAULT_MINOR;
-       return page;
+               return VM_FAULT_OOM;
+       clear_user_page(page_address(page), (unsigned long)vmf->virtual_address,
+                       page);
+       vmf->page = page;
+       return 0;
 }
 
 static struct vm_operations_struct videobuf_vm_ops =
 {
        .open     = videobuf_vm_open,
        .close    = videobuf_vm_close,
-       .nopage   = videobuf_vm_nopage,
+       .fault    = videobuf_vm_fault,
 };
 
 /* ---------------------------------------------------------------------