From: James Clark <james.clark@arm.com>
To: zhangsongyi.cgel@gmail.com
Cc: suzuki.poulose@arm.com, mike.leach@linaro.org,
leo.yan@linaro.org, alexander.shishkin@linux.intel.com,
mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com,
coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org,
linux-stm32@st-md-mailman.stormreply.com,
linux-kernel@vger.kernel.org,
zhang songyi <zhang.songyi@zte.com.cn>,
Zeal Robot <zealci@zte.com.cn>,
Mathieu Poirier <mathieu.poirier@linaro.org>
Subject: Re: [PATCH linux-next] coresight: use sysfs_emit() to instead of scnprintf()
Date: Wed, 28 Sep 2022 15:56:18 +0100 [thread overview]
Message-ID: <b8ad73ea-a20e-0e74-766e-eeb4cdeb1890@arm.com> (raw)
In-Reply-To: <20220927115136.259926-1-zhang.songyi@zte.com.cn>
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,
next prev parent reply other threads:[~2022-09-28 14:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-27 11:51 zhangsongyi.cgel
2022-09-28 14:56 ` James Clark [this message]
2022-09-29 10:21 ` Suzuki K Poulose
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b8ad73ea-a20e-0e74-766e-eeb4cdeb1890@arm.com \
--to=james.clark@arm.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=alexandre.torgue@foss.st.com \
--cc=coresight@lists.linaro.org \
--cc=leo.yan@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mathieu.poirier@linaro.org \
--cc=mcoquelin.stm32@gmail.com \
--cc=mike.leach@linaro.org \
--cc=suzuki.poulose@arm.com \
--cc=zealci@zte.com.cn \
--cc=zhang.songyi@zte.com.cn \
--cc=zhangsongyi.cgel@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®