diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2015-12-16 05:32:48 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2016-07-08 13:34:57 -0400 |
commit | 8f10c2db775ebac0646b9651f32d7f8f0f0a029c (patch) | |
tree | c2aece3d875d33d02af4744baca98e35ea817b20 | |
parent | 20be7ab8dba68072b34ae2285c282290b2344339 (diff) |
[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 <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
-rw-r--r-- | samples/v4l/v4l2-pci-skeleton.c | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/samples/v4l/v4l2-pci-skeleton.c b/samples/v4l/v4l2-pci-skeleton.c index a55cf94ac907..5f91d76260ff 100644 --- a/samples/v4l/v4l2-pci-skeleton.c +++ b/samples/v4l/v4l2-pci-skeleton.c | |||
@@ -56,7 +56,6 @@ MODULE_LICENSE("GPL v2"); | |||
56 | * @format: current pix format | 56 | * @format: current pix format |
57 | * @input: current video input (0 = SDTV, 1 = HDTV) | 57 | * @input: current video input (0 = SDTV, 1 = HDTV) |
58 | * @queue: vb2 video capture queue | 58 | * @queue: vb2 video capture queue |
59 | * @alloc_ctx: vb2 contiguous DMA context | ||
60 | * @qlock: spinlock controlling access to buf_list and sequence | 59 | * @qlock: spinlock controlling access to buf_list and sequence |
61 | * @buf_list: list of buffers queued for DMA | 60 | * @buf_list: list of buffers queued for DMA |
62 | * @sequence: frame sequence counter | 61 | * @sequence: frame sequence counter |
@@ -73,7 +72,6 @@ struct skeleton { | |||
73 | unsigned input; | 72 | unsigned input; |
74 | 73 | ||
75 | struct vb2_queue queue; | 74 | struct vb2_queue queue; |
76 | struct vb2_alloc_ctx *alloc_ctx; | ||
77 | 75 | ||
78 | spinlock_t qlock; | 76 | spinlock_t qlock; |
79 | struct list_head buf_list; | 77 | struct list_head buf_list; |
@@ -182,7 +180,6 @@ static int queue_setup(struct vb2_queue *vq, | |||
182 | 180 | ||
183 | if (vq->num_buffers + *nbuffers < 3) | 181 | if (vq->num_buffers + *nbuffers < 3) |
184 | *nbuffers = 3 - vq->num_buffers; | 182 | *nbuffers = 3 - vq->num_buffers; |
185 | alloc_ctxs[0] = skel->alloc_ctx; | ||
186 | 183 | ||
187 | if (*nplanes) | 184 | if (*nplanes) |
188 | return sizes[0] < skel->format.sizeimage ? -EINVAL : 0; | 185 | 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) | |||
820 | q = &skel->queue; | 817 | q = &skel->queue; |
821 | q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 818 | q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
822 | q->io_modes = VB2_MMAP | VB2_DMABUF | VB2_READ; | 819 | q->io_modes = VB2_MMAP | VB2_DMABUF | VB2_READ; |
820 | q->dev = &pdev->dev; | ||
823 | q->drv_priv = skel; | 821 | q->drv_priv = skel; |
824 | q->buf_struct_size = sizeof(struct skel_buffer); | 822 | q->buf_struct_size = sizeof(struct skel_buffer); |
825 | q->ops = &skel_qops; | 823 | q->ops = &skel_qops; |
@@ -850,12 +848,6 @@ static int skeleton_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
850 | if (ret) | 848 | if (ret) |
851 | goto free_hdl; | 849 | goto free_hdl; |
852 | 850 | ||
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 | } | ||
859 | INIT_LIST_HEAD(&skel->buf_list); | 851 | INIT_LIST_HEAD(&skel->buf_list); |
860 | spin_lock_init(&skel->qlock); | 852 | spin_lock_init(&skel->qlock); |
861 | 853 | ||
@@ -885,13 +877,11 @@ static int skeleton_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
885 | 877 | ||
886 | ret = video_register_device(vdev, VFL_TYPE_GRABBER, -1); | 878 | ret = video_register_device(vdev, VFL_TYPE_GRABBER, -1); |
887 | if (ret) | 879 | if (ret) |
888 | goto free_ctx; | 880 | goto free_hdl; |
889 | 881 | ||
890 | dev_info(&pdev->dev, "V4L2 PCI Skeleton Driver loaded\n"); | 882 | dev_info(&pdev->dev, "V4L2 PCI Skeleton Driver loaded\n"); |
891 | return 0; | 883 | return 0; |
892 | 884 | ||
893 | free_ctx: | ||
894 | vb2_dma_contig_cleanup_ctx(skel->alloc_ctx); | ||
895 | free_hdl: | 885 | free_hdl: |
896 | v4l2_ctrl_handler_free(&skel->ctrl_handler); | 886 | v4l2_ctrl_handler_free(&skel->ctrl_handler); |
897 | v4l2_device_unregister(&skel->v4l2_dev); | 887 | v4l2_device_unregister(&skel->v4l2_dev); |
@@ -907,7 +897,6 @@ static void skeleton_remove(struct pci_dev *pdev) | |||
907 | 897 | ||
908 | video_unregister_device(&skel->vdev); | 898 | video_unregister_device(&skel->vdev); |
909 | v4l2_ctrl_handler_free(&skel->ctrl_handler); | 899 | v4l2_ctrl_handler_free(&skel->ctrl_handler); |
910 | vb2_dma_contig_cleanup_ctx(skel->alloc_ctx); | ||
911 | v4l2_device_unregister(&skel->v4l2_dev); | 900 | v4l2_device_unregister(&skel->v4l2_dev); |
912 | pci_disable_device(skel->pdev); | 901 | pci_disable_device(skel->pdev); |
913 | } | 902 | } |