Hi Junghak, [auto build test ERROR on v4.3-rc4 -- if it's inappropriate base, please ignore] config: x86_64-rhel (attached as .config) reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All error/warnings (new ones prefixed by >>): >> drivers/media/dvb-core/dvb_vb2.c:32:5: warning: 'struct vb2_format' declared inside parameter list unsigned int sizes[], void *alloc_ctxs[]) ^ >> drivers/media/dvb-core/dvb_vb2.c:32:5: warning: its scope is only this definition or declaration, which is probably not what you want >> drivers/media/dvb-core/dvb_vb2.c:114:2: warning: initialization from incompatible pointer type .queue_setup = _queue_setup, ^ >> drivers/media/dvb-core/dvb_vb2.c:114:2: warning: (near initialization for 'dvb_vb2_qops.queue_setup') drivers/media/dvb-core/dvb_vb2.c: In function '_fill_dmx_buffer': >> drivers/media/dvb-core/dvb_vb2.c:128:15: error: 'struct vb2_buffer' has no member named 'index' b->index = vb->index; ^ >> drivers/media/dvb-core/dvb_vb2.c:129:27: error: 'struct vb2_plane' has no member named 'length' b->length = vb->planes[0].length; ^ >> drivers/media/dvb-core/dvb_vb2.c:130:30: error: 'struct vb2_plane' has no member named 'bytesused' b->bytesused = vb->planes[0].bytesused; ^ >> drivers/media/dvb-core/dvb_vb2.c:131:27: error: 'struct vb2_plane' has no member named 'm' b->offset = vb->planes[0].m.offset; ^ drivers/media/dvb-core/dvb_vb2.c: In function '_fill_vb2_buffer': drivers/media/dvb-core/dvb_vb2.c:143:11: error: 'struct vb2_plane' has no member named 'bytesused' planes[0].bytesused = 0; ^ drivers/media/dvb-core/dvb_vb2.c: At top level: >> drivers/media/dvb-core/dvb_vb2.c:149:21: error: variable 'dvb_vb2_buf_ops' has initializer but incomplete type static const struct vb2_buf_ops dvb_vb2_buf_ops = { ^ >> drivers/media/dvb-core/dvb_vb2.c:150:2: error: unknown field 'fill_user_buffer' specified in initializer .fill_user_buffer = _fill_dmx_buffer, ^ >> drivers/media/dvb-core/dvb_vb2.c:150:2: warning: excess elements in struct initializer >> drivers/media/dvb-core/dvb_vb2.c:150:2: warning: (near initialization for 'dvb_vb2_buf_ops') >> drivers/media/dvb-core/dvb_vb2.c:151:2: error: unknown field 'fill_vb2_buffer' specified in initializer .fill_vb2_buffer = _fill_vb2_buffer, ^ drivers/media/dvb-core/dvb_vb2.c:151:2: warning: excess elements in struct initializer drivers/media/dvb-core/dvb_vb2.c:151:2: warning: (near initialization for 'dvb_vb2_buf_ops') drivers/media/dvb-core/dvb_vb2.c: In function 'dvb_vb2_init': >> drivers/media/dvb-core/dvb_vb2.c:170:3: error: 'struct vb2_queue' has no member named 'buf_ops' q->buf_ops = &dvb_vb2_buf_ops; ^ >> drivers/media/dvb-core/dvb_vb2.c:173:2: error: implicit declaration of function 'vb2_core_queue_init' [-Werror=implicit-function-declaration] ret = vb2_core_queue_init(q); ^ drivers/media/dvb-core/dvb_vb2.c: In function 'dvb_vb2_release': >> drivers/media/dvb-core/dvb_vb2.c:198:3: error: implicit declaration of function 'vb2_core_queue_release' [-Werror=implicit-function-declaration] vb2_core_queue_release(q); ^ drivers/media/dvb-core/dvb_vb2.c: In function 'dvb_vb2_stream_on': >> drivers/media/dvb-core/dvb_vb2.c:211:2: error: implicit declaration of function 'vb2_core_streamon' [-Werror=implicit-function-declaration] ret = vb2_core_streamon(q, q->type); ^ drivers/media/dvb-core/dvb_vb2.c: In function 'dvb_vb2_stream_off': >> drivers/media/dvb-core/dvb_vb2.c:237:2: error: implicit declaration of function 'vb2_core_streamoff' [-Werror=implicit-function-declaration] ret = vb2_core_streamoff(q, q->type); ^ drivers/media/dvb-core/dvb_vb2.c: In function 'dvb_vb2_reqbufs': >> drivers/media/dvb-core/dvb_vb2.c:322:2: error: implicit declaration of function 'vb2_core_reqbufs' [-Werror=implicit-function-declaration] ret = vb2_core_reqbufs(&ctx->vb_q, VB2_MEMORY_MMAP, &req->count); ^ >> drivers/media/dvb-core/dvb_vb2.c:322:37: error: 'VB2_MEMORY_MMAP' undeclared (first use in this function) ret = vb2_core_reqbufs(&ctx->vb_q, VB2_MEMORY_MMAP, &req->count); ^ drivers/media/dvb-core/dvb_vb2.c:322:37: note: each undeclared identifier is reported only once for each function it appears in drivers/media/dvb-core/dvb_vb2.c: In function 'dvb_vb2_querybuf': vim +128 drivers/media/dvb-core/dvb_vb2.c 26 if (vb2_debug >= level) \ 27 pr_info("vb2: %s: " fmt, __func__, ## arg); \ 28 } while (0) 29 30 static int _queue_setup(struct vb2_queue *vq, const struct vb2_format *fmt, 31 unsigned int *nbuffers, unsigned int *nplanes, > 32 unsigned int sizes[], void *alloc_ctxs[]) 33 { 34 struct dvb_vb2_ctx *ctx = vb2_get_drv_priv(vq); 35 36 *nbuffers = ctx->buf_cnt; 37 *nplanes = 1; 38 sizes[0] = ctx->buf_siz; 39 40 /* 41 * videobuf2-vmalloc allocator is context-less so no need to set 42 * alloc_ctxs array. 43 */ 44 45 dprintk(3, "[%s] count=%d, size=%d\n", ctx->name, 46 *nbuffers, sizes[0]); 47 48 return 0; 49 } 50 51 static int _buffer_prepare(struct vb2_buffer *vb) 52 { 53 struct dvb_vb2_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue); 54 unsigned long size = ctx->buf_siz; 55 56 if (vb2_plane_size(vb, 0) < size) { 57 dprintk(1, "[%s] data will not fit into plane (%lu < %lu)\n", 58 ctx->name, vb2_plane_size(vb, 0), size); 59 return -EINVAL; 60 } 61 62 vb2_set_plane_payload(vb, 0, size); 63 dprintk(3, "[%s]\n", ctx->name); 64 65 return 0; 66 } 67 68 static void _buffer_queue(struct vb2_buffer *vb) 69 { 70 struct dvb_vb2_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue); 71 struct dvb_buffer *buf = container_of(vb, struct dvb_buffer, vb); 72 unsigned long flags = 0; 73 74 spin_lock_irqsave(&ctx->slock, flags); 75 list_add_tail(&buf->list, &ctx->dvb_q); 76 spin_unlock_irqrestore(&ctx->slock, flags); 77 78 dprintk(3, "[%s]\n", ctx->name); 79 } 80 81 static int _start_streaming(struct vb2_queue *vq, unsigned int count) 82 { 83 struct dvb_vb2_ctx *ctx = vb2_get_drv_priv(vq); 84 85 dprintk(3, "[%s] count=%d\n", ctx->name, count); 86 return 0; 87 } 88 89 static void _stop_streaming(struct vb2_queue *vq) 90 { 91 struct dvb_vb2_ctx *ctx = vb2_get_drv_priv(vq); 92 93 dprintk(3, "[%s]\n", ctx->name); 94 } 95 96 static void _dmxdev_lock(struct vb2_queue *vq) 97 { 98 struct dvb_vb2_ctx *ctx = vb2_get_drv_priv(vq); 99 100 mutex_lock(&ctx->mutex); 101 dprintk(3, "[%s]\n", ctx->name); 102 } 103 104 static void _dmxdev_unlock(struct vb2_queue *vq) 105 { 106 struct dvb_vb2_ctx *ctx = vb2_get_drv_priv(vq); 107 108 if (mutex_is_locked(&ctx->mutex)) 109 mutex_unlock(&ctx->mutex); 110 dprintk(3, "[%s]\n", ctx->name); 111 } 112 113 static const struct vb2_ops dvb_vb2_qops = { > 114 .queue_setup = _queue_setup, 115 .buf_prepare = _buffer_prepare, 116 .buf_queue = _buffer_queue, 117 .start_streaming = _start_streaming, 118 .stop_streaming = _stop_streaming, 119 .wait_prepare = _dmxdev_unlock, 120 .wait_finish = _dmxdev_lock, 121 }; 122 123 static int _fill_dmx_buffer(struct vb2_buffer *vb, void *pb) 124 { 125 struct dvb_vb2_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue); 126 struct dmx_buffer *b = pb; 127 > 128 b->index = vb->index; > 129 b->length = vb->planes[0].length; > 130 b->bytesused = vb->planes[0].bytesused; > 131 b->offset = vb->planes[0].m.offset; 132 memset(b->reserved, 0, sizeof(b->reserved)); 133 dprintk(3, "[%s]\n", ctx->name); 134 135 return 0; 136 } 137 138 static int _fill_vb2_buffer(struct vb2_buffer *vb, 139 const void *pb, struct vb2_plane *planes) 140 { 141 struct dvb_vb2_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue); 142 > 143 planes[0].bytesused = 0; 144 dprintk(3, "[%s]\n", ctx->name); 145 146 return 0; 147 } 148 > 149 static const struct vb2_buf_ops dvb_vb2_buf_ops = { > 150 .fill_user_buffer = _fill_dmx_buffer, > 151 .fill_vb2_buffer = _fill_vb2_buffer, 152 }; 153 154 /* 155 * Videobuf operations 156 */ 157 int dvb_vb2_init(struct dvb_vb2_ctx *ctx, const char *name, int nonblocking) 158 { 159 struct vb2_queue *q = &ctx->vb_q; 160 int ret; 161 162 memset(ctx, 0, sizeof(struct dvb_vb2_ctx)); 163 q->type = DVB_BUF_TYPE_CAPTURE; 164 q->io_modes = VB2_MMAP | VB2_USERPTR | VB2_READ | VB2_DMABUF; 165 q->drv_priv = ctx; 166 q->buf_struct_size = sizeof(struct dvb_buffer); 167 q->min_buffers_needed = 1; 168 q->ops = &dvb_vb2_qops; 169 q->mem_ops = &vb2_vmalloc_memops; > 170 q->buf_ops = &dvb_vb2_buf_ops; 171 q->num_buffers = 0; 172 > 173 ret = vb2_core_queue_init(q); 174 if (ret) { 175 ctx->state = DVB_VB2_STATE_NONE; 176 dprintk(1, "[%s] errno=%d\n", ctx->name, ret); 177 return ret; 178 } 179 180 mutex_init(&ctx->mutex); 181 spin_lock_init(&ctx->slock); 182 INIT_LIST_HEAD(&ctx->dvb_q); 183 184 strncpy(ctx->name, name, DVB_VB2_NAME_MAX); 185 ctx->nonblocking = nonblocking; 186 ctx->state = DVB_VB2_STATE_INIT; 187 188 dprintk(3, "[%s]\n", ctx->name); 189 190 return 0; 191 } 192 193 int dvb_vb2_release(struct dvb_vb2_ctx *ctx) 194 { 195 struct vb2_queue *q = (struct vb2_queue *)&ctx->vb_q; 196 197 if (ctx->state && DVB_VB2_STATE_INIT) > 198 vb2_core_queue_release(q); 199 200 ctx->state = DVB_VB2_STATE_NONE; 201 dprintk(3, "[%s]\n", ctx->name); 202 203 return 0; 204 } 205 206 int dvb_vb2_stream_on(struct dvb_vb2_ctx *ctx) 207 { 208 struct vb2_queue *q = &ctx->vb_q; 209 int ret; 210 > 211 ret = vb2_core_streamon(q, q->type); 212 if (ret) { 213 ctx->state = DVB_VB2_STATE_NONE; 214 dprintk(1, "[%s] errno=%d\n", ctx->name, ret); 215 return ret; 216 } 217 ctx->state |= DVB_VB2_STATE_STREAMON; 218 dprintk(3, "[%s]\n", ctx->name); 219 220 return 0; 221 } 222 223 int dvb_vb2_stream_off(struct dvb_vb2_ctx *ctx) 224 { 225 struct vb2_queue *q = (struct vb2_queue *)&ctx->vb_q; 226 int ret; 227 int i; 228 229 ctx->state &= ~DVB_VB2_STATE_STREAMON; 230 231 for (i = 0; i < q->num_buffers; ++i) { 232 if (q->bufs[i]->state == VB2_BUF_STATE_ACTIVE) 233 vb2_buffer_done(q->bufs[i], VB2_BUF_STATE_ERROR); 234 235 } 236 > 237 ret = vb2_core_streamoff(q, q->type); 238 if (ret) { 239 ctx->state = DVB_VB2_STATE_NONE; 240 dprintk(1, "[%s] errno=%d\n", ctx->name, ret); 241 return ret; 242 } 243 dprintk(3, "[%s]\n", ctx->name); 244 245 return 0; 246 } 247 248 int dvb_vb2_is_streaming(struct dvb_vb2_ctx *ctx) 249 { 250 return (ctx->state & DVB_VB2_STATE_STREAMON); 251 } 252 253 int dvb_vb2_fill_buffer(struct dvb_vb2_ctx *ctx, 254 const unsigned char *src, int len) 255 { 256 unsigned long flags = 0; 257 void *vbuf; 258 int todo = len; 259 unsigned char *psrc = (unsigned char *)src; 260 int ll; 261 262 while (todo) { 263 if (!ctx->buf) { 264 if (list_empty(&ctx->dvb_q)) { 265 dprintk(3, "[%s] Buffer overflow!!!\n", 266 ctx->name); 267 break; 268 } 269 270 spin_lock_irqsave(&ctx->slock, flags); 271 ctx->buf = list_entry(ctx->dvb_q.next, 272 struct dvb_buffer, list); 273 list_del(&ctx->buf->list); 274 ctx->remain = vb2_plane_size(&ctx->buf->vb, 0); 275 ctx->offset = 0; 276 spin_unlock_irqrestore(&ctx->slock, flags); 277 } 278 279 if (!dvb_vb2_is_streaming(ctx)) { 280 vb2_buffer_done(&ctx->buf->vb, VB2_BUF_STATE_ERROR); 281 ctx->buf = NULL; 282 break; 283 } 284 285 /* Fill buffer */ 286 vbuf = vb2_plane_vaddr(&ctx->buf->vb, 0); 287 288 ll = min(todo, ctx->remain); 289 memcpy(vbuf+ctx->offset, psrc, ll); 290 todo -= ll; 291 psrc += ll; 292 293 ctx->remain -= ll; 294 ctx->offset += ll; 295 296 if (ctx->remain == 0) { 297 vb2_buffer_done(&ctx->buf->vb, VB2_BUF_STATE_DONE); 298 ctx->buf = NULL; 299 } 300 } 301 302 if (ctx->nonblocking && ctx->buf) { 303 vb2_buffer_done(&ctx->buf->vb, VB2_BUF_STATE_DONE); 304 ctx->buf = NULL; 305 } 306 307 if (todo) 308 dprintk(1, "[%s] %d bytes are dropped.\n", ctx->name, todo); 309 else 310 dprintk(3, "[%s]\n", ctx->name); 311 312 return (len - todo); 313 } 314 315 int dvb_vb2_reqbufs(struct dvb_vb2_ctx *ctx, struct dmx_requestbuffers *req) 316 { 317 int ret; 318 319 ctx->buf_siz = req->size; 320 ctx->buf_cnt = req->count; 321 > 322 ret = vb2_core_reqbufs(&ctx->vb_q, VB2_MEMORY_MMAP, &req->count); 323 if (ret) { 324 ctx->state = DVB_VB2_STATE_NONE; 325 dprintk(1, "[%s] count=%d size=%d errno=%d\n", ctx->name, --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: Binary data