From patchwork Fri Dec 2 08:42:14 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: 28781 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp722370wrr; Fri, 2 Dec 2022 00:57:16 -0800 (PST) X-Google-Smtp-Source: AA0mqf7oNmssWVccGFEGQqxbU5gPW1mLzWT+poQjvEP4FlVnnsdVYj4uLFSwwXlQCsR8AAFm6j0l X-Received: by 2002:a05:6402:494:b0:46a:c9bc:ccd4 with SMTP id k20-20020a056402049400b0046ac9bcccd4mr30037088edv.200.1669971436133; Fri, 02 Dec 2022 00:57:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669971436; cv=none; d=google.com; s=arc-20160816; b=HiWjPc7D/k7sSIM3tRz3Ye6TnybGm5LVnCY2gtymhdWgoUzbAY7MKmXqWelAsy96tk 4wOD31rYKUIUgLSZ/7HJqqlmtEmp2Wd+owpZ82alYVZvSoC36zpO9mwOmPKpMPqfXuhj btgg+nHX3s8iZniTQMY6K1t/Wns9H/M/wlB7t2lpvIIh2RnzZ/G8I2qL5vMf2gFeHxaY Xv4iV+1XEavMHjeiykUX0NjQAwMPrhhRQnIMiKY9Fk9wF7Iu+Kr8jraKcHJjY8mHS6Ae YlH2LPMN1wTFFtyMvSrl09O8jUlNsBObEpaLnXxBCceh7+YHJlKZpzap0hdoskiyjyI2 82Ag== 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=7NPX08kUjr7TJV3XzwneJs4eZTAzUO5AyDcWY3YsSx0=; b=ovEQUJoA+2to0qboJq8j70Pq6MKLYskQSApDL87wtRKFGcbPho25S+YGT150sox7Xd EacwsVOSfSR8LVcfiDM/hU+3kvSYPgy4MYnSPA0hnfZ507wnzHeCQwc3ckhwnRC3dZhg WIw5suMcuCfYugPVjQptRstZV5y7SmhwxewAZoDFDti/t65jx8z6YKxDKg6wmxeO9Rr4 r4/uV6Jrbnyb7qxA14uUVgvoyhdWsAwhbWDV0i3k6BPo1CVqD3Ot2N15NuUDKWaRnqpA knHMnE9XmvHsvdyyUSSEdeYjiEfGRRaY38SEwChCYqtdMM8fyZ7WDABKdRXztuAVtbpb LYFg== 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 jj18-20020a170907985200b0078db1343eedsi4772837ejc.774.2022.12.02.00.56.50; Fri, 02 Dec 2022 00:57:16 -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 S232288AbiLBImd (ORCPT + 99 others); Fri, 2 Dec 2022 03:42:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231730AbiLBImc (ORCPT ); Fri, 2 Dec 2022 03:42:32 -0500 Received: from mxct.zte.com.cn (mxct.zte.com.cn [183.62.165.209]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91550100; Fri, 2 Dec 2022 00:42: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 4NNmfD01Zpz501Qh; Fri, 2 Dec 2022 16:42:28 +0800 (CST) Received: from xaxapp01.zte.com.cn ([10.88.40.50]) by mse-fl2.zte.com.cn with SMTP id 2B28gCQX002973; Fri, 2 Dec 2022 16:42:12 +0800 (+08) (envelope-from ye.xingchen@zte.com.cn) Received: from mapi (xaxapp01[null]) by mapi (Zmail) with MAPI id mid31; Fri, 2 Dec 2022 16:42:14 +0800 (CST) Date: Fri, 2 Dec 2022 16:42:14 +0800 (CST) X-Zmail-TransId: 2af96389ba667b8f7013 X-Mailer: Zmail v1.0 Message-ID: <202212021642142044742@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , , , Subject: =?utf-8?q?=5BPATCH=5D_net=3A_ipa=3A_use_sysfs=5Femit=28=29_to_inste?= =?utf-8?q?ad_of_scnprintf=28=29?= X-MAIL: mse-fl2.zte.com.cn 2B28gCQX002973 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.251.13.novalocal with ID 6389BA73.002 by FangMail milter! X-FangMail-Envelope: 1669970548/4NNmfD01Zpz501Qh/6389BA73.002/10.5.228.133/[10.5.228.133]/mse-fl2.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 6389BA73.002/4NNmfD01Zpz501Qh 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?1751091968530736023?= X-GMAIL-MSGID: =?utf-8?q?1751091968530736023?= 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 Reviewed-by: Alex Elder --- drivers/net/ipa/ipa_sysfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ipa/ipa_sysfs.c b/drivers/net/ipa/ipa_sysfs.c index 5cbc15a971f9..14bd2f903045 100644 --- a/drivers/net/ipa/ipa_sysfs.c +++ b/drivers/net/ipa/ipa_sysfs.c @@ -46,7 +46,7 @@ version_show(struct device *dev, struct device_attribute *attr, char *buf) { struct ipa *ipa = dev_get_drvdata(dev); - return scnprintf(buf, PAGE_SIZE, "%s\n", ipa_version_string(ipa)); + return sysfs_emit(buf, "%s\n", ipa_version_string(ipa)); } static DEVICE_ATTR_RO(version); @@ -70,7 +70,7 @@ static ssize_t rx_offload_show(struct device *dev, { struct ipa *ipa = dev_get_drvdata(dev); - return scnprintf(buf, PAGE_SIZE, "%s\n", ipa_offload_string(ipa)); + return sysfs_emit(buf, "%s\n", ipa_offload_string(ipa)); } static DEVICE_ATTR_RO(rx_offload); @@ -80,7 +80,7 @@ static ssize_t tx_offload_show(struct device *dev, { struct ipa *ipa = dev_get_drvdata(dev); - return scnprintf(buf, PAGE_SIZE, "%s\n", ipa_offload_string(ipa)); + return sysfs_emit(buf, "%s\n", ipa_offload_string(ipa)); } static DEVICE_ATTR_RO(tx_offload);