[PATCH] scsi: ufs: core: Use str_true_false() helper in UFS_FLAG()

liu.xuemei1@zte.com.cn posted 1 patch 2 months, 2 weeks ago
drivers/ufs/core/ufs-sysfs.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[PATCH] scsi: ufs: core: Use str_true_false() helper in UFS_FLAG()
Posted by liu.xuemei1@zte.com.cn 2 months, 2 weeks ago
From: Liu Song <liu.song13@zte.com.cn>

Remove hard-coded strings by using the str_true_false() helper function.

Signed-off-by: Liu Song <liu.song13@zte.com.cn>
---
 drivers/ufs/core/ufs-sysfs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/ufs/core/ufs-sysfs.c b/drivers/ufs/core/ufs-sysfs.c
index 00948378a719..4bd7d491e3c5 100644
--- a/drivers/ufs/core/ufs-sysfs.c
+++ b/drivers/ufs/core/ufs-sysfs.c
@@ -5,6 +5,7 @@
 #include <linux/string.h>
 #include <linux/bitfield.h>
 #include <linux/unaligned.h>
+#include <linux/string_choices.h>

 #include <ufs/ufs.h>
 #include <ufs/unipro.h>
@@ -1516,7 +1517,7 @@ static ssize_t _name##_show(struct device *dev,				\
 		ret = -EINVAL;						\
 		goto out;						\
 	}								\
-	ret = sysfs_emit(buf, "%s\n", flag ? "true" : "false");		\
+	ret = sysfs_emit(buf, "%s\n", str_true_false(flag));		\
 out:									\
 	up(&hba->host_sem);						\
 	return ret;							\
-- 
2.27.0
Re: [PATCH] scsi: ufs: core: Use str_true_false() helper in UFS_FLAG()
Posted by Martin K. Petersen 2 months, 1 week ago
> Remove hard-coded strings by using the str_true_false() helper
> function.

Applied to 6.17/scsi-staging, thanks!

-- 
Martin K. Petersen
Re: [PATCH] scsi: ufs: core: Use str_true_false() helper in UFS_FLAG()
Posted by Peter Wang (王信友) 2 months, 2 weeks ago
On Mon, 2025-07-21 at 20:01 +0800, liu.xuemei1@zte.com.cn wrote:
> 
> @@ -1516,7 +1517,7 @@ static ssize_t _name##_show(struct device
> *dev,                           \
>                 ret = -
> EINVAL;                                          \
>                 goto
> out;                                               \
>        
> }                                                               \
> -       ret = sysfs_emit(buf, "%s\n", flag ? "true" :
> "false");         \
> +       ret = sysfs_emit(buf, "%s\n",
> str_true_false(flag));            \
>  out:                                                                
>    \
>         up(&hba-
> >host_sem);                                             \
>         return
> ret;                                                     \
> --
> 2.27.0

Reviewed-by: Peter Wang <peter.wang@mediatek.com>