]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.19.34/media-s5p-jpeg-correct-return-type-for-mem2mem-buffe.patch
Linux 4.14.111
[thirdparty/kernel/stable-queue.git] / releases / 4.19.34 / media-s5p-jpeg-correct-return-type-for-mem2mem-buffe.patch
1 From 4454b8c18e893d44abbee9bb47a3a29a0af5a935 Mon Sep 17 00:00:00 2001
2 From: Ezequiel Garcia <ezequiel@collabora.com>
3 Date: Fri, 8 Feb 2019 11:17:45 -0500
4 Subject: media: s5p-jpeg: Correct return type for mem2mem buffer helpers
5
6 [ Upstream commit 4a88f89885c7cf65c62793f385261a6e3315178a ]
7
8 Fix the assigned type of mem2mem buffer handling API.
9 Namely, these functions:
10
11 v4l2_m2m_next_buf
12 v4l2_m2m_last_buf
13 v4l2_m2m_buf_remove
14 v4l2_m2m_next_src_buf
15 v4l2_m2m_next_dst_buf
16 v4l2_m2m_last_src_buf
17 v4l2_m2m_last_dst_buf
18 v4l2_m2m_src_buf_remove
19 v4l2_m2m_dst_buf_remove
20
21 return a struct vb2_v4l2_buffer, and not a struct vb2_buffer.
22
23 Fixing this is necessary to fix the mem2mem buffer handling API,
24 changing the return to the correct struct vb2_v4l2_buffer instead
25 of a void pointer.
26
27 Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
28 Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
29 Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
30 Signed-off-by: Sasha Levin <sashal@kernel.org>
31 ---
32 drivers/media/platform/s5p-jpeg/jpeg-core.c | 38 ++++++++++-----------
33 1 file changed, 19 insertions(+), 19 deletions(-)
34
35 diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c
36 index 04fd2e0493c0..29daecf8de7d 100644
37 --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c
38 +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c
39 @@ -793,14 +793,14 @@ static void skip(struct s5p_jpeg_buffer *buf, long len);
40 static void exynos4_jpeg_parse_decode_h_tbl(struct s5p_jpeg_ctx *ctx)
41 {
42 struct s5p_jpeg *jpeg = ctx->jpeg;
43 - struct vb2_buffer *vb = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx);
44 + struct vb2_v4l2_buffer *vb = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx);
45 struct s5p_jpeg_buffer jpeg_buffer;
46 unsigned int word;
47 int c, x, components;
48
49 jpeg_buffer.size = 2; /* Ls */
50 jpeg_buffer.data =
51 - (unsigned long)vb2_plane_vaddr(vb, 0) + ctx->out_q.sos + 2;
52 + (unsigned long)vb2_plane_vaddr(&vb->vb2_buf, 0) + ctx->out_q.sos + 2;
53 jpeg_buffer.curr = 0;
54
55 word = 0;
56 @@ -830,14 +830,14 @@ static void exynos4_jpeg_parse_decode_h_tbl(struct s5p_jpeg_ctx *ctx)
57 static void exynos4_jpeg_parse_huff_tbl(struct s5p_jpeg_ctx *ctx)
58 {
59 struct s5p_jpeg *jpeg = ctx->jpeg;
60 - struct vb2_buffer *vb = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx);
61 + struct vb2_v4l2_buffer *vb = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx);
62 struct s5p_jpeg_buffer jpeg_buffer;
63 unsigned int word;
64 int c, i, n, j;
65
66 for (j = 0; j < ctx->out_q.dht.n; ++j) {
67 jpeg_buffer.size = ctx->out_q.dht.len[j];
68 - jpeg_buffer.data = (unsigned long)vb2_plane_vaddr(vb, 0) +
69 + jpeg_buffer.data = (unsigned long)vb2_plane_vaddr(&vb->vb2_buf, 0) +
70 ctx->out_q.dht.marker[j];
71 jpeg_buffer.curr = 0;
72
73 @@ -889,13 +889,13 @@ static void exynos4_jpeg_parse_huff_tbl(struct s5p_jpeg_ctx *ctx)
74 static void exynos4_jpeg_parse_decode_q_tbl(struct s5p_jpeg_ctx *ctx)
75 {
76 struct s5p_jpeg *jpeg = ctx->jpeg;
77 - struct vb2_buffer *vb = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx);
78 + struct vb2_v4l2_buffer *vb = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx);
79 struct s5p_jpeg_buffer jpeg_buffer;
80 int c, x, components;
81
82 jpeg_buffer.size = ctx->out_q.sof_len;
83 jpeg_buffer.data =
84 - (unsigned long)vb2_plane_vaddr(vb, 0) + ctx->out_q.sof;
85 + (unsigned long)vb2_plane_vaddr(&vb->vb2_buf, 0) + ctx->out_q.sof;
86 jpeg_buffer.curr = 0;
87
88 skip(&jpeg_buffer, 5); /* P, Y, X */
89 @@ -920,14 +920,14 @@ static void exynos4_jpeg_parse_decode_q_tbl(struct s5p_jpeg_ctx *ctx)
90 static void exynos4_jpeg_parse_q_tbl(struct s5p_jpeg_ctx *ctx)
91 {
92 struct s5p_jpeg *jpeg = ctx->jpeg;
93 - struct vb2_buffer *vb = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx);
94 + struct vb2_v4l2_buffer *vb = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx);
95 struct s5p_jpeg_buffer jpeg_buffer;
96 unsigned int word;
97 int c, i, j;
98
99 for (j = 0; j < ctx->out_q.dqt.n; ++j) {
100 jpeg_buffer.size = ctx->out_q.dqt.len[j];
101 - jpeg_buffer.data = (unsigned long)vb2_plane_vaddr(vb, 0) +
102 + jpeg_buffer.data = (unsigned long)vb2_plane_vaddr(&vb->vb2_buf, 0) +
103 ctx->out_q.dqt.marker[j];
104 jpeg_buffer.curr = 0;
105
106 @@ -2072,15 +2072,15 @@ static void s5p_jpeg_device_run(void *priv)
107 {
108 struct s5p_jpeg_ctx *ctx = priv;
109 struct s5p_jpeg *jpeg = ctx->jpeg;
110 - struct vb2_buffer *src_buf, *dst_buf;
111 + struct vb2_v4l2_buffer *src_buf, *dst_buf;
112 unsigned long src_addr, dst_addr, flags;
113
114 spin_lock_irqsave(&ctx->jpeg->slock, flags);
115
116 src_buf = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx);
117 dst_buf = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx);
118 - src_addr = vb2_dma_contig_plane_dma_addr(src_buf, 0);
119 - dst_addr = vb2_dma_contig_plane_dma_addr(dst_buf, 0);
120 + src_addr = vb2_dma_contig_plane_dma_addr(&src_buf->vb2_buf, 0);
121 + dst_addr = vb2_dma_contig_plane_dma_addr(&dst_buf->vb2_buf, 0);
122
123 s5p_jpeg_reset(jpeg->regs);
124 s5p_jpeg_poweron(jpeg->regs);
125 @@ -2153,7 +2153,7 @@ static void exynos4_jpeg_set_img_addr(struct s5p_jpeg_ctx *ctx)
126 {
127 struct s5p_jpeg *jpeg = ctx->jpeg;
128 struct s5p_jpeg_fmt *fmt;
129 - struct vb2_buffer *vb;
130 + struct vb2_v4l2_buffer *vb;
131 struct s5p_jpeg_addr jpeg_addr = {};
132 u32 pix_size, padding_bytes = 0;
133
134 @@ -2172,7 +2172,7 @@ static void exynos4_jpeg_set_img_addr(struct s5p_jpeg_ctx *ctx)
135 vb = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx);
136 }
137
138 - jpeg_addr.y = vb2_dma_contig_plane_dma_addr(vb, 0);
139 + jpeg_addr.y = vb2_dma_contig_plane_dma_addr(&vb->vb2_buf, 0);
140
141 if (fmt->colplanes == 2) {
142 jpeg_addr.cb = jpeg_addr.y + pix_size - padding_bytes;
143 @@ -2190,7 +2190,7 @@ static void exynos4_jpeg_set_img_addr(struct s5p_jpeg_ctx *ctx)
144 static void exynos4_jpeg_set_jpeg_addr(struct s5p_jpeg_ctx *ctx)
145 {
146 struct s5p_jpeg *jpeg = ctx->jpeg;
147 - struct vb2_buffer *vb;
148 + struct vb2_v4l2_buffer *vb;
149 unsigned int jpeg_addr = 0;
150
151 if (ctx->mode == S5P_JPEG_ENCODE)
152 @@ -2198,7 +2198,7 @@ static void exynos4_jpeg_set_jpeg_addr(struct s5p_jpeg_ctx *ctx)
153 else
154 vb = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx);
155
156 - jpeg_addr = vb2_dma_contig_plane_dma_addr(vb, 0);
157 + jpeg_addr = vb2_dma_contig_plane_dma_addr(&vb->vb2_buf, 0);
158 if (jpeg->variant->version == SJPEG_EXYNOS5433 &&
159 ctx->mode == S5P_JPEG_DECODE)
160 jpeg_addr += ctx->out_q.sos;
161 @@ -2314,7 +2314,7 @@ static void exynos3250_jpeg_set_img_addr(struct s5p_jpeg_ctx *ctx)
162 {
163 struct s5p_jpeg *jpeg = ctx->jpeg;
164 struct s5p_jpeg_fmt *fmt;
165 - struct vb2_buffer *vb;
166 + struct vb2_v4l2_buffer *vb;
167 struct s5p_jpeg_addr jpeg_addr = {};
168 u32 pix_size;
169
170 @@ -2328,7 +2328,7 @@ static void exynos3250_jpeg_set_img_addr(struct s5p_jpeg_ctx *ctx)
171 fmt = ctx->cap_q.fmt;
172 }
173
174 - jpeg_addr.y = vb2_dma_contig_plane_dma_addr(vb, 0);
175 + jpeg_addr.y = vb2_dma_contig_plane_dma_addr(&vb->vb2_buf, 0);
176
177 if (fmt->colplanes == 2) {
178 jpeg_addr.cb = jpeg_addr.y + pix_size;
179 @@ -2346,7 +2346,7 @@ static void exynos3250_jpeg_set_img_addr(struct s5p_jpeg_ctx *ctx)
180 static void exynos3250_jpeg_set_jpeg_addr(struct s5p_jpeg_ctx *ctx)
181 {
182 struct s5p_jpeg *jpeg = ctx->jpeg;
183 - struct vb2_buffer *vb;
184 + struct vb2_v4l2_buffer *vb;
185 unsigned int jpeg_addr = 0;
186
187 if (ctx->mode == S5P_JPEG_ENCODE)
188 @@ -2354,7 +2354,7 @@ static void exynos3250_jpeg_set_jpeg_addr(struct s5p_jpeg_ctx *ctx)
189 else
190 vb = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx);
191
192 - jpeg_addr = vb2_dma_contig_plane_dma_addr(vb, 0);
193 + jpeg_addr = vb2_dma_contig_plane_dma_addr(&vb->vb2_buf, 0);
194 exynos3250_jpeg_jpgadr(jpeg->regs, jpeg_addr);
195 }
196
197 --
198 2.19.1
199