From patchwork Wed Dec 7 07:41:38 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: 30680 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp39049wrr; Tue, 6 Dec 2022 23:43:52 -0800 (PST) X-Google-Smtp-Source: AA0mqf4YVKEwutSilthhCLm+PRXDiYIbSdXQXvp5h1ilyj7ZAUGUfIKls0M/MJZAVeHuFoPG2odK X-Received: by 2002:a05:6402:4499:b0:46c:43fd:d1ab with SMTP id er25-20020a056402449900b0046c43fdd1abmr5542926edb.197.1670399032731; Tue, 06 Dec 2022 23:43:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670399032; cv=none; d=google.com; s=arc-20160816; b=HBK+QQS9q4O0nHrolV+qvZAlz0JLvAW0KWxGIG1MJOfGNErLERxBAxlR92vFyDFs7l tFOFkOnH9GsJR9uW0C/XhtnfuBVzb7WjSIcb1L+kpiNnzqBGQkrREt3vAmsgU5+gkb2c yGDgZCm1nQEPGbV5Y179/3eO7J9YoyIgpkktclz5RPzE7p0LFt8o78ROPyzvJh96UIEu N8cLECBMupBrwgIM07LzLOcVHmNWTc4DXjDP4wii74DGJeoLztZ3eGOtv7l7aQ/W9yIF K1z/wSzuqhq/jUX0WorwqxMjxT0JKM0YiLE0Kh+eSMDEFoqSJbzBrC+PLzukLTPqweMT 6Idg== 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=OapEc9Cwbdjr02fcBFanlK9jG14V/v3ZFEE8UrWrjOU=; b=WrsLA0iQ+FxVurfB43z2n83lFJ3SPKtzDcDnpzWjXdXsBHrJ+hVudc5js+o+nGOQei YDX+6U8KLRg7RVOZILYF3+E0JDIfbsA2d3clQyy9xMwAj4MwgWS99A0mE0JnJnAJzODT VE5y1yfn37Ahs4s/NGhx/F3CdUuuwbWC5BmkztPP1IHQrW34UKNwfUubIjcREY2JkKix YL3H20AI2r+iYstzC3Ggh5fR3wqWE1NS1DScOptVGoucW8gHihHEBzuIsSaJ8eGaqF3W kCCjXjgtZ2MBkDWC3OMY5T6ADn5k0n2Dw9yMFvwahAXd0YKSMbIm3I9IV8OvsGe3EhHa UceQ== 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 nc16-20020a1709071c1000b007a7fc67c880si17171519ejc.71.2022.12.06.23.43.26; Tue, 06 Dec 2022 23:43:52 -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 S229815AbiLGHmJ (ORCPT + 99 others); Wed, 7 Dec 2022 02:42:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229814AbiLGHly (ORCPT ); Wed, 7 Dec 2022 02:41:54 -0500 Received: from mxct.zte.com.cn (mxct.zte.com.cn [183.62.165.209]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E76E2CE30; Tue, 6 Dec 2022 23:41:53 -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 4NRq400Hg9z4y0ty; Wed, 7 Dec 2022 15:41:52 +0800 (CST) Received: from xaxapp03.zte.com.cn ([10.88.40.52]) by mse-fl1.zte.com.cn with SMTP id 2B77faks058631; Wed, 7 Dec 2022 15:41:36 +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:41:38 +0800 (CST) Date: Wed, 7 Dec 2022 15:41:38 +0800 (CST) X-Zmail-TransId: 2af9639043b27d9844c1 X-Mailer: Zmail v1.0 Message-ID: <202212071541387812582@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , , Subject: =?utf-8?q?=5BPATCH=5D_iio=3A_light=3A_bh1750=3A_Convert_to_use_sysf?= =?utf-8?q?s=5Femit=5Fat=28=29_API?= X-MAIL: mse-fl1.zte.com.cn 2B77faks058631 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.251.13.novalocal with ID 639043C0.000 by FangMail milter! X-FangMail-Envelope: 1670398912/4NRq400Hg9z4y0ty/639043C0.000/10.5.228.132/[10.5.228.132]/mse-fl1.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 639043C0.000/4NRq400Hg9z4y0ty 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?1751540336220821956?= X-GMAIL-MSGID: =?utf-8?q?1751540336220821956?= 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/bh1750.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/iio/light/bh1750.c b/drivers/iio/light/bh1750.c index 390c5b3ad4f6..ab682865885d 100644 --- a/drivers/iio/light/bh1750.c +++ b/drivers/iio/light/bh1750.c @@ -194,8 +194,7 @@ static ssize_t bh1750_show_int_time_available(struct device *dev, const struct bh1750_chip_info *chip_info = data->chip_info; for (i = chip_info->mtreg_min; i <= chip_info->mtreg_max; i += chip_info->inc) - len += scnprintf(buf + len, PAGE_SIZE - len, "0.%06d ", - chip_info->mtreg_to_usec * i); + len += sysfs_emit_at(buf, len, "0.%06d ", chip_info->mtreg_to_usec * i); buf[len - 1] = '\n';