From patchwork Thu Dec 8 08:21:18 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: 31200 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp71230wrr; Thu, 8 Dec 2022 00:26:02 -0800 (PST) X-Google-Smtp-Source: AA0mqf4Fu2kDxC4XiPHoG4DJoHdUxgLrDWFlgc3D/CgPBm8wDrfht694KoUW7aFFdHnmk60ZKQQz X-Received: by 2002:a17:90a:77c4:b0:219:8132:70db with SMTP id e4-20020a17090a77c400b00219813270dbmr32222047pjs.183.1670487962342; Thu, 08 Dec 2022 00:26:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670487962; cv=none; d=google.com; s=arc-20160816; b=0o73JQDBm8dg7IvHjHLme4iYbehwYADQpadWOaqCvgAEffXES46269kaTl8RotYI8y JJLGaGpgGW7Dh1vKYmaQJcAJsLWfqG7HmNy5xPjBVERMcyuX+z8le51a+YDRD+Vk7GK4 5A/o7+KBP5eouBybJaGSAOPTK41+UKtXuqvambx6dPg7JqveGP4ptZo8DVr5V/VaYOHt QpqKeTb+JrGfoQHvD3Ocv6cLfRONbbx9bi7nAhv/LurgDYESbQlmUkVx+10TX9vjWEAi Vbo1tLobhCq8dm6HXHxct8vhLHoqZhOgXMvqYjBuDqIRrnYs9Y5TGpXtVn8gUvzH3ZDL xvUQ== 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=vtdkgXUP4w3BdreutoBMzmbPcOBiaPlLqnAn7vdD35Q=; b=XNNARBS4tGkIzzwfSB+KY31ZWYkqaJiVgpOmEs+SQpoy0+A/1+EVslkEeCK+fO3oI0 bEjNMh9Ii0rJPevZKT7WzRcgQOmM2Rsdw/jwNRIAZTj1fWsFrv1bwgsa+0un59noxBlU P6NouCuhrQtyKJBmdaW2s2LVKBGtLeUQzGRzK5QjHVdfSYEv4h1XNBqKbyKDgUdrXeyt 655sckDC5W9g7TNLeer0hPTSVOy9atXMQ/okKIKvqA9BVlmWDxkoiaLGe6pX1HeE6UTS 59t9nV9ECJCTOzdescyF7IcXg5ddtq10E557P0K3tuFy5n62t8RH7393GWa8Lt/F8eI4 brow== 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 h8-20020a17090a648800b00218f916f005si3511871pjj.121.2022.12.08.00.25.48; Thu, 08 Dec 2022 00:26:02 -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 S229841AbiLHIV0 (ORCPT + 99 others); Thu, 8 Dec 2022 03:21:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229820AbiLHIVY (ORCPT ); Thu, 8 Dec 2022 03:21:24 -0500 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B8F759178; Thu, 8 Dec 2022 00:21:23 -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 4NSRv55mX6z4xVnf; Thu, 8 Dec 2022 16:21:21 +0800 (CST) Received: from xaxapp03.zte.com.cn ([10.88.40.52]) by mse-fl1.zte.com.cn with SMTP id 2B88LGWi014440; Thu, 8 Dec 2022 16:21:16 +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 16:21:18 +0800 (CST) Date: Thu, 8 Dec 2022 16:21:18 +0800 (CST) X-Zmail-TransId: 2af963919e7effffffff8cb47df7 X-Mailer: Zmail v1.0 Message-ID: <202212081621189260759@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , Subject: =?utf-8?q?=5BPATCH=5D_scsi=3A_be2iscsi=3A_Convert_to_use_sysfs=5Fem?= =?utf-8?q?it=5Fat=28=29_API?= X-MAIL: mse-fl1.zte.com.cn 2B88LGWi014440 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.250.138.novalocal with ID 63919E81.000 by FangMail milter! X-FangMail-Envelope: 1670487681/4NSRv55mX6z4xVnf/63919E81.000/10.5.228.132/[10.5.228.132]/mse-fl1.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 63919E81.000/4NSRv55mX6z4xVnf 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?1751633585876419257?= X-GMAIL-MSGID: =?utf-8?q?1751633585876419257?= 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/scsi/be2iscsi/be_mgmt.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c index 4e899ec1477d..bf39140250bc 100644 --- a/drivers/scsi/be2iscsi/be_mgmt.c +++ b/drivers/scsi/be2iscsi/be_mgmt.c @@ -1185,12 +1185,10 @@ beiscsi_active_session_disp(struct device *dev, struct device_attribute *attr, if (test_bit(ulp_num, (void *)&phba->fw_config.ulp_supported)) { avlbl_cids = BEISCSI_ULP_AVLBL_CID(phba, ulp_num); total_cids = BEISCSI_GET_CID_COUNT(phba, ulp_num); - len += scnprintf(buf+len, PAGE_SIZE - len, - "ULP%d : %d\n", ulp_num, - (total_cids - avlbl_cids)); + len += sysfs_emit_at(buf, len, "ULP%d : %d\n", + ulp_num, (total_cids - avlbl_cids)); } else - len += scnprintf(buf+len, PAGE_SIZE - len, - "ULP%d : %d\n", ulp_num, 0); + len += sysfs_emit_at(buf, len, "ULP%d : %d\n", ulp_num, 0); } return len; @@ -1215,12 +1213,10 @@ beiscsi_free_session_disp(struct device *dev, struct device_attribute *attr, for (ulp_num = 0; ulp_num < BEISCSI_ULP_COUNT; ulp_num++) { if (test_bit(ulp_num, (void *)&phba->fw_config.ulp_supported)) - len += scnprintf(buf+len, PAGE_SIZE - len, - "ULP%d : %d\n", ulp_num, - BEISCSI_ULP_AVLBL_CID(phba, ulp_num)); + len += sysfs_emit_at(buf, len, "ULP%d : %d\n", ulp_num, + BEISCSI_ULP_AVLBL_CID(phba, ulp_num)); else - len += scnprintf(buf+len, PAGE_SIZE - len, - "ULP%d : %d\n", ulp_num, 0); + len += sysfs_emit_at(buf, len, "ULP%d : %d\n", ulp_num, 0); } return len;