aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNitin Rawat <nitirawa@codeaurora.org>2020-06-17 23:05:45 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2020-06-24 09:26:09 -0700
commit99368f4304a7ce1f2d9ec6064ba5e965c8e671a8 (patch)
tree7d5568513d674dc97dbdb06a2621670bbaf86699
parent2ffb6e9fc9f3bc857e569127d533965d4e5bd872 (diff)
scsi: ufs: Resume ufs host before accessing controller registerLA.UM.8.12.r1-12500-sm8250.0
Ensure hba's power runtime status is active before accessing auto hibern8 timer register. To guarantee this, add pm_runtime_get/put_sync() before call is made to access the register. There might be scenarios where userspace is trying to access the UFS exposed API to change the value of auto hiber8 timer when hba power runtime status could be either RPM_RESUMING or RPM_SUSPENDED. so in these cases, when hibern8 exit is sent to device , since device has not yet resumed, we see hiber8 failure with reason as power fatal error. To fix this always calls pm_runtime_get_sync which ensures device is in active status before first command is sent to device . Change-Id: Icfcb3d9cf2b30bbc23fdc18e3aaca2c933024854 Signed-off-by: Nitin Rawat <nitirawa@codeaurora.org>
-rw-r--r--drivers/scsi/ufs/ufs-sysfs.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/scsi/ufs/ufs-sysfs.c b/drivers/scsi/ufs/ufs-sysfs.c
index b6690a068768..4ac38aee5d93 100644
--- a/drivers/scsi/ufs/ufs-sysfs.c
+++ b/drivers/scsi/ufs/ufs-sysfs.c
@@ -131,6 +131,7 @@ static void ufshcd_auto_hibern8_update(struct ufs_hba *hba, u32 ahit)
goto out_unlock;
if (!pm_runtime_suspended(hba->dev)) {
spin_unlock_irqrestore(hba->host->host_lock, flags);
+ pm_runtime_get_sync(hba->dev);
ufshcd_hold(hba, false);
down_write(&hba->lock);
ufshcd_scsi_block_requests(hba);
@@ -145,6 +146,7 @@ static void ufshcd_auto_hibern8_update(struct ufs_hba *hba, u32 ahit)
up_write(&hba->lock);
ufshcd_scsi_unblock_requests(hba);
ufshcd_release(hba, false);
+ pm_runtime_put(hba->dev);
return;
}
hba->ahit = ahit;