diff options
author | Jens Axboe <jens.axboe@oracle.com> | 2007-10-24 05:20:47 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2007-10-24 05:20:47 -0400 |
commit | 642f149031d70415d9318b919d50b71e4724adbd (patch) | |
tree | e792ad29dedffc6756d55e9d63e18ada35515b4b /drivers/media | |
parent | bd6dee6f30a0f6943df190b387b5f8fe98a848f3 (diff) |
SG: Change sg_set_page() to take length and offset argument
Most drivers need to set length and offset as well, so may as well fold
those three lines into one.
Add sg_assign_page() for those two locations that only needed to set
the page, where the offset/length is set outside of the function context.
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 | 6 | ||||
-rw-r--r-- | drivers/media/video/videobuf-dma-sg.c | 10 |
3 files changed, 6 insertions, 13 deletions
diff --git a/drivers/media/common/saa7146_core.c b/drivers/media/common/saa7146_core.c index 2b1f8b4be00..cb034ead95a 100644 --- a/drivers/media/common/saa7146_core.c +++ b/drivers/media/common/saa7146_core.c | |||
@@ -118,8 +118,7 @@ static struct scatterlist* vmalloc_to_sg(unsigned char *virt, int nr_pages) | |||
118 | if (NULL == pg) | 118 | if (NULL == pg) |
119 | goto err; | 119 | goto err; |
120 | BUG_ON(PageHighMem(pg)); | 120 | BUG_ON(PageHighMem(pg)); |
121 | sg_set_page(&sglist[i], pg); | 121 | sg_set_page(&sglist[i], pg, PAGE_SIZE, 0); |
122 | sglist[i].length = PAGE_SIZE; | ||
123 | } | 122 | } |
124 | return sglist; | 123 | return sglist; |
125 | 124 | ||
diff --git a/drivers/media/video/ivtv/ivtv-udma.c b/drivers/media/video/ivtv/ivtv-udma.c index 912b424e520..460db03b0ba 100644 --- a/drivers/media/video/ivtv/ivtv-udma.c +++ b/drivers/media/video/ivtv/ivtv-udma.c | |||
@@ -49,8 +49,6 @@ int ivtv_udma_fill_sg_list (struct ivtv_user_dma *dma, struct ivtv_dma_page_info | |||
49 | unsigned int len = (i == dma_page->page_count - 1) ? | 49 | unsigned int len = (i == dma_page->page_count - 1) ? |
50 | dma_page->tail : PAGE_SIZE - offset; | 50 | dma_page->tail : PAGE_SIZE - offset; |
51 | 51 | ||
52 | dma->SGlist[map_offset].length = len; | ||
53 | dma->SGlist[map_offset].offset = offset; | ||
54 | if (PageHighMem(dma->map[map_offset])) { | 52 | if (PageHighMem(dma->map[map_offset])) { |
55 | void *src; | 53 | void *src; |
56 | 54 | ||
@@ -63,10 +61,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); | 61 | memcpy(page_address(dma->bouncemap[map_offset]) + offset, src, len); |
64 | kunmap_atomic(src, KM_BOUNCE_READ); | 62 | kunmap_atomic(src, KM_BOUNCE_READ); |
65 | local_irq_restore(flags); | 63 | local_irq_restore(flags); |
66 | sg_set_page(&dma->SGlist[map_offset], dma->bouncemap[map_offset]); | 64 | sg_set_page(&dma->SGlist[map_offset], dma->bouncemap[map_offset], len, offset); |
67 | } | 65 | } |
68 | else { | 66 | else { |
69 | sg_set_page(&dma->SGlist[map_offset], dma->map[map_offset]); | 67 | sg_set_page(&dma->SGlist[map_offset], dma->map[map_offset], len, offset); |
70 | } | 68 | } |
71 | offset = 0; | 69 | offset = 0; |
72 | map_offset++; | 70 | map_offset++; |
diff --git a/drivers/media/video/videobuf-dma-sg.c b/drivers/media/video/videobuf-dma-sg.c index 9ab94a749d8..44ee408e145 100644 --- a/drivers/media/video/videobuf-dma-sg.c +++ b/drivers/media/video/videobuf-dma-sg.c | |||
@@ -67,8 +67,7 @@ videobuf_vmalloc_to_sg(unsigned char *virt, int nr_pages) | |||
67 | if (NULL == pg) | 67 | if (NULL == pg) |
68 | goto err; | 68 | goto err; |
69 | BUG_ON(PageHighMem(pg)); | 69 | BUG_ON(PageHighMem(pg)); |
70 | sg_set_page(&sglist[i], pg); | 70 | sg_set_page(&sglist[i], pg, PAGE_SIZE, 0); |
71 | sglist[i].length = PAGE_SIZE; | ||
72 | } | 71 | } |
73 | return sglist; | 72 | return sglist; |
74 | 73 | ||
@@ -95,16 +94,13 @@ videobuf_pages_to_sg(struct page **pages, int nr_pages, int offset) | |||
95 | if (PageHighMem(pages[0])) | 94 | if (PageHighMem(pages[0])) |
96 | /* DMA to highmem pages might not work */ | 95 | /* DMA to highmem pages might not work */ |
97 | goto highmem; | 96 | goto highmem; |
98 | sg_set_page(&sglist[0], pages[0]); | 97 | sg_set_page(&sglist[0], pages[0], PAGE_SIZE - offset, offset); |
99 | sglist[0].offset = offset; | ||
100 | sglist[0].length = PAGE_SIZE - offset; | ||
101 | for (i = 1; i < nr_pages; i++) { | 98 | for (i = 1; i < nr_pages; i++) { |
102 | if (NULL == pages[i]) | 99 | if (NULL == pages[i]) |
103 | goto nopage; | 100 | goto nopage; |
104 | if (PageHighMem(pages[i])) | 101 | if (PageHighMem(pages[i])) |
105 | goto highmem; | 102 | goto highmem; |
106 | sg_set_page(&sglist[i], pages[i]); | 103 | sg_set_page(&sglist[i], pages[i], PAGE_SIZE, 0); |
107 | sglist[i].length = PAGE_SIZE; | ||
108 | } | 104 | } |
109 | return sglist; | 105 | return sglist; |
110 | 106 | ||