From 2548fee63d9eb43299dacd0ca30dd9d8f407d795 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Tue, 16 Feb 2016 07:30:19 -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 Cc: Kyungmin Park Cc: Sylwester Nawrocki Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/s5p-mfc/s5p_mfc.c | 18 +----------------- drivers/media/platform/s5p-mfc/s5p_mfc_common.h | 2 -- drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 10 ++++------ drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | 14 +++++--------- 4 files changed, 10 insertions(+), 34 deletions(-) (limited to 'drivers/media/platform/s5p-mfc') diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c index c6f92c464378..e3f104fafd0a 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c @@ -1192,23 +1192,13 @@ static int s5p_mfc_probe(struct platform_device *pdev) } vb2_dma_contig_set_max_seg_size(dev->mem_dev_l, DMA_BIT_MASK(32)); - dev->alloc_ctx[0] = vb2_dma_contig_init_ctx(dev->mem_dev_l); - if (IS_ERR(dev->alloc_ctx[0])) { - ret = PTR_ERR(dev->alloc_ctx[0]); - goto err_res; - } vb2_dma_contig_set_max_seg_size(dev->mem_dev_r, DMA_BIT_MASK(32)); - dev->alloc_ctx[1] = vb2_dma_contig_init_ctx(dev->mem_dev_r); - if (IS_ERR(dev->alloc_ctx[1])) { - ret = PTR_ERR(dev->alloc_ctx[1]); - goto err_mem_init_ctx_1; - } mutex_init(&dev->mfc_mutex); ret = s5p_mfc_alloc_firmware(dev); if (ret) - goto err_alloc_fw; + goto err_res; ret = v4l2_device_register(&pdev->dev, &dev->v4l2_dev); if (ret) @@ -1294,10 +1284,6 @@ err_dec_alloc: v4l2_device_unregister(&dev->v4l2_dev); err_v4l2_dev_reg: s5p_mfc_release_firmware(dev); -err_alloc_fw: - vb2_dma_contig_cleanup_ctx(dev->alloc_ctx[1]); -err_mem_init_ctx_1: - vb2_dma_contig_cleanup_ctx(dev->alloc_ctx[0]); err_res: s5p_mfc_final_pm(dev); err_dma: @@ -1325,8 +1311,6 @@ static int s5p_mfc_remove(struct platform_device *pdev) video_device_release(dev->vfd_dec); v4l2_device_unregister(&dev->v4l2_dev); s5p_mfc_release_firmware(dev); - vb2_dma_contig_cleanup_ctx(dev->alloc_ctx[0]); - vb2_dma_contig_cleanup_ctx(dev->alloc_ctx[1]); s5p_mfc_unconfigure_dma_memory(dev); vb2_dma_contig_clear_max_seg_size(dev->mem_dev_l); vb2_dma_contig_clear_max_seg_size(dev->mem_dev_r); diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h index a10dcd244ff0..373e346fce3e 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h @@ -287,7 +287,6 @@ struct s5p_mfc_priv_buf { * @watchdog_cnt: counter for the watchdog * @watchdog_workqueue: workqueue for the watchdog * @watchdog_work: worker for the watchdog - * @alloc_ctx: videobuf2 allocator contexts for two memory banks * @enter_suspend: flag set when entering suspend * @ctx_buf: common context memory (MFCv6) * @warn_start: hardware error code from which warnings start @@ -330,7 +329,6 @@ struct s5p_mfc_dev { struct timer_list watchdog_timer; struct workqueue_struct *watchdog_workqueue; struct work_struct watchdog_work; - void *alloc_ctx[2]; unsigned long enter_suspend; struct s5p_mfc_priv_buf ctx_buf; diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c index 889d1c8c91e3..ae98a5568b69 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c @@ -931,16 +931,14 @@ static int s5p_mfc_queue_setup(struct vb2_queue *vq, psize[1] = ctx->chroma_size; if (IS_MFCV6_PLUS(dev)) - allocators[0] = - ctx->dev->alloc_ctx[MFC_BANK1_ALLOC_CTX]; + allocators[0] = &ctx->dev->mem_dev_l; else - allocators[0] = - ctx->dev->alloc_ctx[MFC_BANK2_ALLOC_CTX]; - allocators[1] = ctx->dev->alloc_ctx[MFC_BANK1_ALLOC_CTX]; + allocators[0] = &ctx->dev->mem_dev_r; + allocators[1] = &ctx->dev->mem_dev_l; } else if (vq->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE && ctx->state == MFCINST_INIT) { psize[0] = ctx->dec_src_buf_size; - allocators[0] = ctx->dev->alloc_ctx[MFC_BANK1_ALLOC_CTX]; + allocators[0] = &ctx->dev->mem_dev_l; } else { mfc_err("This video node is dedicated to decoding. Decoding not initialized\n"); return -EINVAL; diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c index fd961515a908..b95796a0cc33 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c @@ -1832,7 +1832,7 @@ static int s5p_mfc_queue_setup(struct vb2_queue *vq, if (*buf_count > MFC_MAX_BUFFERS) *buf_count = MFC_MAX_BUFFERS; psize[0] = ctx->enc_dst_buf_size; - allocators[0] = ctx->dev->alloc_ctx[MFC_BANK1_ALLOC_CTX]; + allocators[0] = &ctx->dev->mem_dev_l; } else if (vq->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { if (ctx->src_fmt) *plane_count = ctx->src_fmt->num_planes; @@ -1848,15 +1848,11 @@ static int s5p_mfc_queue_setup(struct vb2_queue *vq, psize[1] = ctx->chroma_size; if (IS_MFCV6_PLUS(dev)) { - allocators[0] = - ctx->dev->alloc_ctx[MFC_BANK1_ALLOC_CTX]; - allocators[1] = - ctx->dev->alloc_ctx[MFC_BANK1_ALLOC_CTX]; + allocators[0] = &ctx->dev->mem_dev_l; + allocators[1] = &ctx->dev->mem_dev_l; } else { - allocators[0] = - ctx->dev->alloc_ctx[MFC_BANK2_ALLOC_CTX]; - allocators[1] = - ctx->dev->alloc_ctx[MFC_BANK2_ALLOC_CTX]; + allocators[0] = &ctx->dev->mem_dev_r; + allocators[1] = &ctx->dev->mem_dev_r; } } else { mfc_err("invalid queue type: %d\n", vq->type); -- cgit v1.2.3-59-g8ed1b