Skip to contentSkip to conversation

hwmon: (dme1737) Use str_yes_no() helper in dme1737_init_device()

PATCH In review Archit More 3 participants 3 messages Nov 9

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

PATCH 1/1 hwmon: (dme1737) Use str_yes_no() helper in dme1737_init_device()

Replace open-coded ternary string choices ("yes" / "no") with the standard str_yes_no() helper from <linux/string_choices.h>.

---
 drivers/hwmon/dme1737.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/hwmon/dme1737.c +8 -7
index b1bd3682c5fb..c3bf5f4ef941 100644
@@ -17,6 +17,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <linux/string_choices.h>
 #include <linux/jiffies.h>
 #include <linux/i2c.h>
 #include <linux/platform_device.h>
@@ -2316,13 +2317,13 @@ static int dme1737_init_device(struct device *dev)
 
 	dev_info(dev,
 		 "Optional features: pwm3=%s, pwm5=%s, pwm6=%s, fan3=%s, fan4=%s, fan5=%s, fan6=%s.\n",
-		 (data->has_features & HAS_PWM(2)) ? "yes" : "no",
-		 (data->has_features & HAS_PWM(4)) ? "yes" : "no",
-		 (data->has_features & HAS_PWM(5)) ? "yes" : "no",
-		 (data->has_features & HAS_FAN(2)) ? "yes" : "no",
-		 (data->has_features & HAS_FAN(3)) ? "yes" : "no",
-		 (data->has_features & HAS_FAN(4)) ? "yes" : "no",
-		 (data->has_features & HAS_FAN(5)) ? "yes" : "no");
+		 str_yes_no(data->has_features & HAS_PWM(2)),
+		 str_yes_no(data->has_features & HAS_PWM(4)),
+		 str_yes_no(data->has_features & HAS_PWM(5)),
+		 str_yes_no(data->has_features & HAS_FAN(2)),
+		 str_yes_no(data->has_features & HAS_FAN(3)),
+		 str_yes_no(data->has_features & HAS_FAN(4)),
+		 str_yes_no(data->has_features & HAS_FAN(5)));
 
 	reg = dme1737_read(data, DME1737_REG_TACH_PWM);
 	/* Inform if fan-to-pwm mapping differs from the default */
Signature · 1 line
2.34.1
#1 lore raw
Sashiko has reviewed this patch and found no issues.
Quoted 4 lines

Replace open-coded ternary string choices ("yes" / "no") with the standard str_yes_no() helper from <linux/string_choices.h>.

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
maintainer
#2 lore raw
In reply to Archit More
Quoted 4 lines · Archit More

Replace open-coded ternary string choices ("yes" / "no") with the standard str_yes_no() helper from <linux/string_choices.h>.

Please refrain from submitting such patches. I will not apply them. The Linux kernel is known to have thousands of bugs. If you want to do some good, concentrate on fixing some of those.

Thanks,
Guenter

Quoted 37 lines
---
  drivers/hwmon/dme1737.c | 15 ++++++++-------
  1 file changed, 8 insertions(+), 7 deletions(-)
drivers/hwmon/dme1737.c +8 -7
index b1bd3682c5fb..c3bf5f4ef941 100644
@@ -17,6 +17,7 @@
  #include <linux/module.h>
  #include <linux/init.h>
  #include <linux/slab.h>
+#include <linux/string_choices.h>
  #include <linux/jiffies.h>
  #include <linux/i2c.h>
  #include <linux/platform_device.h>
@@ -2316,13 +2317,13 @@ static int dme1737_init_device(struct device *dev)
 
  	dev_info(dev,
  		 "Optional features: pwm3=%s, pwm5=%s, pwm6=%s, fan3=%s, fan4=%s, fan5=%s, fan6=%s.\n",
-		 (data->has_features & HAS_PWM(2)) ? "yes" : "no",
-		 (data->has_features & HAS_PWM(4)) ? "yes" : "no",
-		 (data->has_features & HAS_PWM(5)) ? "yes" : "no",
-		 (data->has_features & HAS_FAN(2)) ? "yes" : "no",
-		 (data->has_features & HAS_FAN(3)) ? "yes" : "no",
-		 (data->has_features & HAS_FAN(4)) ? "yes" : "no",
-		 (data->has_features & HAS_FAN(5)) ? "yes" : "no");
+		 str_yes_no(data->has_features & HAS_PWM(2)),
+		 str_yes_no(data->has_features & HAS_PWM(4)),
+		 str_yes_no(data->has_features & HAS_PWM(5)),
+		 str_yes_no(data->has_features & HAS_FAN(2)),
+		 str_yes_no(data->has_features & HAS_FAN(3)),
+		 str_yes_no(data->has_features & HAS_FAN(4)),
+		 str_yes_no(data->has_features & HAS_FAN(5)));
 
  	reg = dme1737_read(data, DME1737_REG_TACH_PWM);
  	/* Inform if fan-to-pwm mapping differs from the default */