Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp615104rwb; Thu, 8 Dec 2022 00:12:51 -0800 (PST) X-Google-Smtp-Source: AA0mqf46sHSB7JRRLWarFxoewIjes0eQyaLDFwYKmKdQrCDaEn5FQ1qNmFI0mRLKEJ/JrLWCJdbc X-Received: by 2002:a50:eb46:0:b0:46a:6426:f458 with SMTP id z6-20020a50eb46000000b0046a6426f458mr58587292edp.119.1670487171132; Thu, 08 Dec 2022 00:12:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670487171; cv=none; d=google.com; s=arc-20160816; b=DVeFKVJaC/Ub0rbShy5r7IF/qUOL1C44aWLpR5neNq7Uf8lWfdJ2pNQYbliO27ZBvf /StvAFijrNSuIMuagLpaJ+jWo10bBnbGSv+AxlgjdEZQ6NaJgVSH93s+Y9bFedClOiEW MjC69tUkwAL+jncqqIg3XCzd7dJ/tdLMVNYNpfOefqjjrIAkdJ3zM+tcfllusr+JOl6u a/yz74U5BS6Wk1UL+z6U9CQOqOBX0CjXUoZu4D21VVlKvk1OlAIuLctAwkU9Z6FATnPU UiIqvJlbc5W58W8MYAex2YBsSi8opnR9HO40wDenHQVusWL8t3ad0o3Fl0E+SSKPcwQ3 9rJw== 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=p2hOXK4We8uzkP5ghl35aXZEXZDHhxLTNOJO64mzAnU=; b=OcimTnbi/z7fKjKAHpxR/b0/cQcqB7veKpGXq/dgdunUDAuf0tNztGu2AwWVlyu365 y3ngl24somNuDAdubo5yvXo5CgtKn4Itiq3l6ilLUEcndAny8MB68osNQXKg4TYzKBhp 6bU1ohaAKIUPf4EXlN482KMBpDfbtzx2sU1THZYEevmBhNLip99s+osQ8oYiTmgHQp2A RJ/C7O9VBZyfllT2/Vb/HDj1YhVbzq6VYrWReIeVHEJN2gUisYmOvAsR9Copy0+xg6p7 7pea0mzUDyZr9mD8hW/x0j+UDbpJi3mXK07j0qw2456s9dWyErstY4RHfSTCZ+j+9Sr2 eXyA== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c1-20020aa7df01000000b0046b1d405d4asi5337713edy.206.2022.12.08.00.12.34; Thu, 08 Dec 2022 00:12:51 -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 S229696AbiLHHXh (ORCPT + 73 others); Thu, 8 Dec 2022 02:23:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229458AbiLHHXf (ORCPT ); Thu, 8 Dec 2022 02:23:35 -0500 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9188A46646; Wed, 7 Dec 2022 23:23:32 -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 mxhk.zte.com.cn (FangMail) with ESMTPS id 4NSQcM0rSdz8R041; Thu, 8 Dec 2022 15:23:31 +0800 (CST) Received: from xaxapp01.zte.com.cn ([10.88.40.50]) by mse-fl1.zte.com.cn with SMTP id 2B87NPXn058403; Thu, 8 Dec 2022 15:23:25 +0800 (+08) (envelope-from ye.xingchen@zte.com.cn) Received: from mapi (xaxapp01[null]) by mapi (Zmail) with MAPI id mid31; Thu, 8 Dec 2022 15:23:27 +0800 (CST) Date: Thu, 8 Dec 2022 15:23:27 +0800 (CST) X-Zmail-TransId: 2af9639190efffffffff94be3eda X-Mailer: Zmail v1.0 Message-ID: <202212081523277319144@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , , , , , , Subject: =?UTF-8?B?W1BBVENIIG5ldC1uZXh0XSBzZmM6IENvbnZlcnQgdG8gdXNlIHN5c2ZzX2VtaXRfYXQoKSBBUEk=?= Content-Type: text/plain; charset="UTF-8" X-MAIL: mse-fl1.zte.com.cn 2B87NPXn058403 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.250.137.novalocal with ID 639190F3.000 by FangMail milter! X-FangMail-Envelope: 1670484211/4NSQcM0rSdz8R041/639190F3.000/10.5.228.132/[10.5.228.132]/mse-fl1.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 639190F3.000/4NSQcM0rSdz8R041 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 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/net/ethernet/sfc/mcdi.c | 14 ++++---------- drivers/net/ethernet/sfc/siena/mcdi.c | 14 ++++---------- 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/drivers/net/ethernet/sfc/mcdi.c b/drivers/net/ethernet/sfc/mcdi.c index af338208eae9..73269db3ca39 100644 --- a/drivers/net/ethernet/sfc/mcdi.c +++ b/drivers/net/ethernet/sfc/mcdi.c @@ -210,14 +210,10 @@ static void efx_mcdi_send_request(struct efx_nic *efx, unsigned cmd, * progress on a NIC at any one time. So no need for locking. */ for (i = 0; i < hdr_len / 4 && bytes < PAGE_SIZE; i++) - bytes += scnprintf(buf + bytes, PAGE_SIZE - bytes, - " %08x", - le32_to_cpu(hdr[i].u32[0])); + bytes += sysfs_emit_at(buf, bytes, " %08x", le32_to_cpu(hdr[i].u32[0])); for (i = 0; i < inlen / 4 && bytes < PAGE_SIZE; i++) - bytes += scnprintf(buf + bytes, PAGE_SIZE - bytes, - " %08x", - le32_to_cpu(inbuf[i].u32[0])); + bytes += sysfs_emit_at(buf, bytes, " %08x", le32_to_cpu(inbuf[i].u32[0])); netif_info(efx, hw, efx->net_dev, "MCDI RPC REQ:%s\n", buf); } @@ -302,15 +298,13 @@ static void efx_mcdi_read_response_header(struct efx_nic *efx) */ for (i = 0; i < hdr_len && bytes < PAGE_SIZE; i++) { efx->type->mcdi_read_response(efx, &hdr, (i * 4), 4); - bytes += scnprintf(buf + bytes, PAGE_SIZE - bytes, - " %08x", le32_to_cpu(hdr.u32[0])); + bytes += sysfs_emit_at(buf, bytes, " %08x", le32_to_cpu(hdr.u32[0])); } for (i = 0; i < data_len && bytes < PAGE_SIZE; i++) { efx->type->mcdi_read_response(efx, &hdr, mcdi->resp_hdr_len + (i * 4), 4); - bytes += scnprintf(buf + bytes, PAGE_SIZE - bytes, - " %08x", le32_to_cpu(hdr.u32[0])); + bytes += sysfs_emit_at(buf, bytes, " %08x", le32_to_cpu(hdr.u32[0])); } netif_info(efx, hw, efx->net_dev, "MCDI RPC RESP:%s\n", buf); diff --git a/drivers/net/ethernet/sfc/siena/mcdi.c b/drivers/net/ethernet/sfc/siena/mcdi.c index 3f7899daa86a..4e10d4594c3a 100644 --- a/drivers/net/ethernet/sfc/siena/mcdi.c +++ b/drivers/net/ethernet/sfc/siena/mcdi.c @@ -213,14 +213,10 @@ static void efx_mcdi_send_request(struct efx_nic *efx, unsigned cmd, * progress on a NIC at any one time. So no need for locking. */ for (i = 0; i < hdr_len / 4 && bytes < PAGE_SIZE; i++) - bytes += scnprintf(buf + bytes, PAGE_SIZE - bytes, - " %08x", - le32_to_cpu(hdr[i].u32[0])); + bytes += sysfs_emit_at(buf, bytes, " %08x", le32_to_cpu(hdr[i].u32[0])); for (i = 0; i < inlen / 4 && bytes < PAGE_SIZE; i++) - bytes += scnprintf(buf + bytes, PAGE_SIZE - bytes, - " %08x", - le32_to_cpu(inbuf[i].u32[0])); + bytes += sysfs_emit_at(buf, bytes, " %08x", le32_to_cpu(inbuf[i].u32[0])); netif_info(efx, hw, efx->net_dev, "MCDI RPC REQ:%s\n", buf); } @@ -305,15 +301,13 @@ static void efx_mcdi_read_response_header(struct efx_nic *efx) */ for (i = 0; i < hdr_len && bytes < PAGE_SIZE; i++) { efx->type->mcdi_read_response(efx, &hdr, (i * 4), 4); - bytes += scnprintf(buf + bytes, PAGE_SIZE - bytes, - " %08x", le32_to_cpu(hdr.u32[0])); + bytes += sysfs_emit_at(buf, bytes, " %08x", le32_to_cpu(hdr.u32[0])); } for (i = 0; i < data_len && bytes < PAGE_SIZE; i++) { efx->type->mcdi_read_response(efx, &hdr, mcdi->resp_hdr_len + (i * 4), 4); - bytes += scnprintf(buf + bytes, PAGE_SIZE - bytes, - " %08x", le32_to_cpu(hdr.u32[0])); + bytes += sysfs_emit_at(buf, bytes, " %08x", le32_to_cpu(hdr.u32[0])); } netif_info(efx, hw, efx->net_dev, "MCDI RPC RESP:%s\n", buf); -- 2.25.1