diff options
author | Marek Szyprowski <m.szyprowski@samsung.com> | 2011-12-15 03:44:12 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-12-30 13:07:07 -0500 |
commit | 5931ffe3bee6216e59faf18b317dea4e637eef03 (patch) | |
tree | 0cf49caa0d1d3755be7084b09b5bf5aaef001b8b | |
parent | b037c0fde22b1d3cd0b3c3717d28e54619fc1592 (diff) |
[media] media: vb2: remove plane argument from call_memop and cleanup mempriv usage
This patch removes unused 'plane' argument from call_memop macro.
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
CC: Pawel Osciak <pawel@osciak.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/video/videobuf2-core.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/drivers/media/video/videobuf2-core.c b/drivers/media/video/videobuf2-core.c index a3a9bf908d84..9dc887b2aac0 100644 --- a/drivers/media/video/videobuf2-core.c +++ b/drivers/media/video/videobuf2-core.c | |||
@@ -30,7 +30,7 @@ module_param(debug, int, 0644); | |||
30 | printk(KERN_DEBUG "vb2: " fmt, ## arg); \ | 30 | printk(KERN_DEBUG "vb2: " fmt, ## arg); \ |
31 | } while (0) | 31 | } while (0) |
32 | 32 | ||
33 | #define call_memop(q, plane, op, args...) \ | 33 | #define call_memop(q, op, args...) \ |
34 | (((q)->mem_ops->op) ? \ | 34 | (((q)->mem_ops->op) ? \ |
35 | ((q)->mem_ops->op(args)) : 0) | 35 | ((q)->mem_ops->op(args)) : 0) |
36 | 36 | ||
@@ -52,7 +52,7 @@ static int __vb2_buf_mem_alloc(struct vb2_buffer *vb) | |||
52 | 52 | ||
53 | /* Allocate memory for all planes in this buffer */ | 53 | /* Allocate memory for all planes in this buffer */ |
54 | for (plane = 0; plane < vb->num_planes; ++plane) { | 54 | for (plane = 0; plane < vb->num_planes; ++plane) { |
55 | mem_priv = call_memop(q, plane, alloc, q->alloc_ctx[plane], | 55 | mem_priv = call_memop(q, alloc, q->alloc_ctx[plane], |
56 | q->plane_sizes[plane]); | 56 | q->plane_sizes[plane]); |
57 | if (IS_ERR_OR_NULL(mem_priv)) | 57 | if (IS_ERR_OR_NULL(mem_priv)) |
58 | goto free; | 58 | goto free; |
@@ -66,7 +66,7 @@ static int __vb2_buf_mem_alloc(struct vb2_buffer *vb) | |||
66 | free: | 66 | free: |
67 | /* Free already allocated memory if one of the allocations failed */ | 67 | /* Free already allocated memory if one of the allocations failed */ |
68 | for (; plane > 0; --plane) | 68 | for (; plane > 0; --plane) |
69 | call_memop(q, plane, put, vb->planes[plane - 1].mem_priv); | 69 | call_memop(q, put, vb->planes[plane - 1].mem_priv); |
70 | 70 | ||
71 | return -ENOMEM; | 71 | return -ENOMEM; |
72 | } | 72 | } |
@@ -80,7 +80,7 @@ static void __vb2_buf_mem_free(struct vb2_buffer *vb) | |||
80 | unsigned int plane; | 80 | unsigned int plane; |
81 | 81 | ||
82 | for (plane = 0; plane < vb->num_planes; ++plane) { | 82 | for (plane = 0; plane < vb->num_planes; ++plane) { |
83 | call_memop(q, plane, put, vb->planes[plane].mem_priv); | 83 | call_memop(q, put, vb->planes[plane].mem_priv); |
84 | vb->planes[plane].mem_priv = NULL; | 84 | vb->planes[plane].mem_priv = NULL; |
85 | dprintk(3, "Freed plane %d of buffer %d\n", | 85 | dprintk(3, "Freed plane %d of buffer %d\n", |
86 | plane, vb->v4l2_buf.index); | 86 | plane, vb->v4l2_buf.index); |
@@ -100,7 +100,7 @@ static void __vb2_buf_userptr_put(struct vb2_buffer *vb) | |||
100 | void *mem_priv = vb->planes[plane].mem_priv; | 100 | void *mem_priv = vb->planes[plane].mem_priv; |
101 | 101 | ||
102 | if (mem_priv) { | 102 | if (mem_priv) { |
103 | call_memop(q, plane, put_userptr, mem_priv); | 103 | call_memop(q, put_userptr, mem_priv); |
104 | vb->planes[plane].mem_priv = NULL; | 104 | vb->planes[plane].mem_priv = NULL; |
105 | } | 105 | } |
106 | } | 106 | } |
@@ -305,7 +305,7 @@ static bool __buffer_in_use(struct vb2_queue *q, struct vb2_buffer *vb) | |||
305 | * case anyway. If num_users() returns more than 1, | 305 | * case anyway. If num_users() returns more than 1, |
306 | * we are not the only user of the plane's memory. | 306 | * we are not the only user of the plane's memory. |
307 | */ | 307 | */ |
308 | if (mem_priv && call_memop(q, plane, num_users, mem_priv) > 1) | 308 | if (mem_priv && call_memop(q, num_users, mem_priv) > 1) |
309 | return true; | 309 | return true; |
310 | } | 310 | } |
311 | return false; | 311 | return false; |
@@ -734,7 +734,7 @@ void *vb2_plane_vaddr(struct vb2_buffer *vb, unsigned int plane_no) | |||
734 | if (plane_no > vb->num_planes) | 734 | if (plane_no > vb->num_planes) |
735 | return NULL; | 735 | return NULL; |
736 | 736 | ||
737 | return call_memop(q, plane_no, vaddr, vb->planes[plane_no].mem_priv); | 737 | return call_memop(q, vaddr, vb->planes[plane_no].mem_priv); |
738 | 738 | ||
739 | } | 739 | } |
740 | EXPORT_SYMBOL_GPL(vb2_plane_vaddr); | 740 | EXPORT_SYMBOL_GPL(vb2_plane_vaddr); |
@@ -757,7 +757,7 @@ void *vb2_plane_cookie(struct vb2_buffer *vb, unsigned int plane_no) | |||
757 | if (plane_no > vb->num_planes) | 757 | if (plane_no > vb->num_planes) |
758 | return NULL; | 758 | return NULL; |
759 | 759 | ||
760 | return call_memop(q, plane_no, cookie, vb->planes[plane_no].mem_priv); | 760 | return call_memop(q, cookie, vb->planes[plane_no].mem_priv); |
761 | } | 761 | } |
762 | EXPORT_SYMBOL_GPL(vb2_plane_cookie); | 762 | EXPORT_SYMBOL_GPL(vb2_plane_cookie); |
763 | 763 | ||
@@ -899,8 +899,7 @@ static int __qbuf_userptr(struct vb2_buffer *vb, const struct v4l2_buffer *b) | |||
899 | 899 | ||
900 | /* Release previously acquired memory if present */ | 900 | /* Release previously acquired memory if present */ |
901 | if (vb->planes[plane].mem_priv) | 901 | if (vb->planes[plane].mem_priv) |
902 | call_memop(q, plane, put_userptr, | 902 | call_memop(q, put_userptr, vb->planes[plane].mem_priv); |
903 | vb->planes[plane].mem_priv); | ||
904 | 903 | ||
905 | vb->planes[plane].mem_priv = NULL; | 904 | vb->planes[plane].mem_priv = NULL; |
906 | vb->v4l2_planes[plane].m.userptr = 0; | 905 | vb->v4l2_planes[plane].m.userptr = 0; |
@@ -944,8 +943,7 @@ err: | |||
944 | /* In case of errors, release planes that were already acquired */ | 943 | /* In case of errors, release planes that were already acquired */ |
945 | for (plane = 0; plane < vb->num_planes; ++plane) { | 944 | for (plane = 0; plane < vb->num_planes; ++plane) { |
946 | if (vb->planes[plane].mem_priv) | 945 | if (vb->planes[plane].mem_priv) |
947 | call_memop(q, plane, put_userptr, | 946 | call_memop(q, put_userptr, vb->planes[plane].mem_priv); |
948 | vb->planes[plane].mem_priv); | ||
949 | vb->planes[plane].mem_priv = NULL; | 947 | vb->planes[plane].mem_priv = NULL; |
950 | vb->v4l2_planes[plane].m.userptr = 0; | 948 | vb->v4l2_planes[plane].m.userptr = 0; |
951 | vb->v4l2_planes[plane].length = 0; | 949 | vb->v4l2_planes[plane].length = 0; |