From: Yue Hu <zbestahu@gmail.com>
To: martin.petersen@oracle.com, avri.altman@wdc.com,
jejb@linux.ibm.com, alim.akhtar@samsung.com,
linux-scsi@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, huyue2@yulong.com, zbestahu@163.com
Subject: [PATCH] scsi: ufs: Don't check UFSHCD_CAP_WB_EN capability in ufshcd_wb_toggle{_flush}
Date: Fri, 19 Mar 2021 14:53:05 +0800 [thread overview]
Message-ID: <20210319065305.2188-1-zbestahu@gmail.com> (raw)
From: Yue Hu <huyue2@yulong.com>
There are several redundant calls to ufshcd_is_wb_allowed() as below:
ufshcd_wb_config()
|-> ufshcd_is_wb_allowed()
|-> ufshcd_wb_toggle() -> ufshcd_is_wb_allowed()
|-> ufshcd_wb_toggle_flush() -> ufshcd_is_wb_allowed()
wb_on_store()
|-> ufshcd_is_wb_allowed()
|-> ufshcd_wb_toggle() -> ufshcd_is_wb_allowed()
Considering code handling in wb_on_store(), let's remove needless
ufshcd_is_wb_allowed() in ufshcd_wb_toggle(). Meanwhile, keep the
check in caller ufshcd_devfreq_scale(). Accordingly, also remove
the redundant check in ufshcd_wb_toggle_flush().
Signed-off-by: Yue Hu <huyue2@yulong.com>
---
drivers/scsi/ufs/ufshcd.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index b6bfc80..ee71cba 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -1260,7 +1260,8 @@ static int ufshcd_devfreq_scale(struct ufs_hba *hba, bool scale_up)
/* Enable Write Booster if we have scaled up else disable it */
downgrade_write(&hba->clk_scaling_lock);
is_writelock = false;
- ufshcd_wb_toggle(hba, scale_up);
+ if (ufshcd_is_wb_allowed(hba))
+ ufshcd_wb_toggle(hba, scale_up);
out_unprepare:
ufshcd_clock_scaling_unprepare(hba, is_writelock);
@@ -5438,9 +5439,6 @@ int ufshcd_wb_toggle(struct ufs_hba *hba, bool enable)
{
int ret;
- if (!ufshcd_is_wb_allowed(hba))
- return 0;
-
if (!(enable ^ hba->dev_info.wb_enabled))
return 0;
@@ -5477,8 +5475,7 @@ static inline void ufshcd_wb_toggle_flush(struct ufs_hba *hba, bool enable)
{
int ret;
- if (!ufshcd_is_wb_allowed(hba) ||
- hba->dev_info.wb_buf_flush_enabled == enable)
+ if (hba->dev_info.wb_buf_flush_enabled == enable)
return;
ret = __ufshcd_wb_toggle(hba, enable, QUERY_FLAG_IDN_WB_BUFF_FLUSH_EN);
--
1.9.1
reply other threads:[~2021-03-19 6:54 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210319065305.2188-1-zbestahu@gmail.com \
--to=zbestahu@gmail.com \
--cc=alim.akhtar@samsung.com \
--cc=avri.altman@wdc.com \
--cc=huyue2@yulong.com \
--cc=jejb@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=zbestahu@163.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®