From patchwork Wed Dec 7 07:36:05 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: 30675 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp37838wrr; Tue, 6 Dec 2022 23:39:47 -0800 (PST) X-Google-Smtp-Source: AA0mqf6KgbsnFcNLyCbRz0FKU0v7cn5JGcqrvIb4CpJeC+k+sCG0AzhiL+1141YE7DesdFKni0mo X-Received: by 2002:a17:907:3101:b0:7c0:f45e:22ff with SMTP id wl1-20020a170907310100b007c0f45e22ffmr10757768ejb.104.1670398786869; Tue, 06 Dec 2022 23:39:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670398786; cv=none; d=google.com; s=arc-20160816; b=vijewR47eq99W4KJSbhfDk8RVCMnz9QfmToI+h8BX6t4953d81vP5+0I6XU4NejS12 yOJLiKEF/BIPrxYSU4lVfeBlE+9wjHHcWn2mAynbvI3mqkssg/IMZ+Q9o7C6ijG/mS8W lmOB5nhzTZxzF6r87LUGLqGOkR5Qif5o8D/dl/2909yqK7TNrCJDfBICbqAmJCU7Kndn PuHW+iSPipAfEc75GRLJD3++7/TB8fzZGBma/VqMsCWjIbf+LYnyBrxmSRfQom5e3j2Z tkzrDBz29mOn96KvAb49Jc+sIp/fX8tbzVybtyn7bjwPQ4vK0LXExnOvW5UGOMUB+BNj rniA== 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=6EF/p6rSgV0rA1qD8SwnJVfqOWtq/YJg7IjyrPXf98Y=; b=IdGJ3Vi8slAs/wiI3wZfE693+EqkOk19McU1+Et0Gyfloqfd0QyBtl7wdVyfYHjH5O 869rD0b4FxEUKxepF0bHXDz+F0/S5x8ua6lwdhGNTa/28mWi+5ZwMifV2Z2f9ywKcMPp V/4klrgmnIHrbmZjeymM0QtsJ4nPDd7mTr01WiXM4V6yF0K4Ojc2SZGRgUW/U9XcAZ45 vOd1NbU3/lDfUO8EJ1NLls1RlrX/+9nNln5ClDS9x+sTwHyhtzYuNlg8iEHvrBUArwrE sj7STP/nXmyrz/5SKzj6mEs0L1EfDrDrFl5m3bh01k2FPAOU7Fj/qClyItYsOAi90wUs iM1g== 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 c6-20020a056402100600b00461540620f1si3307565edu.169.2022.12.06.23.39.23; Tue, 06 Dec 2022 23:39:46 -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 S229763AbiLGHhK (ORCPT + 99 others); Wed, 7 Dec 2022 02:37:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229713AbiLGHgf (ORCPT ); Wed, 7 Dec 2022 02:36:35 -0500 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCA693057A; Tue, 6 Dec 2022 23:36:21 -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 mxhk.zte.com.cn (FangMail) with ESMTPS id 4NRpxc3WY4z4xVnm; Wed, 7 Dec 2022 15:36:20 +0800 (CST) Received: from xaxapp01.zte.com.cn ([10.88.40.50]) by mse-fl1.zte.com.cn with SMTP id 2B77a2Qs054104; Wed, 7 Dec 2022 15:36:02 +0800 (+08) (envelope-from ye.xingchen@zte.com.cn) Received: from mapi (xaxapp01[null]) by mapi (Zmail) with MAPI id mid31; Wed, 7 Dec 2022 15:36:05 +0800 (CST) Date: Wed, 7 Dec 2022 15:36:05 +0800 (CST) X-Zmail-TransId: 2af96390426508a78d7d X-Mailer: Zmail v1.0 Message-ID: <202212071536050872424@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , , Subject: =?utf-8?q?=5BPATCH=5D_iio=3A_chemical=3A_scd30=3A_Convert_to_use_sy?= =?utf-8?q?sfs=5Femit=5Fat=28=29_API?= X-MAIL: mse-fl1.zte.com.cn 2B77a2Qs054104 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.250.138.novalocal with ID 63904274.001 by FangMail milter! X-FangMail-Envelope: 1670398580/4NRpxc3WY4z4xVnm/63904274.001/10.5.228.132/[10.5.228.132]/mse-fl1.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 63904274.001/4NRpxc3WY4z4xVnm 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751540078031756249?= X-GMAIL-MSGID: =?utf-8?q?1751540078031756249?= 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/iio/chemical/scd30_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/chemical/scd30_core.c b/drivers/iio/chemical/scd30_core.c index 682fca39d14d..76a48dbdfe2e 100644 --- a/drivers/iio/chemical/scd30_core.c +++ b/drivers/iio/chemical/scd30_core.c @@ -354,7 +354,7 @@ static ssize_t sampling_frequency_available_show(struct device *dev, struct devi ssize_t len = 0; do { - len += scnprintf(buf + len, PAGE_SIZE - len, "0.%09u ", 1000000000 / i); + len += sysfs_emit_at(buf, len, "0.%09u ", 1000000000 / i); /* * Not all values fit PAGE_SIZE buffer hence print every 6th * (each frequency differs by 6s in time domain from the