From dbdab7dbb0742a6fc2969974888295d309bdb993 Mon Sep 17 00:00:00 2001 From: Venkat Chinta Date: Fri, 31 Jan 2020 15:05:23 -0800 Subject: [PATCH] msm: camera: ife: Change data type for timeout This commit changes the data type used to capture wait for completion timeout return value from integer type to the more appropriate unsigned long type. CRs-Fixed: 2620807 Change-Id: Ifcf54bdee133df5277ce56f0ba85442d32046eac Signed-off-by: Venkat Chinta --- drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c | 34 ++++++++----------- .../isp_hw/ife_csid_hw/cam_ife_csid_core.c | 20 +++++------ 2 files changed, 25 insertions(+), 29 deletions(-) diff --git a/drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c b/drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c index d12a375daf..ae4944b342 100644 --- a/drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c +++ b/drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c @@ -3521,6 +3521,7 @@ static int cam_ife_mgr_config_hw(void *hw_mgr_priv, struct cam_cdm_bl_request *cdm_cmd; struct cam_ife_hw_mgr_ctx *ctx; struct cam_isp_prepare_hw_update_data *hw_update_data; + unsigned long rem_jiffies = 0; if (!hw_mgr_priv || !config_hw_args) { CAM_ERR(CAM_ISP, @@ -3635,21 +3636,18 @@ static int cam_ife_mgr_config_hw(void *hw_mgr_priv, } if (cfg->init_packet) { - rc = wait_for_completion_timeout( + rem_jiffies = wait_for_completion_timeout( &ctx->config_done_complete, msecs_to_jiffies(30)); - if (rc <= 0) { + if (rem_jiffies == 0) { CAM_ERR(CAM_ISP, - "config done completion timeout for req_id=%llu rc=%d ctx_index %d", - cfg->request_id, rc, ctx->ctx_index); - if (rc == 0) - rc = -ETIMEDOUT; - } else { - rc = 0; + "config done completion timeout for req_id=%llu ctx_index %d", + cfg->request_id, ctx->ctx_index); + rc = -ETIMEDOUT; + } else CAM_DBG(CAM_ISP, "config done Success for req_id=%llu ctx_index %d", cfg->request_id, ctx->ctx_index); - } } } else { CAM_ERR(CAM_ISP, "No commands to config"); @@ -3797,6 +3795,7 @@ static int cam_ife_mgr_stop_hw(void *hw_mgr_priv, void *stop_hw_args) struct cam_ife_hw_mgr_ctx *ctx; enum cam_ife_csid_halt_cmd csid_halt_type; uint32_t i, master_base_idx = 0; + unsigned long rem_jiffies = 0; if (!hw_mgr_priv || !stop_hw_args) { CAM_ERR(CAM_ISP, "Invalid arguments"); @@ -3896,14 +3895,12 @@ static int cam_ife_mgr_stop_hw(void *hw_mgr_priv, void *stop_hw_args) cam_ife_mgr_pause_hw(ctx); - rc = wait_for_completion_timeout(&ctx->config_done_complete, + rem_jiffies = wait_for_completion_timeout(&ctx->config_done_complete, msecs_to_jiffies(10)); - if (rc == 0) { + if (rem_jiffies == 0) CAM_WARN(CAM_ISP, "config done completion timeout for last applied req_id=%llu rc=%d ctx_index %d", ctx->applied_req_id, rc, ctx->ctx_index); - rc = -ETIMEDOUT; - } if (stop_isp->stop_only) goto end; @@ -6144,6 +6141,7 @@ static int cam_ife_mgr_cmd(void *hw_mgr_priv, void *cmd_args) hw_cmd_args->ctxt_to_hw_map; struct cam_isp_hw_cmd_args *isp_hw_cmd_args = NULL; struct cam_packet *packet; + unsigned long rem_jiffies = 0; if (!hw_mgr_priv || !cmd_args) { CAM_ERR(CAM_ISP, "Invalid arguments"); @@ -6217,15 +6215,13 @@ static int cam_ife_mgr_cmd(void *hw_mgr_priv, void *cmd_args) if (ctx->last_dump_flush_req_id == ctx->applied_req_id) return 0; - rc = wait_for_completion_timeout( + rem_jiffies = wait_for_completion_timeout( &ctx->config_done_complete, msecs_to_jiffies(30)); - if (rc <= 0) { + if (rem_jiffies == 0) CAM_ERR(CAM_ISP, - "config done completion timeout, Reg dump will be unreliable rc=%d ctx_index %d", - rc, ctx->ctx_index); - rc = 0; - } + "config done completion timeout, Reg dump will be unreliable ctx_index %d", + ctx->ctx_index); ctx->last_dump_flush_req_id = ctx->applied_req_id; rc = cam_ife_mgr_handle_reg_dump(ctx, ctx->reg_dump_buf_desc, diff --git a/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.c b/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.c index bef045e79a..07ea4a8154 100644 --- a/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.c +++ b/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.c @@ -3280,7 +3280,7 @@ static int cam_ife_csid_reset_regs( csid_hw->csid_info->csid_reg; struct cam_hw_soc_info *soc_info; uint32_t val = 0; - unsigned long flags; + unsigned long flags, rem_jiffies = 0; soc_info = &csid_hw->hw_info->soc_info; @@ -3323,9 +3323,10 @@ static int cam_ife_csid_reset_regs( spin_unlock_irqrestore(&csid_hw->hw_info->hw_lock, flags); CAM_DBG(CAM_ISP, "CSID reset start"); - rc = wait_for_completion_timeout(&csid_hw->csid_top_complete, + + rem_jiffies = wait_for_completion_timeout(&csid_hw->csid_top_complete, msecs_to_jiffies(CAM_IFE_CSID_RESET_TIMEOUT_MS)); - if (rc <= 0) { + if (rem_jiffies == 0) { val = cam_io_r_mb(soc_info->reg_map[0].mem_base + csid_reg->cmn_reg->csid_top_irq_status_addr); if (val & 0x1) { @@ -3337,19 +3338,18 @@ static int cam_ife_csid_reset_regs( CAM_DBG(CAM_ISP, "CSID:%d %s reset completed %d", csid_hw->hw_intf->hw_idx, reset_hw ? "hw" : "sw", - rc); - rc = 0; + rem_jiffies); goto end; } CAM_ERR(CAM_ISP, "CSID:%d csid_reset %s fail rc = %d", - csid_hw->hw_intf->hw_idx, reset_hw ? "hw" : "sw", rc); + csid_hw->hw_intf->hw_idx, reset_hw ? "hw" : "sw", + rem_jiffies); rc = -ETIMEDOUT; goto end; - } else { + } else CAM_DBG(CAM_ISP, "CSID:%d %s reset completed %d", - csid_hw->hw_intf->hw_idx, reset_hw ? "hw" : "sw", rc); - rc = 0; - } + csid_hw->hw_intf->hw_idx, reset_hw ? "hw" : "sw", + rem_jiffies); end: return rc;