From patchwork Wed Dec 7 07:44:03 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: 30689 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp42989wrr; Tue, 6 Dec 2022 23:57:10 -0800 (PST) X-Google-Smtp-Source: AA0mqf6h1mzd9VKvk9OP/xbV68U4xvn4curtcv+Cmy6Lw8k8OBr+q5/RCs0YQMGDMN8ssIRdiVJO X-Received: by 2002:a17:906:3a10:b0:7a4:22c4:ade7 with SMTP id z16-20020a1709063a1000b007a422c4ade7mr77007411eje.722.1670399830082; Tue, 06 Dec 2022 23:57:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670399830; cv=none; d=google.com; s=arc-20160816; b=pIhRz3VjohKYTxgZL/TE+J6X6pJmkHOD7E8JvUen6lBG0Zn2Md6sWa4q5x9at5lnt+ lhBOTxwOAnOXjwSxz8D/ykV0X1IHjcZMfkiNtmMJGWjYXHGn1QIv2MKW6RgJ+VGhkKzR dI4lJd0hKnQN0sjxsv8evgvgfBih20PTQ79Fb7rJm00ZJaKbcIl1T/rjXyA+yQNxTOCO NCBbBtRX+7/8h3IBYtBDPY4aIdaVip4cbq38LfX06Y1a6A1IAAzYUb/qcIc1vnPweFGv Y3Ky5V/L/rRcjLRvqdZqSwfRMq5WmUtcTT5Po8E8OvZ3Yx7mGFbgtDc0B3ciN28VP3Yu ojQg== 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=912vtgg2cBXgEnd2CnIMN3MKAGYyTeaSCFzNBDeixzk=; b=Rm1vH9hwwV1/FS1xFwnamVJVIn/f0kTCVqVK0mqlaiNCJgOiwpetWeQjObdLPNvSIE MmCOQ7OBItazps9+GXeEcuXtTv9c2zu+ex8YfL0JVks6Xd1XxOKk15DC+cW6UmBCHrI2 SNq3KiTbXZHfAjeOJpELDyjazB+P5KvbG1OvLN7m9WdxGEyQbiVhjBto6oiPlgFS5re4 o+eLFOfqLEIb+Hvbc74K1fNTvqiaxtunOPjD2CtNmjKiO4XaZUPQmGrBOE/+2yvpu6yz RMwWeQfiHXoof4EIEDkjUBJZ5ymx6qttj69A2qOmQUljuvKZyrs1RqW2rTcaNxpytdhB be6g== 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 mp26-20020a1709071b1a00b007adf3067a4esi10038231ejc.490.2022.12.06.23.56.46; Tue, 06 Dec 2022 23:57:10 -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 S229849AbiLGHoU (ORCPT + 99 others); Wed, 7 Dec 2022 02:44:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229878AbiLGHoK (ORCPT ); Wed, 7 Dec 2022 02:44:10 -0500 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02EB33B2; Tue, 6 Dec 2022 23:44:08 -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 4NRq6Z3XHxz8R03x; Wed, 7 Dec 2022 15:44:06 +0800 (CST) Received: from xaxapp03.zte.com.cn ([10.88.40.52]) by mse-fl2.zte.com.cn with SMTP id 2B77i1YT066091; Wed, 7 Dec 2022 15:44:01 +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:44:03 +0800 (CST) Date: Wed, 7 Dec 2022 15:44:03 +0800 (CST) X-Zmail-TransId: 2af963904443ffffffffaf5897d8 X-Mailer: Zmail v1.0 Message-ID: <202212071544032182658@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , , , , , Subject: =?utf-8?q?=5BPATCH=5D_iio=3A_light=3A_ltr501=3A_Convert_to_use_sysf?= =?utf-8?q?s=5Femit=5Fat=28=29_API?= X-MAIL: mse-fl2.zte.com.cn 2B77i1YT066091 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.250.137.novalocal with ID 63904446.001 by FangMail milter! X-FangMail-Envelope: 1670399046/4NRq6Z3XHxz8R03x/63904446.001/10.5.228.133/[10.5.228.133]/mse-fl2.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 63904446.001/4NRq6Z3XHxz8R03x 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?1751541172557211738?= X-GMAIL-MSGID: =?utf-8?q?1751541172557211738?= 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/light/ltr501.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/iio/light/ltr501.c b/drivers/iio/light/ltr501.c index bdbd918213e4..436f060a34e2 100644 --- a/drivers/iio/light/ltr501.c +++ b/drivers/iio/light/ltr501.c @@ -1116,9 +1116,9 @@ static ssize_t ltr501_show_proximity_scale_avail(struct device *dev, for (i = 0; i < info->ps_gain_tbl_size; i++) { if (info->ps_gain[i].scale == LTR501_RESERVED_GAIN) continue; - len += scnprintf(buf + len, PAGE_SIZE - len, "%d.%06d ", - info->ps_gain[i].scale, - info->ps_gain[i].uscale); + len += sysfs_emit_at(buf, len, "%d.%06d ", + info->ps_gain[i].scale, + info->ps_gain[i].uscale); } buf[len - 1] = '\n'; @@ -1138,9 +1138,9 @@ static ssize_t ltr501_show_intensity_scale_avail(struct device *dev, for (i = 0; i < info->als_gain_tbl_size; i++) { if (info->als_gain[i].scale == LTR501_RESERVED_GAIN) continue; - len += scnprintf(buf + len, PAGE_SIZE - len, "%d.%06d ", - info->als_gain[i].scale, - info->als_gain[i].uscale); + len += sysfs_emit_at(buf, len, "%d.%06d ", + info->als_gain[i].scale, + info->als_gain[i].uscale); } buf[len - 1] = '\n';