diff options
author | Jens Axboe <jens.axboe@oracle.com> | 2007-10-22 15:19:53 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2007-10-22 15:19:53 -0400 |
commit | 45711f1af6eff1a6d010703b4862e0d2b9afd056 (patch) | |
tree | 3d0048f46e3df9d217d56127462ebe680348bd5a /drivers/media | |
parent | 78c2f0b8c285c5305b3e67b0595200541e15eb43 (diff) |
[SG] Update drivers to use sg helpers
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/common/saa7146_core.c | 3 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-udma.c | 4 | ||||
-rw-r--r-- | drivers/media/video/videobuf-dma-sg.c | 8 |
3 files changed, 9 insertions, 6 deletions
diff --git a/drivers/media/common/saa7146_core.c b/drivers/media/common/saa7146_core.c index 365a22118a09..2b1f8b4be00a 100644 --- a/drivers/media/common/saa7146_core.c +++ b/drivers/media/common/saa7146_core.c | |||
@@ -112,12 +112,13 @@ static struct scatterlist* vmalloc_to_sg(unsigned char *virt, int nr_pages) | |||
112 | sglist = kcalloc(nr_pages, sizeof(struct scatterlist), GFP_KERNEL); | 112 | sglist = kcalloc(nr_pages, sizeof(struct scatterlist), GFP_KERNEL); |
113 | if (NULL == sglist) | 113 | if (NULL == sglist) |
114 | return NULL; | 114 | return NULL; |
115 | sg_init_table(sglist, nr_pages); | ||
115 | for (i = 0; i < nr_pages; i++, virt += PAGE_SIZE) { | 116 | for (i = 0; i < nr_pages; i++, virt += PAGE_SIZE) { |
116 | pg = vmalloc_to_page(virt); | 117 | pg = vmalloc_to_page(virt); |
117 | if (NULL == pg) | 118 | if (NULL == pg) |
118 | goto err; | 119 | goto err; |
119 | BUG_ON(PageHighMem(pg)); | 120 | BUG_ON(PageHighMem(pg)); |
120 | sglist[i].page = pg; | 121 | sg_set_page(&sglist[i], pg); |
121 | sglist[i].length = PAGE_SIZE; | 122 | sglist[i].length = PAGE_SIZE; |
122 | } | 123 | } |
123 | return sglist; | 124 | return sglist; |
diff --git a/drivers/media/video/ivtv/ivtv-udma.c b/drivers/media/video/ivtv/ivtv-udma.c index c4626d1cdf41..912b424e5204 100644 --- a/drivers/media/video/ivtv/ivtv-udma.c +++ b/drivers/media/video/ivtv/ivtv-udma.c | |||
@@ -63,10 +63,10 @@ int ivtv_udma_fill_sg_list (struct ivtv_user_dma *dma, struct ivtv_dma_page_info | |||
63 | memcpy(page_address(dma->bouncemap[map_offset]) + offset, src, len); | 63 | memcpy(page_address(dma->bouncemap[map_offset]) + offset, src, len); |
64 | kunmap_atomic(src, KM_BOUNCE_READ); | 64 | kunmap_atomic(src, KM_BOUNCE_READ); |
65 | local_irq_restore(flags); | 65 | local_irq_restore(flags); |
66 | dma->SGlist[map_offset].page = dma->bouncemap[map_offset]; | 66 | sg_set_page(&dma->SGlist[map_offset], dma->bouncemap[map_offset]); |
67 | } | 67 | } |
68 | else { | 68 | else { |
69 | dma->SGlist[map_offset].page = dma->map[map_offset]; | 69 | sg_set_page(&dma->SGlist[map_offset], dma->map[map_offset]); |
70 | } | 70 | } |
71 | offset = 0; | 71 | offset = 0; |
72 | map_offset++; | 72 | map_offset++; |
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; |