Received: by 2002:a05:7412:8d09:b0:fa:4c10:6cad with SMTP id bj9csp246631rdb; Mon, 15 Jan 2024 21:07:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IHdNPh0dX6mqdlOX4Vl3jhZBnO0uIilPH+fsHRdxi8W4TKpbrgOhcVIfuBLjfenQJRNRBOk X-Received: by 2002:a05:6808:331a:b0:3bd:82d4:6c1d with SMTP id ca26-20020a056808331a00b003bd82d46c1dmr2075008oib.26.1705381625916; Mon, 15 Jan 2024 21:07:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705381625; cv=none; d=google.com; s=arc-20160816; b=MB6iB455h3U7xiw12kQ7RNg2NNLi0fBXKxvNmVwqq3LVf0lNQJ1ewBZ4BAbtN0XNu0 M9f4xnbQyubRz9KvdVT72CYWoZE++WOxdM5EBMdINJZ6iCQCZxsNFLQR2/64XLsimap/ +RZlAV05bQSXet1P1BF9Fumo1cB/d1pSMqwLrHXgnErxt243RpMwiZF2wlI4XNSyb4B/ JGl3ocr3eyAvRw4INNJsWrUUwcNgUK+cY00/ciJdzmQh9t4dHmAH4s180TH3p9qadbGn 0Iid6+stv39rFZhrbqiZ9T+C3NKquAVXiT5/m1YTE8JdN8zyxcDJLlHfzNHpZcT3v6Ie YRQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=b8EwNN2kPmx593F4jzDlcM1nZBtSC+6bOsGvbSCzd60=; fh=J6IRo0uzVvLRQ67h2u0oOEtZu+aP3SN5ggwaTvM+bNk=; b=osHnfe5BxnAqaEIkvvp4TovCUlVEb0lAqeLfPBg+mmsP7I20SzrUwXDkTEbOII1Lu9 bvkjrfg/t2j4+T2KAOpYlgFRRw/PmJIqPKDzcFp/ZlTvdnVygGC0sj3feuDEJCYiLEAz KxxIye6xnYyX4EwN99vn9e4DacdVD0KX+m9c0u47epcSzKRMw6NqIzq5S0ERIj5mRRLa E25bnZVk2H0yxucZ/wneiseEbdTziWEosaRnAvV2UkpETruwYID0tjSmCJm18Jp43un9 OEBwcKNFAUWRciooM6R/iRI0N1dFOTWvwKJuzYPdrbczzwBRdnlSEceA/141x3J4+xP0 4fcQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-26993-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26993-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=fujitsu.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id n5-20020a632705000000b005ce07907cb2si9615479pgn.422.2024.01.15.21.07.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 21:07:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-26993-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-26993-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26993-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=fujitsu.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 1DCDDB23E21 for ; Tue, 16 Jan 2024 05:02:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 890271DFEA; Tue, 16 Jan 2024 04:52:43 +0000 (UTC) Received: from esa3.hc1455-7.c3s2.iphmx.com (esa3.hc1455-7.c3s2.iphmx.com [207.54.90.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB89E1D528; Tue, 16 Jan 2024 04:52:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=fujitsu.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fujitsu.com X-IronPort-AV: E=McAfee;i="6600,9927,10954"; a="146236503" X-IronPort-AV: E=Sophos;i="6.04,198,1695654000"; d="scan'208";a="146236503" Received: from unknown (HELO oym-r4.gw.nic.fujitsu.com) ([210.162.30.92]) by esa3.hc1455-7.c3s2.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jan 2024 13:52:23 +0900 Received: from oym-m1.gw.nic.fujitsu.com (oym-nat-oym-m1.gw.nic.fujitsu.com [192.168.87.58]) by oym-r4.gw.nic.fujitsu.com (Postfix) with ESMTP id 05A73D9D92; Tue, 16 Jan 2024 13:52:21 +0900 (JST) Received: from kws-ab4.gw.nic.fujitsu.com (kws-ab4.gw.nic.fujitsu.com [192.51.206.22]) by oym-m1.gw.nic.fujitsu.com (Postfix) with ESMTP id 3088AD8AD7; Tue, 16 Jan 2024 13:52:20 +0900 (JST) Received: from edo.cn.fujitsu.com (edo.cn.fujitsu.com [10.167.33.5]) by kws-ab4.gw.nic.fujitsu.com (Postfix) with ESMTP id C2E0A6B4C7; Tue, 16 Jan 2024 13:52:19 +0900 (JST) Received: from localhost.localdomain (unknown [10.167.226.45]) by edo.cn.fujitsu.com (Postfix) with ESMTP id 5408C1A0070; Tue, 16 Jan 2024 12:52:19 +0800 (CST) From: Li Zhijian To: linux-kernel@vger.kernel.org Cc: Li Zhijian , Ketan Mukadam , "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org Subject: [PATCH 20/42] drivers/scsi/be2iscsi: Convert snprintf to sysfs_emit Date: Tue, 16 Jan 2024 12:51:29 +0800 Message-Id: <20240116045151.3940401-18-lizhijian@fujitsu.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240116045151.3940401-1-lizhijian@fujitsu.com> References: <20240116041129.3937800-1-lizhijian@fujitsu.com> <20240116045151.3940401-1-lizhijian@fujitsu.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSS-9.1.0.1417-9.0.0.1002-28122.005 X-TM-AS-User-Approved-Sender: Yes X-TMASE-Version: IMSS-9.1.0.1417-9.0.1002-28122.005 X-TMASE-Result: 10--10.024000-10.000000 X-TMASE-MatchedRID: /HyfiRbsgEU4ibokZ3+Q0CoiRKlBVkYIBXngI6jFvpfvd49YGReckE1N J2MN+nPkgxCMf8A0YpR5sRK06wHV4dL4Vi2vvkbTrMZ+BqQt2NrBOVz0Jwcxl6vCrG0TnfVUg9x e4gtUJtpqw4mhfH/CjxItqQ/criE6dYlaOEy4HBxkGI+vgRTxMPlSepWcgdLPx8BJ7uScK23tk+ BYDo8lj+LzNWBegCW2wgn7iDBesS0gBwKKRHe+r1wp4zMzUhxAOXrm7p4CV73rYz1qlpCwNGo/2 6nVPTwlraIJ3ojsIQ8= X-TMASE-SNAP-Result: 1.821001.0001-0-1-22:0,33:0,34:0-0 Per filesystems/sysfs.rst, show() should only use sysfs_emit() or sysfs_emit_at() when formatting the value to be returned to user space. coccinelle complains that there are still a couple of functions that use snprintf(). Convert them to sysfs_emit(). > ./drivers/scsi/be2iscsi/be_mgmt.c:1145:8-16: WARNING: please use sysfs_emit > ./drivers/scsi/be2iscsi/be_mgmt.c:1164:8-16: WARNING: please use sysfs_emit > ./drivers/scsi/be2iscsi/be_mgmt.c:1251:9-17: WARNING: please use sysfs_emit > ./drivers/scsi/be2iscsi/be_mgmt.c:1280:8-16: WARNING: please use sysfs_emit No functional change intended CC: Ketan Mukadam CC: "James E.J. Bottomley" CC: "Martin K. Petersen" CC: linux-scsi@vger.kernel.org Signed-off-by: Li Zhijian --- drivers/scsi/be2iscsi/be_mgmt.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c index 4e899ec1477d..35e12e13d580 100644 --- a/drivers/scsi/be2iscsi/be_mgmt.c +++ b/drivers/scsi/be2iscsi/be_mgmt.c @@ -1142,7 +1142,7 @@ ssize_t beiscsi_drvr_ver_disp(struct device *dev, struct device_attribute *attr, char *buf) { - return snprintf(buf, PAGE_SIZE, BE_NAME "\n"); + return sysfs_emit(buf, BE_NAME "\n"); } /** @@ -1161,7 +1161,7 @@ beiscsi_fw_ver_disp(struct device *dev, struct device_attribute *attr, struct Scsi_Host *shost = class_to_shost(dev); struct beiscsi_hba *phba = iscsi_host_priv(shost); - return snprintf(buf, PAGE_SIZE, "%s\n", phba->fw_ver_str); + return sysfs_emit(buf, "%s\n", phba->fw_ver_str); } /** @@ -1248,16 +1248,16 @@ beiscsi_adap_family_disp(struct device *dev, struct device_attribute *attr, case BE_DEVICE_ID1: case OC_DEVICE_ID1: case OC_DEVICE_ID2: - return snprintf(buf, PAGE_SIZE, - "Obsolete/Unsupported BE2 Adapter Family\n"); + return sysfs_emit(buf, + "Obsolete/Unsupported BE2 Adapter Family\n"); case BE_DEVICE_ID2: case OC_DEVICE_ID3: - return snprintf(buf, PAGE_SIZE, "BE3-R Adapter Family\n"); + return sysfs_emit(buf, "BE3-R Adapter Family\n"); case OC_SKH_ID1: - return snprintf(buf, PAGE_SIZE, "Skyhawk-R Adapter Family\n"); + return sysfs_emit(buf, "Skyhawk-R Adapter Family\n"); default: - return snprintf(buf, PAGE_SIZE, - "Unknown Adapter Family: 0x%x\n", dev_id); + return sysfs_emit(buf, + "Unknown Adapter Family: 0x%x\n", dev_id); } } @@ -1277,8 +1277,8 @@ beiscsi_phys_port_disp(struct device *dev, struct device_attribute *attr, struct Scsi_Host *shost = class_to_shost(dev); struct beiscsi_hba *phba = iscsi_host_priv(shost); - return snprintf(buf, PAGE_SIZE, "Port Identifier : %u\n", - phba->fw_config.phys_port); + return sysfs_emit(buf, "Port Identifier : %u\n", + phba->fw_config.phys_port); } void beiscsi_offload_cxn_v0(struct beiscsi_offload_params *params, -- 2.29.2