diff mbox series

coresight: Use str_enable_disable-like helpers

Message ID 20250114192730.912515-1-krzysztof.kozlowski@linaro.org (mailing list archive)
State New
Headers show
Series coresight: Use str_enable_disable-like helpers | expand

Commit Message

Krzysztof Kozlowski Jan. 14, 2025, 7:27 p.m. UTC
Replace ternary (condition ? "enable" : "disable") syntax with helpers
from string_choices.h because:
1. Simple function call with one argument is easier to read.  Ternary
   operator has three arguments and with wrapping might lead to quite
   long code.
2. Is slightly shorter thus also easier to read.
3. It brings uniformity in the text - same string.
4. Allows deduping by the linker, which results in a smaller binary
   file.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 drivers/hwtracing/coresight/coresight-config.c    | 3 ++-
 drivers/hwtracing/coresight/coresight-cpu-debug.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/hwtracing/coresight/coresight-config.c b/drivers/hwtracing/coresight/coresight-config.c
index 4723bf7402a2..d39887f22df5 100644
--- a/drivers/hwtracing/coresight/coresight-config.c
+++ b/drivers/hwtracing/coresight/coresight-config.c
@@ -4,6 +4,7 @@ 
  * Author: Mike Leach <mike.leach@linaro.org>
  */
 
+#include <linux/string_choices.h>
 #include <linux/sysfs.h>
 #include "coresight-config.h"
 #include "coresight-priv.h"
@@ -233,7 +234,7 @@  static int cscfg_prog_config(struct cscfg_config_csdev *config_csdev, bool enabl
 		feat_csdev = config_csdev->feats_csdev[i];
 		csdev = feat_csdev->csdev;
 		dev_dbg(&csdev->dev, "cfg %s;  %s feature:%s", config_csdev->config_desc->name,
-			enable ? "enable" : "disable", feat_csdev->feat_desc->name);
+			str_enable_disable(enable), feat_csdev->feat_desc->name);
 
 		if (enable)
 			err = cscfg_set_on_enable(feat_csdev);
diff --git a/drivers/hwtracing/coresight/coresight-cpu-debug.c b/drivers/hwtracing/coresight/coresight-cpu-debug.c
index 342c3aaf414d..d93d8d480e05 100644
--- a/drivers/hwtracing/coresight/coresight-cpu-debug.c
+++ b/drivers/hwtracing/coresight/coresight-cpu-debug.c
@@ -23,6 +23,7 @@ 
 #include <linux/pm_qos.h>
 #include <linux/slab.h>
 #include <linux/smp.h>
+#include <linux/string_choices.h>
 #include <linux/types.h>
 #include <linux/uaccess.h>
 
@@ -496,7 +497,7 @@  static ssize_t debug_func_knob_write(struct file *f,
 
 	if (ret) {
 		pr_err("%s: unable to %s debug function: %d\n",
-		       __func__, val ? "enable" : "disable", ret);
+		       __func__, str_enable_disable(val), ret);
 		goto err;
 	}