Skip to contentSkip to conversation

HID: hid-msi: Use str_true_false() helper

PATCH New Aryan Sinha 1 participant 1 message Oct 12

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

PATCH 1/1 HID: hid-msi: Use str_true_false() helper

Replace the open coded ternary in enabled_show() with the helper from string_choices.h. Gives Same output, but with one less conditional.

---
 drivers/hid/hid-msi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/hid/hid-msi.c +2 -1
index 3225d3bf6..4822b5d6d 100644
@@ -28,6 +28,7 @@
 #include <linux/mutex.h>
 #include <linux/pm.h>
 #include <linux/spinlock.h>
+#include <linux/string_choices.h>
 #include <linux/sysfs.h>
 #include <linux/types.h>
 #include <linux/unaligned.h>
@@ -1586,7 +1587,7 @@ static ssize_t enabled_show(struct device *dev,
 			return -ENODEV;
 	}
 
-	return sysfs_emit(buf, "%s\n", drvdata->rgb_enabled ? "true" : "false");
+	return sysfs_emit(buf, "%s\n", str_true_false(drvdata->rgb_enabled));
 }
 static DEVICE_ATTR_RW(enabled);
 
Signature · 1 line
2.46.0