From patchwork Wed Jun 2 03:00:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen \(ThunderTown\)" X-Patchwork-Id: 452470 Delivered-To: patch@linaro.org Received: by 2002:a02:c735:0:0:0:0:0 with SMTP id h21csp181620jao; Tue, 1 Jun 2021 20:01:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1qxzsuPyrqJo/xidIFwEpykPn0Nxs0nAMllVTtSUeg+DxRbTJIawgWSowwXHRCWMDv8pg X-Received: by 2002:a05:6402:2317:: with SMTP id l23mr36739428eda.265.1622602866148; Tue, 01 Jun 2021 20:01:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622602866; cv=none; d=google.com; s=arc-20160816; b=CjncPjS2dPS/aGr/FU/tIbsjy4lEGjP61JD2y34AMyUbRt/l4iITq6RjHt6gWXUFJh 8Al8rTA7zw7+3GxAH2QgM7izVxx32A1JcJDiEw95sm+1SZKenlaO4FMx+tWwio6pSev1 gJLAbCMCDekGBPq9LGmruGVdzxf3iSWORUGvBPHUMSwz4b/LEkAX/xpbIxJX7F2rYv5a n27eXMYVKF1fmmFKUZg+W9nRfg45k24TS1T1HXK6IwBBCZKBDA/I1MJf3LSW9MF7RjvN fkP2Z061nKy7V8KDgZL9OA+ZqlHCmlRcAbMelgN0+iBr7xDhracIelnB2D9wuJ6TXSD3 lG/g== 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=YbKuK733Ah5ceYsH/agcKHQzcxWcpPmh+GjeK+KFdg4=; b=OraigRX0SUx2Ej0M8ZeQHvjC+GTsqu1EkB981oqFYYHs8l8R4MgfPXtu0nB7oH9HHD MI5scJwXF5BzvS9DeepJ8gwBAC7DFdTC4aKD9epkFABFCI+Cvy4u0p7ZujiiheimO3vx dL0RNJlS1ZvNOaz1WYWF8bRGD0hKlBx+3NXmx4G+fTkir7tTejlPN5CD34dAROoJwUM0 KgjMyt/vnGBoS4vNee+Dgssq2jFOqOHx1PKKmR9gW5WlC38kTiZCGIoDXH31qHfjwpeH un8ahf94UHl0hdWez63V8MBXxk/edHUS2gcP+A6/bAAsEoIGnVmGEsn6mYg/ZbsZMRBr beUQ== 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 gb8si22389500ejc.572.2021.06.01.20.01.06 for ; Tue, 01 Jun 2021 20:01:06 -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 S230388AbhFBDCr (ORCPT ); Tue, 1 Jun 2021 23:02:47 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:6130 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229866AbhFBDCr (ORCPT ); Tue, 1 Jun 2021 23:02:47 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Fvty31HN8zYpts; Wed, 2 Jun 2021 10:58:19 +0800 (CST) Received: from dggpemm500006.china.huawei.com (7.185.36.236) by dggemv704-chm.china.huawei.com (10.3.19.47) 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 11:01:03 +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 11:01:02 +0800 From: Zhen Lei To: Saurav Kashyap , Javed Hasan , GR-QLogic-Storage-Upstream , "James E . J . Bottomley" , "Martin K . Petersen" , linux-scsi , linux-kernel CC: Zhen Lei Subject: [PATCH 1/1] scsi: qedf: use DEVICE_ATTR_RO macro Date: Wed, 2 Jun 2021 11:00:56 +0800 Message-ID: <20210602030056.10799-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/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,