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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxx>
---
 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





[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux