Skip to content

Commit 8f10c2d

Browse files
Hans Verkuilmchehab
authored andcommitted
[media] v4l2-pci-skeleton: set q->dev instead of allocating a context
Stop using alloc_ctx as that is now no longer needed. Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent 20be7ab commit 8f10c2d

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

samples/v4l/v4l2-pci-skeleton.c

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ MODULE_LICENSE("GPL v2");
5656
* @format: current pix format
5757
* @input: current video input (0 = SDTV, 1 = HDTV)
5858
* @queue: vb2 video capture queue
59-
* @alloc_ctx: vb2 contiguous DMA context
6059
* @qlock: spinlock controlling access to buf_list and sequence
6160
* @buf_list: list of buffers queued for DMA
6261
* @sequence: frame sequence counter
@@ -73,7 +72,6 @@ struct skeleton {
7372
unsigned input;
7473

7574
struct vb2_queue queue;
76-
struct vb2_alloc_ctx *alloc_ctx;
7775

7876
spinlock_t qlock;
7977
struct list_head buf_list;
@@ -182,7 +180,6 @@ static int queue_setup(struct vb2_queue *vq,
182180

183181
if (vq->num_buffers + *nbuffers < 3)
184182
*nbuffers = 3 - vq->num_buffers;
185-
alloc_ctxs[0] = skel->alloc_ctx;
186183

187184
if (*nplanes)
188185
return sizes[0] < skel->format.sizeimage ? -EINVAL : 0;
@@ -820,6 +817,7 @@ static int skeleton_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
820817
q = &skel->queue;
821818
q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
822819
q->io_modes = VB2_MMAP | VB2_DMABUF | VB2_READ;
820+
q->dev = &pdev->dev;
823821
q->drv_priv = skel;
824822
q->buf_struct_size = sizeof(struct skel_buffer);
825823
q->ops = &skel_qops;
@@ -850,12 +848,6 @@ static int skeleton_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
850848
if (ret)
851849
goto free_hdl;
852850

853-
skel->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev);
854-
if (IS_ERR(skel->alloc_ctx)) {
855-
dev_err(&pdev->dev, "Can't allocate buffer context");
856-
ret = PTR_ERR(skel->alloc_ctx);
857-
goto free_hdl;
858-
}
859851
INIT_LIST_HEAD(&skel->buf_list);
860852
spin_lock_init(&skel->qlock);
861853

@@ -885,13 +877,11 @@ static int skeleton_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
885877

886878
ret = video_register_device(vdev, VFL_TYPE_GRABBER, -1);
887879
if (ret)
888-
goto free_ctx;
880+
goto free_hdl;
889881

890882
dev_info(&pdev->dev, "V4L2 PCI Skeleton Driver loaded\n");
891883
return 0;
892884

893-
free_ctx:
894-
vb2_dma_contig_cleanup_ctx(skel->alloc_ctx);
895885
free_hdl:
896886
v4l2_ctrl_handler_free(&skel->ctrl_handler);
897887
v4l2_device_unregister(&skel->v4l2_dev);
@@ -907,7 +897,6 @@ static void skeleton_remove(struct pci_dev *pdev)
907897

908898
video_unregister_device(&skel->vdev);
909899
v4l2_ctrl_handler_free(&skel->ctrl_handler);
910-
vb2_dma_contig_cleanup_ctx(skel->alloc_ctx);
911900
v4l2_device_unregister(&skel->v4l2_dev);
912901
pci_disable_device(skel->pdev);
913902
}

0 commit comments

Comments
 (0)