[media] media: exynos-gsc: use vb2_ops_wait_prepare/finish helper
authorPrabhakar Lad <prabhakar.csengg@gmail.com>
Wed, 26 Nov 2014 22:42:26 +0000 (19:42 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Mon, 22 Dec 2014 16:34:35 +0000 (14:34 -0200)
This patch drops driver specific wait_prepare() and
wait_finish() callbacks from vb2_ops and instead uses
the the helpers vb2_ops_wait_prepare/finish() provided
by the vb2 core, the lock member of the queue needs
to be initalized to a mutex so that vb2 helpers
vb2_ops_wait_prepare/finish() can make use of it.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Cc: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/platform/exynos-gsc/gsc-core.h
drivers/media/platform/exynos-gsc/gsc-m2m.c

index 0abdb17fb19cceb590c636413749499a160a878e..fa572aacdb3f29ee65b56b51a7c4e11489c011c0 100644 (file)
@@ -466,18 +466,6 @@ static inline void gsc_hw_clear_irq(struct gsc_dev *dev, int irq)
        writel(cfg, dev->regs + GSC_IRQ);
 }
 
-static inline void gsc_lock(struct vb2_queue *vq)
-{
-       struct gsc_ctx *ctx = vb2_get_drv_priv(vq);
-       mutex_lock(&ctx->gsc_dev->lock);
-}
-
-static inline void gsc_unlock(struct vb2_queue *vq)
-{
-       struct gsc_ctx *ctx = vb2_get_drv_priv(vq);
-       mutex_unlock(&ctx->gsc_dev->lock);
-}
-
 static inline bool gsc_ctx_state_is_set(u32 mask, struct gsc_ctx *ctx)
 {
        unsigned long flags;
index 74e1de637e8f65fdb0f8b784e8e24e63374fd43a..d5cffef2e2271232d223b4f8a836af26c45b087f 100644 (file)
@@ -267,8 +267,8 @@ static struct vb2_ops gsc_m2m_qops = {
        .queue_setup     = gsc_m2m_queue_setup,
        .buf_prepare     = gsc_m2m_buf_prepare,
        .buf_queue       = gsc_m2m_buf_queue,
-       .wait_prepare    = gsc_unlock,
-       .wait_finish     = gsc_lock,
+       .wait_prepare    = vb2_ops_wait_prepare,
+       .wait_finish     = vb2_ops_wait_finish,
        .stop_streaming  = gsc_m2m_stop_streaming,
        .start_streaming = gsc_m2m_start_streaming,
 };
@@ -590,6 +590,7 @@ static int queue_init(void *priv, struct vb2_queue *src_vq,
        src_vq->mem_ops = &vb2_dma_contig_memops;
        src_vq->buf_struct_size = sizeof(struct v4l2_m2m_buffer);
        src_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
+       src_vq->lock = &ctx->gsc_dev->lock;
 
        ret = vb2_queue_init(src_vq);
        if (ret)
@@ -603,6 +604,7 @@ static int queue_init(void *priv, struct vb2_queue *src_vq,
        dst_vq->mem_ops = &vb2_dma_contig_memops;
        dst_vq->buf_struct_size = sizeof(struct v4l2_m2m_buffer);
        dst_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
+       dst_vq->lock = &ctx->gsc_dev->lock;
 
        return vb2_queue_init(dst_vq);
 }