From: <ye.xingchen@zte.com.cn>
To: <rafael@kernel.org>
Cc: <daniel.lezcano@linaro.org>, <amitk@kernel.org>,
<rui.zhang@intel.com>, <linux-pm@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: [PATCH] thermal: Convert to use sysfs_emit_at() API
Date: Tue, 17 Jan 2023 10:40:26 +0800 (CST) [thread overview]
Message-ID: <202301171040260804580@zte.com.cn> (raw)
From: ye xingchen <ye.xingchen@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.
Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
---
drivers/thermal/thermal_core.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index d9a3d9566d73..5ffc7006cce4 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -229,10 +229,9 @@ int thermal_build_list_of_policies(char *buf)
mutex_lock(&thermal_governor_lock);
list_for_each_entry(pos, &thermal_governor_list, governor_list) {
- count += scnprintf(buf + count, PAGE_SIZE - count, "%s ",
- pos->name);
+ count += sysfs_emit_at(buf, count, "%s ", pos->name);
}
- count += scnprintf(buf + count, PAGE_SIZE - count, "\n");
+ count += sysfs_emit_at(buf, count, "\n");
mutex_unlock(&thermal_governor_lock);
--
2.25.1
next reply other threads:[~2023-01-17 2:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-17 2:40 ye.xingchen [this message]
2023-02-09 19:42 ` [PATCH] thermal: Convert to use sysfs_emit_at() API Rafael J. Wysocki
-- strict thread matches above, loose matches on Subject: below --
2022-12-08 9:06 ye.xingchen
2022-12-08 11:51 ` Rafael J. Wysocki
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=202301171040260804580@zte.com.cn \
--to=ye.xingchen@zte.com.cn \
--cc=amitk@kernel.org \
--cc=daniel.lezcano@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=rui.zhang@intel.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;
as well as URLs for NNTP newsgroup(s).