Message ID | 202212081706290141979@zte.com.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp86642wrr; Thu, 8 Dec 2022 01:09:32 -0800 (PST) X-Google-Smtp-Source: AA0mqf601fC6ujM9b4A0jNBuKO7EACemrw0AYrzBo5Hncbo6Vfdx2d0Cjj43HxGlV2tKaRFFT4+j X-Received: by 2002:a17:906:f05:b0:7b2:c575:2ee8 with SMTP id z5-20020a1709060f0500b007b2c5752ee8mr63410021eji.136.1670490572735; Thu, 08 Dec 2022 01:09:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670490572; cv=none; d=google.com; s=arc-20160816; b=XVV7BPKRftA3vEyGAsmcDVLqptpOBGF/kqZoyggDxnNtDqM/vewTPj4RpbSzHQWPyO BYM8aW0PDTcSnwUhnscfw2b/42xmQ9yhYJRPCE7ZBj+yJkxDZe2l3oEJey2Yf0Iyq86T dpNr1irBcuFlEgwQQpwTRSirGCK8WHwdfhjBwj6n51GC/Hrq24/ECwmlrAeeK1vgmquR K7rI9GP6i9fOVsYt6YvVJA+YYACpZAhUNA5wO9cLmZ9+GFpMIiChb32fOhzeSmkNhtIJ lv4/eLuMrs8VEjNhNjvr3MjXGck4JI/1uIGmIGiJyIneR1rFK+yWvtOLhhwq5W2oKFHd dETw== 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=dgIWvX+MkjSAQ2FzAJCKifK4nslUU3Rc94ivgDNMlIo=; b=m3j0z9AEp10WtUAMYneUboqVy0ONzNSOYFkwnl/1gN5Ix+ppZB3KqLX/rVbXVoMUQZ lPuzGG1DMdpYnqprTsQeQEQ09mP+8ME5tAur4HPffjsbPZEhfH/1GCrsQxouxl8e6/wb DVwgIn3RqdPrD7KHjd47rnIv2+JCS9VFfb3bi/WD6FKjLwHFXLkdhbHrigF0IeFKlTUd 2lQiNnO/etLyrFa7iIZCP18w8ytp7vwZ1yv2tDRxTknyqgPm6dGx5lAbGzH7pExcKVFP zKX3pn6bAKyCzvuHMNK0nKXcmfeIh4pLSBFXclImzwTwDpezIxqxUcmencQ54gLKyIY8 WfNg== 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 nc2-20020a1709071c0200b007aeb99bbb99si19064758ejc.48.2022.12.08.01.09.07; Thu, 08 Dec 2022 01:09:32 -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 S230180AbiLHJHx (ORCPT <rfc822;foxyelen666@gmail.com> + 99 others); Thu, 8 Dec 2022 04:07:53 -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 <rfc822;linux-kernel@vger.kernel.org>); 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: <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 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/<ye.xingchen@zte.com.cn> X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 6391A917.000/4NSSvC2GbRz4y0vL X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,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?1751636322549144165?= X-GMAIL-MSGID: =?utf-8?q?1751636322549144165?= |
Series |
thermal: Convert to use sysfs_emit_at() API
|
|
Commit Message
ye.xingchen@zte.com.cn
Dec. 8, 2022, 9:06 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 Thu, Dec 8, 2022 at 10:06 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> Again, please resend this after 6.2-rc1 is out, thanks! > --- > 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); > > -- > 2.25.1
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);