[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250114192730.912515-1-krzysztof.kozlowski@linaro.org>
Date: Tue, 14 Jan 2025 20:27:30 +0100
From: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
To: Suzuki K Poulose <suzuki.poulose@....com>,
Mike Leach <mike.leach@...aro.org>,
James Clark <james.clark@...aro.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
coresight@...ts.linaro.org,
linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
Subject: [PATCH] coresight: Use str_enable_disable-like helpers
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@...aro.org>
---
drivers/hwtracing/coresight/coresight-config.c | 3 ++-
drivers/hwtracing/coresight/coresight-cpu-debug.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
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@...aro.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;
}
--
2.43.0
Powered by blists - more mailing lists