lkml.org 
[lkml]   [2022]   [Sep]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH linux-next] coresight: use sysfs_emit() to instead of scnprintf()
Date
From: zhang songyi <zhang.songyi@zte.com.cn>

Follow the advice of the Documentation/filesystems/sysfs.rst and show()
should only use sysfs_emit() or sysfs_emit_at() when formatting the value
to be returned to user space.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: zhang songyi <zhang.songyi@zte.com.cn>
---
drivers/hwtracing/coresight/coresight-stm.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-stm.c b/drivers/hwtracing/coresight/coresight-stm.c
index 463f449cfb79..3a1b07217932 100644
--- a/drivers/hwtracing/coresight/coresight-stm.c
+++ b/drivers/hwtracing/coresight/coresight-stm.c
@@ -466,7 +466,7 @@ static ssize_t hwevent_enable_show(struct device *dev,
struct stm_drvdata *drvdata = dev_get_drvdata(dev->parent);
unsigned long val = drvdata->stmheer;

- return scnprintf(buf, PAGE_SIZE, "%#lx\n", val);
+ return sysfs_emit(buf, "%#lx\n", val);
}

static ssize_t hwevent_enable_store(struct device *dev,
@@ -495,7 +495,7 @@ static ssize_t hwevent_select_show(struct device *dev,
struct stm_drvdata *drvdata = dev_get_drvdata(dev->parent);
unsigned long val = drvdata->stmhebsr;

- return scnprintf(buf, PAGE_SIZE, "%#lx\n", val);
+ return sysfs_emit(buf, "%#lx\n", val);
}

static ssize_t hwevent_select_store(struct device *dev,
@@ -530,7 +530,7 @@ static ssize_t port_select_show(struct device *dev,
spin_unlock(&drvdata->spinlock);
}

- return scnprintf(buf, PAGE_SIZE, "%#lx\n", val);
+ return sysfs_emit(buf, "%#lx\n", val);
}

static ssize_t port_select_store(struct device *dev,
@@ -577,7 +577,7 @@ static ssize_t port_enable_show(struct device *dev,
spin_unlock(&drvdata->spinlock);
}

- return scnprintf(buf, PAGE_SIZE, "%#lx\n", val);
+ return sysfs_emit(buf, "%#lx\n", val);
}

static ssize_t port_enable_store(struct device *dev,
--
2.25.1

\
 
 \ /
  Last update: 2022-09-27 13:52    [W:0.489 / U:0.532 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site