]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
misc: enclosure: Use str_on_off() helper
authorYumeng Fang <fang.yumeng@zte.com.cn>
Mon, 23 Jun 2025 12:29:44 +0000 (20:29 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 24 Jun 2025 15:46:04 +0000 (16:46 +0100)
Remove hard-coded strings by using the str_on_off() helper.

Signed-off-by: Yumeng Fang <fang.yumeng@zte.com.cn>
Link: https://lore.kernel.org/r/20250623202944425TQzPdeMtYA8qRtlrnwiR8@zte.com.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/enclosure.c

index 76511d279aff8e9cc6e166723d45837ba9b944d7..ca4c420e4a2f7683f5334b4964344699e9cc53e4 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/module.h>
 #include <linux/mutex.h>
 #include <linux/slab.h>
+#include <linux/string_choices.h>
 
 static LIST_HEAD(container_list);
 static DEFINE_MUTEX(container_list_lock);
@@ -592,7 +593,7 @@ static ssize_t get_component_power_status(struct device *cdev,
        if (ecomp->power_status == -1)
                return (edev->cb->get_power_status) ? -EIO : -ENOTTY;
 
-       return sysfs_emit(buf, "%s\n", ecomp->power_status ? "on" : "off");
+       return sysfs_emit(buf, "%s\n", str_on_off(ecomp->power_status));
 }
 
 static ssize_t set_component_power_status(struct device *cdev,