[PATCH v1] aoe: Convert ternary operator to str_up_down() helper

Yu Jiaoliang posted 1 patch 3 months, 4 weeks ago
drivers/block/aoe/aoeblk.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[PATCH v1] aoe: Convert ternary operator to str_up_down() helper
Posted by Yu Jiaoliang 3 months, 4 weeks ago
Replace direct ternary condition check with existing helper function
str_up_down() to improve code readability and maintain consistency.

Signed-off-by: Yu Jiaoliang <yujiaoliang@vivo.com>
---
 drivers/block/aoe/aoeblk.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c
index 00b74a845..0d95e06e0 100644
--- a/drivers/block/aoe/aoeblk.c
+++ b/drivers/block/aoe/aoeblk.c
@@ -17,6 +17,7 @@
 #include <linux/export.h>
 #include <linux/moduleparam.h>
 #include <linux/debugfs.h>
+#include <linux/string_choices.h>
 #include <scsi/sg.h>
 #include "aoe.h"
 
@@ -37,7 +38,7 @@ static ssize_t aoedisk_show_state(struct device *dev,
 	struct aoedev *d = disk->private_data;
 
 	return sysfs_emit(page, "%s%s\n",
-			(d->flags & DEVFL_UP) ? "up" : "down",
+			str_up_down(d->flags & DEVFL_UP),
 			(d->flags & DEVFL_KICKME) ? ",kickme" :
 			(d->nopen && !(d->flags & DEVFL_UP)) ? ",closewait" : "");
 	/* I'd rather see nopen exported so we can ditch closewait */
-- 
2.34.1