linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: <ye.xingchen@zte.com.cn>
To: <rafael@kernel.org>
Cc: <daniel.lezcano@linaro.org>, <amitk@kernel.org>,
	<rui.zhang@intel.com>, <srinivas.pandruvada@linux.intel.com>,
	<dave@stgolabs.net>, <keescook@chromium.org>,
	<sumeet.r.pawnikar@intel.com>, <jiasheng@iscas.ac.cn>,
	<linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH] thermal/int340x_thermal: Convert to use sysfs_emit_at() API
Date: Thu, 8 Dec 2022 17:07:50 +0800 (CST)	[thread overview]
Message-ID: <202212081707505932014@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>
---
 .../thermal/intel/int340x_thermal/int3400_thermal.c    | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
index db8a6f63657d..c1fc4a78607c 100644
--- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
+++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
@@ -130,10 +130,7 @@ static ssize_t available_uuids_show(struct device *dev,

 	for (i = 0; i < INT3400_THERMAL_MAXIMUM_UUID; i++) {
 		if (priv->uuid_bitmap & (1 << i))
-			length += scnprintf(&buf[length],
-					    PAGE_SIZE - length,
-					    "%s\n",
-					    int3400_thermal_uuids[i]);
+			length += sysfs_emit_at(buf, length, int3400_thermal_uuids[i]);
 	}

 	return length;
@@ -151,10 +148,7 @@ static ssize_t current_uuid_show(struct device *dev,

 	for (i = 0; i <= INT3400_THERMAL_CRITICAL; i++) {
 		if (priv->os_uuid_mask & BIT(i))
-			length += scnprintf(&buf[length],
-					    PAGE_SIZE - length,
-					    "%s\n",
-					    int3400_thermal_uuids[i]);
+			length += sysfs_emit_at(buf, length, int3400_thermal_uuids[i]);
 	}

 	if (length)
-- 
2.25.1

             reply	other threads:[~2022-12-08  9:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-08  9:07 ye.xingchen [this message]
2022-12-08 11:50 ` [PATCH] thermal/int340x_thermal: Convert to use sysfs_emit_at() API Rafael J. Wysocki
  -- strict thread matches above, loose matches on Subject: below --
2023-01-17  2:42 ye.xingchen
2023-01-20 17:00 ` 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=202212081707505932014@zte.com.cn \
    --to=ye.xingchen@zte.com.cn \
    --cc=amitk@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=dave@stgolabs.net \
    --cc=jiasheng@iscas.ac.cn \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=srinivas.pandruvada@linux.intel.com \
    --cc=sumeet.r.pawnikar@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).