From patchwork Wed Dec 7 07:42:47 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: 30681 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp39320wrr; Tue, 6 Dec 2022 23:44:44 -0800 (PST) X-Google-Smtp-Source: AA0mqf7XWRXtr3t5yltFP8D/X/vtw/P2O2X/PHIPA5FEwI3ZRMW3QsW2/ngl9N630QGB19H5wFyU X-Received: by 2002:a05:6402:5517:b0:461:c563:defa with SMTP id fi23-20020a056402551700b00461c563defamr79465392edb.72.1670399084791; Tue, 06 Dec 2022 23:44:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670399084; cv=none; d=google.com; s=arc-20160816; b=c1SlFgGx24Bvn7/gV/5b01h+2L3wftAM2KCJHvmnDlWNLsMeo9rE9Ys8FjVb6j/Q3r cgEU8yYMjrKTRUaXLUFqbaUgLanoj8CzdykIgWO1U72NRohxixxmIHDrCf4zkI1wHOls 7M2FITC+pjFFebS0xlpaK5s6beKUyFbGZSjO2opjHcQ0xfFWBgrjeomITEy089ZQ/Bbq immLqtAFi3hRupv8xs/n3OpkLO5xqW/12SEBHgkMIsivKrIbbwPZP0eays/kz0ItUwpJ kSrTAgQToP3waUusLYVyakqTDmzAqZX+9yyxG1VQK9Gs5TTScXIblK3XzOGC+TXAjqQA jfWw== 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=0i4Y5+0p9v5XARZVslW2NDOx0T25mlAS9Fzi+22cLFg=; b=n8/91ZvuEQJcNIn/4a0FqP3tag0vSqZ3ahlyw/KqnVEVd9iiYVuO9MeIn1IvqIneup XfQ2MPQB0i543XbPGDS1uDlmlUHW1stR4rf/llrhXpcpXhRDW4GNMoIvss4RAhp7P8HJ kNxR9nviJ2GWPgmlzRIfPO+TwT5uMvsPmPdhQR0C9WJWXMomwBlmzYZKfflA/PSc5dJt BI0yNi4GPtORC+653bwxyl+mFadTsrovwTd8xHFhB/NGq88VbIRSXNg4OAtfj154HSUO Q2hoaFDJOqw2Fe+hCBl/EZilTgav48OxBLL8xHTcFh0o9xmrJAWdmU1rC/YpI0bSz6zy pxyg== 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 dd22-20020a1709069b9600b00781d695b597si17274061ejc.473.2022.12.06.23.44.21; Tue, 06 Dec 2022 23:44:44 -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 S229783AbiLGHn0 (ORCPT + 99 others); Wed, 7 Dec 2022 02:43:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229944AbiLGHmz (ORCPT ); Wed, 7 Dec 2022 02:42:55 -0500 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADE8D17048; Tue, 6 Dec 2022 23:42:52 -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 4NRq572jwxz8QrkZ; Wed, 7 Dec 2022 15:42:51 +0800 (CST) Received: from xaxapp01.zte.com.cn ([10.88.40.50]) by mse-fl1.zte.com.cn with SMTP id 2B77giPi061070; Wed, 7 Dec 2022 15:42:44 +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:42:47 +0800 (CST) Date: Wed, 7 Dec 2022 15:42:47 +0800 (CST) X-Zmail-TransId: 2af9639043f7fffffffff4886c2e X-Mailer: Zmail v1.0 Message-ID: <202212071542472012621@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , , Subject: =?utf-8?q?=5BPATCH=5D_iio=3A_light=3A_cm3232=3A_Convert_to_use_sysf?= =?utf-8?q?s=5Femit=5Fat=28=29_API?= X-MAIL: mse-fl1.zte.com.cn 2B77giPi061070 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.250.137.novalocal with ID 639043FB.000 by FangMail milter! X-FangMail-Envelope: 1670398971/4NRq572jwxz8QrkZ/639043FB.000/10.5.228.132/[10.5.228.132]/mse-fl1.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 639043FB.000/4NRq572jwxz8QrkZ 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?1751540390921538318?= X-GMAIL-MSGID: =?utf-8?q?1751540390921538318?= 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/cm3232.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/iio/light/cm3232.c b/drivers/iio/light/cm3232.c index 43e492f5051d..e5ff14a825bf 100644 --- a/drivers/iio/light/cm3232.c +++ b/drivers/iio/light/cm3232.c @@ -291,10 +291,10 @@ static ssize_t cm3232_get_it_available(struct device *dev, int i, len; for (i = 0, len = 0; i < ARRAY_SIZE(cm3232_als_it_scales); i++) - len += scnprintf(buf + len, PAGE_SIZE - len, "%u.%06u ", - cm3232_als_it_scales[i].val, - cm3232_als_it_scales[i].val2); - return len + scnprintf(buf + len, PAGE_SIZE - len, "\n"); + len += sysfs_emit_at(buf, len, "%u.%06u ", + cm3232_als_it_scales[i].val, + cm3232_als_it_scales[i].val2); + return len + sysfs_emit_at(buf, len, "\n"); } static const struct iio_chan_spec cm3232_channels[] = {