aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2014-03-07 19:29:31 -0500
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-05-25 10:19:08 -0400
commit1e345d4ab4a873a0c96ecbdfdd2f9a36998bba6f (patch)
treec771c7d67dab6be773fbbf7ebac78dbd289e9a46 /drivers/media
parent2a0a5472af5caa0d0df334abb9975dc496f045da (diff)
[media] omap3isp: queue: Don't build scatterlist for kernel buffer
The scatterlist is not needed for those buffers, don't build it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Sakari Ailus <sakari.ailus@iki.fi> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/platform/omap3isp/ispqueue.c24
-rw-r--r--drivers/media/platform/omap3isp/ispqueue.h8
2 files changed, 7 insertions, 25 deletions
diff --git a/drivers/media/platform/omap3isp/ispqueue.c b/drivers/media/platform/omap3isp/ispqueue.c
index 9c90fb081404..515ed94cec48 100644
--- a/drivers/media/platform/omap3isp/ispqueue.c
+++ b/drivers/media/platform/omap3isp/ispqueue.c
@@ -147,21 +147,6 @@ out:
147} 147}
148 148
149/* 149/*
150 * isp_video_buffer_prepare_kernel - Build scatter list for a kernel-allocated
151 * buffer
152 *
153 * Retrieve the sgtable using the DMA API.
154 */
155static int isp_video_buffer_prepare_kernel(struct isp_video_buffer *buf)
156{
157 struct isp_video_fh *vfh = isp_video_queue_to_isp_video_fh(buf->queue);
158 struct isp_video *video = vfh->video;
159
160 return dma_get_sgtable(video->isp->dev, &buf->sgt, buf->vaddr,
161 buf->dma, PAGE_ALIGN(buf->vbuf.length));
162}
163
164/*
165 * isp_video_buffer_cleanup - Release pages for a userspace VMA. 150 * isp_video_buffer_cleanup - Release pages for a userspace VMA.
166 * 151 *
167 * Release pages locked by a call isp_video_buffer_prepare_user and free the 152 * Release pages locked by a call isp_video_buffer_prepare_user and free the
@@ -181,10 +166,9 @@ static void isp_video_buffer_cleanup(struct isp_video_buffer *buf)
181 ? DMA_FROM_DEVICE : DMA_TO_DEVICE; 166 ? DMA_FROM_DEVICE : DMA_TO_DEVICE;
182 dma_unmap_sg_attrs(buf->queue->dev, buf->sgt.sgl, 167 dma_unmap_sg_attrs(buf->queue->dev, buf->sgt.sgl,
183 buf->sgt.orig_nents, direction, &attrs); 168 buf->sgt.orig_nents, direction, &attrs);
169 sg_free_table(&buf->sgt);
184 } 170 }
185 171
186 sg_free_table(&buf->sgt);
187
188 if (buf->pages != NULL) { 172 if (buf->pages != NULL) {
189 isp_video_buffer_lock_vma(buf, 0); 173 isp_video_buffer_lock_vma(buf, 0);
190 174
@@ -400,7 +384,7 @@ done:
400 * 384 *
401 * - validating VMAs (userspace buffers only) 385 * - validating VMAs (userspace buffers only)
402 * - locking pages and VMAs into memory (userspace buffers only) 386 * - locking pages and VMAs into memory (userspace buffers only)
403 * - building page and scatter-gather lists 387 * - building page and scatter-gather lists (userspace buffers only)
404 * - mapping buffers for DMA operation 388 * - mapping buffers for DMA operation
405 * - performing driver-specific preparation 389 * - performing driver-specific preparation
406 * 390 *
@@ -416,9 +400,7 @@ static int isp_video_buffer_prepare(struct isp_video_buffer *buf)
416 400
417 switch (buf->vbuf.memory) { 401 switch (buf->vbuf.memory) {
418 case V4L2_MEMORY_MMAP: 402 case V4L2_MEMORY_MMAP:
419 ret = isp_video_buffer_prepare_kernel(buf); 403 ret = 0;
420 if (ret < 0)
421 goto done;
422 break; 404 break;
423 405
424 case V4L2_MEMORY_USERPTR: 406 case V4L2_MEMORY_USERPTR:
diff --git a/drivers/media/platform/omap3isp/ispqueue.h b/drivers/media/platform/omap3isp/ispqueue.h
index ae4acb9ab5f9..27189bb5a690 100644
--- a/drivers/media/platform/omap3isp/ispqueue.h
+++ b/drivers/media/platform/omap3isp/ispqueue.h
@@ -70,8 +70,8 @@ enum isp_video_buffer_state {
70 * @vaddr: Memory virtual address (for kernel buffers) 70 * @vaddr: Memory virtual address (for kernel buffers)
71 * @vm_flags: Buffer VMA flags (for userspace buffers) 71 * @vm_flags: Buffer VMA flags (for userspace buffers)
72 * @npages: Number of pages (for userspace buffers) 72 * @npages: Number of pages (for userspace buffers)
73 * @sgt: Scatter gather table (for userspace buffers)
73 * @pages: Pages table (for userspace non-VM_PFNMAP buffers) 74 * @pages: Pages table (for userspace non-VM_PFNMAP buffers)
74 * @sgt: Scatter gather table
75 * @vbuf: V4L2 buffer 75 * @vbuf: V4L2 buffer
76 * @irqlist: List head for insertion into IRQ queue 76 * @irqlist: List head for insertion into IRQ queue
77 * @state: Current buffer state 77 * @state: Current buffer state
@@ -90,11 +90,11 @@ struct isp_video_buffer {
90 /* For userspace buffers. */ 90 /* For userspace buffers. */
91 vm_flags_t vm_flags; 91 vm_flags_t vm_flags;
92 unsigned int npages; 92 unsigned int npages;
93 struct page **pages;
94
95 /* For all buffers. */
96 struct sg_table sgt; 93 struct sg_table sgt;
97 94
95 /* For non-VM_PFNMAP userspace buffers. */
96 struct page **pages;
97
98 /* Touched by the interrupt handler. */ 98 /* Touched by the interrupt handler. */
99 struct v4l2_buffer vbuf; 99 struct v4l2_buffer vbuf;
100 struct list_head irqlist; 100 struct list_head irqlist;