From patchwork Tue Dec 6 09:14:50 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: 30153 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2716230wrr; Tue, 6 Dec 2022 01:19:09 -0800 (PST) X-Google-Smtp-Source: AA0mqf5zJ9xh1J7eTM1ic3ospxx9feBhD3kNgXkDLxvJxot6PHUBxnYC6xnSKyTNd3talASNPj3o X-Received: by 2002:aa7:c756:0:b0:46b:7038:b1f9 with SMTP id c22-20020aa7c756000000b0046b7038b1f9mr29680691eds.306.1670318349658; Tue, 06 Dec 2022 01:19:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670318349; cv=none; d=google.com; s=arc-20160816; b=Tcfy36Vyq2TyEYBmaLD/lOyqA2sBNrp/NQFi6vZBRlDpieR4KJq593P+AOTraxa7JL 0hELJCBBjP547YFr3RjO/6RjLfSTi/NSkkBmenjiE670KWv6jyOaBqALJh1gEkNDcQoF dQPkmjMuVgVN0F1Ls2E7VMJLGRUOEFKknGvakkhSkTB8ajzukRyZXXx40v4fT9NlDrjD 9k7Fbxggng7PW6dpOa3kbGdGllvE0anxv4yyMXuAuKPhaU8CdUAi3i6SGALw1o7ahw5n vdmHZ67vMlrbUg1Xu10nWVjKqR3BY1AMw3Vu6Ex/6divJAApPJHuiA3R8bu/lhyBYOIa 8zSw== 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=pBwCqxMR1i5TD8FV7fI8oImpCNqp+Qc9iJ8dEZ7iqro=; b=hgZx55ViUCtziAOSVNciF2ApqTWbqn6BkWm7613Zh0lMVy4booh9WV8frlzm31I422 8h+grXIWmzrlju17+6z8IGIHaCPBYaK3tIVZEkiA4HQvnSOCw2WKG64fQNylBj8wDxDU Kq+PvF2xe1MllCGWBwYy2z4EIEVUXoXWAqqaSLSTEg2omvIeT53xxm8W8PbLh7keNc4D QhcQl3Ed0kxyz5SeXhdWtpuCR1vtsOBE1dqNYFwOg/pJJB00M10N46cWyXqo9PkxOyIg Vv5xx+xk5FNbw9R8ZVyK3/61dabvnW6CeIB9u+4SqQJarH2yv6PVDPhkpPAi3IMQ92dr hxNg== 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 sg33-20020a170907a42100b0078d9f02b452si9527224ejc.861.2022.12.06.01.18.36; Tue, 06 Dec 2022 01:19:09 -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 S234611AbiLFJPN (ORCPT + 99 others); Tue, 6 Dec 2022 04:15:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234449AbiLFJPF (ORCPT ); Tue, 6 Dec 2022 04:15:05 -0500 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41DF01EEC7; Tue, 6 Dec 2022 01:15:01 -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 4NRF9v59Wbz8RV7N; Tue, 6 Dec 2022 17:14:59 +0800 (CST) Received: from xaxapp01.zte.com.cn ([10.88.40.50]) by mse-fl2.zte.com.cn with SMTP id 2B69Em72018258; Tue, 6 Dec 2022 17:14:48 +0800 (+08) (envelope-from ye.xingchen@zte.com.cn) Received: from mapi (xaxapp01[null]) by mapi (Zmail) with MAPI id mid31; Tue, 6 Dec 2022 17:14:50 +0800 (CST) Date: Tue, 6 Dec 2022 17:14:50 +0800 (CST) X-Zmail-TransId: 2af9638f080a56acf900 X-Mailer: Zmail v1.0 Message-ID: <202212061714501297954@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , Subject: =?utf-8?q?=5BPATCH=5D_dmaengine=3A_ppc4xx=3A_Convert_to_use=C2=A0sy?= =?utf-8?q?sfs=5Femit=28=29/sysfs=5Femit=5Fat=28=29_APIs?= X-MAIL: mse-fl2.zte.com.cn 2B69Em72018258 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.250.137.novalocal with ID 638F0813.000 by FangMail milter! X-FangMail-Envelope: 1670318099/4NRF9v59Wbz8RV7N/638F0813.000/10.5.228.133/[10.5.228.133]/mse-fl2.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 638F0813.000/4NRF9v59Wbz8RV7N 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?1751455733589250606?= X-GMAIL-MSGID: =?utf-8?q?1751455733589250606?= 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/dma/ppc4xx/adma.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/dma/ppc4xx/adma.c b/drivers/dma/ppc4xx/adma.c index 6b5e91f26afc..686c270ef710 100644 --- a/drivers/dma/ppc4xx/adma.c +++ b/drivers/dma/ppc4xx/adma.c @@ -4299,9 +4299,8 @@ static ssize_t devices_show(struct device_driver *dev, char *buf) for (i = 0; i < PPC440SPE_ADMA_ENGINES_NUM; i++) { if (ppc440spe_adma_devices[i] == -1) continue; - size += scnprintf(buf + size, PAGE_SIZE - size, - "PPC440SP(E)-ADMA.%d: %s\n", i, - ppc_adma_errors[ppc440spe_adma_devices[i]]); + size += sysfs_emit_at(buf, size, "PPC440SP(E)-ADMA.%d: %s\n", + i, ppc_adma_errors[ppc440spe_adma_devices[i]]); } return size; } @@ -4309,9 +4308,8 @@ static DRIVER_ATTR_RO(devices); static ssize_t enable_show(struct device_driver *dev, char *buf) { - return snprintf(buf, PAGE_SIZE, - "PPC440SP(e) RAID-6 capabilities are %sABLED.\n", - ppc440spe_r6_enabled ? "EN" : "DIS"); + return sysfs_emit(buf, "PPC440SP(e) RAID-6 capabilities are %sABLED.\n", + ppc440spe_r6_enabled ? "EN" : "DIS"); } static ssize_t enable_store(struct device_driver *dev, const char *buf, @@ -4362,7 +4360,7 @@ static ssize_t poly_show(struct device_driver *dev, char *buf) reg &= 0xFF; #endif - size = snprintf(buf, PAGE_SIZE, "PPC440SP(e) RAID-6 driver " + size = sysfs_emit(buf, "PPC440SP(e) RAID-6 driver " "uses 0x1%02x polynomial.\n", reg); return size; }