Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5052511rwb; Sun, 13 Nov 2022 20:37:49 -0800 (PST) X-Google-Smtp-Source: AA0mqf7PAHCDZyDhs1HMOllwfuKHdURLIBTP4fLEEhXq7P8cXccRSdbCpCm3/cLNpMRKHJ2YOVAs X-Received: by 2002:a17:906:f8d6:b0:7ad:a0cb:f79e with SMTP id lh22-20020a170906f8d600b007ada0cbf79emr8673324ejb.458.1668400669434; Sun, 13 Nov 2022 20:37:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668400669; cv=none; d=google.com; s=arc-20160816; b=hd2AMRqqiuIXODuIwVm6dtxepxBMU+u+OpSsYNv7Ek94HxCZj5PIj8Fkb4Ena8svZ1 /UJZnTuFeOa+D8JdgPY6Oo+b+hcYpa4qh5klDJD3aiYjJSxtEnULdPcGeP0Aeossb53Z nkJR+4/4OqkLbDqZnCBZnISmrBjLnWW1Xagqr/sXdp84KD3DOu9+mxhlIJmZNgN9yOAG BduiXgqdpXpssZBwbkC0c75FQzGNb/lVaXqJlDhH8DKviAAhmqJq7B54/8wPn9Un5g6c i70vhtL223Vm5brVim6yhtBRdTmPPouFqaKgAFfxwmjZIViSe3jRiPUoSHTNvYOwQS+T dPXA== 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=mc39/RG4VNUBPYm8hAY63C1GTh8NTmfgX0p7QPm3EYg=; b=enofP63gO6GzYJv18ajQKD5BT9EylZLUnPrLmf1wneIkWxhXzOiz5jWQffXEeaJD3t Kl5vA+Z/7V62+L8roe4EbnXFojKZJpNLbdCChkHOf8BhqWLjG1puXVuDZabAina8eMUk ZlOiVxXsHZRy8TTiyis00JH+PRMn/cEjowLI5JrATRmFfuRX0W0DZKXqMPjNDppizdrD De4Qgi1WTh3tApN1mKa7eHJKgPLS1BaFfB0bvW6RC2PnD9Buj9DGCG4jgqLBKWA4ep7c FXBd+GRp6IhEn/95lpiC9KP+eMbJKQ5cUdMN5yXMuJqnVXjEPzPCSCjsJYF1YDSMWK64 WtFw== 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 m15-20020a056402430f00b0046777d0ad16si6630460edc.394.2022.11.13.20.37.28; Sun, 13 Nov 2022 20:37:49 -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 S235719AbiKNDjA (ORCPT + 88 others); Sun, 13 Nov 2022 22:39:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235348AbiKNDi6 (ORCPT ); Sun, 13 Nov 2022 22:38:58 -0500 Received: from mxct.zte.com.cn (mxct.zte.com.cn [58.251.27.85]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAF8E6559; Sun, 13 Nov 2022 19:38:55 -0800 (PST) Received: from mxde.zte.com.cn (unknown [10.35.20.121]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mxct.zte.com.cn (FangMail) with ESMTPS id 4N9ZmF2RPFzjn8; Mon, 14 Nov 2022 11:38:53 +0800 (CST) Received: from mxus.zte.com.cn (unknown [10.207.168.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mxde.zte.com.cn (FangMail) with ESMTPS id 4N9Zly5p4kz9vSpd; Mon, 14 Nov 2022 11:38:38 +0800 (CST) Received: from mxhk.zte.com.cn (unknown [192.168.250.137]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mxus.zte.com.cn (FangMail) with ESMTPS id 4N9Zlt5GxZzdmYkl; Mon, 14 Nov 2022 11:38:34 +0800 (CST) 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 4N9Zlq52SGz8QrkZ; Mon, 14 Nov 2022 11:38:31 +0800 (CST) Received: from szxlzmapp04.zte.com.cn ([10.5.231.166]) by mse-fl1.zte.com.cn with SMTP id 2AE3cRn1020766; Mon, 14 Nov 2022 11:38:27 +0800 (+08) (envelope-from yang.yang29@zte.com.cn) Received: from mapi (szxlzmapp04[null]) by mapi (Zmail) with MAPI id mid14; Mon, 14 Nov 2022 11:38:28 +0800 (CST) Date: Mon, 14 Nov 2022 11:38:28 +0800 (CST) X-Zmail-TransId: 2b066371b834ffffffff9acfccbb X-Mailer: Zmail v1.0 Message-ID: <202211141138288877199@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , , , , , , , Subject: =?UTF-8?B?W1BBVENIIGxpbnV4IG5leHQgdjJdIHNjc2k6IGlibXZmYzogdXNlIHN5c2ZzX2VtaXQoKSB0byBpbnN0ZWFkIG9mIHNjbnByaW50Zigp?= Content-Type: text/plain; charset="UTF-8" X-MAIL: mse-fl1.zte.com.cn 2AE3cRn1020766 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.251.14.novalocal with ID 6371B84C.000 by FangMail milter! X-FangMail-Envelope: 1668397133/4N9ZmF2RPFzjn8/6371B84C.000/10.35.20.121/[10.35.20.121]/mxde.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 6371B84C.000/4N9ZmF2RPFzjn8 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 From: Xu Panda Replace the open-code with sysfs_emit() to simplify the code. --- change for v2 - align code --- Signed-off-by: Xu Panda Signed-off-by: Yang Yang --- drivers/scsi/ibmvscsi/ibmvfc.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c index 1a0c0b7289d2..841e47c94b12 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c @@ -3411,8 +3411,7 @@ static ssize_t ibmvfc_show_host_partition_name(struct device *dev, struct Scsi_Host *shost = class_to_shost(dev); struct ibmvfc_host *vhost = shost_priv(shost); - return snprintf(buf, PAGE_SIZE, "%s\n", - vhost->login_buf->resp.partition_name); + return sysfs_emit(buf, "%s\n", vhost->login_buf->resp.partition_name); } static ssize_t ibmvfc_show_host_device_name(struct device *dev, @@ -3421,8 +3420,7 @@ static ssize_t ibmvfc_show_host_device_name(struct device *dev, struct Scsi_Host *shost = class_to_shost(dev); struct ibmvfc_host *vhost = shost_priv(shost); - return snprintf(buf, PAGE_SIZE, "%s\n", - vhost->login_buf->resp.device_name); + return sysfs_emit(buf, "%s\n", vhost->login_buf->resp.device_name); } static ssize_t ibmvfc_show_host_loc_code(struct device *dev, @@ -3431,8 +3429,7 @@ static ssize_t ibmvfc_show_host_loc_code(struct device *dev, struct Scsi_Host *shost = class_to_shost(dev); struct ibmvfc_host *vhost = shost_priv(shost); - return snprintf(buf, PAGE_SIZE, "%s\n", - vhost->login_buf->resp.port_loc_code); + return sysfs_emit(buf, "%s\n", vhost->login_buf->resp.port_loc_code); } static ssize_t ibmvfc_show_host_drc_name(struct device *dev, @@ -3441,8 +3438,7 @@ static ssize_t ibmvfc_show_host_drc_name(struct device *dev, struct Scsi_Host *shost = class_to_shost(dev); struct ibmvfc_host *vhost = shost_priv(shost); - return snprintf(buf, PAGE_SIZE, "%s\n", - vhost->login_buf->resp.drc_name); + return sysfs_emit(buf, "%s\n", vhost->login_buf->resp.drc_name); } static ssize_t ibmvfc_show_host_npiv_version(struct device *dev, @@ -3450,7 +3446,7 @@ static ssize_t ibmvfc_show_host_npiv_version(struct device *dev, { struct Scsi_Host *shost = class_to_shost(dev); struct ibmvfc_host *vhost = shost_priv(shost); - return snprintf(buf, PAGE_SIZE, "%d\n", be32_to_cpu(vhost->login_buf->resp.version)); + return sysfs_emit(buf, "%d\n", be32_to_cpu(vhost->login_buf->resp.version)); } static ssize_t ibmvfc_show_host_capabilities(struct device *dev, @@ -3458,7 +3454,7 @@ static ssize_t ibmvfc_show_host_capabilities(struct device *dev, { struct Scsi_Host *shost = class_to_shost(dev); struct ibmvfc_host *vhost = shost_priv(shost); - return snprintf(buf, PAGE_SIZE, "%llx\n", be64_to_cpu(vhost->login_buf->resp.capabilities)); + return sysfs_emit(buf, "%llx\n", be64_to_cpu(vhost->login_buf->resp.capabilities)); } /** @@ -3479,7 +3475,7 @@ static ssize_t ibmvfc_show_log_level(struct device *dev, int len; spin_lock_irqsave(shost->host_lock, flags); - len = snprintf(buf, PAGE_SIZE, "%d\n", vhost->log_level); + len = sysfs_emit(buf, "%d\n", vhost->log_level); spin_unlock_irqrestore(shost->host_lock, flags); return len; } @@ -3517,7 +3513,7 @@ static ssize_t ibmvfc_show_scsi_channels(struct device *dev, int len; spin_lock_irqsave(shost->host_lock, flags); - len = snprintf(buf, PAGE_SIZE, "%d\n", vhost->client_scsi_channels); + len = sysfs_emit(buf, "%d\n", vhost->client_scsi_channels); spin_unlock_irqrestore(shost->host_lock, flags); return len; } -- 2.15.2