diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2013-03-01 13:44:20 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-03-21 12:17:51 -0400 |
commit | b6ba2057f7823352bbc44ee846faa03b36e8b6ac (patch) | |
tree | 130c5bafcd2e497c45d8a1e5e9e764dc88bff00c /drivers/media/v4l2-core/videobuf2-dma-sg.c | |
parent | 808d24d6c0b5c30c8f804b251caf476ea63954ef (diff) |
[media] videobuf2: add gfp_flags
Some drivers have special memory requirements for their buffers, usually
related to DMA (e.g. GFP_DMA or __GFP_DMA32). Make it possible to specify
additional GFP flags for those buffers by adding a gfp_flags field to
vb2_queue.
Note that this field will be replaced in the future with a different
mechanism, but that is still work in progress and we need this feature
now so we won't be able to convert drivers with such requirements to vb2.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Federico Vaga <federico.vaga@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/v4l2-core/videobuf2-dma-sg.c')
-rw-r--r-- | drivers/media/v4l2-core/videobuf2-dma-sg.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/media/v4l2-core/videobuf2-dma-sg.c b/drivers/media/v4l2-core/videobuf2-dma-sg.c index 25c3b360e1ad..952776fafe2c 100644 --- a/drivers/media/v4l2-core/videobuf2-dma-sg.c +++ b/drivers/media/v4l2-core/videobuf2-dma-sg.c | |||
@@ -33,7 +33,7 @@ struct vb2_dma_sg_buf { | |||
33 | 33 | ||
34 | static void vb2_dma_sg_put(void *buf_priv); | 34 | static void vb2_dma_sg_put(void *buf_priv); |
35 | 35 | ||
36 | static void *vb2_dma_sg_alloc(void *alloc_ctx, unsigned long size) | 36 | static void *vb2_dma_sg_alloc(void *alloc_ctx, unsigned long size, gfp_t gfp_flags) |
37 | { | 37 | { |
38 | struct vb2_dma_sg_buf *buf; | 38 | struct vb2_dma_sg_buf *buf; |
39 | int i; | 39 | int i; |
@@ -60,7 +60,8 @@ static void *vb2_dma_sg_alloc(void *alloc_ctx, unsigned long size) | |||
60 | goto fail_pages_array_alloc; | 60 | goto fail_pages_array_alloc; |
61 | 61 | ||
62 | for (i = 0; i < buf->sg_desc.num_pages; ++i) { | 62 | for (i = 0; i < buf->sg_desc.num_pages; ++i) { |
63 | buf->pages[i] = alloc_page(GFP_KERNEL | __GFP_ZERO | __GFP_NOWARN); | 63 | buf->pages[i] = alloc_page(GFP_KERNEL | __GFP_ZERO | |
64 | __GFP_NOWARN | gfp_flags); | ||
64 | if (NULL == buf->pages[i]) | 65 | if (NULL == buf->pages[i]) |
65 | goto fail_pages_alloc; | 66 | goto fail_pages_alloc; |
66 | sg_set_page(&buf->sg_desc.sglist[i], | 67 | sg_set_page(&buf->sg_desc.sglist[i], |