From patchwork Wed Dec 7 07:33:38 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: 30673 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp37158wrr; Tue, 6 Dec 2022 23:37:35 -0800 (PST) X-Google-Smtp-Source: AA0mqf7ns57ARelyFESSNOvt+Cj4C5GI93ZDTnxCQ172I6sHzDV/7qQxoOq/6MrpUolofVZRYN3d X-Received: by 2002:a17:906:6acc:b0:78d:b371:16e5 with SMTP id q12-20020a1709066acc00b0078db37116e5mr61065636ejs.456.1670398654888; Tue, 06 Dec 2022 23:37:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670398654; cv=none; d=google.com; s=arc-20160816; b=YsIhLr6FR096C/RRSST6LHypoOOffLYva1Aqq0MhX2h5DHj6UB7biXxDvx96h18arc 5uCYbVza34Kz8eTOLI+2EOmPIeVts+T8pTsJQb9nQzAFvIMnT0UlEyNUL1KWaz8InCKW hJU4E4B9MrzA1s07TKb5QAwGYLNIG+HEh2EK+ZRYcUowVkPBwQ/XuXcik0JLpPkertdj WqDCGGx+b+4W40beonIzBCtuYa5PmdX2b9vIzVXtzbXCkLwwWYdH+KasatA6a6vYCouM 9Lnip9b560r7qrbbsu+Z4Ap6ySzQwTL8enkvD7Bul+29QxL7jRq/aD5RPvHCG20Ihw7S WrvQ== 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=QGbKAegfuC88OKP5hlXTTcI7GrPYwFbfbRqiFxZXLX8=; b=RE16iwvRkopMP0/VSkHYqn6NghlLU7rFnnxqf1uGGK308TFuORiDenaRBsLQ3egAaT xAkBls2TtWdwBVlBqcD9t+yRdRBuC2ATxs0Ck7IYaWi6vN1vBqrIBnoFB0rsgNYwopGi wLs/1dBYdqhVlZAYbsLeRCbYsv8iTTjIOOri3J2lom18DkoOxN3e1iwvk1p/sfLzHsQH uEKo9Yfx8B6X5rVFj2xqAz0DfKyUK7iCfTt6lkV85x5WxaeMUHxuvPrgHZJaFBa/sYUV JeRcOgmEVn7kFGs7CpXEg1f1QoY0QlmcjMzqyxfrPulX53hmQpFqSqUm+Z7G8UljSmz0 49Qg== 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 w20-20020a056402269400b0046c9a4ab650si4510636edd.393.2022.12.06.23.37.11; Tue, 06 Dec 2022 23:37:34 -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 S229628AbiLGHdx (ORCPT + 99 others); Wed, 7 Dec 2022 02:33:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229854AbiLGHdt (ORCPT ); Wed, 7 Dec 2022 02:33:49 -0500 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FE951DA63; Tue, 6 Dec 2022 23:33:48 -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 4NRptf6w7qz8QrkZ; Wed, 7 Dec 2022 15:33:46 +0800 (CST) Received: from xaxapp01.zte.com.cn ([10.88.40.50]) by mse-fl2.zte.com.cn with SMTP id 2B77XbKG053189; Wed, 7 Dec 2022 15:33:37 +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:33:38 +0800 (CST) Date: Wed, 7 Dec 2022 15:33:38 +0800 (CST) X-Zmail-TransId: 2af9639041d2fffffffff4b73c44 X-Mailer: Zmail v1.0 Message-ID: <202212071533389702351@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , Subject: =?utf-8?q?=5BPATCH=5D_iio=3A_adc=3A_nau7802=3A_Convert_to_use_sysfs?= =?utf-8?q?=5Femit=5Fat=28=29_API?= X-MAIL: mse-fl2.zte.com.cn 2B77XbKG053189 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.250.137.novalocal with ID 639041DA.001 by FangMail milter! X-FangMail-Envelope: 1670398426/4NRptf6w7qz8QrkZ/639041DA.001/10.5.228.133/[10.5.228.133]/mse-fl2.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 639041DA.001/4NRptf6w7qz8QrkZ 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?1751539940013572228?= X-GMAIL-MSGID: =?utf-8?q?1751539940013572228?= 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/nau7802.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/iio/adc/nau7802.c b/drivers/iio/adc/nau7802.c index c1261ecd400c..4dbf54979733 100644 --- a/drivers/iio/adc/nau7802.c +++ b/drivers/iio/adc/nau7802.c @@ -86,8 +86,7 @@ static ssize_t nau7802_show_scales(struct device *dev, int i, len = 0; for (i = 0; i < ARRAY_SIZE(st->scale_avail); i++) - len += scnprintf(buf + len, PAGE_SIZE - len, "0.%09d ", - st->scale_avail[i]); + len += sysfs_emit_at(buf, len, "0.%09d ", st->scale_avail[i]); buf[len-1] = '\n';