[media] media: vivid: use vb2_ops_wait_prepare/finish helper
authorPrabhakar Lad <prabhakar.csengg@gmail.com>
Tue, 18 Nov 2014 11:23:39 +0000 (08:23 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Tue, 25 Nov 2014 10:12:30 +0000 (08:12 -0200)
Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/platform/vivid/vivid-core.c
drivers/media/platform/vivid/vivid-core.h
drivers/media/platform/vivid/vivid-sdr-cap.c
drivers/media/platform/vivid/vivid-vbi-cap.c
drivers/media/platform/vivid/vivid-vbi-out.c
drivers/media/platform/vivid/vivid-vid-cap.c
drivers/media/platform/vivid/vivid-vid-out.c

index 686c3c2ad05bcdb1fb9e28246f78cccdef514872..987a46cdea5e66f79f5ebd7f93d840ee2c500951 100644 (file)
@@ -195,20 +195,6 @@ static const u8 vivid_hdmi_edid[256] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd7
 };
 
-void vivid_lock(struct vb2_queue *vq)
-{
-       struct vivid_dev *dev = vb2_get_drv_priv(vq);
-
-       mutex_lock(&dev->mutex);
-}
-
-void vivid_unlock(struct vb2_queue *vq)
-{
-       struct vivid_dev *dev = vb2_get_drv_priv(vq);
-
-       mutex_unlock(&dev->mutex);
-}
-
 static int vidioc_querycap(struct file *file, void  *priv,
                                        struct v4l2_capability *cap)
 {
@@ -1018,6 +1004,7 @@ static int __init vivid_create_instance(int inst)
                q->mem_ops = &vb2_vmalloc_memops;
                q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
                q->min_buffers_needed = 2;
+               q->lock = &dev->mutex;
 
                ret = vb2_queue_init(q);
                if (ret)
@@ -1036,6 +1023,7 @@ static int __init vivid_create_instance(int inst)
                q->mem_ops = &vb2_vmalloc_memops;
                q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
                q->min_buffers_needed = 2;
+               q->lock = &dev->mutex;
 
                ret = vb2_queue_init(q);
                if (ret)
@@ -1054,6 +1042,7 @@ static int __init vivid_create_instance(int inst)
                q->mem_ops = &vb2_vmalloc_memops;
                q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
                q->min_buffers_needed = 2;
+               q->lock = &dev->mutex;
 
                ret = vb2_queue_init(q);
                if (ret)
@@ -1072,6 +1061,7 @@ static int __init vivid_create_instance(int inst)
                q->mem_ops = &vb2_vmalloc_memops;
                q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
                q->min_buffers_needed = 2;
+               q->lock = &dev->mutex;
 
                ret = vb2_queue_init(q);
                if (ret)
@@ -1089,6 +1079,7 @@ static int __init vivid_create_instance(int inst)
                q->mem_ops = &vb2_vmalloc_memops;
                q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
                q->min_buffers_needed = 8;
+               q->lock = &dev->mutex;
 
                ret = vb2_queue_init(q);
                if (ret)
index 811c286491a5a670e870108b1c723dc24a0d8960..6f4445ad7d4d83981ac5b234ecdbd3c33c8451b3 100644 (file)
@@ -514,7 +514,4 @@ static inline bool vivid_is_hdmi_out(const struct vivid_dev *dev)
        return dev->output_type[dev->output] == HDMI;
 }
 
-void vivid_lock(struct vb2_queue *vq);
-void vivid_unlock(struct vb2_queue *vq);
-
 #endif
index 8c5d661cfc49656c4820600a72997da9dd799d71..4af55f18829f78eb640d2677d6535cfb387a291a 100644 (file)
@@ -297,8 +297,8 @@ const struct vb2_ops vivid_sdr_cap_qops = {
        .buf_queue              = sdr_cap_buf_queue,
        .start_streaming        = sdr_cap_start_streaming,
        .stop_streaming         = sdr_cap_stop_streaming,
-       .wait_prepare           = vivid_unlock,
-       .wait_finish            = vivid_lock,
+       .wait_prepare           = vb2_ops_wait_prepare,
+       .wait_finish            = vb2_ops_wait_finish,
 };
 
 int vivid_sdr_enum_freq_bands(struct file *file, void *fh, struct v4l2_frequency_band *band)
index 2166d0bf6fe27a33c4ee433a716ff91c330cc032..ef81b01b53d22a4fc577c676f5efeb687ab4f2de 100644 (file)
@@ -236,8 +236,8 @@ const struct vb2_ops vivid_vbi_cap_qops = {
        .buf_queue              = vbi_cap_buf_queue,
        .start_streaming        = vbi_cap_start_streaming,
        .stop_streaming         = vbi_cap_stop_streaming,
-       .wait_prepare           = vivid_unlock,
-       .wait_finish            = vivid_lock,
+       .wait_prepare           = vb2_ops_wait_prepare,
+       .wait_finish            = vb2_ops_wait_finish,
 };
 
 int vidioc_g_fmt_vbi_cap(struct file *file, void *priv,
index 9d00a07ecdcd90b6699eff65686fbc9f6c256ee7..4e4c70e1e04ad25d93b3835be58879d8b47ac15f 100644 (file)
@@ -131,8 +131,8 @@ const struct vb2_ops vivid_vbi_out_qops = {
        .buf_queue              = vbi_out_buf_queue,
        .start_streaming        = vbi_out_start_streaming,
        .stop_streaming         = vbi_out_stop_streaming,
-       .wait_prepare           = vivid_unlock,
-       .wait_finish            = vivid_lock,
+       .wait_prepare           = vb2_ops_wait_prepare,
+       .wait_finish            = vb2_ops_wait_finish,
 };
 
 int vidioc_g_fmt_vbi_out(struct file *file, void *priv,
index 331c54429b400843eb03fa67e7f9d95695d30f1a..1309d311c627cdd041537e722084a8a1d007e3c9 100644 (file)
@@ -288,8 +288,8 @@ const struct vb2_ops vivid_vid_cap_qops = {
        .buf_queue              = vid_cap_buf_queue,
        .start_streaming        = vid_cap_start_streaming,
        .stop_streaming         = vid_cap_stop_streaming,
-       .wait_prepare           = vivid_unlock,
-       .wait_finish            = vivid_lock,
+       .wait_prepare           = vb2_ops_wait_prepare,
+       .wait_finish            = vb2_ops_wait_finish,
 };
 
 /*
index 69c2dbd2d1658c9c80f7a8d0e67d098b70c3fc3f..078bc35571b45efee64f3e04aebd6c4b3fbfe3c6 100644 (file)
@@ -209,8 +209,8 @@ const struct vb2_ops vivid_vid_out_qops = {
        .buf_queue              = vid_out_buf_queue,
        .start_streaming        = vid_out_start_streaming,
        .stop_streaming         = vid_out_stop_streaming,
-       .wait_prepare           = vivid_unlock,
-       .wait_finish            = vivid_lock,
+       .wait_prepare           = vb2_ops_wait_prepare,
+       .wait_finish            = vb2_ops_wait_finish,
 };
 
 /*