From patchwork Wed Jun 16 03:44:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen \(ThunderTown\)" X-Patchwork-Id: 461340 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp196422jae; Tue, 15 Jun 2021 20:45:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvqfp+D0G7JRTVlXR5zr++w/CrDY52gl7o7p91/z8KePJ/vaxc2rgg1Djw5e/HMdFSPv73 X-Received: by 2002:a05:6e02:1d03:: with SMTP id i3mr2059858ila.35.1623815149707; Tue, 15 Jun 2021 20:45:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623815149; cv=none; d=google.com; s=arc-20160816; b=poD4GkA+yy+304hBQquVXljxLEYBXNvd/BrWtSGAZrvk0EB6KyWWeCKzVIpKrV61Ib 5WwOFLxBgSbD2KIdAOz1SI4H0d+cFN0oj+/4/bDidI8wt2l87RiwG4qUZrji1/WlYppF 7B8fua8CdH2nWPF7+TpQY7b57tZfvMlE2BvoqAfYm3Wy2NikWPGIjqHyLXcZooZYhsjG dKX34IXhJ/5DSgd4Xt9gtPKTyawCiXE8co4k1Ey6oFZef9bmyssV69JiKHjKvNBrD85h rEIDsSh7m2pHZyhyD2WJ6uj/R0sHgZGsKB6Aeol/ZLhhBiSgptLdhcXOesn03F2B0aTD 4yQA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=YbKuK733Ah5ceYsH/agcKHQzcxWcpPmh+GjeK+KFdg4=; b=djLAi/aJnNQtv+PQ1jg7tYWx9oUJxsbOkSwdSwXXXwX9WE84DFQFg5uVf6jxBJTwzu 2IVtIgdtCXOKq8LIMHKaq4C/xxCFCALSkxDKPgZRNMHkeR+tPCh+XYO76xNOWrKvDKqD jEguWqshl8ABXYOWCLAhlnx/YDXE4VHUEcd9GXm2Au8noiNhn1GzLN+pyeNUIjN3cDFY lWSaDjX1GHw1rkLtLAMngKeViEwyJ4h49rlMas7IC1b7yIbNVpAy1XjstYfB1RfHYZjM YO313G7GVqs/eH+ygBIPfxQfw6nhVdxFjdcOUhAxLPYOEToHy16ylzHyFzcdA7SgD4cf 5YiQ== 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 j18si1198777jak.97.2021.06.15.20.45.49 for ; Tue, 15 Jun 2021 20:45:49 -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 S230482AbhFPDry (ORCPT ); Tue, 15 Jun 2021 23:47:54 -0400 Received: from szxga08-in.huawei.com ([45.249.212.255]:7286 "EHLO szxga08-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230083AbhFPDry (ORCPT ); Tue, 15 Jun 2021 23:47:54 -0400 Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.56]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4G4WDZ5q2tz1BMVP; Wed, 16 Jun 2021 11:40:46 +0800 (CST) Received: from dggpemm500006.china.huawei.com (7.185.36.236) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 16 Jun 2021 11:45:46 +0800 Received: from thunder-town.china.huawei.com (10.174.179.0) 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, 16 Jun 2021 11:45:44 +0800 From: Zhen Lei To: Nilesh Javali , Manish Rangankar , Saurav Kashyap , Javed Hasan , Kashyap Desai , "Sumit Saxena" , Shivasharan S , GR-QLogic-Storage-Upstream , "megaraidlinux . pdl" , "James E . J . Bottomley" , "Martin K . Petersen" , linux-scsi CC: Zhen Lei Subject: [PATCH v2 2/4] scsi: qedf: use DEVICE_ATTR_RO macro Date: Wed, 16 Jun 2021 11:44:17 +0800 Message-ID: <20210616034419.725-3-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.26.0.windows.1 In-Reply-To: <20210616034419.725-1-thunder.leizhen@huawei.com> References: <20210616034419.725-1-thunder.leizhen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.174.179.0] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) 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/qedf/qedf_attr.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) -- 2.26.0.106.g9fadedd diff --git a/drivers/scsi/qedf/qedf_attr.c b/drivers/scsi/qedf/qedf_attr.c index d995f72a67595bd..461c0c9180c444e 100644 --- a/drivers/scsi/qedf/qedf_attr.c +++ b/drivers/scsi/qedf/qedf_attr.c @@ -24,9 +24,8 @@ static struct qedf_ctx *qedf_get_base_qedf(struct qedf_ctx *qedf) return lport_priv(base_lport); } -static ssize_t -qedf_fcoe_mac_show(struct device *dev, - struct device_attribute *attr, char *buf) +static ssize_t fcoe_mac_show(struct device *dev, + struct device_attribute *attr, char *buf) { struct fc_lport *lport = shost_priv(class_to_shost(dev)); u32 port_id; @@ -42,9 +41,8 @@ qedf_fcoe_mac_show(struct device *dev, return scnprintf(buf, PAGE_SIZE, "%pM\n", fcoe_mac); } -static ssize_t -qedf_fka_period_show(struct device *dev, - struct device_attribute *attr, char *buf) +static ssize_t fka_period_show(struct device *dev, + struct device_attribute *attr, char *buf) { struct fc_lport *lport = shost_priv(class_to_shost(dev)); struct qedf_ctx *qedf = lport_priv(lport); @@ -59,8 +57,8 @@ qedf_fka_period_show(struct device *dev, return scnprintf(buf, PAGE_SIZE, "%d\n", fka_period); } -static DEVICE_ATTR(fcoe_mac, S_IRUGO, qedf_fcoe_mac_show, NULL); -static DEVICE_ATTR(fka_period, S_IRUGO, qedf_fka_period_show, NULL); +static DEVICE_ATTR_RO(fcoe_mac); +static DEVICE_ATTR_RO(fka_period); struct device_attribute *qedf_host_attrs[] = { &dev_attr_fcoe_mac,