* [PATCH linux-next] coresight: use sysfs_emit() to instead of scnprintf()
@ 2022-09-27 11:51 zhangsongyi.cgel
2022-09-28 14:56 ` James Clark
0 siblings, 1 reply; 3+ messages in thread
From: zhangsongyi.cgel @ 2022-09-27 11:51 UTC (permalink / raw)
To: mathieu.poirier
Cc: suzuki.poulose, mike.leach, leo.yan, alexander.shishkin,
mcoquelin.stm32, alexandre.torgue, coresight, linux-arm-kernel,
linux-stm32, linux-kernel, zhang songyi, Zeal Robot
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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH linux-next] coresight: use sysfs_emit() to instead of scnprintf()
2022-09-27 11:51 [PATCH linux-next] coresight: use sysfs_emit() to instead of scnprintf() zhangsongyi.cgel
@ 2022-09-28 14:56 ` James Clark
2022-09-29 10:21 ` Suzuki K Poulose
0 siblings, 1 reply; 3+ messages in thread
From: James Clark @ 2022-09-28 14:56 UTC (permalink / raw)
To: zhangsongyi.cgel
Cc: suzuki.poulose, mike.leach, leo.yan, alexander.shishkin,
mcoquelin.stm32, alexandre.torgue, coresight, linux-arm-kernel,
linux-stm32, linux-kernel, zhang songyi, Zeal Robot,
Mathieu Poirier
On 27/09/2022 12:51, zhangsongyi.cgel@gmail.com wrote:
> 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(-)
>
Reviewed-by: James Clark <james.clark@arm.com>
> 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,
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH linux-next] coresight: use sysfs_emit() to instead of scnprintf()
2022-09-28 14:56 ` James Clark
@ 2022-09-29 10:21 ` Suzuki K Poulose
0 siblings, 0 replies; 3+ messages in thread
From: Suzuki K Poulose @ 2022-09-29 10:21 UTC (permalink / raw)
To: James Clark, zhangsongyi.cgel
Cc: mike.leach, leo.yan, alexander.shishkin, mcoquelin.stm32,
alexandre.torgue, coresight, linux-arm-kernel, linux-stm32,
linux-kernel, zhang songyi, Zeal Robot, Mathieu Poirier
On 28/09/2022 15:56, James Clark wrote:
>
>
> On 27/09/2022 12:51, zhangsongyi.cgel@gmail.com wrote:
>> 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(-)
>>
>
> Reviewed-by: James Clark <james.clark@arm.com>
I have queued this locally for now, will push it once the next
cycle is out.
Suzuki
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-09-29 10:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-27 11:51 [PATCH linux-next] coresight: use sysfs_emit() to instead of scnprintf() zhangsongyi.cgel
2022-09-28 14:56 ` James Clark
2022-09-29 10:21 ` Suzuki K Poulose
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).