From patchwork Wed Dec 7 07:46: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: 30685 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp42637wrr; Tue, 6 Dec 2022 23:56:00 -0800 (PST) X-Google-Smtp-Source: AA0mqf71Np4HzYmtEEc0siTUTa+3lJjv2/SS5X0xKO6yX/1nrDZy4vLUKTLPlHGDC8fLubyfoRgX X-Received: by 2002:a17:906:34da:b0:7c0:f2cf:23fd with SMTP id h26-20020a17090634da00b007c0f2cf23fdmr10645783ejb.709.1670399760707; Tue, 06 Dec 2022 23:56:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670399760; cv=none; d=google.com; s=arc-20160816; b=LdlX4QA7bP2hNdzI4nBJjNMp6V4wYK88dkqoCgQN2VL4oXF39VP1P7v9HVIiCm3LEt MjjPMU+p4XjVsTV5+VGJ1jS4UczRL0X4BuSkl6lsIgJx4O6dL5to6CYeUpGjSOViRmwC Thzwm6upgr9wVpifm55YBdco5FVsAABqchWhHXjQpUIG5fsX3OI3N6LhF/voIvpkkBXv b+0EPRDkeqoGZL8n63NDDz1Y4PFy+YvL7uL8ew/+IaLfGOmYiIRo7+na2kfMHeUo273G nQPgrgsHyvT45ccWrBvGun6mJJPujMv3Vd6APNZ4rbAf6r4BVefYsSTywqCz2fQLw/5B 7+9Q== 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=tiH+S0m/1QSwquQLCPQT2JuUkeroov3u5JRwj5hEzZ4=; b=VXjhwQWgh7rDWk4RYrcEEt+jQ/ZoBRZbN3bvnbkzO0FdC6xWmeMaOas+bfdx/8WV9p hfuE7dLRoZ8xa8qNaWYbhfFV+Sx4Z0SeAe9YZLtac8C4HmjuVTXHreRzIPatBpny+vj4 JZcTb/03IWEJKewOFmoutnoh1mCuOR/epBs++eX8BKH+pnXu5SjT0nO9u7qZTSoAvHvc bvQMMy2Nvyib5sve2lh3LbakWtAd+96v4fzjMqD9vDRjrSQ4CH+3OJj1AxNce7LkklB0 MCbwCAfYRMaJSl0iBlc8TU8xc4beEvQcducm5lmt17/JRYbWVeo/C/WNlNBkMjPgzozJ ZQ1w== 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 nc9-20020a1709071c0900b007bc5528a4d7si17831159ejc.47.2022.12.06.23.55.38; Tue, 06 Dec 2022 23:56:00 -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 S229901AbiLGHq5 (ORCPT + 99 others); Wed, 7 Dec 2022 02:46:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229832AbiLGHqz (ORCPT ); Wed, 7 Dec 2022 02:46:55 -0500 Received: from mxct.zte.com.cn (mxct.zte.com.cn [183.62.165.209]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EC782EF21; Tue, 6 Dec 2022 23:46:54 -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 mxct.zte.com.cn (FangMail) with ESMTPS id 4NRq9m0kk0z4y0v1; Wed, 7 Dec 2022 15:46:52 +0800 (CST) Received: from xaxapp03.zte.com.cn ([10.88.40.52]) by mse-fl1.zte.com.cn with SMTP id 2B77kiio065981; Wed, 7 Dec 2022 15:46: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:46:47 +0800 (CST) Date: Wed, 7 Dec 2022 15:46:47 +0800 (CST) X-Zmail-TransId: 2af9639044e73898f066 X-Mailer: Zmail v1.0 Message-ID: <202212071546472332762@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , , , Subject: =?utf-8?b?W1BBVENIXSBpaW86IGxpZ2h0OiB0c2wyNzcyOiBDb252ZXJ0IHRvIHVz?= =?utf-8?b?ZcKgc3lzZnNfZW1pdCgpL3N5c2ZzX2VtaXRfYXQoKSBBUElz?= X-MAIL: mse-fl1.zte.com.cn 2B77kiio065981 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.251.13.novalocal with ID 639044EC.000 by FangMail milter! X-FangMail-Envelope: 1670399212/4NRq9m0kk0z4y0v1/639044EC.000/10.5.228.132/[10.5.228.132]/mse-fl1.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 639044EC.000/4NRq9m0kk0z4y0v1 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?1751541099195168184?= X-GMAIL-MSGID: =?utf-8?q?1751541099195168184?= 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/tsl2772.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/iio/light/tsl2772.c b/drivers/iio/light/tsl2772.c index ad50baa0202c..03cae6a536b4 100644 --- a/drivers/iio/light/tsl2772.c +++ b/drivers/iio/light/tsl2772.c @@ -927,7 +927,7 @@ static ssize_t in_illuminance0_target_input_show(struct device *dev, { struct tsl2772_chip *chip = iio_priv(dev_to_iio_dev(dev)); - return scnprintf(buf, PAGE_SIZE, "%d\n", chip->settings.als_cal_target); + return sysfs_emit(buf, "%d\n", chip->settings.als_cal_target); } static ssize_t in_illuminance0_target_input_store(struct device *dev, @@ -981,9 +981,9 @@ static ssize_t in_illuminance0_lux_table_show(struct device *dev, int offset = 0; while (i < TSL2772_MAX_LUX_TABLE_SIZE) { - offset += scnprintf(buf + offset, PAGE_SIZE - offset, "%u,%u,", - chip->tsl2772_device_lux[i].ch0, - chip->tsl2772_device_lux[i].ch1); + offset += sysfs_emit_at(buf, offset, "%u,%u,", + chip->tsl2772_device_lux[i].ch0, + chip->tsl2772_device_lux[i].ch1); if (chip->tsl2772_device_lux[i].ch0 == 0) { /* * We just printed the first "0" entry. @@ -995,7 +995,7 @@ static ssize_t in_illuminance0_lux_table_show(struct device *dev, i++; } - offset += scnprintf(buf + offset, PAGE_SIZE - offset, "\n"); + offset += sysfs_emit_at(buf, offset, "\n"); return offset; }