mtd: msm_qpic_nand: Add mutex lock in system suspend/resume functions

Some race condition is happening where as part of mtd_write_oob post
msm_nand_get_devices function msm_nand_suspend function is getting
invoked and since we don't have any locks there so it ends up turning
off the qpic clocks leading to NOC error.

Add mutex lock in system suspend/resume functions for synchronization.

Change-Id: Iaa3e3ee0041c425e2edddc5a023074009010e393
Signed-off-by: Sarthak Garg <quic_sartgarg@quicinc.com>
Signed-off-by: Pradeep P V K <quic_pragalla@quicinc.com>
This commit is contained in:
Pradeep P V K 2023-09-08 11:55:47 +05:30
parent 58114830df
commit 6c27e9b705

View File

@ -231,20 +231,27 @@ static void msm_nand_print_rpm_info(struct device *dev)
static int msm_nand_suspend(struct device *dev)
{
int ret = 0;
struct msm_nand_info *info = dev_get_drvdata(dev);
mutex_lock(&info->lock);
if (!pm_runtime_suspended(dev))
ret = msm_nand_runtime_suspend(dev);
mutex_unlock(&info->lock);
return ret;
}
static int msm_nand_resume(struct device *dev)
{
int ret = 0;
struct msm_nand_info *info = dev_get_drvdata(dev);
mutex_lock(&info->lock);
if (!pm_runtime_suspended(dev))
ret = msm_nand_runtime_resume(dev);
mutex_unlock(&info->lock);
return ret;
}
#else