[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b8ad73ea-a20e-0e74-766e-eeb4cdeb1890@arm.com>
Date: Wed, 28 Sep 2022 15:56:18 +0100
From: James Clark <james.clark@....com>
To: zhangsongyi.cgel@...il.com
Cc: suzuki.poulose@....com, mike.leach@...aro.org, leo.yan@...aro.org,
alexander.shishkin@...ux.intel.com, mcoquelin.stm32@...il.com,
alexandre.torgue@...s.st.com, coresight@...ts.linaro.org,
linux-arm-kernel@...ts.infradead.org,
linux-stm32@...md-mailman.stormreply.com,
linux-kernel@...r.kernel.org,
zhang songyi <zhang.songyi@....com.cn>,
Zeal Robot <zealci@....com.cn>,
Mathieu Poirier <mathieu.poirier@...aro.org>
Subject: Re: [PATCH linux-next] coresight: use sysfs_emit() to instead of
scnprintf()
On 27/09/2022 12:51, zhangsongyi.cgel@...il.com wrote:
> From: zhang songyi <zhang.songyi@....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@....com.cn>
> Signed-off-by: zhang songyi <zhang.songyi@....com.cn>
> ---
> drivers/hwtracing/coresight/coresight-stm.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
Reviewed-by: James Clark <james.clark@....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,
Powered by blists - more mailing lists