diff options
author | Ezequiel Garcia <ezequiel@collabora.com> | 2018-06-18 00:38:52 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2018-07-24 17:45:08 -0400 |
commit | 5525b8314389a0c558d15464e86f438974b94e32 (patch) | |
tree | 108ad7116251e10aa005ad9835c19e61c1007999 | |
parent | 774f1c912776330ece84540fac370ec201c878b4 (diff) |
media: mem2mem: Make .job_abort optional
Implementing job_abort() does not make sense on some drivers.
This is not a problem, as the abort is not required to
wait for the job to finish. Quite the opposite, drivers
are encouraged not to wait.
Demote v4l2_m2m_ops.job_abort from required to optional, and
clean all drivers with dummy implementations.
Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
-rw-r--r-- | drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c | 5 | ||||
-rw-r--r-- | drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c | 5 | ||||
-rw-r--r-- | drivers/media/platform/rcar_jpu.c | 5 | ||||
-rw-r--r-- | drivers/media/platform/rockchip/rga/rga.c | 6 | ||||
-rw-r--r-- | drivers/media/platform/s5p-g2d/g2d.c | 5 | ||||
-rw-r--r-- | drivers/media/platform/s5p-jpeg/jpeg-core.c | 7 | ||||
-rw-r--r-- | drivers/media/v4l2-core/v4l2-mem2mem.c | 6 | ||||
-rw-r--r-- | include/media/v4l2-mem2mem.h | 2 |
8 files changed, 4 insertions, 37 deletions
diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c index 328e8f650d9b..4f24da8afecc 100644 --- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c +++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c | |||
@@ -861,14 +861,9 @@ static int mtk_jpeg_job_ready(void *priv) | |||
861 | return (ctx->state == MTK_JPEG_RUNNING) ? 1 : 0; | 861 | return (ctx->state == MTK_JPEG_RUNNING) ? 1 : 0; |
862 | } | 862 | } |
863 | 863 | ||
864 | static void mtk_jpeg_job_abort(void *priv) | ||
865 | { | ||
866 | } | ||
867 | |||
868 | static const struct v4l2_m2m_ops mtk_jpeg_m2m_ops = { | 864 | static const struct v4l2_m2m_ops mtk_jpeg_m2m_ops = { |
869 | .device_run = mtk_jpeg_device_run, | 865 | .device_run = mtk_jpeg_device_run, |
870 | .job_ready = mtk_jpeg_job_ready, | 866 | .job_ready = mtk_jpeg_job_ready, |
871 | .job_abort = mtk_jpeg_job_abort, | ||
872 | }; | 867 | }; |
873 | 868 | ||
874 | static int mtk_jpeg_queue_init(void *priv, struct vb2_queue *src_vq, | 869 | static int mtk_jpeg_queue_init(void *priv, struct vb2_queue *src_vq, |
diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c b/drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c index c2e2f5f1ebf1..ceffc31cc6eb 100644 --- a/drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c | |||
@@ -441,10 +441,6 @@ static void mtk_mdp_m2m_stop_streaming(struct vb2_queue *q) | |||
441 | pm_runtime_put(&ctx->mdp_dev->pdev->dev); | 441 | pm_runtime_put(&ctx->mdp_dev->pdev->dev); |
442 | } | 442 | } |
443 | 443 | ||
444 | static void mtk_mdp_m2m_job_abort(void *priv) | ||
445 | { | ||
446 | } | ||
447 | |||
448 | /* The color format (num_planes) must be already configured. */ | 444 | /* The color format (num_planes) must be already configured. */ |
449 | static void mtk_mdp_prepare_addr(struct mtk_mdp_ctx *ctx, | 445 | static void mtk_mdp_prepare_addr(struct mtk_mdp_ctx *ctx, |
450 | struct vb2_buffer *vb, | 446 | struct vb2_buffer *vb, |
@@ -1215,7 +1211,6 @@ static const struct v4l2_file_operations mtk_mdp_m2m_fops = { | |||
1215 | 1211 | ||
1216 | static const struct v4l2_m2m_ops mtk_mdp_m2m_ops = { | 1212 | static const struct v4l2_m2m_ops mtk_mdp_m2m_ops = { |
1217 | .device_run = mtk_mdp_m2m_device_run, | 1213 | .device_run = mtk_mdp_m2m_device_run, |
1218 | .job_abort = mtk_mdp_m2m_job_abort, | ||
1219 | }; | 1214 | }; |
1220 | 1215 | ||
1221 | int mtk_mdp_register_m2m_device(struct mtk_mdp_dev *mdp) | 1216 | int mtk_mdp_register_m2m_device(struct mtk_mdp_dev *mdp) |
diff --git a/drivers/media/platform/rcar_jpu.c b/drivers/media/platform/rcar_jpu.c index 90d40b2d6259..a808258a4180 100644 --- a/drivers/media/platform/rcar_jpu.c +++ b/drivers/media/platform/rcar_jpu.c | |||
@@ -1492,13 +1492,8 @@ static void jpu_device_run(void *priv) | |||
1492 | spin_unlock_irqrestore(&ctx->jpu->lock, flags); | 1492 | spin_unlock_irqrestore(&ctx->jpu->lock, flags); |
1493 | } | 1493 | } |
1494 | 1494 | ||
1495 | static void jpu_job_abort(void *priv) | ||
1496 | { | ||
1497 | } | ||
1498 | |||
1499 | static const struct v4l2_m2m_ops jpu_m2m_ops = { | 1495 | static const struct v4l2_m2m_ops jpu_m2m_ops = { |
1500 | .device_run = jpu_device_run, | 1496 | .device_run = jpu_device_run, |
1501 | .job_abort = jpu_job_abort, | ||
1502 | }; | 1497 | }; |
1503 | 1498 | ||
1504 | /* | 1499 | /* |
diff --git a/drivers/media/platform/rockchip/rga/rga.c b/drivers/media/platform/rockchip/rga/rga.c index 8ace1873202a..69a2797d7bbe 100644 --- a/drivers/media/platform/rockchip/rga/rga.c +++ b/drivers/media/platform/rockchip/rga/rga.c | |||
@@ -39,11 +39,6 @@ | |||
39 | static int debug; | 39 | static int debug; |
40 | module_param(debug, int, 0644); | 40 | module_param(debug, int, 0644); |
41 | 41 | ||
42 | static void job_abort(void *prv) | ||
43 | { | ||
44 | /* Can't do anything rational here */ | ||
45 | } | ||
46 | |||
47 | static void device_run(void *prv) | 42 | static void device_run(void *prv) |
48 | { | 43 | { |
49 | struct rga_ctx *ctx = prv; | 44 | struct rga_ctx *ctx = prv; |
@@ -104,7 +99,6 @@ static irqreturn_t rga_isr(int irq, void *prv) | |||
104 | 99 | ||
105 | static struct v4l2_m2m_ops rga_m2m_ops = { | 100 | static struct v4l2_m2m_ops rga_m2m_ops = { |
106 | .device_run = device_run, | 101 | .device_run = device_run, |
107 | .job_abort = job_abort, | ||
108 | }; | 102 | }; |
109 | 103 | ||
110 | static int | 104 | static int |
diff --git a/drivers/media/platform/s5p-g2d/g2d.c b/drivers/media/platform/s5p-g2d/g2d.c index ee7322b33666..e901201b6fcc 100644 --- a/drivers/media/platform/s5p-g2d/g2d.c +++ b/drivers/media/platform/s5p-g2d/g2d.c | |||
@@ -483,10 +483,6 @@ static int vidioc_s_crop(struct file *file, void *prv, const struct v4l2_crop *c | |||
483 | return 0; | 483 | return 0; |
484 | } | 484 | } |
485 | 485 | ||
486 | static void job_abort(void *prv) | ||
487 | { | ||
488 | } | ||
489 | |||
490 | static void device_run(void *prv) | 486 | static void device_run(void *prv) |
491 | { | 487 | { |
492 | struct g2d_ctx *ctx = prv; | 488 | struct g2d_ctx *ctx = prv; |
@@ -605,7 +601,6 @@ static const struct video_device g2d_videodev = { | |||
605 | 601 | ||
606 | static const struct v4l2_m2m_ops g2d_m2m_ops = { | 602 | static const struct v4l2_m2m_ops g2d_m2m_ops = { |
607 | .device_run = device_run, | 603 | .device_run = device_run, |
608 | .job_abort = job_abort, | ||
609 | }; | 604 | }; |
610 | 605 | ||
611 | static const struct of_device_id exynos_g2d_match[]; | 606 | static const struct of_device_id exynos_g2d_match[]; |
diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c index 79b63da27f53..04fd2e0493c0 100644 --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c | |||
@@ -2467,26 +2467,19 @@ static int s5p_jpeg_job_ready(void *priv) | |||
2467 | return 1; | 2467 | return 1; |
2468 | } | 2468 | } |
2469 | 2469 | ||
2470 | static void s5p_jpeg_job_abort(void *priv) | ||
2471 | { | ||
2472 | } | ||
2473 | |||
2474 | static struct v4l2_m2m_ops s5p_jpeg_m2m_ops = { | 2470 | static struct v4l2_m2m_ops s5p_jpeg_m2m_ops = { |
2475 | .device_run = s5p_jpeg_device_run, | 2471 | .device_run = s5p_jpeg_device_run, |
2476 | .job_ready = s5p_jpeg_job_ready, | 2472 | .job_ready = s5p_jpeg_job_ready, |
2477 | .job_abort = s5p_jpeg_job_abort, | ||
2478 | }; | 2473 | }; |
2479 | 2474 | ||
2480 | static struct v4l2_m2m_ops exynos3250_jpeg_m2m_ops = { | 2475 | static struct v4l2_m2m_ops exynos3250_jpeg_m2m_ops = { |
2481 | .device_run = exynos3250_jpeg_device_run, | 2476 | .device_run = exynos3250_jpeg_device_run, |
2482 | .job_ready = s5p_jpeg_job_ready, | 2477 | .job_ready = s5p_jpeg_job_ready, |
2483 | .job_abort = s5p_jpeg_job_abort, | ||
2484 | }; | 2478 | }; |
2485 | 2479 | ||
2486 | static struct v4l2_m2m_ops exynos4_jpeg_m2m_ops = { | 2480 | static struct v4l2_m2m_ops exynos4_jpeg_m2m_ops = { |
2487 | .device_run = exynos4_jpeg_device_run, | 2481 | .device_run = exynos4_jpeg_device_run, |
2488 | .job_ready = s5p_jpeg_job_ready, | 2482 | .job_ready = s5p_jpeg_job_ready, |
2489 | .job_abort = s5p_jpeg_job_abort, | ||
2490 | }; | 2483 | }; |
2491 | 2484 | ||
2492 | /* | 2485 | /* |
diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-core/v4l2-mem2mem.c index 725da74d15d8..4aeedb91594a 100644 --- a/drivers/media/v4l2-core/v4l2-mem2mem.c +++ b/drivers/media/v4l2-core/v4l2-mem2mem.c | |||
@@ -322,7 +322,8 @@ static void v4l2_m2m_cancel_job(struct v4l2_m2m_ctx *m2m_ctx) | |||
322 | m2m_ctx->job_flags |= TRANS_ABORT; | 322 | m2m_ctx->job_flags |= TRANS_ABORT; |
323 | if (m2m_ctx->job_flags & TRANS_RUNNING) { | 323 | if (m2m_ctx->job_flags & TRANS_RUNNING) { |
324 | spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags); | 324 | spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags); |
325 | m2m_dev->m2m_ops->job_abort(m2m_ctx->priv); | 325 | if (m2m_dev->m2m_ops->job_abort) |
326 | m2m_dev->m2m_ops->job_abort(m2m_ctx->priv); | ||
326 | dprintk("m2m_ctx %p running, will wait to complete", m2m_ctx); | 327 | dprintk("m2m_ctx %p running, will wait to complete", m2m_ctx); |
327 | wait_event(m2m_ctx->finished, | 328 | wait_event(m2m_ctx->finished, |
328 | !(m2m_ctx->job_flags & TRANS_RUNNING)); | 329 | !(m2m_ctx->job_flags & TRANS_RUNNING)); |
@@ -788,8 +789,7 @@ struct v4l2_m2m_dev *v4l2_m2m_init(const struct v4l2_m2m_ops *m2m_ops) | |||
788 | { | 789 | { |
789 | struct v4l2_m2m_dev *m2m_dev; | 790 | struct v4l2_m2m_dev *m2m_dev; |
790 | 791 | ||
791 | if (!m2m_ops || WARN_ON(!m2m_ops->device_run) || | 792 | if (!m2m_ops || WARN_ON(!m2m_ops->device_run)) |
792 | WARN_ON(!m2m_ops->job_abort)) | ||
793 | return ERR_PTR(-EINVAL); | 793 | return ERR_PTR(-EINVAL); |
794 | 794 | ||
795 | m2m_dev = kzalloc(sizeof *m2m_dev, GFP_KERNEL); | 795 | m2m_dev = kzalloc(sizeof *m2m_dev, GFP_KERNEL); |
diff --git a/include/media/v4l2-mem2mem.h b/include/media/v4l2-mem2mem.h index af48b1eca025..d60d3060f762 100644 --- a/include/media/v4l2-mem2mem.h +++ b/include/media/v4l2-mem2mem.h | |||
@@ -32,7 +32,7 @@ | |||
32 | * assumed that one source and one destination buffer are all | 32 | * assumed that one source and one destination buffer are all |
33 | * that is required for the driver to perform one full transaction. | 33 | * that is required for the driver to perform one full transaction. |
34 | * This method may not sleep. | 34 | * This method may not sleep. |
35 | * @job_abort: required. Informs the driver that it has to abort the currently | 35 | * @job_abort: optional. Informs the driver that it has to abort the currently |
36 | * running transaction as soon as possible (i.e. as soon as it can | 36 | * running transaction as soon as possible (i.e. as soon as it can |
37 | * stop the device safely; e.g. in the next interrupt handler), | 37 | * stop the device safely; e.g. in the next interrupt handler), |
38 | * even if the transaction would not have been finished by then. | 38 | * even if the transaction would not have been finished by then. |