2014-11-18 11:24:01

by Lad, Prabhakar

[permalink] [raw]
Subject: [PATCH 00/12] media: use vb2_ops_wait_prepare/finish helper

Hi All,

This patch set uses the vb2 ops helpers for wait_prepare and
wait_finish callbacks for drivers which using vb2 helpers.
This patchset is compile tested only.

I am not sure on how mem2mem drivers work because the have
2 queues sharing the same lock, so not sure if these
changes to mem2mem drivers are valid.

Lad, Prabhakar (12):
media: s3c-camif: use vb2_ops_wait_prepare/finish helper
media: ti-vpe: use vb2_ops_wait_prepare/finish helper
media: exynos-gsc: use vb2_ops_wait_prepare/finish helper
media: soc_camera: use vb2_ops_wait_prepare/finish helper
media: sh_veu: use vb2_ops_wait_prepare/finish helper
media: marvell-ccic: use vb2_ops_wait_prepare/finish helper
media: s5p-tv: use vb2_ops_wait_prepare/finish helper
media: blackfin: use vb2_ops_wait_prepare/finish helper
media: s5p-mfc: use vb2_ops_wait_prepare/finish helper
media: vivid: use vb2_ops_wait_prepare/finish helper
media: davinci: vpif_capture: use vb2_ops_wait_prepare/finish helper
media: usb: uvc: use vb2_ops_wait_prepare/finish helper

drivers/media/platform/blackfin/bfin_capture.c | 17 ++---------
drivers/media/platform/davinci/vpif_capture.c | 2 ++
drivers/media/platform/exynos-gsc/gsc-core.h | 12 --------
drivers/media/platform/exynos-gsc/gsc-m2m.c | 6 ++--
drivers/media/platform/marvell-ccic/mcam-core.c | 29 ++++--------------
drivers/media/platform/s3c-camif/camif-capture.c | 17 ++---------
drivers/media/platform/s5p-mfc/s5p_mfc.c | 1 +
drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 20 ++-----------
drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | 20 ++-----------
drivers/media/platform/s5p-tv/mixer_video.c | 21 ++-----------
drivers/media/platform/sh_veu.c | 35 +++++-----------------
drivers/media/platform/soc_camera/atmel-isi.c | 7 +++--
drivers/media/platform/soc_camera/mx3_camera.c | 7 +++--
drivers/media/platform/soc_camera/rcar_vin.c | 7 +++--
.../platform/soc_camera/sh_mobile_ceu_camera.c | 7 +++--
drivers/media/platform/soc_camera/soc_camera.c | 16 ----------
drivers/media/platform/ti-vpe/vpe.c | 19 ++++--------
drivers/media/platform/vivid/vivid-core.c | 19 ++++--------
drivers/media/platform/vivid/vivid-core.h | 3 --
drivers/media/platform/vivid/vivid-sdr-cap.c | 4 +--
drivers/media/platform/vivid/vivid-vbi-cap.c | 4 +--
drivers/media/platform/vivid/vivid-vbi-out.c | 4 +--
drivers/media/platform/vivid/vivid-vid-cap.c | 4 +--
drivers/media/platform/vivid/vivid-vid-out.c | 4 +--
drivers/media/usb/uvc/uvc_queue.c | 19 ++----------
25 files changed, 75 insertions(+), 229 deletions(-)

--
1.9.1


2014-11-18 11:24:13

by Lad, Prabhakar

[permalink] [raw]
Subject: [PATCH 04/12] media: soc_camera: use vb2_ops_wait_prepare/finish helper

Signed-off-by: Lad, Prabhakar <[email protected]>
Cc: Josh Wu <[email protected]>
Cc: Guennadi Liakhovetski <[email protected]>
---
drivers/media/platform/soc_camera/atmel-isi.c | 7 +++++--
drivers/media/platform/soc_camera/mx3_camera.c | 7 +++++--
drivers/media/platform/soc_camera/rcar_vin.c | 7 +++++--
drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c | 7 +++++--
drivers/media/platform/soc_camera/soc_camera.c | 16 ----------------
5 files changed, 20 insertions(+), 24 deletions(-)

diff --git a/drivers/media/platform/soc_camera/atmel-isi.c b/drivers/media/platform/soc_camera/atmel-isi.c
index ee5650f..6306ba5 100644
--- a/drivers/media/platform/soc_camera/atmel-isi.c
+++ b/drivers/media/platform/soc_camera/atmel-isi.c
@@ -455,8 +455,8 @@ static struct vb2_ops isi_video_qops = {
.buf_queue = buffer_queue,
.start_streaming = start_streaming,
.stop_streaming = stop_streaming,
- .wait_prepare = soc_camera_unlock,
- .wait_finish = soc_camera_lock,
+ .wait_prepare = vb2_ops_wait_prepare,
+ .wait_finish = vb2_ops_wait_finish,
};

/* ------------------------------------------------------------------
@@ -465,6 +465,8 @@ static struct vb2_ops isi_video_qops = {
static int isi_camera_init_videobuf(struct vb2_queue *q,
struct soc_camera_device *icd)
{
+ struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
+
q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
q->io_modes = VB2_MMAP;
q->drv_priv = icd;
@@ -472,6 +474,7 @@ static int isi_camera_init_videobuf(struct vb2_queue *q,
q->ops = &isi_video_qops;
q->mem_ops = &vb2_dma_contig_memops;
q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
+ q->lock = &ici->host_lock;

return vb2_queue_init(q);
}
diff --git a/drivers/media/platform/soc_camera/mx3_camera.c b/drivers/media/platform/soc_camera/mx3_camera.c
index 8e52ccc..1000c2e 100644
--- a/drivers/media/platform/soc_camera/mx3_camera.c
+++ b/drivers/media/platform/soc_camera/mx3_camera.c
@@ -435,14 +435,16 @@ static struct vb2_ops mx3_videobuf_ops = {
.buf_queue = mx3_videobuf_queue,
.buf_cleanup = mx3_videobuf_release,
.buf_init = mx3_videobuf_init,
- .wait_prepare = soc_camera_unlock,
- .wait_finish = soc_camera_lock,
+ .wait_prepare = vb2_ops_wait_prepare,
+ .wait_finish = vb2_ops_wait_finish,
.stop_streaming = mx3_stop_streaming,
};

static int mx3_camera_init_videobuf(struct vb2_queue *q,
struct soc_camera_device *icd)
{
+ struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
+
q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
q->io_modes = VB2_MMAP | VB2_USERPTR;
q->drv_priv = icd;
@@ -450,6 +452,7 @@ static int mx3_camera_init_videobuf(struct vb2_queue *q,
q->mem_ops = &vb2_dma_contig_memops;
q->buf_struct_size = sizeof(struct mx3_camera_buffer);
q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
+ q->lock = &ici->host_lock;

return vb2_queue_init(q);
}
diff --git a/drivers/media/platform/soc_camera/rcar_vin.c b/drivers/media/platform/soc_camera/rcar_vin.c
index 8d8438b..724e239 100644
--- a/drivers/media/platform/soc_camera/rcar_vin.c
+++ b/drivers/media/platform/soc_camera/rcar_vin.c
@@ -535,8 +535,8 @@ static struct vb2_ops rcar_vin_vb2_ops = {
.buf_cleanup = rcar_vin_videobuf_release,
.buf_queue = rcar_vin_videobuf_queue,
.stop_streaming = rcar_vin_stop_streaming,
- .wait_prepare = soc_camera_unlock,
- .wait_finish = soc_camera_lock,
+ .wait_prepare = vb2_ops_wait_prepare,
+ .wait_finish = vb2_ops_wait_finish,
};

static irqreturn_t rcar_vin_irq(int irq, void *data)
@@ -1364,6 +1364,8 @@ static int rcar_vin_querycap(struct soc_camera_host *ici,
static int rcar_vin_init_videobuf2(struct vb2_queue *vq,
struct soc_camera_device *icd)
{
+ struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
+
vq->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
vq->io_modes = VB2_MMAP | VB2_USERPTR;
vq->drv_priv = icd;
@@ -1371,6 +1373,7 @@ static int rcar_vin_init_videobuf2(struct vb2_queue *vq,
vq->mem_ops = &vb2_dma_contig_memops;
vq->buf_struct_size = sizeof(struct rcar_vin_buffer);
vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
+ vq->lock = &ici->host_lock;

return vb2_queue_init(vq);
}
diff --git a/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c b/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c
index 5f58ed9..d92b746 100644
--- a/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c
+++ b/drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c
@@ -496,8 +496,8 @@ static struct vb2_ops sh_mobile_ceu_videobuf_ops = {
.buf_queue = sh_mobile_ceu_videobuf_queue,
.buf_cleanup = sh_mobile_ceu_videobuf_release,
.buf_init = sh_mobile_ceu_videobuf_init,
- .wait_prepare = soc_camera_unlock,
- .wait_finish = soc_camera_lock,
+ .wait_prepare = vb2_ops_wait_prepare,
+ .wait_finish = vb2_ops_wait_finish,
.stop_streaming = sh_mobile_ceu_stop_streaming,
};

@@ -1659,6 +1659,8 @@ static int sh_mobile_ceu_querycap(struct soc_camera_host *ici,
static int sh_mobile_ceu_init_videobuf(struct vb2_queue *q,
struct soc_camera_device *icd)
{
+ struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
+
q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
q->io_modes = VB2_MMAP | VB2_USERPTR;
q->drv_priv = icd;
@@ -1666,6 +1668,7 @@ static int sh_mobile_ceu_init_videobuf(struct vb2_queue *q,
q->mem_ops = &vb2_dma_contig_memops;
q->buf_struct_size = sizeof(struct sh_mobile_ceu_buffer);
q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
+ q->lock = &ici->host_lock;

return vb2_queue_init(q);
}
diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c
index f4be2a1..5aad197 100644
--- a/drivers/media/platform/soc_camera/soc_camera.c
+++ b/drivers/media/platform/soc_camera/soc_camera.c
@@ -843,22 +843,6 @@ static unsigned int soc_camera_poll(struct file *file, poll_table *pt)
return res;
}

-void soc_camera_lock(struct vb2_queue *vq)
-{
- struct soc_camera_device *icd = vb2_get_drv_priv(vq);
- struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
- mutex_lock(&ici->host_lock);
-}
-EXPORT_SYMBOL(soc_camera_lock);
-
-void soc_camera_unlock(struct vb2_queue *vq)
-{
- struct soc_camera_device *icd = vb2_get_drv_priv(vq);
- struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
- mutex_unlock(&ici->host_lock);
-}
-EXPORT_SYMBOL(soc_camera_unlock);
-
static struct v4l2_file_operations soc_camera_fops = {
.owner = THIS_MODULE,
.open = soc_camera_open,
--
1.9.1

2014-11-18 11:24:05

by Lad, Prabhakar

[permalink] [raw]
Subject: [PATCH 01/12] media: s3c-camif: use vb2_ops_wait_prepare/finish helper

Signed-off-by: Lad, Prabhakar <[email protected]>
Cc: Sylwester Nawrocki <[email protected]>
---
drivers/media/platform/s3c-camif/camif-capture.c | 17 +++--------------
1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/drivers/media/platform/s3c-camif/camif-capture.c b/drivers/media/platform/s3c-camif/camif-capture.c
index aa40c82..54479d6 100644
--- a/drivers/media/platform/s3c-camif/camif-capture.c
+++ b/drivers/media/platform/s3c-camif/camif-capture.c
@@ -536,24 +536,12 @@ static void buffer_queue(struct vb2_buffer *vb)
spin_unlock_irqrestore(&camif->slock, flags);
}

-static void camif_lock(struct vb2_queue *vq)
-{
- struct camif_vp *vp = vb2_get_drv_priv(vq);
- mutex_lock(&vp->camif->lock);
-}
-
-static void camif_unlock(struct vb2_queue *vq)
-{
- struct camif_vp *vp = vb2_get_drv_priv(vq);
- mutex_unlock(&vp->camif->lock);
-}
-
static const struct vb2_ops s3c_camif_qops = {
.queue_setup = queue_setup,
.buf_prepare = buffer_prepare,
.buf_queue = buffer_queue,
- .wait_prepare = camif_unlock,
- .wait_finish = camif_lock,
+ .wait_prepare = vb2_ops_wait_prepare,
+ .wait_finish = vb2_ops_wait_finish,
.start_streaming = start_streaming,
.stop_streaming = stop_streaming,
};
@@ -1161,6 +1149,7 @@ int s3c_camif_register_video_node(struct camif_dev *camif, int idx)
q->buf_struct_size = sizeof(struct camif_buffer);
q->drv_priv = vp;
q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
+ q->lock = &vp->camif->lock;

ret = vb2_queue_init(q);
if (ret)
--
1.9.1

2014-11-18 11:24:20

by Lad, Prabhakar

[permalink] [raw]
Subject: [PATCH 10/12] media: vivid: use vb2_ops_wait_prepare/finish helper

Signed-off-by: Lad, Prabhakar <[email protected]>
Cc: Hans Verkuil <[email protected]>
---
drivers/media/platform/vivid/vivid-core.c | 19 +++++--------------
drivers/media/platform/vivid/vivid-core.h | 3 ---
drivers/media/platform/vivid/vivid-sdr-cap.c | 4 ++--
drivers/media/platform/vivid/vivid-vbi-cap.c | 4 ++--
drivers/media/platform/vivid/vivid-vbi-out.c | 4 ++--
drivers/media/platform/vivid/vivid-vid-cap.c | 4 ++--
drivers/media/platform/vivid/vivid-vid-out.c | 4 ++--
7 files changed, 15 insertions(+), 27 deletions(-)

diff --git a/drivers/media/platform/vivid/vivid-core.c b/drivers/media/platform/vivid/vivid-core.c
index 686c3c2..987a46c 100644
--- a/drivers/media/platform/vivid/vivid-core.c
+++ b/drivers/media/platform/vivid/vivid-core.c
@@ -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)
diff --git a/drivers/media/platform/vivid/vivid-core.h b/drivers/media/platform/vivid/vivid-core.h
index 811c286..6f4445a 100644
--- a/drivers/media/platform/vivid/vivid-core.h
+++ b/drivers/media/platform/vivid/vivid-core.h
@@ -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
diff --git a/drivers/media/platform/vivid/vivid-sdr-cap.c b/drivers/media/platform/vivid/vivid-sdr-cap.c
index 8c5d661..4af55f1 100644
--- a/drivers/media/platform/vivid/vivid-sdr-cap.c
+++ b/drivers/media/platform/vivid/vivid-sdr-cap.c
@@ -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)
diff --git a/drivers/media/platform/vivid/vivid-vbi-cap.c b/drivers/media/platform/vivid/vivid-vbi-cap.c
index 2166d0b..ef81b01 100644
--- a/drivers/media/platform/vivid/vivid-vbi-cap.c
+++ b/drivers/media/platform/vivid/vivid-vbi-cap.c
@@ -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,
diff --git a/drivers/media/platform/vivid/vivid-vbi-out.c b/drivers/media/platform/vivid/vivid-vbi-out.c
index 9d00a07..4e4c70e 100644
--- a/drivers/media/platform/vivid/vivid-vbi-out.c
+++ b/drivers/media/platform/vivid/vivid-vbi-out.c
@@ -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,
diff --git a/drivers/media/platform/vivid/vivid-vid-cap.c b/drivers/media/platform/vivid/vivid-vid-cap.c
index 331c544..1309d31 100644
--- a/drivers/media/platform/vivid/vivid-vid-cap.c
+++ b/drivers/media/platform/vivid/vivid-vid-cap.c
@@ -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,
};

/*
diff --git a/drivers/media/platform/vivid/vivid-vid-out.c b/drivers/media/platform/vivid/vivid-vid-out.c
index 69c2dbd..078bc35 100644
--- a/drivers/media/platform/vivid/vivid-vid-out.c
+++ b/drivers/media/platform/vivid/vivid-vid-out.c
@@ -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,
};

/*
--
1.9.1

2014-11-18 11:24:22

by Lad, Prabhakar

[permalink] [raw]
Subject: [PATCH 12/12] media: usb: uvc: use vb2_ops_wait_prepare/finish helper

Signed-off-by: Lad, Prabhakar <[email protected]>
Cc: Laurent Pinchart <[email protected]>
---
drivers/media/usb/uvc/uvc_queue.c | 19 +++----------------
1 file changed, 3 insertions(+), 16 deletions(-)

diff --git a/drivers/media/usb/uvc/uvc_queue.c b/drivers/media/usb/uvc/uvc_queue.c
index 6e92d20..9c42ac6f 100644
--- a/drivers/media/usb/uvc/uvc_queue.c
+++ b/drivers/media/usb/uvc/uvc_queue.c
@@ -117,27 +117,13 @@ static void uvc_buffer_finish(struct vb2_buffer *vb)
uvc_video_clock_update(stream, &vb->v4l2_buf, buf);
}

-static void uvc_wait_prepare(struct vb2_queue *vq)
-{
- struct uvc_video_queue *queue = vb2_get_drv_priv(vq);
-
- mutex_unlock(&queue->mutex);
-}
-
-static void uvc_wait_finish(struct vb2_queue *vq)
-{
- struct uvc_video_queue *queue = vb2_get_drv_priv(vq);
-
- mutex_lock(&queue->mutex);
-}
-
static struct vb2_ops uvc_queue_qops = {
.queue_setup = uvc_queue_setup,
.buf_prepare = uvc_buffer_prepare,
.buf_queue = uvc_buffer_queue,
.buf_finish = uvc_buffer_finish,
- .wait_prepare = uvc_wait_prepare,
- .wait_finish = uvc_wait_finish,
+ .wait_prepare = vb2_ops_wait_prepare,
+ .wait_finish = vb2_ops_wait_finish,
};

int uvc_queue_init(struct uvc_video_queue *queue, enum v4l2_buf_type type,
@@ -153,6 +139,7 @@ int uvc_queue_init(struct uvc_video_queue *queue, enum v4l2_buf_type type,
queue->queue.mem_ops = &vb2_vmalloc_memops;
queue->queue.timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC
| V4L2_BUF_FLAG_TSTAMP_SRC_SOE;
+ queue->queue.lock = &queue->mutex;
ret = vb2_queue_init(&queue->queue);
if (ret)
return ret;
--
1.9.1

2014-11-18 11:24:18

by Lad, Prabhakar

[permalink] [raw]
Subject: [PATCH 11/12] media: davinci: vpif_capture: use vb2_ops_wait_prepare/finish helper

Signed-off-by: Lad, Prabhakar <[email protected]>
---
drivers/media/platform/davinci/vpif_capture.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c
index 3ccb26f..d8e1b98 100644
--- a/drivers/media/platform/davinci/vpif_capture.c
+++ b/drivers/media/platform/davinci/vpif_capture.c
@@ -311,6 +311,8 @@ static struct vb2_ops video_qops = {
.start_streaming = vpif_start_streaming,
.stop_streaming = vpif_stop_streaming,
.buf_queue = vpif_buffer_queue,
+ .wait_prepare = vb2_ops_wait_prepare,
+ .wait_finish = vb2_ops_wait_finish,
};

/**
--
1.9.1

2014-11-18 11:24:10

by Lad, Prabhakar

[permalink] [raw]
Subject: [PATCH 05/12] media: sh_veu: use vb2_ops_wait_prepare/finish helper

Signed-off-by: Lad, Prabhakar <[email protected]>
Cc: Mauro Carvalho Chehab <[email protected]>
---
drivers/media/platform/sh_veu.c | 35 +++++++----------------------------
1 file changed, 7 insertions(+), 28 deletions(-)

diff --git a/drivers/media/platform/sh_veu.c b/drivers/media/platform/sh_veu.c
index be3b3bc..7884117 100644
--- a/drivers/media/platform/sh_veu.c
+++ b/drivers/media/platform/sh_veu.c
@@ -242,20 +242,6 @@ static void sh_veu_job_abort(void *priv)
veu->aborting = true;
}

-static void sh_veu_lock(void *priv)
-{
- struct sh_veu_dev *veu = priv;
-
- mutex_lock(&veu->fop_lock);
-}
-
-static void sh_veu_unlock(void *priv)
-{
- struct sh_veu_dev *veu = priv;
-
- mutex_unlock(&veu->fop_lock);
-}
-
static void sh_veu_process(struct sh_veu_dev *veu,
struct vb2_buffer *src_buf,
struct vb2_buffer *dst_buf)
@@ -950,36 +936,28 @@ static void sh_veu_buf_queue(struct vb2_buffer *vb)
v4l2_m2m_buf_queue(veu->m2m_ctx, vb);
}

-static void sh_veu_wait_prepare(struct vb2_queue *q)
-{
- sh_veu_unlock(vb2_get_drv_priv(q));
-}
-
-static void sh_veu_wait_finish(struct vb2_queue *q)
-{
- sh_veu_lock(vb2_get_drv_priv(q));
-}
-
static const struct vb2_ops sh_veu_qops = {
.queue_setup = sh_veu_queue_setup,
.buf_prepare = sh_veu_buf_prepare,
.buf_queue = sh_veu_buf_queue,
- .wait_prepare = sh_veu_wait_prepare,
- .wait_finish = sh_veu_wait_finish,
+ .wait_prepare = vb2_ops_wait_prepare,
+ .wait_finish = vb2_ops_wait_finish,
};

static int sh_veu_queue_init(void *priv, struct vb2_queue *src_vq,
struct vb2_queue *dst_vq)
{
+ struct sh_veu_dev *veu = priv;
int ret;

memset(src_vq, 0, sizeof(*src_vq));
src_vq->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
src_vq->io_modes = VB2_MMAP | VB2_USERPTR;
- src_vq->drv_priv = priv;
+ src_vq->drv_priv = veu;
src_vq->buf_struct_size = sizeof(struct v4l2_m2m_buffer);
src_vq->ops = &sh_veu_qops;
src_vq->mem_ops = &vb2_dma_contig_memops;
+ src_vq->lock = &veu->fop_lock;

ret = vb2_queue_init(src_vq);
if (ret < 0)
@@ -988,10 +966,11 @@ static int sh_veu_queue_init(void *priv, struct vb2_queue *src_vq,
memset(dst_vq, 0, sizeof(*dst_vq));
dst_vq->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
dst_vq->io_modes = VB2_MMAP | VB2_USERPTR;
- dst_vq->drv_priv = priv;
+ dst_vq->drv_priv = veu;
dst_vq->buf_struct_size = sizeof(struct v4l2_m2m_buffer);
dst_vq->ops = &sh_veu_qops;
dst_vq->mem_ops = &vb2_dma_contig_memops;
+ dst_vq->lock = &veu->fop_lock;

return vb2_queue_init(dst_vq);
}
--
1.9.1

2014-11-18 11:25:40

by Lad, Prabhakar

[permalink] [raw]
Subject: [PATCH 08/12] media: blackfin: use vb2_ops_wait_prepare/finish helper

Signed-off-by: Lad, Prabhakar <[email protected]>
Cc: Scott Jiang <[email protected]>
---
drivers/media/platform/blackfin/bfin_capture.c | 17 +++--------------
1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/drivers/media/platform/blackfin/bfin_capture.c b/drivers/media/platform/blackfin/bfin_capture.c
index b3345b3..819ec0e 100644
--- a/drivers/media/platform/blackfin/bfin_capture.c
+++ b/drivers/media/platform/blackfin/bfin_capture.c
@@ -349,18 +349,6 @@ static void bcap_buffer_cleanup(struct vb2_buffer *vb)
spin_unlock_irqrestore(&bcap_dev->lock, flags);
}

-static void bcap_lock(struct vb2_queue *vq)
-{
- struct bcap_device *bcap_dev = vb2_get_drv_priv(vq);
- mutex_lock(&bcap_dev->mutex);
-}
-
-static void bcap_unlock(struct vb2_queue *vq)
-{
- struct bcap_device *bcap_dev = vb2_get_drv_priv(vq);
- mutex_unlock(&bcap_dev->mutex);
-}
-
static int bcap_start_streaming(struct vb2_queue *vq, unsigned int count)
{
struct bcap_device *bcap_dev = vb2_get_drv_priv(vq);
@@ -457,8 +445,8 @@ static struct vb2_ops bcap_video_qops = {
.buf_prepare = bcap_buffer_prepare,
.buf_cleanup = bcap_buffer_cleanup,
.buf_queue = bcap_buffer_queue,
- .wait_prepare = bcap_unlock,
- .wait_finish = bcap_lock,
+ .wait_prepare = vb2_ops_wait_prepare,
+ .wait_finish = vb2_ops_wait_finish,
.start_streaming = bcap_start_streaming,
.stop_streaming = bcap_stop_streaming,
};
@@ -995,6 +983,7 @@ static int bcap_probe(struct platform_device *pdev)
q->ops = &bcap_video_qops;
q->mem_ops = &vb2_dma_contig_memops;
q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
+ q->lock = &bcap_dev->mutex;

ret = vb2_queue_init(q);
if (ret)
--
1.9.1

2014-11-18 11:25:39

by Lad, Prabhakar

[permalink] [raw]
Subject: [PATCH 09/12] media: s5p-mfc: use vb2_ops_wait_prepare/finish helper

Signed-off-by: Lad, Prabhakar <[email protected]>
Cc: Kyungmin Park <[email protected]>
Cc: Kamil Debski <[email protected]>
Cc: Jeongtae Park <[email protected]>
---
drivers/media/platform/s5p-mfc/s5p_mfc.c | 1 +
drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 20 ++------------------
drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | 20 ++------------------
3 files changed, 5 insertions(+), 36 deletions(-)

diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c
index 03204fd..52f65e9 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
@@ -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();
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
index 74bcec8..78b3e0e 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
@@ -946,22 +946,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;
@@ -1109,8 +1093,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,
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
index e7240cb..ffa9c1d 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
@@ -1869,22 +1869,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;
@@ -2054,8 +2038,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,
--
1.9.1

2014-11-18 11:26:32

by Lad, Prabhakar

[permalink] [raw]
Subject: [PATCH 07/12] media: s5p-tv: use vb2_ops_wait_prepare/finish helper

Signed-off-by: Lad, Prabhakar <[email protected]>
Cc: Kyungmin Park <[email protected]>
Cc: Tomasz Stanislawski <[email protected]>
---
drivers/media/platform/s5p-tv/mixer_video.c | 21 +++------------------
1 file changed, 3 insertions(+), 18 deletions(-)

diff --git a/drivers/media/platform/s5p-tv/mixer_video.c b/drivers/media/platform/s5p-tv/mixer_video.c
index b4d2696..72d4f2e 100644
--- a/drivers/media/platform/s5p-tv/mixer_video.c
+++ b/drivers/media/platform/s5p-tv/mixer_video.c
@@ -926,22 +926,6 @@ static void buf_queue(struct vb2_buffer *vb)
mxr_dbg(mdev, "queuing buffer\n");
}

-static void wait_lock(struct vb2_queue *vq)
-{
- struct mxr_layer *layer = vb2_get_drv_priv(vq);
-
- mxr_dbg(layer->mdev, "%s\n", __func__);
- mutex_lock(&layer->mutex);
-}
-
-static void wait_unlock(struct vb2_queue *vq)
-{
- struct mxr_layer *layer = vb2_get_drv_priv(vq);
-
- mxr_dbg(layer->mdev, "%s\n", __func__);
- mutex_unlock(&layer->mutex);
-}
-
static int start_streaming(struct vb2_queue *vq, unsigned int count)
{
struct mxr_layer *layer = vb2_get_drv_priv(vq);
@@ -1040,8 +1024,8 @@ static void stop_streaming(struct vb2_queue *vq)
static struct vb2_ops mxr_video_qops = {
.queue_setup = queue_setup,
.buf_queue = buf_queue,
- .wait_prepare = wait_unlock,
- .wait_finish = wait_lock,
+ .wait_prepare = vb2_ops_wait_prepare,
+ .wait_finish = vb2_ops_wait_finish,
.start_streaming = start_streaming,
.stop_streaming = stop_streaming,
};
@@ -1122,6 +1106,7 @@ struct mxr_layer *mxr_base_layer_create(struct mxr_device *mdev,
.ops = &mxr_video_qops,
.min_buffers_needed = 1,
.mem_ops = &vb2_dma_contig_memops,
+ .lock = &layer->mutex,
};

return layer;
--
1.9.1

2014-11-18 11:26:54

by Lad, Prabhakar

[permalink] [raw]
Subject: [PATCH 06/12] media: marvell-ccic: use vb2_ops_wait_prepare/finish helper

Signed-off-by: Lad, Prabhakar <[email protected]>
Cc: Jonathan Corbet <[email protected]>
---
drivers/media/platform/marvell-ccic/mcam-core.c | 29 +++++--------------------
1 file changed, 5 insertions(+), 24 deletions(-)

diff --git a/drivers/media/platform/marvell-ccic/mcam-core.c b/drivers/media/platform/marvell-ccic/mcam-core.c
index f0eeb6c..eeb87d1 100644
--- a/drivers/media/platform/marvell-ccic/mcam-core.c
+++ b/drivers/media/platform/marvell-ccic/mcam-core.c
@@ -1100,26 +1100,6 @@ static void mcam_vb_buf_queue(struct vb2_buffer *vb)
mcam_read_setup(cam);
}

-
-/*
- * vb2 uses these to release the mutex when waiting in dqbuf. I'm
- * not actually sure we need to do this (I'm not sure that vb2_dqbuf() needs
- * to be called with the mutex held), but better safe than sorry.
- */
-static void mcam_vb_wait_prepare(struct vb2_queue *vq)
-{
- struct mcam_camera *cam = vb2_get_drv_priv(vq);
-
- mutex_unlock(&cam->s_mutex);
-}
-
-static void mcam_vb_wait_finish(struct vb2_queue *vq)
-{
- struct mcam_camera *cam = vb2_get_drv_priv(vq);
-
- mutex_lock(&cam->s_mutex);
-}
-
/*
* These need to be called with the mutex held from vb2
*/
@@ -1189,8 +1169,8 @@ static const struct vb2_ops mcam_vb2_ops = {
.buf_queue = mcam_vb_buf_queue,
.start_streaming = mcam_vb_start_streaming,
.stop_streaming = mcam_vb_stop_streaming,
- .wait_prepare = mcam_vb_wait_prepare,
- .wait_finish = mcam_vb_wait_finish,
+ .wait_prepare = vb2_ops_wait_prepare,
+ .wait_finish = vb2_ops_wait_finish,
};


@@ -1266,8 +1246,8 @@ static const struct vb2_ops mcam_vb2_sg_ops = {
.buf_cleanup = mcam_vb_sg_buf_cleanup,
.start_streaming = mcam_vb_start_streaming,
.stop_streaming = mcam_vb_stop_streaming,
- .wait_prepare = mcam_vb_wait_prepare,
- .wait_finish = mcam_vb_wait_finish,
+ .wait_prepare = vb2_ops_wait_prepare,
+ .wait_finish = vb2_ops_wait_finish,
};

#endif /* MCAM_MODE_DMA_SG */
@@ -1279,6 +1259,7 @@ static int mcam_setup_vb2(struct mcam_camera *cam)
memset(vq, 0, sizeof(*vq));
vq->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
vq->drv_priv = cam;
+ vq->lock = &cam->s_mutex;
INIT_LIST_HEAD(&cam->buffers);
switch (cam->buffer_mode) {
case B_DMA_contig:
--
1.9.1

2014-11-18 11:27:30

by Lad, Prabhakar

[permalink] [raw]
Subject: [PATCH 02/12] media: ti-vpe: use vb2_ops_wait_prepare/finish helper

Signed-off-by: Lad, Prabhakar <[email protected]>
Cc: Kukjin Kim <[email protected]>
---
drivers/media/platform/ti-vpe/vpe.c | 19 +++++--------------
1 file changed, 5 insertions(+), 14 deletions(-)

diff --git a/drivers/media/platform/ti-vpe/vpe.c b/drivers/media/platform/ti-vpe/vpe.c
index 9a081c2..d5d745d 100644
--- a/drivers/media/platform/ti-vpe/vpe.c
+++ b/drivers/media/platform/ti-vpe/vpe.c
@@ -1913,30 +1913,19 @@ static void vpe_buf_queue(struct vb2_buffer *vb)
v4l2_m2m_buf_queue(ctx->m2m_ctx, vb);
}

-static void vpe_wait_prepare(struct vb2_queue *q)
-{
- struct vpe_ctx *ctx = vb2_get_drv_priv(q);
- vpe_unlock(ctx);
-}
-
-static void vpe_wait_finish(struct vb2_queue *q)
-{
- struct vpe_ctx *ctx = vb2_get_drv_priv(q);
- vpe_lock(ctx);
-}
-
static struct vb2_ops vpe_qops = {
.queue_setup = vpe_queue_setup,
.buf_prepare = vpe_buf_prepare,
.buf_queue = vpe_buf_queue,
- .wait_prepare = vpe_wait_prepare,
- .wait_finish = vpe_wait_finish,
+ .wait_prepare = vb2_ops_wait_prepare,
+ .wait_finish = vb2_ops_wait_finish,
};

static int queue_init(void *priv, struct vb2_queue *src_vq,
struct vb2_queue *dst_vq)
{
struct vpe_ctx *ctx = priv;
+ struct vpe_dev *dev = ctx->dev;
int ret;

memset(src_vq, 0, sizeof(*src_vq));
@@ -1947,6 +1936,7 @@ static int queue_init(void *priv, struct vb2_queue *src_vq,
src_vq->ops = &vpe_qops;
src_vq->mem_ops = &vb2_dma_contig_memops;
src_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
+ src_vq->lock = &dev->dev_mutex;

ret = vb2_queue_init(src_vq);
if (ret)
@@ -1960,6 +1950,7 @@ static int queue_init(void *priv, struct vb2_queue *src_vq,
dst_vq->ops = &vpe_qops;
dst_vq->mem_ops = &vb2_dma_contig_memops;
dst_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
+ dst_vq->lock = &dev->dev_mutex;

return vb2_queue_init(dst_vq);
}
--
1.9.1

2014-11-18 11:27:28

by Lad, Prabhakar

[permalink] [raw]
Subject: [PATCH 03/12] media: exynos-gsc: use vb2_ops_wait_prepare/finish helper

Signed-off-by: Lad, Prabhakar <[email protected]>
Cc: Kukjin Kim <[email protected]>
---
drivers/media/platform/exynos-gsc/gsc-core.h | 12 ------------
drivers/media/platform/exynos-gsc/gsc-m2m.c | 6 ++++--
2 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/drivers/media/platform/exynos-gsc/gsc-core.h b/drivers/media/platform/exynos-gsc/gsc-core.h
index 0abdb17..fa572aa 100644
--- a/drivers/media/platform/exynos-gsc/gsc-core.h
+++ b/drivers/media/platform/exynos-gsc/gsc-core.h
@@ -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;
diff --git a/drivers/media/platform/exynos-gsc/gsc-m2m.c b/drivers/media/platform/exynos-gsc/gsc-m2m.c
index 74e1de6..d5cffef 100644
--- a/drivers/media/platform/exynos-gsc/gsc-m2m.c
+++ b/drivers/media/platform/exynos-gsc/gsc-m2m.c
@@ -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);
}
--
1.9.1

2014-11-18 13:03:20

by Jonathan Corbet

[permalink] [raw]
Subject: Re: [PATCH 06/12] media: marvell-ccic: use vb2_ops_wait_prepare/finish helper

On Tue, 18 Nov 2014 11:23:35 +0000
"Lad, Prabhakar" <[email protected]> wrote:

> drivers/media/platform/marvell-ccic/mcam-core.c | 29 +++++--------------------
> 1 file changed, 5 insertions(+), 24 deletions(-)

So I'm not convinced that this patch improves things; it moves a tiny bit
of code into another file where anybody reading the driver will have to
go look to see what's going on. But I guess it doesn't really make
things worse either; I won't try to stand in its way. It would be nice
to see a real changelog on the patch, though.

jon

2014-11-18 13:23:37

by Lad, Prabhakar

[permalink] [raw]
Subject: Re: [PATCH 06/12] media: marvell-ccic: use vb2_ops_wait_prepare/finish helper

Hi Jonathan,

On Tue, Nov 18, 2014 at 1:03 PM, Jonathan Corbet <[email protected]> wrote:
> On Tue, 18 Nov 2014 11:23:35 +0000
> "Lad, Prabhakar" <[email protected]> wrote:
>
>> drivers/media/platform/marvell-ccic/mcam-core.c | 29 +++++--------------------
>> 1 file changed, 5 insertions(+), 24 deletions(-)
>
> So I'm not convinced that this patch improves things; it moves a tiny bit
> of code into another file where anybody reading the driver will have to
> go look to see what's going on. But I guess it doesn't really make
> things worse either; I won't try to stand in its way. It would be nice
> to see a real changelog on the patch, though.
>
Sorry there is no movement of code to other file. And I dont see any
reason why anybody reading will go haywire its a standard v4l2 thing.
The subject explains it all, If you still want me to elaborate I can
post a v2.

Thanks,
--Prabhakar Lad

2014-11-18 14:31:36

by Jonathan Corbet

[permalink] [raw]
Subject: Re: [PATCH 06/12] media: marvell-ccic: use vb2_ops_wait_prepare/finish helper

On Tue, 18 Nov 2014 13:23:04 +0000
Prabhakar Lad <[email protected]> wrote:

> Sorry there is no movement of code to other file. And I dont see any
> reason why anybody reading will go haywire its a standard v4l2 thing.

Whatever, I said I wouldn't stand in the way.

> The subject explains it all, If you still want me to elaborate I can
> post a v2.

Here I totally disagree, though. You say what you are doing, not why.
What's strange about the idea that a patch should have a reasonable
changelog?

jon

2014-11-25 11:25:03

by Kamil Debski

[permalink] [raw]
Subject: RE: [PATCH 09/12] media: s5p-mfc: use vb2_ops_wait_prepare/finish helper

Hi,

Please provide a commit description. No matter how obvious the commit
seems.

Best wishes,
--
Kamil Debski
Samsung R&D Institute Poland


> -----Original Message-----
> From: Lad, Prabhakar [mailto:[email protected]]
> Sent: Tuesday, November 18, 2014 12:24 PM
> To: Hans Verkuil; Mauro Carvalho Chehab; LMML
> Cc: LKML; Lad, Prabhakar; Kyungmin Park; Kamil Debski; Jeongtae Park
> Subject: [PATCH 09/12] media: s5p-mfc: use vb2_ops_wait_prepare/finish
> helper
>
> Signed-off-by: Lad, Prabhakar <[email protected]>
> Cc: Kyungmin Park <[email protected]>
> Cc: Kamil Debski <[email protected]>
> Cc: Jeongtae Park <[email protected]>
> ---
> drivers/media/platform/s5p-mfc/s5p_mfc.c | 1 +
> drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 20 ++------------------
> drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | 20 ++------------------
> 3 files changed, 5 insertions(+), 36 deletions(-)
>
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c
> b/drivers/media/platform/s5p-mfc/s5p_mfc.c
> index 03204fd..52f65e9 100644
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
> @@ -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();
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> index 74bcec8..78b3e0e 100644
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> @@ -946,22 +946,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;
> @@ -1109,8 +1093,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,
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
> b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
> index e7240cb..ffa9c1d 100644
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
> @@ -1869,22 +1869,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;
> @@ -2054,8 +2038,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,
> --
> 1.9.1