From patchwork Wed Dec 7 07:31:08 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: 30670 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp36792wrr; Tue, 6 Dec 2022 23:36:28 -0800 (PST) X-Google-Smtp-Source: AA0mqf7Dmt2asR+knXxVPm7RNQgSsO8C8jb73d6nihadB2OwakL3pTVkKcZXN0HeEl+lPOIvjXMC X-Received: by 2002:aa7:9257:0:b0:56c:cea7:8650 with SMTP id 23-20020aa79257000000b0056ccea78650mr73485535pfp.40.1670398588337; Tue, 06 Dec 2022 23:36:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670398588; cv=none; d=google.com; s=arc-20160816; b=R4yOSUJ0MoWlr6scJmaYajfFcp19+KvuAYtFD6+wcqPWtRO+ajk3jHAAwCQJVz5sx4 4O6vqu5QZ9IsdOVGOUA6pnlaiT5jIo7N6G7ExUzWVTBzC0LPZ+AmsLt6GrcstFLxbbcR d8VUiCZSQpGe0Y34WWNEgnPpTfjqjllrFR34cvujODL2XGxhSpe8Vj1MlC5U6Cf+o28a y+/64Nx9o3+QvrY87UmkllRPnPL1QnqUVyPYIDqlWgS0ulVtgqbZOuNZlFCrz8bO0uXa WMY3pP/DeWUl2Ud912OZcUn5E4FCdL8aPUmFr+3HkkCyf3ozzSsKW2EloewbYNNG9mM4 TjBw== 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=fmoYtTjShVaUDYbtVPto21gy9lS273zz4zYGJ9/g5KA=; b=t3RvN2MUVELSXJurc98qv5ry1LutJ7qOHQYznU6RZvKqmJnunX1m12Hh69jKuIRZfG zXp0f76rtbA2veyfqg6PFRLZwKCR5+c04HiKa9xcvld8ys1Svl608pNLsAKxHs5h50gh b23uz/laptWLGPqUAl57z8epeN0kHi1zof1PvuGHlJICtiui8w+hEzs4WfBj/SGbQ8Gu 8l1RWtQnEFULe4y7T9wS4K+FVkp7z8n2uMnp7tfoa3zcKUBX7z2gTkqQENb2pzHs0ZP9 gNE3vfrfZTu9AvGcJCDMgx91YLbyV5XEgKA+ypF4GfHwOZ3aeBKhxDUKTHnpC3zgQJDX XR9w== 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 e30-20020a631e1e000000b004786b79642dsi17763559pge.276.2022.12.06.23.36.14; Tue, 06 Dec 2022 23:36:28 -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 S229731AbiLGHbf (ORCPT + 99 others); Wed, 7 Dec 2022 02:31:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229825AbiLGHbQ (ORCPT ); Wed, 7 Dec 2022 02:31:16 -0500 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B2C927CC5; Tue, 6 Dec 2022 23:31:16 -0800 (PST) Received: from mse-fl2.zte.com.cn (unknown [10.5.228.133]) (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 4NRpqk5KJPz8R041; Wed, 7 Dec 2022 15:31:14 +0800 (CST) Received: from xaxapp03.zte.com.cn ([10.88.40.52]) by mse-fl2.zte.com.cn with SMTP id 2B77V6Lb049894; Wed, 7 Dec 2022 15:31:06 +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:31:08 +0800 (CST) Date: Wed, 7 Dec 2022 15:31:08 +0800 (CST) X-Zmail-TransId: 2af96390413c14e6de4c X-Mailer: Zmail v1.0 Message-ID: <202212071531083612274@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , , Subject: =?utf-8?q?=5BPATCH=5D_iio=3A_ad7768-1=3A_Convert_to_use_sysfs=5Femi?= =?utf-8?q?t=5Fat=28=29_API?= X-MAIL: mse-fl2.zte.com.cn 2B77V6Lb049894 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.250.137.novalocal with ID 63904142.001 by FangMail milter! X-FangMail-Envelope: 1670398274/4NRpqk5KJPz8R041/63904142.001/10.5.228.133/[10.5.228.133]/mse-fl2.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 63904142.001/4NRpqk5KJPz8R041 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H2, 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?1751539869955808120?= X-GMAIL-MSGID: =?utf-8?q?1751539869955808120?= 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/adc/ad7768-1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/ad7768-1.c b/drivers/iio/adc/ad7768-1.c index 70a25949142c..eea796a3f83c 100644 --- a/drivers/iio/adc/ad7768-1.c +++ b/drivers/iio/adc/ad7768-1.c @@ -346,7 +346,7 @@ static ssize_t ad7768_sampling_freq_avail(struct device *dev, for (i = 0; i < ARRAY_SIZE(ad7768_clk_config); i++) { freq = DIV_ROUND_CLOSEST(st->mclk_freq, ad7768_clk_config[i].clk_div); - len += scnprintf(buf + len, PAGE_SIZE - len, "%d ", freq); + len += sysfs_emit_at(buf, len, "%d ", freq); } buf[len - 1] = '\n';