From dce57314b53760b6f9190c98287ce8f89c80d233 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 15 Feb 2016 13:24:11 -0200 Subject: [media] media/platform: 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 Acked-by: Fabien Dessenne Acked-by: Benoit Parrot Reviewed-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/ti-vpe/cal.c | 15 +-------------- drivers/media/platform/ti-vpe/vpe.c | 20 ++++---------------- 2 files changed, 5 insertions(+), 30 deletions(-) (limited to 'drivers/media/platform/ti-vpe') diff --git a/drivers/media/platform/ti-vpe/cal.c b/drivers/media/platform/ti-vpe/cal.c index 82001e6b5553..51ebf32c659c 100644 --- a/drivers/media/platform/ti-vpe/cal.c +++ b/drivers/media/platform/ti-vpe/cal.c @@ -287,7 +287,6 @@ struct cal_ctx { /* Several counters */ unsigned long jiffies; - struct vb2_alloc_ctx *alloc_ctx; struct cal_dmaqueue vidq; /* Input Number */ @@ -1233,7 +1232,6 @@ static int cal_queue_setup(struct vb2_queue *vq, if (vq->num_buffers + *nbuffers < 3) *nbuffers = 3 - vq->num_buffers; - alloc_ctxs[0] = ctx->alloc_ctx; if (*nplanes) { if (sizes[0] < size) @@ -1551,6 +1549,7 @@ static int cal_complete_ctx(struct cal_ctx *ctx) q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; q->lock = &ctx->mutex; q->min_buffers_needed = 3; + q->dev = ctx->v4l2_dev.dev; ret = vb2_queue_init(q); if (ret) @@ -1578,18 +1577,7 @@ static int cal_complete_ctx(struct cal_ctx *ctx) v4l2_info(&ctx->v4l2_dev, "V4L2 device registered as %s\n", video_device_node_name(vfd)); - ctx->alloc_ctx = vb2_dma_contig_init_ctx(vfd->v4l2_dev->dev); - if (IS_ERR(ctx->alloc_ctx)) { - ctx_err(ctx, "Failed to alloc vb2 context\n"); - ret = PTR_ERR(ctx->alloc_ctx); - goto vdev_unreg; - } - return 0; - -vdev_unreg: - video_unregister_device(vfd); - return ret; } static struct device_node * @@ -1914,7 +1902,6 @@ static int cal_remove(struct platform_device *pdev) video_device_node_name(&ctx->vdev)); camerarx_phy_disable(ctx); v4l2_async_notifier_unregister(&ctx->notifier); - vb2_dma_contig_cleanup_ctx(ctx->alloc_ctx); v4l2_ctrl_handler_free(&ctx->ctrl_handler); v4l2_device_unregister(&ctx->v4l2_dev); video_unregister_device(&ctx->vdev); diff --git a/drivers/media/platform/ti-vpe/vpe.c b/drivers/media/platform/ti-vpe/vpe.c index 1fa00c2cf3d7..3fefd8ad37af 100644 --- a/drivers/media/platform/ti-vpe/vpe.c +++ b/drivers/media/platform/ti-vpe/vpe.c @@ -362,7 +362,6 @@ struct vpe_dev { void __iomem *base; struct resource *res; - struct vb2_alloc_ctx *alloc_ctx; struct vpdma_data *vpdma; /* vpdma data handle */ struct sc_data *sc; /* scaler data handle */ struct csc_data *csc; /* csc data handle */ @@ -1807,10 +1806,8 @@ static int vpe_queue_setup(struct vb2_queue *vq, *nplanes = q_data->fmt->coplanar ? 2 : 1; - for (i = 0; i < *nplanes; i++) { + for (i = 0; i < *nplanes; i++) sizes[i] = q_data->sizeimage[i]; - alloc_ctxs[i] = ctx->dev->alloc_ctx; - } vpe_dbg(ctx->dev, "get %d buffer(s) of size %d", *nbuffers, sizes[VPE_LUMA]); @@ -1907,6 +1904,7 @@ static int queue_init(void *priv, struct vb2_queue *src_vq, src_vq->mem_ops = &vb2_dma_contig_memops; src_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY; src_vq->lock = &dev->dev_mutex; + src_vq->dev = dev->v4l2_dev.dev; ret = vb2_queue_init(src_vq); if (ret) @@ -1921,6 +1919,7 @@ static int queue_init(void *priv, struct vb2_queue *src_vq, dst_vq->mem_ops = &vb2_dma_contig_memops; dst_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY; dst_vq->lock = &dev->dev_mutex; + dst_vq->dev = dev->v4l2_dev.dev; return vb2_queue_init(dst_vq); } @@ -2161,7 +2160,6 @@ static void vpe_fw_cb(struct platform_device *pdev) vpe_runtime_put(pdev); pm_runtime_disable(&pdev->dev); v4l2_m2m_release(dev->m2m_dev); - vb2_dma_contig_cleanup_ctx(dev->alloc_ctx); v4l2_device_unregister(&dev->v4l2_dev); return; @@ -2213,18 +2211,11 @@ static int vpe_probe(struct platform_device *pdev) platform_set_drvdata(pdev, dev); - dev->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev); - if (IS_ERR(dev->alloc_ctx)) { - vpe_err(dev, "Failed to alloc vb2 context\n"); - ret = PTR_ERR(dev->alloc_ctx); - goto v4l2_dev_unreg; - } - dev->m2m_dev = v4l2_m2m_init(&m2m_ops); if (IS_ERR(dev->m2m_dev)) { vpe_err(dev, "Failed to init mem2mem device\n"); ret = PTR_ERR(dev->m2m_dev); - goto rel_ctx; + goto v4l2_dev_unreg; } pm_runtime_enable(&pdev->dev); @@ -2269,8 +2260,6 @@ runtime_put: rel_m2m: pm_runtime_disable(&pdev->dev); v4l2_m2m_release(dev->m2m_dev); -rel_ctx: - vb2_dma_contig_cleanup_ctx(dev->alloc_ctx); v4l2_dev_unreg: v4l2_device_unregister(&dev->v4l2_dev); @@ -2286,7 +2275,6 @@ static int vpe_remove(struct platform_device *pdev) v4l2_m2m_release(dev->m2m_dev); video_unregister_device(&dev->vfd); v4l2_device_unregister(&dev->v4l2_dev); - vb2_dma_contig_cleanup_ctx(dev->alloc_ctx); vpe_set_clock_enable(dev, 0); vpe_runtime_put(pdev); -- cgit v1.2.3