diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2016-02-15 09:58:44 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2016-07-08 13:38:31 -0400 |
commit | 57813da417f9c9aff1299a24182f590deac08c19 (patch) | |
tree | c11fb3013ef277290467e45fe8d5d4b899803054 | |
parent | 77516a85cb8ee29b14577c5aa8dd29f4bbc92efd (diff) |
[media] staging/media: convert drivers to use the new vb2_queue dev field
Stop using alloc_ctx and just fill in the device pointer.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
-rw-r--r-- | drivers/staging/media/davinci_vpfe/vpfe_video.c | 10 | ||||
-rw-r--r-- | drivers/staging/media/davinci_vpfe/vpfe_video.h | 2 | ||||
-rw-r--r-- | drivers/staging/media/omap4iss/iss_video.c | 10 | ||||
-rw-r--r-- | drivers/staging/media/omap4iss/iss_video.h | 1 |
4 files changed, 2 insertions, 21 deletions
diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c b/drivers/staging/media/davinci_vpfe/vpfe_video.c index ea3ddec75806..77e66e75ffce 100644 --- a/drivers/staging/media/davinci_vpfe/vpfe_video.c +++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c | |||
@@ -542,7 +542,6 @@ static int vpfe_release(struct file *file) | |||
542 | video->io_usrs = 0; | 542 | video->io_usrs = 0; |
543 | /* Free buffers allocated */ | 543 | /* Free buffers allocated */ |
544 | vb2_queue_release(&video->buffer_queue); | 544 | vb2_queue_release(&video->buffer_queue); |
545 | vb2_dma_contig_cleanup_ctx(video->alloc_ctx); | ||
546 | } | 545 | } |
547 | /* Decrement device users counter */ | 546 | /* Decrement device users counter */ |
548 | video->usrs--; | 547 | video->usrs--; |
@@ -1115,7 +1114,6 @@ vpfe_buffer_queue_setup(struct vb2_queue *vq, | |||
1115 | 1114 | ||
1116 | *nplanes = 1; | 1115 | *nplanes = 1; |
1117 | sizes[0] = size; | 1116 | sizes[0] = size; |
1118 | alloc_ctxs[0] = video->alloc_ctx; | ||
1119 | v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, | 1117 | v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, |
1120 | "nbuffers=%d, size=%lu\n", *nbuffers, size); | 1118 | "nbuffers=%d, size=%lu\n", *nbuffers, size); |
1121 | return 0; | 1119 | return 0; |
@@ -1350,12 +1348,6 @@ static int vpfe_reqbufs(struct file *file, void *priv, | |||
1350 | video->memory = req_buf->memory; | 1348 | video->memory = req_buf->memory; |
1351 | 1349 | ||
1352 | /* Initialize videobuf2 queue as per the buffer type */ | 1350 | /* Initialize videobuf2 queue as per the buffer type */ |
1353 | video->alloc_ctx = vb2_dma_contig_init_ctx(vpfe_dev->pdev); | ||
1354 | if (IS_ERR(video->alloc_ctx)) { | ||
1355 | v4l2_err(&vpfe_dev->v4l2_dev, "Failed to get the context\n"); | ||
1356 | return PTR_ERR(video->alloc_ctx); | ||
1357 | } | ||
1358 | |||
1359 | q = &video->buffer_queue; | 1351 | q = &video->buffer_queue; |
1360 | q->type = req_buf->type; | 1352 | q->type = req_buf->type; |
1361 | q->io_modes = VB2_MMAP | VB2_USERPTR; | 1353 | q->io_modes = VB2_MMAP | VB2_USERPTR; |
@@ -1365,11 +1357,11 @@ static int vpfe_reqbufs(struct file *file, void *priv, | |||
1365 | q->mem_ops = &vb2_dma_contig_memops; | 1357 | q->mem_ops = &vb2_dma_contig_memops; |
1366 | q->buf_struct_size = sizeof(struct vpfe_cap_buffer); | 1358 | q->buf_struct_size = sizeof(struct vpfe_cap_buffer); |
1367 | q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; | 1359 | q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; |
1360 | q->dev = vpfe_dev->pdev; | ||
1368 | 1361 | ||
1369 | ret = vb2_queue_init(q); | 1362 | ret = vb2_queue_init(q); |
1370 | if (ret) { | 1363 | if (ret) { |
1371 | v4l2_err(&vpfe_dev->v4l2_dev, "vb2_queue_init() failed\n"); | 1364 | v4l2_err(&vpfe_dev->v4l2_dev, "vb2_queue_init() failed\n"); |
1372 | vb2_dma_contig_cleanup_ctx(vpfe_dev->pdev); | ||
1373 | return ret; | 1365 | return ret; |
1374 | } | 1366 | } |
1375 | 1367 | ||
diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.h b/drivers/staging/media/davinci_vpfe/vpfe_video.h index 653334d537d3..aaec4403df3b 100644 --- a/drivers/staging/media/davinci_vpfe/vpfe_video.h +++ b/drivers/staging/media/davinci_vpfe/vpfe_video.h | |||
@@ -123,8 +123,6 @@ struct vpfe_video_device { | |||
123 | /* Used to store pixel format */ | 123 | /* Used to store pixel format */ |
124 | struct v4l2_format fmt; | 124 | struct v4l2_format fmt; |
125 | struct vb2_queue buffer_queue; | 125 | struct vb2_queue buffer_queue; |
126 | /* allocator-specific contexts for each plane */ | ||
127 | struct vb2_alloc_ctx *alloc_ctx; | ||
128 | /* Queue of filled frames */ | 126 | /* Queue of filled frames */ |
129 | struct list_head dma_queue; | 127 | struct list_head dma_queue; |
130 | spinlock_t irqlock; | 128 | spinlock_t irqlock; |
diff --git a/drivers/staging/media/omap4iss/iss_video.c b/drivers/staging/media/omap4iss/iss_video.c index cf8da23558bb..3c077e378267 100644 --- a/drivers/staging/media/omap4iss/iss_video.c +++ b/drivers/staging/media/omap4iss/iss_video.c | |||
@@ -310,8 +310,6 @@ static int iss_video_queue_setup(struct vb2_queue *vq, | |||
310 | if (sizes[0] == 0) | 310 | if (sizes[0] == 0) |
311 | return -EINVAL; | 311 | return -EINVAL; |
312 | 312 | ||
313 | alloc_ctxs[0] = video->alloc_ctx; | ||
314 | |||
315 | *count = min(*count, video->capture_mem / PAGE_ALIGN(sizes[0])); | 313 | *count = min(*count, video->capture_mem / PAGE_ALIGN(sizes[0])); |
316 | 314 | ||
317 | return 0; | 315 | return 0; |
@@ -1017,13 +1015,6 @@ static int iss_video_open(struct file *file) | |||
1017 | goto done; | 1015 | goto done; |
1018 | } | 1016 | } |
1019 | 1017 | ||
1020 | video->alloc_ctx = vb2_dma_contig_init_ctx(video->iss->dev); | ||
1021 | if (IS_ERR(video->alloc_ctx)) { | ||
1022 | ret = PTR_ERR(video->alloc_ctx); | ||
1023 | omap4iss_put(video->iss); | ||
1024 | goto done; | ||
1025 | } | ||
1026 | |||
1027 | q = &handle->queue; | 1018 | q = &handle->queue; |
1028 | 1019 | ||
1029 | q->type = video->type; | 1020 | q->type = video->type; |
@@ -1033,6 +1024,7 @@ static int iss_video_open(struct file *file) | |||
1033 | q->mem_ops = &vb2_dma_contig_memops; | 1024 | q->mem_ops = &vb2_dma_contig_memops; |
1034 | q->buf_struct_size = sizeof(struct iss_buffer); | 1025 | q->buf_struct_size = sizeof(struct iss_buffer); |
1035 | q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; | 1026 | q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; |
1027 | q->dev = video->iss->dev; | ||
1036 | 1028 | ||
1037 | ret = vb2_queue_init(q); | 1029 | ret = vb2_queue_init(q); |
1038 | if (ret) { | 1030 | if (ret) { |
diff --git a/drivers/staging/media/omap4iss/iss_video.h b/drivers/staging/media/omap4iss/iss_video.h index c8bd2958a3f8..d7e05d04512c 100644 --- a/drivers/staging/media/omap4iss/iss_video.h +++ b/drivers/staging/media/omap4iss/iss_video.h | |||
@@ -170,7 +170,6 @@ struct iss_video { | |||
170 | spinlock_t qlock; /* protects dmaqueue and error */ | 170 | spinlock_t qlock; /* protects dmaqueue and error */ |
171 | struct list_head dmaqueue; | 171 | struct list_head dmaqueue; |
172 | enum iss_video_dmaqueue_flags dmaqueue_flags; | 172 | enum iss_video_dmaqueue_flags dmaqueue_flags; |
173 | struct vb2_alloc_ctx *alloc_ctx; | ||
174 | 173 | ||
175 | const struct iss_video_operations *ops; | 174 | const struct iss_video_operations *ops; |
176 | }; | 175 | }; |