From patchwork Wed Jun 16 03:44:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen \(ThunderTown\)" X-Patchwork-Id: 461339 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp196402jae; Tue, 15 Jun 2021 20:45:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxiFpCgI5nTBTqWuVqPqI5fhoU+JLyXo/zQvjETiuoZP3dAjIBCq9QnJaxvRm1zQnuo3vO3 X-Received: by 2002:a92:2a05:: with SMTP id r5mr1876460ile.69.1623815147188; Tue, 15 Jun 2021 20:45:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623815147; cv=none; d=google.com; s=arc-20160816; b=ns4eWVLn1lhogomddRQ3HIPPKtkqX37uQmFNsoaEuCuqV+p+Cjrb7V9JY98HEgu/Br yBrk85v7+3ptyzZKXe4Q3ZpiyLltx8QKiMzUaIoDyDQyM8irSt8Mc4hx4QFYy3R9ahBP cmTke84mmYj/VA7NqpqUnruNr/PROATzr9cESK1JPGfvzhjinjruGrL2heDSP0QIT+Cb KMiSDpCa8fssdYMiqUBK86wRXlDFenMZwQ3kUsl1pS4iLgTSHUe17qjBEjIWEXF+hP4v /7XJVsZfQSYrLuMCq0HMW4Sc435Gy/qFoFpcvnEr3ITohHYVYnzLtGUV1B3YYvo14tA7 bJiQ== 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=G6Kh8UomxYpAADO2+HtKnjdZEEfeNa3tN4re6XbH2rc=; b=kS7g4o+z3mmVXT4mJj6eplN37MEFv4NcPzUb77y+Diwm5igKLve0SSapPM/8dRZ/Ld PSf2nXd5IF9YtiWwq5re4bAJf+8b5LUehMOZF7PJlL8cqaJ91eBYDQ/qUd6yeen3Cu8z eFKH8E7gf8Lfr98JTml6wbMuQXRh0n37aYbu4aGVSD7sLsfTga/rybNm42iAlxIvqzsz CU3oUAFm+cnFct4K7PXABmFUH2kMRjJIok5Wvrp5245iY0Eaeqy56nPIT494BIVHg8cb WaaSIlS+fAayX/blDhN9UDMioMgkHxtB0G/P33NWVc8eEjrLFky1zA3kBResvv9hVyAy kS7w== 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.47 for ; Tue, 15 Jun 2021 20:45:47 -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 S230211AbhFPDrw (ORCPT ); Tue, 15 Jun 2021 23:47:52 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:7447 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230083AbhFPDrv (ORCPT ); Tue, 15 Jun 2021 23:47:51 -0400 Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4G4WGx3cc9zZhk2; Wed, 16 Jun 2021 11:42:49 +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, 16 Jun 2021 11:45:44 +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 1/4] scsi: qedi: use DEVICE_ATTR_RO macro Date: Wed, 16 Jun 2021 11:44:16 +0800 Message-ID: <20210616034419.725-2-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/qedi/qedi_sysfs.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) -- 2.26.0.106.g9fadedd Acked-by: Manish Rangankar 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,