]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
greybus: svc: use string choice helpers instead of ternary operator
authorNai-Chen Cheng <bleach1827@gmail.com>
Wed, 6 Aug 2025 06:27:11 +0000 (14:27 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 19 Aug 2025 10:50:31 +0000 (12:50 +0200)
Replace ternary operator with str_enabled_disabled() helper to improve
code readability and consistency.

Generated using Coccinelle semantic patch.

Signed-off-by: Nai-Chen Cheng <bleach1827@gmail.com>
Reviewed-by: Alex Elder <elder@riscstar.com>
Link: https://lore.kernel.org/r/20250806-greybus-string-choices-v1-1-3e1c91048b62@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/greybus/svc.c

index 4256467fcd35976e011a5f226be38387ce9199b7..35ea7147dca6cb499ad71f75b7263c4ab4a9a1a3 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/kstrtox.h>
 #include <linux/workqueue.h>
 #include <linux/greybus.h>
+#include <linux/string_choices.h>
 
 #define SVC_INTF_EJECT_TIMEOUT         9000
 #define SVC_INTF_ACTIVATE_TIMEOUT      6000
@@ -73,7 +74,7 @@ static ssize_t watchdog_show(struct device *dev, struct device_attribute *attr,
        struct gb_svc *svc = to_gb_svc(dev);
 
        return sprintf(buf, "%s\n",
-                      gb_svc_watchdog_enabled(svc) ? "enabled" : "disabled");
+                      str_enabled_disabled(gb_svc_watchdog_enabled(svc)));
 }
 
 static ssize_t watchdog_store(struct device *dev,