]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
driver core: location: Use str_yes_no() helper function
authorThorsten Blum <thorsten.blum@linux.dev>
Tue, 11 Feb 2025 13:24:09 +0000 (14:24 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Feb 2025 08:20:30 +0000 (09:20 +0100)
Remove hard-coded strings by using the str_yes_no() helper function.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Link: https://lore.kernel.org/r/20250211132409.700073-2-thorsten.blum@linux.dev
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/physical_location.c

index 5db06e825c94f2449664aba800e77317689a9d29..a5539e294d4df8a3375a1cfece520994908c2bba 100644 (file)
@@ -7,6 +7,7 @@
 
 #include <linux/acpi.h>
 #include <linux/sysfs.h>
+#include <linux/string_choices.h>
 
 #include "physical_location.h"
 
@@ -116,7 +117,7 @@ static ssize_t dock_show(struct device *dev, struct device_attribute *attr,
        char *buf)
 {
        return sysfs_emit(buf, "%s\n",
-               dev->physical_location->dock ? "yes" : "no");
+               str_yes_no(dev->physical_location->dock));
 }
 static DEVICE_ATTR_RO(dock);
 
@@ -124,7 +125,7 @@ static ssize_t lid_show(struct device *dev, struct device_attribute *attr,
        char *buf)
 {
        return sysfs_emit(buf, "%s\n",
-               dev->physical_location->lid ? "yes" : "no");
+               str_yes_no(dev->physical_location->lid));
 }
 static DEVICE_ATTR_RO(lid);