From 5e597b465b42e7c5a7ace97933e26cbed6ea84a3 Mon Sep 17 00:00:00 2001 From: Rahul Sharma Date: Mon, 14 Nov 2016 11:41:26 +0530 Subject: [PATCH] msm: vidc: prevent vcd_stop to wait for long Video decoder release calls vid_dec_close_client which calls vcd_stop. If vcd_stop notification fails, then there is a long wait. This patch is limiting the same Change-Id: Ibdf33e3882826429bf8c49a5888b8c9908e2e62d Signed-off-by: Rahul Sharma --- drivers/video/msm/vidc/common/dec/vdec.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/video/msm/vidc/common/dec/vdec.c b/drivers/video/msm/vidc/common/dec/vdec.c index 05531dcaedd7..d722a5b41375 100644 --- a/drivers/video/msm/vidc/common/dec/vdec.c +++ b/drivers/video/msm/vidc/common/dec/vdec.c @@ -2595,6 +2595,7 @@ static u32 vid_dec_close_client(struct video_client_ctx *client_ctx) { struct vid_dec_msg *vdec_msg; u32 vcd_status; + int rc; DBG("msm_vidc_dec: Inside %s()", __func__); if (!client_ctx || (!client_ctx->vcd_handle)) { @@ -2608,8 +2609,16 @@ static u32 vid_dec_close_client(struct video_client_ctx *client_ctx) client_ctx->stop_sync_cb = true; vcd_status = vcd_stop(client_ctx->vcd_handle); DBG("\n Stuck at the stop call"); - if (!vcd_status) - wait_for_completion(&client_ctx->event); + if (!vcd_status) { + rc = wait_for_completion_timeout(&client_ctx->event, + msecs_to_jiffies(500)); + if (!rc) + ERR("%s:ERROR vcd_stop time out rc = %d\n", + __func__, rc); + if (client_ctx->event_status) + ERR("%s:ERROR vcd_stop event_status failure\n", + __func__); + } DBG("\n Came out of wait event"); } mutex_lock(&client_ctx->msg_queue_lock);