]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[media] media: s5p-mfc: use vb2_ops_wait_prepare/finish helper
authorPrabhakar Lad <prabhakar.csengg@gmail.com>
Wed, 26 Nov 2014 22:42:32 +0000 (19:42 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Mon, 22 Dec 2014 16:36:21 +0000 (14:36 -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: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Kamil Debski <k.debski@samsung.com>
Cc: Jeongtae Park <jtp.park@samsung.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/platform/s5p-mfc/s5p_mfc.c
drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
drivers/media/platform/s5p-mfc/s5p_mfc_enc.c

index fbfdf03b9054ac1bd7c9435009e27e3d04b9c601..8e44a59d8ec20f17bcfd601fd4a8c7abdaf8a530 100644 (file)
@@ -810,6 +810,7 @@ static int s5p_mfc_open(struct file *file)
        q = &ctx->vq_dst;
        q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
        q->drv_priv = &ctx->fh;
+       q->lock = &dev->mfc_mutex;
        if (vdev == dev->vfd_dec) {
                q->io_modes = VB2_MMAP;
                q->ops = get_dec_queue_ops();
index c6c3452ccca16d8f93babd124db74ca3b3391553..9b14827ef4b99eeff6b64e3171c7d67b948c0ba6 100644 (file)
@@ -944,22 +944,6 @@ static int s5p_mfc_queue_setup(struct vb2_queue *vq,
        return 0;
 }
 
-static void s5p_mfc_unlock(struct vb2_queue *q)
-{
-       struct s5p_mfc_ctx *ctx = fh_to_ctx(q->drv_priv);
-       struct s5p_mfc_dev *dev = ctx->dev;
-
-       mutex_unlock(&dev->mfc_mutex);
-}
-
-static void s5p_mfc_lock(struct vb2_queue *q)
-{
-       struct s5p_mfc_ctx *ctx = fh_to_ctx(q->drv_priv);
-       struct s5p_mfc_dev *dev = ctx->dev;
-
-       mutex_lock(&dev->mfc_mutex);
-}
-
 static int s5p_mfc_buf_init(struct vb2_buffer *vb)
 {
        struct vb2_queue *vq = vb->vb2_queue;
@@ -1107,8 +1091,8 @@ static void s5p_mfc_buf_queue(struct vb2_buffer *vb)
 
 static struct vb2_ops s5p_mfc_dec_qops = {
        .queue_setup            = s5p_mfc_queue_setup,
-       .wait_prepare           = s5p_mfc_unlock,
-       .wait_finish            = s5p_mfc_lock,
+       .wait_prepare           = vb2_ops_wait_prepare,
+       .wait_finish            = vb2_ops_wait_finish,
        .buf_init               = s5p_mfc_buf_init,
        .start_streaming        = s5p_mfc_start_streaming,
        .stop_streaming         = s5p_mfc_stop_streaming,
index bd64f1dcbdb50f6b7123cac8759d70d2ed62bb10..ac12f653ddce08c0c75cfb3954cfe4d630601ee7 100644 (file)
@@ -1867,22 +1867,6 @@ static int s5p_mfc_queue_setup(struct vb2_queue *vq,
        return 0;
 }
 
-static void s5p_mfc_unlock(struct vb2_queue *q)
-{
-       struct s5p_mfc_ctx *ctx = fh_to_ctx(q->drv_priv);
-       struct s5p_mfc_dev *dev = ctx->dev;
-
-       mutex_unlock(&dev->mfc_mutex);
-}
-
-static void s5p_mfc_lock(struct vb2_queue *q)
-{
-       struct s5p_mfc_ctx *ctx = fh_to_ctx(q->drv_priv);
-       struct s5p_mfc_dev *dev = ctx->dev;
-
-       mutex_lock(&dev->mfc_mutex);
-}
-
 static int s5p_mfc_buf_init(struct vb2_buffer *vb)
 {
        struct vb2_queue *vq = vb->vb2_queue;
@@ -2052,8 +2036,8 @@ static void s5p_mfc_buf_queue(struct vb2_buffer *vb)
 
 static struct vb2_ops s5p_mfc_enc_qops = {
        .queue_setup            = s5p_mfc_queue_setup,
-       .wait_prepare           = s5p_mfc_unlock,
-       .wait_finish            = s5p_mfc_lock,
+       .wait_prepare           = vb2_ops_wait_prepare,
+       .wait_finish            = vb2_ops_wait_finish,
        .buf_init               = s5p_mfc_buf_init,
        .buf_prepare            = s5p_mfc_buf_prepare,
        .start_streaming        = s5p_mfc_start_streaming,