From patchwork Wed Dec 7 07:39:07 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: 30677 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp38144wrr; Tue, 6 Dec 2022 23:40:45 -0800 (PST) X-Google-Smtp-Source: AA0mqf6CHQDk+/lT6yj1pBzhp+90/+rq+cFHilKrEqr9kX/6XP+0IOQcpuYdUQV33cBFObcvj2QE X-Received: by 2002:a17:906:3b42:b0:7c0:c220:a341 with SMTP id h2-20020a1709063b4200b007c0c220a341mr17549819ejf.569.1670398844868; Tue, 06 Dec 2022 23:40:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670398844; cv=none; d=google.com; s=arc-20160816; b=D9DkgEsX8jvapmno9230QSwSg6SmK3CggWTwF8KEVbnoEyfIDM6raQSRt9cLh8tqwG jRDRlUwpSOkK0mMamos/8F+CPUSed5Uk8z7ihEbHaDXdNJHFr+GRdIYJEdL98bglWlPk UgUDaGNzP2iCDogHhN7tWQbHV5xoJQkkV19yWeegYY+UMQGMyf95lpC8uLGjXPcL53V8 szcl9seX2y0De0mPJQGGR0psOhaeP9RbRfAVAO92KdLyk9B0Oen8aATfESiCbLFKrHg5 CkN0j1IWS1NVyToWfhve5We89aVIf3TF8G5LsKVP+qsjeS+JPzW/MKV24OLr4wKvVUhG Zg5Q== 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=cAVKUXimZgMCf53kRKHo9iQ1ust3k4EypoaY8goKRlY=; b=CyuSAD7WO3yACyHhILY0v+g/wgEqr16CnK5DE43O60Lnu+lKtUwhqgfN5sZiv+71Xm joAxQJLR5g83jgYcrI94macF2vGs0M0Om8gf8fdfQ3PsvIh1nGOEnG4RF0DBze9V496j mQG+BNr8031BEj6ou1Ok6omATLmD3iatFurW/myxpKca1kk1BbrS76epR1LtgIw5mGG5 dPgvIpDTs8o29aPMca6e/fnSyTDNZ7c9Rzfrs2LGh0d6XWVYD8unsuG2P7tjO/olIBP3 pqmCyAyl6GBiLKuMmdKYOa0f3PoA6d/GiJ6D1YCbC1vgIQkFojlqgQpmpbgonHiAGV5L gDtQ== 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 wt7-20020a170906ee8700b007912fb7ad6esi10265216ejb.893.2022.12.06.23.40.21; Tue, 06 Dec 2022 23:40: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 S229678AbiLGHjX (ORCPT + 99 others); Wed, 7 Dec 2022 02:39:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229602AbiLGHjT (ORCPT ); Wed, 7 Dec 2022 02:39:19 -0500 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F19B0338; Tue, 6 Dec 2022 23:39:18 -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 4NRq114wDJz8QrkZ; Wed, 7 Dec 2022 15:39:17 +0800 (CST) Received: from xaxapp03.zte.com.cn ([10.88.40.52]) by mse-fl2.zte.com.cn with SMTP id 2B77d5vB059234; Wed, 7 Dec 2022 15:39:05 +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:39:07 +0800 (CST) Date: Wed, 7 Dec 2022 15:39:07 +0800 (CST) X-Zmail-TransId: 2af96390431b63e7f32b X-Mailer: Zmail v1.0 Message-ID: <202212071539074382512@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , , Subject: =?utf-8?q?=5BPATCH=5D_iio=3A_humidity=3A_hts211=3A_Convert_to_use_s?= =?utf-8?q?ysfs=5Femit=5Fat=28=29_API?= X-MAIL: mse-fl2.zte.com.cn 2B77d5vB059234 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.250.137.novalocal with ID 63904325.001 by FangMail milter! X-FangMail-Envelope: 1670398757/4NRq114wDJz8QrkZ/63904325.001/10.5.228.133/[10.5.228.133]/mse-fl2.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 63904325.001/4NRq114wDJz8QrkZ 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?1751540138790675726?= X-GMAIL-MSGID: =?utf-8?q?1751540138790675726?= 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/humidity/hts221_core.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c index 2a413da87b76..e4ae4ffb9ffb 100644 --- a/drivers/iio/humidity/hts221_core.c +++ b/drivers/iio/humidity/hts221_core.c @@ -200,8 +200,7 @@ static ssize_t hts221_sysfs_sampling_freq(struct device *dev, ssize_t len = 0; for (i = 0; i < ARRAY_SIZE(hts221_odr_table); i++) - len += scnprintf(buf + len, PAGE_SIZE - len, "%d ", - hts221_odr_table[i].hz); + len += sysfs_emit_at(buf, len, "%d ", hts221_odr_table[i].hz); buf[len - 1] = '\n'; return len; @@ -217,8 +216,7 @@ hts221_sysfs_rh_oversampling_avail(struct device *dev, int i; for (i = 0; i < ARRAY_SIZE(avg->avg_avl); i++) - len += scnprintf(buf + len, PAGE_SIZE - len, "%d ", - avg->avg_avl[i]); + len += sysfs_emit_at(buf, len, "%d ", avg->avg_avl[i]); buf[len - 1] = '\n'; return len; @@ -234,8 +232,7 @@ hts221_sysfs_temp_oversampling_avail(struct device *dev, int i; for (i = 0; i < ARRAY_SIZE(avg->avg_avl); i++) - len += scnprintf(buf + len, PAGE_SIZE - len, "%d ", - avg->avg_avl[i]); + len += sysfs_emit_at(buf, len, "%d ", avg->avg_avl[i]); buf[len - 1] = '\n'; return len;