Skip to contentSkip to conversation

scsi: ufs: ufshcd: use str_enabled_disabled() for Write Booster messages

PATCH In review Animesh Rai 2 participants 2 messages Jul 1 – Jul 6

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: ufs: ufshcd: use str_enabled_disabled() for Write Booster messages

Replace open-coded ternary expressions of the form
enable ? "enabled" : "disabled"
with the str_enabled_disabled() helper from <linux/string_choices.h>.

This reduces code duplication and allows the linker to deduplicate the constant strings across the kernel image.

---
 drivers/ufs/core/ufshcd.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/ufs/core/ufshcd.c +4 -3
index d3044a3089b5..e9cbed514a5c 100644
@@ -26,6 +26,7 @@
 #include <linux/sched/clock.h>
 #include <linux/sizes.h>
 #include <linux/iopoll.h>
+#include <linux/string_choices.h>
 #include <scsi/scsi_cmnd.h>
 #include <scsi/scsi_dbg.h>
 #include <scsi/scsi_driver.h>
@@ -6339,7 +6340,7 @@ int ufshcd_wb_toggle(struct ufs_hba *hba, bool enable)
 
 	hba->dev_info.wb_enabled = enable;
 	dev_dbg(hba->dev, "%s: Write Booster %s\n",
-			__func__, enable ? "enabled" : "disabled");
+			__func__, str_enabled_disabled(enable));
 
 	return ret;
 }
@@ -6357,7 +6358,7 @@ static void ufshcd_wb_toggle_buf_flush_during_h8(struct ufs_hba *hba,
 		return;
 	}
 	dev_dbg(hba->dev, "%s: WB-Buf Flush during H8 %s\n",
-			__func__, enable ? "enabled" : "disabled");
+			__func__, str_enabled_disabled(enable));
 }
 
 int ufshcd_wb_toggle_buf_flush(struct ufs_hba *hba, bool enable)
@@ -6377,7 +6378,7 @@ int ufshcd_wb_toggle_buf_flush(struct ufs_hba *hba, bool enable)
 
 	hba->dev_info.wb_buf_flush_enabled = enable;
 	dev_dbg(hba->dev, "%s: WB-Buf Flush %s\n",
-			__func__, enable ? "enabled" : "disabled");
+			__func__, str_enabled_disabled(enable));
 
 	return ret;
 }
Signature · 1 line
2.43.0
#1 lore raw
Quoted 6 lines · Animesh Rai

Replace open-coded ternary expressions of the form
enable ? "enabled" : "disabled"
with the str_enabled_disabled() helper from <linux/string_choices.h>.

This reduces code duplication and allows the linker to deduplicate the constant strings across the kernel image.

This patch doesn't look like an improvement to me. I don't think that we need this patch.

Bart.