From b0636474cee353f6a2abfede14b70059aea8e463 Mon Sep 17 00:00:00 2001 From: Tejas Prajapati Date: Wed, 16 Sep 2020 14:41:22 +0530 Subject: [PATCH] msm: camera: icp: use mutex to avoid sleep in spin_lock __might_sleep() cannot be called inside spin_lock, clock core has __might_sleep() call so use mutex in place of spin_lock. Change-Id: Ib09097fa4371a5105553af49f4c75643884cd892 Signed-off-by: Tejas Prajapati --- .../platform/msm/camera/cam_icp/icp_hw/bps_hw/bps_core.c | 9 ++++----- .../platform/msm/camera/cam_icp/icp_hw/ipe_hw/ipe_core.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/media/platform/msm/camera/cam_icp/icp_hw/bps_hw/bps_core.c b/drivers/media/platform/msm/camera/cam_icp/icp_hw/bps_hw/bps_core.c index ced608357161..077a6b455161 100644 --- a/drivers/media/platform/msm/camera/cam_icp/icp_hw/bps_hw/bps_core.c +++ b/drivers/media/platform/msm/camera/cam_icp/icp_hw/bps_hw/bps_core.c @@ -300,7 +300,6 @@ int cam_bps_process_cmd(void *device_priv, uint32_t cmd_type, struct cam_bps_device_core_info *core_info = NULL; struct cam_bps_device_hw_info *hw_info = NULL; int rc = 0; - unsigned long flags; if (!device_priv) { CAM_ERR(CAM_ICP, "Invalid arguments"); @@ -394,16 +393,16 @@ int cam_bps_process_cmd(void *device_priv, uint32_t cmd_type, } break; case CAM_ICP_BPS_CMD_DISABLE_CLK: - spin_lock_irqsave(&bps_dev->hw_lock, flags); + mutex_lock(&bps_dev->hw_mutex); if (core_info->clk_enable == true) cam_bps_toggle_clk(soc_info, false); core_info->clk_enable = false; - spin_unlock_irqrestore(&bps_dev->hw_lock, flags); + mutex_unlock(&bps_dev->hw_mutex); break; case CAM_ICP_BPS_CMD_RESET: - spin_lock_irqsave(&bps_dev->hw_lock, flags); + mutex_lock(&bps_dev->hw_mutex); rc = cam_bps_cmd_reset(soc_info, core_info); - spin_unlock_irqrestore(&bps_dev->hw_lock, flags); + mutex_unlock(&bps_dev->hw_mutex); break; default: CAM_ERR(CAM_ICP, "Invalid Cmd Type:%u", cmd_type); diff --git a/drivers/media/platform/msm/camera/cam_icp/icp_hw/ipe_hw/ipe_core.c b/drivers/media/platform/msm/camera/cam_icp/icp_hw/ipe_hw/ipe_core.c index 88092c624084..7d27401036a8 100644 --- a/drivers/media/platform/msm/camera/cam_icp/icp_hw/ipe_hw/ipe_core.c +++ b/drivers/media/platform/msm/camera/cam_icp/icp_hw/ipe_hw/ipe_core.c @@ -300,7 +300,6 @@ int cam_ipe_process_cmd(void *device_priv, uint32_t cmd_type, struct cam_ipe_device_core_info *core_info = NULL; struct cam_ipe_device_hw_info *hw_info = NULL; int rc = 0; - unsigned long flags; if (!device_priv) { CAM_ERR(CAM_ICP, "Invalid arguments"); @@ -389,16 +388,16 @@ int cam_ipe_process_cmd(void *device_priv, uint32_t cmd_type, } break; case CAM_ICP_IPE_CMD_DISABLE_CLK: - spin_lock_irqsave(&ipe_dev->hw_lock, flags); + mutex_lock(&ipe_dev->hw_mutex); if (core_info->clk_enable == true) cam_ipe_toggle_clk(soc_info, false); core_info->clk_enable = false; - spin_unlock_irqrestore(&ipe_dev->hw_lock, flags); + mutex_unlock(&ipe_dev->hw_mutex); break; case CAM_ICP_IPE_CMD_RESET: - spin_lock_irqsave(&ipe_dev->hw_lock, flags); + mutex_lock(&ipe_dev->hw_mutex); rc = cam_ipe_cmd_reset(soc_info, core_info); - spin_unlock_irqrestore(&ipe_dev->hw_lock, flags); + mutex_unlock(&ipe_dev->hw_mutex); break; default: CAM_ERR(CAM_ICP, "Invalid Cmd Type:%u", cmd_type);