From patchwork Thu Dec 8 09:06:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ye.xingchen@zte.com.cn X-Patchwork-Id: 632819 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2AFE0C4332F for ; Thu, 8 Dec 2022 09:07:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230149AbiLHJHu (ORCPT ); Thu, 8 Dec 2022 04:07:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230201AbiLHJHT (ORCPT ); Thu, 8 Dec 2022 04:07:19 -0500 Received: from mxct.zte.com.cn (mxct.zte.com.cn [183.62.165.209]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29FB86D7DA; Thu, 8 Dec 2022 01:06:33 -0800 (PST) Received: from mse-fl1.zte.com.cn (unknown [10.5.228.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mxct.zte.com.cn (FangMail) with ESMTPS id 4NSSvC2GbRz4y0vL; Thu, 8 Dec 2022 17:06:31 +0800 (CST) Received: from xaxapp03.zte.com.cn ([10.88.40.52]) by mse-fl1.zte.com.cn with SMTP id 2B896QIo053511; Thu, 8 Dec 2022 17:06:26 +0800 (+08) (envelope-from ye.xingchen@zte.com.cn) Received: from mapi (xaxapp01[null]) by mapi (Zmail) with MAPI id mid31; Thu, 8 Dec 2022 17:06:29 +0800 (CST) Date: Thu, 8 Dec 2022 17:06:29 +0800 (CST) X-Zmail-TransId: 2af96391a9151619e636 X-Mailer: Zmail v1.0 Message-ID: <202212081706290141979@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , , Subject: =?utf-8?q?=5BPATCH=5D_thermal=3A_Convert_to_use_sysfs=5Femit=5Fat?= =?utf-8?q?=28=29_API?= X-MAIL: mse-fl1.zte.com.cn 2B896QIo053511 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.251.13.novalocal with ID 6391A917.000 by FangMail milter! X-FangMail-Envelope: 1670490391/4NSSvC2GbRz4y0vL/6391A917.000/10.5.228.132/[10.5.228.132]/mse-fl1.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 6391A917.000/4NSSvC2GbRz4y0vL Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: ye xingchen 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 --- 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 f17ab2316dbd..91d40ce62c92 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);