From patchwork Wed Dec 7 07:45:17 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: 30683 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp42617wrr; Tue, 6 Dec 2022 23:55:55 -0800 (PST) X-Google-Smtp-Source: AA0mqf64fCK4owB4yDI38rt5gzyGtC6K2br7clYIV78iqWKMfgngFOJv9QzkczJdC3Bnt+JIw6I2 X-Received: by 2002:a17:906:74c6:b0:7c0:e381:a32a with SMTP id z6-20020a17090674c600b007c0e381a32amr12906744ejl.188.1670399755379; Tue, 06 Dec 2022 23:55:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670399755; cv=none; d=google.com; s=arc-20160816; b=UDQCaYBDVjC99zmpyH2gzpFGHu1AUxiEmQM5UgpkyUBkuw/y6znoLEnKOz40/6dVWl GijLoHth7bawh+liWsR46gM6yjMF+Zu224s743z60PJS3wzlj4PeqQyrNF9aHqQuaU26 UGqsVfjV0FwpFM1JrUe1OJkveZRJlDxJ73IuUueUCnCrgT8X/nOtBiGpzWjMcEEdQsjd 5iurue+st857MNpzgHCq7WziNttJzb/1Z3z0+6eDyYlWlTgVrRcmeLQbhGIVM8Pjhj+a +a3cEh+L3XL2LOGIm7eRX3Ltcwya+7p2ObZvWFDLKgRxmZgn9+GgEYmXwJrJd0Qnri46 Mf+g== 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=9dOqic+70Zgl1XmI0EVUj00qbYwCL7l/pJwmYugtbts=; b=S96tXLptbRvyshhxvhwuyLIJ/+ITvAWs6xrzxpN0zLaJdNkOxKsLnHut6HmVlrdMn2 r2IvhreVxFA+u1qIk1kwl7whrFe3ihs0d5dJeU9xgIeP4heY6a1BaaNk7nvFYXLD9Xwg plr9+0jkYELxHTm/XB/BNHUZkO5SrRe1rhKNuRd5Zd82tfs+jqzcqEe0axG4+5OKnFVi onXqLtEXCOjtg/Yc9mkYSHMX86Tzl/tTEBePhlu/5qPhsNSEytQJQBzb4Ac4+mqHTChO jgqMJHG2qcsH1PPtssYJZaHQZEM4uJ+dDf7uWyNe8eonManfTnseiUKN7kAXSOzzdKG4 GMsw== 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 gs8-20020a1709072d0800b007ae2368c8a8si17870965ejc.109.2022.12.06.23.55.31; Tue, 06 Dec 2022 23:55:55 -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 S229866AbiLGHpd (ORCPT + 99 others); Wed, 7 Dec 2022 02:45:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229842AbiLGHpa (ORCPT ); Wed, 7 Dec 2022 02:45:30 -0500 Received: from mxct.zte.com.cn (mxct.zte.com.cn [183.62.165.209]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D81B3B3; Tue, 6 Dec 2022 23:45:29 -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 mxct.zte.com.cn (FangMail) with ESMTPS id 4NRq876cwGz4y0tt; Wed, 7 Dec 2022 15:45:27 +0800 (CST) Received: from xaxapp03.zte.com.cn ([10.88.40.52]) by mse-fl2.zte.com.cn with SMTP id 2B77jFkp068016; Wed, 7 Dec 2022 15:45:15 +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:45:17 +0800 (CST) Date: Wed, 7 Dec 2022 15:45:17 +0800 (CST) X-Zmail-TransId: 2af96390448d54e8c22e X-Mailer: Zmail v1.0 Message-ID: <202212071545177462713@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , , Subject: =?utf-8?q?=5BPATCH=5D_iio=3A_light=3A_lv0104cs=3A_Convert_to_use_sy?= =?utf-8?q?sfs=5Femit=5Fat=28=29_API?= X-MAIL: mse-fl2.zte.com.cn 2B77jFkp068016 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.251.13.novalocal with ID 63904497.000 by FangMail milter! X-FangMail-Envelope: 1670399127/4NRq876cwGz4y0tt/63904497.000/10.5.228.133/[10.5.228.133]/mse-fl2.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 63904497.000/4NRq876cwGz4y0tt 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?1751541094152136976?= X-GMAIL-MSGID: =?utf-8?q?1751541094152136976?= 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/lv0104cs.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/iio/light/lv0104cs.c b/drivers/iio/light/lv0104cs.c index c041fa0faa5d..c0e82ae12920 100644 --- a/drivers/iio/light/lv0104cs.c +++ b/drivers/iio/light/lv0104cs.c @@ -397,9 +397,9 @@ static ssize_t lv0104cs_show_calibscale_avail(struct device *dev, int i; for (i = 0; i < ARRAY_SIZE(lv0104cs_calibscales); i++) { - len += scnprintf(buf + len, PAGE_SIZE - len, "%d.%06d ", - lv0104cs_calibscales[i].val, - lv0104cs_calibscales[i].val2); + len += sysfs_emit_at(buf, len, "%d.%06d ", + lv0104cs_calibscales[i].val, + lv0104cs_calibscales[i].val2); } buf[len - 1] = '\n'; @@ -414,9 +414,9 @@ static ssize_t lv0104cs_show_scale_avail(struct device *dev, int i; for (i = 0; i < ARRAY_SIZE(lv0104cs_scales); i++) { - len += scnprintf(buf + len, PAGE_SIZE - len, "%d.%06d ", - lv0104cs_scales[i].val, - lv0104cs_scales[i].val2); + len += sysfs_emit_at(buf, len, "%d.%06d ", + lv0104cs_scales[i].val, + lv0104cs_scales[i].val2); } buf[len - 1] = '\n'; @@ -431,9 +431,9 @@ static ssize_t lv0104cs_show_int_time_avail(struct device *dev, int i; for (i = 0; i < ARRAY_SIZE(lv0104cs_int_times); i++) { - len += scnprintf(buf + len, PAGE_SIZE - len, "%d.%06d ", - lv0104cs_int_times[i].val, - lv0104cs_int_times[i].val2); + len += sysfs_emit_at(buf, len, "%d.%06d ", + lv0104cs_int_times[i].val, + lv0104cs_int_times[i].val2); } buf[len - 1] = '\n';