]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
misc: ad525x_dpot: Use str_enabled_disabled() in sysfs_show_reg()
authorThorsten Blum <thorsten.blum@linux.dev>
Wed, 20 Aug 2025 10:27:34 +0000 (12:27 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 6 Sep 2025 13:59:46 +0000 (15:59 +0200)
Remove hard-coded strings by using the str_enabled_disabled() helper
function and silence the following Coccinelle/coccicheck warning
reported by string_choices.cocci:

  opportunity for str_enabled_disabled(..)

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

index 756ef6912b5aae8c7d870cccd9f15f1a5abccf9b..04683b981e54c623d9eef9db49042ab2ca189a52 100644 (file)
@@ -73,6 +73,7 @@
 #include <linux/kernel.h>
 #include <linux/delay.h>
 #include <linux/slab.h>
+#include <linux/string_choices.h>
 
 #include "ad525x_dpot.h"
 
@@ -418,10 +419,8 @@ static ssize_t sysfs_show_reg(struct device *dev,
        s32 value;
 
        if (reg & DPOT_ADDR_OTP_EN)
-               return sprintf(buf, "%s\n",
-                       test_bit(DPOT_RDAC_MASK & reg, data->otp_en_mask) ?
-                       "enabled" : "disabled");
-
+               return sprintf(buf, "%s\n", str_enabled_disabled(
+                       test_bit(DPOT_RDAC_MASK & reg, data->otp_en_mask)));
 
        mutex_lock(&data->update_lock);
        value = dpot_read(data, reg);