From patchwork Wed Jun 2 02:49:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen \(ThunderTown\)" X-Patchwork-Id: 452469 Delivered-To: patch@linaro.org Received: by 2002:a02:c735:0:0:0:0:0 with SMTP id h21csp175420jao; Tue, 1 Jun 2021 19:50:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4LptNvQKO1U+vFE6wfkKxxJLOibpFVrNrEYkcoSHA6IAuOkr1Vx3BoMnRrlpfpU+YWybe X-Received: by 2002:a17:906:5f93:: with SMTP id a19mr24093341eju.18.1622602219519; Tue, 01 Jun 2021 19:50:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622602219; cv=none; d=google.com; s=arc-20160816; b=w4sn58KJKMRd24nFcT9mILAd21SGT+okBYeDeQD9EGJKDhqksu1h5FuZ8yVp0abm2l kMt3XX7jvKpQwlZ2jbwCWx2IjkikoHj5q2eBjqJFuTM5MolHFXyWpFHlxQOtUmsTh1Ji gYyHUdQRDKXT3/zVZBTX6RZdSaMENBcX7cHpjH4M9QdOLOWBPBwyP3CpPtt+yP027m5w SWknBO7qphN6OTUWbSZLv+uszkoKKzu8wRrRPJP2S4iuHmsqNZar57qrhkWiMiyTm5G7 NEH35HF1pe+gITUeh47u/KKbbumRFK+bntRl2oPnkq+WKv0zsvFjLGv2ZKjPKakg+hdq 09/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=G6Kh8UomxYpAADO2+HtKnjdZEEfeNa3tN4re6XbH2rc=; b=Sz8GYFM9WecSWl45IPeiL7b/nk062Ai/mzs4oyq/RPJCrIHcKjJGM2yiIVGy7t6XD1 VCHAZ9K+5n5JLqGSre05Yp1vxyyJlQFjMnbaxPrpOPqv3U/XB5F/4aO7Z0QeOoHXvbU/ 2AhZ+iAkUZkD2HeV+eflM9TLV+7DSzCweSYF4jOWFhjaV3JDR97jYDUvYgozOkYQYZAc OvWT6kcWuoUGJqWC4kuVsU1I0zyv9AVogFK/mJMTkk9s/cmmYf+Rliq5kEGnrV6YKRyt vbzzKFTjz+q1w/pfjbCsUGVF6o00qalSiKVoepXana+jLvUQOEaeYneiwuqiaQGq0CB7 iMRg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o13si20915112ejb.390.2021.06.01.19.50.19 for ; Tue, 01 Jun 2021 19:50:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229999AbhFBCv4 (ORCPT ); Tue, 1 Jun 2021 22:51:56 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:6129 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229631AbhFBCvz (ORCPT ); Tue, 1 Jun 2021 22:51:55 -0400 Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4FvtjW0D8FzYpwD; Wed, 2 Jun 2021 10:47:27 +0800 (CST) Received: from dggpemm500006.china.huawei.com (7.185.36.236) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 2 Jun 2021 10:49:59 +0800 Received: from thunder-town.china.huawei.com (10.174.177.72) by dggpemm500006.china.huawei.com (7.185.36.236) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 2 Jun 2021 10:49:58 +0800 From: Zhen Lei To: Nilesh Javali , Manish Rangankar , , "James E . J . Bottomley" , "Martin K . Petersen" , linux-scsi , linux-kernel CC: Zhen Lei Subject: [PATCH 1/1] scsi: qedi: use DEVICE_ATTR_RO macro Date: Wed, 2 Jun 2021 10:49:40 +0800 Message-ID: <20210602024940.10746-1-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.26.0.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.174.177.72] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm500006.china.huawei.com (7.185.36.236) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Use DEVICE_ATTR_RO macro helper instead of plain DEVICE_ATTR, which makes the code a bit shorter and easier to read. Signed-off-by: Zhen Lei --- drivers/scsi/qedi/qedi_sysfs.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) -- 2.26.0.106.g9fadedd diff --git a/drivers/scsi/qedi/qedi_sysfs.c b/drivers/scsi/qedi/qedi_sysfs.c index 04ee68e6499c912..be174d30eb7c275 100644 --- a/drivers/scsi/qedi/qedi_sysfs.c +++ b/drivers/scsi/qedi/qedi_sysfs.c @@ -16,9 +16,9 @@ static inline struct qedi_ctx *qedi_dev_to_hba(struct device *dev) return iscsi_host_priv(shost); } -static ssize_t qedi_show_port_state(struct device *dev, - struct device_attribute *attr, - char *buf) +static ssize_t port_state_show(struct device *dev, + struct device_attribute *attr, + char *buf) { struct qedi_ctx *qedi = qedi_dev_to_hba(dev); @@ -28,8 +28,8 @@ static ssize_t qedi_show_port_state(struct device *dev, return sprintf(buf, "Linkdown\n"); } -static ssize_t qedi_show_speed(struct device *dev, - struct device_attribute *attr, char *buf) +static ssize_t speed_show(struct device *dev, + struct device_attribute *attr, char *buf) { struct qedi_ctx *qedi = qedi_dev_to_hba(dev); struct qed_link_output if_link; @@ -39,8 +39,8 @@ static ssize_t qedi_show_speed(struct device *dev, return sprintf(buf, "%d Gbit\n", if_link.speed / 1000); } -static DEVICE_ATTR(port_state, 0444, qedi_show_port_state, NULL); -static DEVICE_ATTR(speed, 0444, qedi_show_speed, NULL); +static DEVICE_ATTR_RO(port_state); +static DEVICE_ATTR_RO(speed); struct device_attribute *qedi_shost_attrs[] = { &dev_attr_port_state,