scsi: ufs: Tidy up WB configuration code
PATCH v3 1/1 scsi: ufs: Tidy up WB configuration code
From: Yue Hu <[email protected]>
There are similar code implementations for WB configuration in ufshcd_wb_{ctrl, toggle_flush_during_h8, toggle_flush}. We can extract the part to create a new helper with a flag parameter to reduce code duplication.
Meanwhile, rename ufshcd_wb_ctrl() to ufshcd_wb_toggle() for better readability.
And remove unnecessary log messages from ufshcd_wb_config() since relevant toggle function will spew log respectively. Also change ufshcd_wb_toggle_flush{__during_h8} to void type accordingly.
---
v2: use opcode instead of val, update minor log words.
v3: use ternery for opcode.
drivers/scsi/ufs/ufs-sysfs.c | 2 +- drivers/scsi/ufs/ufshcd.c | 95 ++++++++++++++++++-------------------------- drivers/scsi/ufs/ufshcd.h | 2 +- 3 files changed, 40 insertions(+), 59 deletions(-)
drivers/scsi/ufs/ufs-sysfs.c +1 -1
@@ -246,7 +246,7 @@ static ssize_t wb_on_store(struct device *dev, struct device_attribute *attr, }pm_runtime_get_sync (hba->dev); - res =ufshcd_wb_ctrl (hba, wb_enable); + res =ufshcd_wb_toggle (hba, wb_enable);pm_runtime_put_sync (hba->dev); out:up (&hba->host_sem);
drivers/scsi/ufs/ufshcd.c +38 -57
158 lines not on this page · raw message
drivers/scsi/ufs/ufshcd.h +1 -1
@@ -1099,7 +1099,7 @@ int ufshcd_exec_raw_upiu_cmd(struct ufs_hba *hba, u8 *desc_buff, int *buff_len, enum query_opcode desc_op); -int ufshcd_wb_ctrl (struct ufs_hba *hba,bool enable); +int ufshcd_wb_toggle (struct ufs_hba *hba,bool enable);/* Wrapper functions for safely calling variant operations */ static inline const char *ufshcd_get_var_name (struct ufs_hba *hba)
Signature · 1 line
1.9.1
Martin K. Petersen
AppliedYue,
Quoted 4 lines
There are similar code implementations for WB configuration in ufshcd_wb_{ctrl,
toggle_flush_during_h8,toggle_flush}. We can extract the part to create a new helper with a flag parameter to reduce code duplication.
Applied to 5.13/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Martin K. Petersen
AppliedQuoted 9 lines · Yue Hu
There are similar code implementations for WB configuration in ufshcd_wb_{ctrl,
toggle_flush_during_h8,toggle_flush}. We can extract the part to create a new helper with a flag parameter to reduce code duplication.Meanwhile, rename
ufshcd_wb_ctrl()toufshcd_wb_toggle()for better readability.[...]
Applied to 5.13/scsi-queue, thanks!
[1/1] scsi: ufs: Tidy up WB configuration code
https://git.kernel.org/mkp/scsi/c/3b5f3c0d0548
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering