Commit 57813da4 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[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: default avatarHans Verkuil <hans.verkuil@cisco.com>
Acked-by: default avatarLad, Prabhakar <prabhakar.csengg@gmail.com>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 77516a85
...@@ -542,7 +542,6 @@ static int vpfe_release(struct file *file) ...@@ -542,7 +542,6 @@ static int vpfe_release(struct file *file)
video->io_usrs = 0; video->io_usrs = 0;
/* Free buffers allocated */ /* Free buffers allocated */
vb2_queue_release(&video->buffer_queue); vb2_queue_release(&video->buffer_queue);
vb2_dma_contig_cleanup_ctx(video->alloc_ctx);
} }
/* Decrement device users counter */ /* Decrement device users counter */
video->usrs--; video->usrs--;
...@@ -1115,7 +1114,6 @@ vpfe_buffer_queue_setup(struct vb2_queue *vq, ...@@ -1115,7 +1114,6 @@ vpfe_buffer_queue_setup(struct vb2_queue *vq,
*nplanes = 1; *nplanes = 1;
sizes[0] = size; sizes[0] = size;
alloc_ctxs[0] = video->alloc_ctx;
v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev,
"nbuffers=%d, size=%lu\n", *nbuffers, size); "nbuffers=%d, size=%lu\n", *nbuffers, size);
return 0; return 0;
...@@ -1350,12 +1348,6 @@ static int vpfe_reqbufs(struct file *file, void *priv, ...@@ -1350,12 +1348,6 @@ static int vpfe_reqbufs(struct file *file, void *priv,
video->memory = req_buf->memory; video->memory = req_buf->memory;
/* Initialize videobuf2 queue as per the buffer type */ /* Initialize videobuf2 queue as per the buffer type */
video->alloc_ctx = vb2_dma_contig_init_ctx(vpfe_dev->pdev);
if (IS_ERR(video->alloc_ctx)) {
v4l2_err(&vpfe_dev->v4l2_dev, "Failed to get the context\n");
return PTR_ERR(video->alloc_ctx);
}
q = &video->buffer_queue; q = &video->buffer_queue;
q->type = req_buf->type; q->type = req_buf->type;
q->io_modes = VB2_MMAP | VB2_USERPTR; q->io_modes = VB2_MMAP | VB2_USERPTR;
...@@ -1365,11 +1357,11 @@ static int vpfe_reqbufs(struct file *file, void *priv, ...@@ -1365,11 +1357,11 @@ static int vpfe_reqbufs(struct file *file, void *priv,
q->mem_ops = &vb2_dma_contig_memops; q->mem_ops = &vb2_dma_contig_memops;
q->buf_struct_size = sizeof(struct vpfe_cap_buffer); q->buf_struct_size = sizeof(struct vpfe_cap_buffer);
q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
q->dev = vpfe_dev->pdev;
ret = vb2_queue_init(q); ret = vb2_queue_init(q);
if (ret) { if (ret) {
v4l2_err(&vpfe_dev->v4l2_dev, "vb2_queue_init() failed\n"); v4l2_err(&vpfe_dev->v4l2_dev, "vb2_queue_init() failed\n");
vb2_dma_contig_cleanup_ctx(vpfe_dev->pdev);
return ret; return ret;
} }
......
...@@ -123,8 +123,6 @@ struct vpfe_video_device { ...@@ -123,8 +123,6 @@ struct vpfe_video_device {
/* Used to store pixel format */ /* Used to store pixel format */
struct v4l2_format fmt; struct v4l2_format fmt;
struct vb2_queue buffer_queue; struct vb2_queue buffer_queue;
/* allocator-specific contexts for each plane */
struct vb2_alloc_ctx *alloc_ctx;
/* Queue of filled frames */ /* Queue of filled frames */
struct list_head dma_queue; struct list_head dma_queue;
spinlock_t irqlock; spinlock_t irqlock;
......
...@@ -310,8 +310,6 @@ static int iss_video_queue_setup(struct vb2_queue *vq, ...@@ -310,8 +310,6 @@ static int iss_video_queue_setup(struct vb2_queue *vq,
if (sizes[0] == 0) if (sizes[0] == 0)
return -EINVAL; return -EINVAL;
alloc_ctxs[0] = video->alloc_ctx;
*count = min(*count, video->capture_mem / PAGE_ALIGN(sizes[0])); *count = min(*count, video->capture_mem / PAGE_ALIGN(sizes[0]));
return 0; return 0;
...@@ -1017,13 +1015,6 @@ static int iss_video_open(struct file *file) ...@@ -1017,13 +1015,6 @@ static int iss_video_open(struct file *file)
goto done; goto done;
} }
video->alloc_ctx = vb2_dma_contig_init_ctx(video->iss->dev);
if (IS_ERR(video->alloc_ctx)) {
ret = PTR_ERR(video->alloc_ctx);
omap4iss_put(video->iss);
goto done;
}
q = &handle->queue; q = &handle->queue;
q->type = video->type; q->type = video->type;
...@@ -1033,6 +1024,7 @@ static int iss_video_open(struct file *file) ...@@ -1033,6 +1024,7 @@ static int iss_video_open(struct file *file)
q->mem_ops = &vb2_dma_contig_memops; q->mem_ops = &vb2_dma_contig_memops;
q->buf_struct_size = sizeof(struct iss_buffer); q->buf_struct_size = sizeof(struct iss_buffer);
q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
q->dev = video->iss->dev;
ret = vb2_queue_init(q); ret = vb2_queue_init(q);
if (ret) { if (ret) {
......
...@@ -170,7 +170,6 @@ struct iss_video { ...@@ -170,7 +170,6 @@ struct iss_video {
spinlock_t qlock; /* protects dmaqueue and error */ spinlock_t qlock; /* protects dmaqueue and error */
struct list_head dmaqueue; struct list_head dmaqueue;
enum iss_video_dmaqueue_flags dmaqueue_flags; enum iss_video_dmaqueue_flags dmaqueue_flags;
struct vb2_alloc_ctx *alloc_ctx;
const struct iss_video_operations *ops; const struct iss_video_operations *ops;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment