Commit 79e3520f authored by Stanley Chu's avatar Stanley Chu Committed by Martin K. Petersen

scsi: ufs: Cleanup WriteBooster feature

Small cleanup as below items,

 1. Use ufshcd_is_wb_allowed() directly instead of ufshcd_wb_sup() since
    ufshcd_wb_sup() just returns the result of ufshcd_is_wb_allowed().

 2. In ufshcd_suspend(), "else if (!ufshcd_is_runtime_pm(pm_op)) can be
    simplified to "else" since both have the same meaning.

This patch does not change any functionality.

Link: https://lore.kernel.org/r/20200508080115.24233-9-stanley.chu@mediatek.comReviewed-by: default avatarAvri Altman <avri.altman@wdc.com>
Reviewed-by: default avatarAsutosh Das <asutoshd@codeaurora.org>
Signed-off-by: default avatarStanley Chu <stanley.chu@mediatek.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 29060a62
...@@ -253,7 +253,6 @@ static int ufshcd_scale_clks(struct ufs_hba *hba, bool scale_up); ...@@ -253,7 +253,6 @@ static int ufshcd_scale_clks(struct ufs_hba *hba, bool scale_up);
static irqreturn_t ufshcd_intr(int irq, void *__hba); static irqreturn_t ufshcd_intr(int irq, void *__hba);
static int ufshcd_change_power_mode(struct ufs_hba *hba, static int ufshcd_change_power_mode(struct ufs_hba *hba,
struct ufs_pa_layer_attr *pwr_mode); struct ufs_pa_layer_attr *pwr_mode);
static bool ufshcd_wb_sup(struct ufs_hba *hba);
static int ufshcd_wb_buf_flush_enable(struct ufs_hba *hba); static int ufshcd_wb_buf_flush_enable(struct ufs_hba *hba);
static int ufshcd_wb_buf_flush_disable(struct ufs_hba *hba); static int ufshcd_wb_buf_flush_disable(struct ufs_hba *hba);
static int ufshcd_wb_ctrl(struct ufs_hba *hba, bool enable); static int ufshcd_wb_ctrl(struct ufs_hba *hba, bool enable);
...@@ -285,7 +284,7 @@ static inline void ufshcd_wb_config(struct ufs_hba *hba) ...@@ -285,7 +284,7 @@ static inline void ufshcd_wb_config(struct ufs_hba *hba)
{ {
int ret; int ret;
if (!ufshcd_wb_sup(hba)) if (!ufshcd_is_wb_allowed(hba))
return; return;
ret = ufshcd_wb_ctrl(hba, true); ret = ufshcd_wb_ctrl(hba, true);
...@@ -5197,18 +5196,13 @@ static void ufshcd_bkops_exception_event_handler(struct ufs_hba *hba) ...@@ -5197,18 +5196,13 @@ static void ufshcd_bkops_exception_event_handler(struct ufs_hba *hba)
__func__, err); __func__, err);
} }
static bool ufshcd_wb_sup(struct ufs_hba *hba)
{
return ufshcd_is_wb_allowed(hba);
}
static int ufshcd_wb_ctrl(struct ufs_hba *hba, bool enable) static int ufshcd_wb_ctrl(struct ufs_hba *hba, bool enable)
{ {
int ret; int ret;
u8 index; u8 index;
enum query_opcode opcode; enum query_opcode opcode;
if (!ufshcd_wb_sup(hba)) if (!ufshcd_is_wb_allowed(hba))
return 0; return 0;
if (!(enable ^ hba->wb_enabled)) if (!(enable ^ hba->wb_enabled))
...@@ -5264,7 +5258,7 @@ static int ufshcd_wb_buf_flush_enable(struct ufs_hba *hba) ...@@ -5264,7 +5258,7 @@ static int ufshcd_wb_buf_flush_enable(struct ufs_hba *hba)
int ret; int ret;
u8 index; u8 index;
if (!ufshcd_wb_sup(hba) || hba->wb_buf_flush_enabled) if (!ufshcd_is_wb_allowed(hba) || hba->wb_buf_flush_enabled)
return 0; return 0;
index = ufshcd_wb_get_flag_index(hba); index = ufshcd_wb_get_flag_index(hba);
...@@ -5286,7 +5280,7 @@ static int ufshcd_wb_buf_flush_disable(struct ufs_hba *hba) ...@@ -5286,7 +5280,7 @@ static int ufshcd_wb_buf_flush_disable(struct ufs_hba *hba)
int ret; int ret;
u8 index; u8 index;
if (!ufshcd_wb_sup(hba) || !hba->wb_buf_flush_enabled) if (!ufshcd_is_wb_allowed(hba) || !hba->wb_buf_flush_enabled)
return 0; return 0;
index = ufshcd_wb_get_flag_index(hba); index = ufshcd_wb_get_flag_index(hba);
...@@ -5336,7 +5330,7 @@ static bool ufshcd_wb_keep_vcc_on(struct ufs_hba *hba) ...@@ -5336,7 +5330,7 @@ static bool ufshcd_wb_keep_vcc_on(struct ufs_hba *hba)
int ret; int ret;
u32 avail_buf; u32 avail_buf;
if (!ufshcd_wb_sup(hba)) if (!ufshcd_is_wb_allowed(hba))
return false; return false;
/* /*
* The ufs device needs the vcc to be ON to flush. * The ufs device needs the vcc to be ON to flush.
...@@ -8235,12 +8229,12 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op) ...@@ -8235,12 +8229,12 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
* configured WB type is 70% full, keep vcc ON * configured WB type is 70% full, keep vcc ON
* for the device to flush the wb buffer * for the device to flush the wb buffer
*/ */
if ((hba->auto_bkops_enabled && ufshcd_wb_sup(hba)) || if ((hba->auto_bkops_enabled && ufshcd_is_wb_allowed(hba)) ||
ufshcd_wb_keep_vcc_on(hba)) ufshcd_wb_keep_vcc_on(hba))
hba->dev_info.keep_vcc_on = true; hba->dev_info.keep_vcc_on = true;
else else
hba->dev_info.keep_vcc_on = false; hba->dev_info.keep_vcc_on = false;
} else if (!ufshcd_is_runtime_pm(pm_op)) { } else {
hba->dev_info.keep_vcc_on = false; hba->dev_info.keep_vcc_on = false;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment