From c8cd4c1cf2b6fd125bd78d0ff461703aa00634e1 Mon Sep 17 00:00:00 2001 From: Sunyoung Kang Date: Mon, 2 Jul 2018 15:53:37 +0900 Subject: [PATCH] [COMMON] media: mfc: DRV4.0: encapsulate mfc_ctx_ready() The mfc_ctx_ready() calls mfc_dec_ctx_ready() or mfc_enc_ctx_ready() according to ctx->type. This changes mfc_dec/enc_ctx_ready() to static and caller uses only mfc_ctx_ready(). Change-Id: Ica665363a32316a72e9f385f2f884ac68a5ab5e9 Signed-off-by: Sunyoung Kang --- drivers/media/platform/exynos/mfc/mfc_dec_v4l2.c | 4 ++-- drivers/media/platform/exynos/mfc/mfc_dec_vb2.c | 7 +++---- drivers/media/platform/exynos/mfc/mfc_enc_v4l2.c | 2 +- drivers/media/platform/exynos/mfc/mfc_enc_vb2.c | 7 +++---- drivers/media/platform/exynos/mfc/mfc_sync.c | 8 ++++---- drivers/media/platform/exynos/mfc/mfc_sync.h | 3 --- 6 files changed, 13 insertions(+), 18 deletions(-) diff --git a/drivers/media/platform/exynos/mfc/mfc_dec_v4l2.c b/drivers/media/platform/exynos/mfc/mfc_dec_v4l2.c index 06053d72dd33..fceeb14fb0d8 100644 --- a/drivers/media/platform/exynos/mfc/mfc_dec_v4l2.c +++ b/drivers/media/platform/exynos/mfc/mfc_dec_v4l2.c @@ -557,7 +557,7 @@ static int vidioc_s_fmt_vid_out_mplane(struct file *file, void *priv, mfc_debug(2, "Got instance number: %d\n", ctx->inst_no); - if (mfc_dec_ctx_ready(ctx)) + if (mfc_ctx_ready(ctx)) mfc_set_bit(ctx->num, &dev->work_bits); if (mfc_is_work_to_do(dev)) queue_work(dev->butler_wq, &dev->butler_work); @@ -664,7 +664,7 @@ static int vidioc_reqbufs(struct file *file, void *priv, ctx->capture_state = QUEUE_BUFS_REQUESTED; - if (mfc_dec_ctx_ready(ctx)) + if (mfc_ctx_ready(ctx)) mfc_set_bit(ctx->num, &dev->work_bits); mfc_try_run(dev); diff --git a/drivers/media/platform/exynos/mfc/mfc_dec_vb2.c b/drivers/media/platform/exynos/mfc/mfc_dec_vb2.c index 4478ceb2f4f4..2730527a0609 100644 --- a/drivers/media/platform/exynos/mfc/mfc_dec_vb2.c +++ b/drivers/media/platform/exynos/mfc/mfc_dec_vb2.c @@ -351,9 +351,8 @@ static int mfc_dec_start_streaming(struct vb2_queue *q, unsigned int count) mfc_change_state(ctx, MFCINST_RUNNING); /* If context is ready then dev = work->data;schedule it to run */ - if (mfc_dec_ctx_ready(ctx)) { + if (mfc_ctx_ready(ctx)) mfc_set_bit(ctx->num, &dev->work_bits); - } mfc_try_run(dev); @@ -546,7 +545,7 @@ static void mfc_dec_stop_streaming(struct vb2_queue *q) mfc_clear_bit(ctx->num, &dev->work_bits); mfc_release_hwlock_ctx(ctx); - if (mfc_dec_ctx_ready(ctx)) + if (mfc_ctx_ready(ctx)) mfc_set_bit(ctx->num, &dev->work_bits); if (mfc_is_work_to_do(dev)) queue_work(dev->butler_wq, &dev->butler_work); @@ -615,7 +614,7 @@ static void mfc_dec_buf_queue(struct vb2_buffer *vb) mfc_err_ctx("Unsupported buffer type (%d)\n", vq->type); } - if (mfc_dec_ctx_ready(ctx)) { + if (mfc_ctx_ready(ctx)) { mfc_set_bit(ctx->num, &dev->work_bits); mfc_try_run(dev); } diff --git a/drivers/media/platform/exynos/mfc/mfc_enc_v4l2.c b/drivers/media/platform/exynos/mfc/mfc_enc_v4l2.c index 09eb5b74cfe0..8fcf61dbf557 100644 --- a/drivers/media/platform/exynos/mfc/mfc_enc_v4l2.c +++ b/drivers/media/platform/exynos/mfc/mfc_enc_v4l2.c @@ -477,7 +477,7 @@ static int vidioc_s_fmt_vid_cap_mplane(struct file *file, void *priv, mfc_debug(2, "Got instance number: %d\n", ctx->inst_no); - if (mfc_enc_ctx_ready(ctx)) + if (mfc_ctx_ready(ctx)) mfc_set_bit(ctx->num, &dev->work_bits); if (ctx->otf_handle && mfc_otf_ctx_ready(ctx)) mfc_set_bit(ctx->num, &dev->work_bits); diff --git a/drivers/media/platform/exynos/mfc/mfc_enc_vb2.c b/drivers/media/platform/exynos/mfc/mfc_enc_vb2.c index b33c1e041287..f80fcc27d36d 100644 --- a/drivers/media/platform/exynos/mfc/mfc_enc_vb2.c +++ b/drivers/media/platform/exynos/mfc/mfc_enc_vb2.c @@ -328,9 +328,8 @@ static int mfc_enc_start_streaming(struct vb2_queue *q, unsigned int count) struct mfc_dev *dev = ctx->dev; /* If context is ready then dev = work->data;schedule it to run */ - if (mfc_enc_ctx_ready(ctx)) { + if (mfc_ctx_ready(ctx)) mfc_set_bit(ctx->num, &dev->work_bits); - } mfc_try_run(dev); @@ -456,9 +455,9 @@ static void mfc_enc_buf_queue(struct vb2_buffer *vb) mfc_err_ctx("unsupported buffer type (%d)\n", vq->type); } - if (mfc_enc_ctx_ready(ctx)) { + if (mfc_ctx_ready(ctx)) mfc_set_bit(ctx->num, &dev->work_bits); - } + mfc_try_run(dev); mfc_debug_leave(); diff --git a/drivers/media/platform/exynos/mfc/mfc_sync.c b/drivers/media/platform/exynos/mfc/mfc_sync.c index c2a4c6a93e08..bbe0513d56ae 100644 --- a/drivers/media/platform/exynos/mfc/mfc_sync.c +++ b/drivers/media/platform/exynos/mfc/mfc_sync.c @@ -206,7 +206,7 @@ int mfc_get_new_ctx(struct mfc_dev *dev) } /* Check whether a context should be run on hardware */ -int mfc_dec_ctx_ready(struct mfc_ctx *ctx) +static int __mfc_dec_ctx_ready(struct mfc_ctx *ctx) { struct mfc_dev *dev = ctx->dev; int src_buf_queue_greater_than_0 = 0; @@ -269,7 +269,7 @@ int mfc_dec_ctx_ready(struct mfc_ctx *ctx) return 0; } -int mfc_enc_ctx_ready(struct mfc_ctx *ctx) +static int __mfc_enc_ctx_ready(struct mfc_ctx *ctx) { struct mfc_enc *enc = ctx->enc_priv; struct mfc_dev *dev = ctx->dev; @@ -334,9 +334,9 @@ int mfc_enc_ctx_ready(struct mfc_ctx *ctx) int mfc_ctx_ready(struct mfc_ctx *ctx) { if (ctx->type == MFCINST_DECODER) - return mfc_dec_ctx_ready(ctx); + return __mfc_dec_ctx_ready(ctx); else if (ctx->type == MFCINST_ENCODER) - return mfc_enc_ctx_ready(ctx); + return __mfc_enc_ctx_ready(ctx); return 0; } diff --git a/drivers/media/platform/exynos/mfc/mfc_sync.h b/drivers/media/platform/exynos/mfc/mfc_sync.h index 21f333dd4c0e..d18cc2eccac2 100644 --- a/drivers/media/platform/exynos/mfc/mfc_sync.h +++ b/drivers/media/platform/exynos/mfc/mfc_sync.h @@ -44,11 +44,8 @@ void mfc_wake_up_ctx(struct mfc_ctx *ctx, unsigned int reason, unsigned int err); int mfc_get_new_ctx(struct mfc_dev *dev); -int mfc_dec_ctx_ready(struct mfc_ctx *ctx); -int mfc_enc_ctx_ready(struct mfc_ctx *ctx); int mfc_ctx_ready(struct mfc_ctx *ctx); - static inline void mfc_set_bit(int num, struct mfc_bits *data) { unsigned long flags; -- 2.20.1