Message ID | 202301171040260804580@zte.com.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1525270wrn; Mon, 16 Jan 2023 18:56:14 -0800 (PST) X-Google-Smtp-Source: AMrXdXtu2KKOJ/JdA2BFzkKseU17Zyfx+/Yyoc/syQN7gk3ZW0KLkQRT4qWrsQouMgu7dosv0Fk3 X-Received: by 2002:a05:6a20:a5a2:b0:b8:8a94:5bf with SMTP id bc34-20020a056a20a5a200b000b88a9405bfmr1382060pzb.21.1673924173810; Mon, 16 Jan 2023 18:56:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673924173; cv=none; d=google.com; s=arc-20160816; b=Wv0yBGkoKplOvQx0NE01eJDfBMUuWcFBWM87k2Mnat2yAI+MAjyCzmr52Tv6CJMgAQ C9wmx4o090OpXfu+cppjA/vLYSScZ9+fwAt1YbDPRIjtFQdcTUCPUzJt4BalNKjOyDSa hZTVd9qMDn0hyw0ueknybwztXtBawJp5JxAs44baRT5qtSXCrICTBvbRECJMkt7MiuK/ ys12C5r6Vp7YqovIBCsrk2qddBKkVLnZ0P71misP7XXUzwN+HJuHu9rV5BIQ3kiXZaLK qiIXnPSKesCGOWOi1czBUseu6zlu5hCG2FiO4ijPFdb7mPIKiLfdV1yv0jnRHFTGxdD3 PADA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:mime-version:message-id:date; bh=ZVEgdreiZXI76qA9rrRnaILcP5sm9FRpkvor64NxdCk=; b=kiN7yvcs08YGejnoNGe3o5b7QJfmma885dT4R2/odpBb8p5Xqnp9yhY+z3HnCYhEMD K/KaCA597gTqkIlVJyvIPlpNOr3NyQSjTST1myr/QEOxjWDHIp7wGKyzekrfKLpn5poW BGycxWJy+NRwdJFa+cjfTOgRBfGKoZkupALJYyeH2zEC4vmEFwAXWSyVcjy2gomuARkf 2Kusa4di35pmR2kgYgjzX7dUeOibcHQBDdW+Rw+HwmZqOH1QIHa3sevz5frGf0n+HWB7 i+PZ5MovqBXjClrHRMJVywHXk4PyL98fFs7085aheSAzyd7THsfXBhWc3IEc4dOhRJQz JfPA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zte.com.cn Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g64-20020a636b43000000b0049bdfffc5a8si31085190pgc.23.2023.01.16.18.56.01; Mon, 16 Jan 2023 18:56:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zte.com.cn Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235685AbjAQCuy (ORCPT <rfc822;stefanalexe802@gmail.com> + 99 others); Mon, 16 Jan 2023 21:50:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235652AbjAQCuI (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 16 Jan 2023 21:50:08 -0500 Received: from mxct.zte.com.cn (mxct.zte.com.cn [58.251.27.85]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B0312CC78; Mon, 16 Jan 2023 18:43:10 -0800 (PST) Received: from mxde.zte.com.cn (unknown [10.35.20.165]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mxct.zte.com.cn (FangMail) with ESMTPS id 4NwtV03zmDz1DFC; Tue, 17 Jan 2023 10:42:48 +0800 (CST) Received: from mxus.zte.com.cn (unknown [10.207.168.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mxde.zte.com.cn (FangMail) with ESMTPS id 4NwtSy0bk8z64Wf7; Tue, 17 Jan 2023 10:41:54 +0800 (CST) Received: from mxhk.zte.com.cn (unknown [192.168.250.138]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mxus.zte.com.cn (FangMail) with ESMTPS id 4NwtRz3N4zzdmYkn; Tue, 17 Jan 2023 10:41:03 +0800 (CST) 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 mxhk.zte.com.cn (FangMail) with ESMTPS id 4NwtRM1KGKz6FK2V; Tue, 17 Jan 2023 10:40:31 +0800 (CST) Received: from xaxapp01.zte.com.cn ([10.88.99.176]) by mse-fl1.zte.com.cn with SMTP id 30H2eOU0046357; Tue, 17 Jan 2023 10:40:24 +0800 (+08) (envelope-from ye.xingchen@zte.com.cn) Received: from mapi (xaxapp01[null]) by mapi (Zmail) with MAPI id mid31; Tue, 17 Jan 2023 10:40:26 +0800 (CST) Date: Tue, 17 Jan 2023 10:40:26 +0800 (CST) X-Zmail-TransId: 2af963c60a9affffffff9fc2c9df X-Mailer: Zmail v1.0 Message-ID: <202301171040260804580@zte.com.cn> Mime-Version: 1.0 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: =?utf-8?q?=5BPATCH=5D_thermal=3A_Convert_to_use_sysfs=5Femit=5Fat?= =?utf-8?q?=28=29_API?= Content-Type: text/plain; charset="UTF-8" X-MAIL: mse-fl1.zte.com.cn 30H2eOU0046357 X-FangMail-Bounce-Flag: 1673923263.63C60ABE.000 X-FangMail-Outinfo: 1673923263/63C60ABE.000/4NwtRz3N4zzdmYkn/ye.xingchen@zte.com.cn/1 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.251.14.novalocal with ID 63C60B27.000 by FangMail milter! X-FangMail-Envelope: 1673923368/4NwtV03zmDz1DFC/63C60B27.000/10.35.20.165/[10.35.20.165]/mxde.zte.com.cn/<ye.xingchen@zte.com.cn> X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 63C60B27.000/4NwtV03zmDz1DFC X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, T_SPF_PERMERROR,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755236714415613642?= X-GMAIL-MSGID: =?utf-8?q?1755236714415613642?= |
Series |
thermal: Convert to use sysfs_emit_at() API
|
|
Commit Message
ye.xingchen@zte.com.cn
Jan. 17, 2023, 2:40 a.m. UTC
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(-)
Comments
On Tue, Jan 17, 2023 at 3:40 AM <ye.xingchen@zte.com.cn> wrote: > > 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); > > -- Applied as 6.3 material, thanks!
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);