diff options
Diffstat (limited to 'drivers/media/video/videobuf-dma-sg.c')
-rw-r--r-- | drivers/media/video/videobuf-dma-sg.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/media/video/videobuf-dma-sg.c b/drivers/media/video/videobuf-dma-sg.c index 3eb6123227b2..0a18286279d3 100644 --- a/drivers/media/video/videobuf-dma-sg.c +++ b/drivers/media/video/videobuf-dma-sg.c | |||
@@ -60,12 +60,13 @@ videobuf_vmalloc_to_sg(unsigned char *virt, int nr_pages) | |||
60 | sglist = kcalloc(nr_pages, sizeof(struct scatterlist), GFP_KERNEL); | 60 | sglist = kcalloc(nr_pages, sizeof(struct scatterlist), GFP_KERNEL); |
61 | if (NULL == sglist) | 61 | if (NULL == sglist) |
62 | return NULL; | 62 | return NULL; |
63 | sg_init_table(sglist, nr_pages); | ||
63 | for (i = 0; i < nr_pages; i++, virt += PAGE_SIZE) { | 64 | for (i = 0; i < nr_pages; i++, virt += PAGE_SIZE) { |
64 | pg = vmalloc_to_page(virt); | 65 | pg = vmalloc_to_page(virt); |
65 | if (NULL == pg) | 66 | if (NULL == pg) |
66 | goto err; | 67 | goto err; |
67 | BUG_ON(PageHighMem(pg)); | 68 | BUG_ON(PageHighMem(pg)); |
68 | sglist[i].page = pg; | 69 | sg_set_page(&sglist[i], pg); |
69 | sglist[i].length = PAGE_SIZE; | 70 | sglist[i].length = PAGE_SIZE; |
70 | } | 71 | } |
71 | return sglist; | 72 | return sglist; |
@@ -86,13 +87,14 @@ videobuf_pages_to_sg(struct page **pages, int nr_pages, int offset) | |||
86 | sglist = kcalloc(nr_pages, sizeof(*sglist), GFP_KERNEL); | 87 | sglist = kcalloc(nr_pages, sizeof(*sglist), GFP_KERNEL); |
87 | if (NULL == sglist) | 88 | if (NULL == sglist) |
88 | return NULL; | 89 | return NULL; |
90 | sg_init_table(sglist, nr_pages); | ||
89 | 91 | ||
90 | if (NULL == pages[0]) | 92 | if (NULL == pages[0]) |
91 | goto nopage; | 93 | goto nopage; |
92 | if (PageHighMem(pages[0])) | 94 | if (PageHighMem(pages[0])) |
93 | /* DMA to highmem pages might not work */ | 95 | /* DMA to highmem pages might not work */ |
94 | goto highmem; | 96 | goto highmem; |
95 | sglist[0].page = pages[0]; | 97 | sg_set_page(&sglist[0], pages[0]); |
96 | sglist[0].offset = offset; | 98 | sglist[0].offset = offset; |
97 | sglist[0].length = PAGE_SIZE - offset; | 99 | sglist[0].length = PAGE_SIZE - offset; |
98 | for (i = 1; i < nr_pages; i++) { | 100 | for (i = 1; i < nr_pages; i++) { |
@@ -100,7 +102,7 @@ videobuf_pages_to_sg(struct page **pages, int nr_pages, int offset) | |||
100 | goto nopage; | 102 | goto nopage; |
101 | if (PageHighMem(pages[i])) | 103 | if (PageHighMem(pages[i])) |
102 | goto highmem; | 104 | goto highmem; |
103 | sglist[i].page = pages[i]; | 105 | sg_set_page(&sglist[i], pages[i]); |
104 | sglist[i].length = PAGE_SIZE; | 106 | sglist[i].length = PAGE_SIZE; |
105 | } | 107 | } |
106 | return sglist; | 108 | return sglist; |