@@ -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);
@@ -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;
}
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(-)