[<prev] [next>] [day] [month] [year] [list]
Message-Id: <cb168c91b274af854b7c45f1feec2db43eff00f8.1519120988.git.asutoshd@codeaurora.org>
Date: Wed, 21 Feb 2018 10:26:35 +0530
From: Asutosh Das <asutoshd@...eaurora.org>
To: subhashj@...eaurora.org, cang@...eaurora.org,
vivek.gautam@...eaurora.org, rnayak@...eaurora.org,
vinholikatti@...il.com, jejb@...ux.vnet.ibm.com,
martin.petersen@...cle.com
Cc: linux-scsi@...r.kernel.org,
Venkat Gopalakrishnan <venkatg@...eaurora.org>,
Asutosh Das <asutoshd@...eaurora.org>,
linux-kernel@...r.kernel.org (open list)
Subject: [PATCH 4/9] scsi: ufshcd: fix possible unclocked register access
From: Subhash Jadavani <subhashj@...eaurora.org>
vendor specific setup_clocks ops may depend on clocks managed by ufshcd
driver so if the vendor specific setup_clocks callback is called when
the required clocks are turned off, it results into unclocked register
access.
This change make sure that required clocks are enabled before vendor
specific setup_clocks callback is called.
Signed-off-by: Subhash Jadavani <subhashj@...eaurora.org>
Signed-off-by: Venkat Gopalakrishnan <venkatg@...eaurora.org>
Signed-off-by: Can Guo <cang@...eaurora.org>
Signed-off-by: Asutosh Das <asutoshd@...eaurora.org>
---
drivers/scsi/ufs/ufshcd.c | 26 ++++++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 8d3f8ce..7a4df95 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -6782,9 +6782,16 @@ static int __ufshcd_setup_clocks(struct ufs_hba *hba, bool on,
if (list_empty(head))
goto out;
- ret = ufshcd_vops_setup_clocks(hba, on, PRE_CHANGE);
- if (ret)
- return ret;
+ /*
+ * vendor specific setup_clocks ops may depend on clocks managed by
+ * this standard driver hence call the vendor specific setup_clocks
+ * before disabling the clocks managed here.
+ */
+ if (!on) {
+ ret = ufshcd_vops_setup_clocks(hba, on, PRE_CHANGE);
+ if (ret)
+ return ret;
+ }
list_for_each_entry(clki, head, list) {
if (!IS_ERR_OR_NULL(clki->clk)) {
@@ -6808,9 +6815,16 @@ static int __ufshcd_setup_clocks(struct ufs_hba *hba, bool on,
}
}
- ret = ufshcd_vops_setup_clocks(hba, on, POST_CHANGE);
- if (ret)
- return ret;
+ /*
+ * vendor specific setup_clocks ops may depend on clocks managed by
+ * this standard driver hence call the vendor specific setup_clocks
+ * after enabling the clocks managed here.
+ */
+ if (on) {
+ ret = ufshcd_vops_setup_clocks(hba, on, POST_CHANGE);
+ if (ret)
+ return ret;
+ }
out:
if (ret) {
--
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
Powered by blists - more mailing lists