Skip to contentSkip to conversation

driver core: location: Use str_yes_no() helper function

PATCH New Thorsten Blum 1 participant 1 message Feb 11, 2025 Driver core

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 driver core: location: Use str_yes_no() helper function

Remove hard-coded strings by using the str_yes_no() helper function.

---
 drivers/base/physical_location.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/base/physical_location.c +3 -2
index 5db06e825c94..a5539e294d4d 100644
@@ -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);
 
Signature · 1 line
2.48.1