From patchwork Wed Jun 16 03:44:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen \(ThunderTown\)" X-Patchwork-Id: 461343 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp196453jae; Tue, 15 Jun 2021 20:45:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwniruZNp9lzKIdLD2VKG77IVnB++FNGhQTdx3BuwnIQmmZoK7UyMbB7UIrQibQh4Z3kpJ2 X-Received: by 2002:a05:6e02:692:: with SMTP id o18mr1909426ils.145.1623815153170; Tue, 15 Jun 2021 20:45:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623815153; cv=none; d=google.com; s=arc-20160816; b=cpcXmb7cXLkxIqwe0NCNw29tab60b7zb36kMasTXOrkBCrTrDD0BrpnB7x4OvZnKJH IVgPWl4duBI7D+kvoI4w1RFbJGdCdYeNqay0UbnnIq0Wl67b8Fs4uOlnaWiMYqQlmqBH wY1cs0Co08FTBIjB+a0nu469kVuIxNzNDvBgBGPlL6WMF+ZH+dmjLCdO75srKgUC9dkX xNbp0rz5e5QokOPjF9M169ihqWfHplTNT/8yhpvkLhSB4+zMrR+lBTCXrPZaQjJNMmrG JM/+19YpRjhID0/VKGNLiWVSH3V1DB6m3IAsZ7kQ+xgKCQbfor8Z6Ppdo4aI8y6+yOgg YBTg== 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=j+2zIE7dOVRQjqsiLAKdcWPyQsL7kyCmFeWYw+57LmQ=; b=Pul7NuKY+Q9LxKzxme8JXz2k9qjRsq+C7n77jedpyCR/qXraMIF8QdnelnLTndGt3m bSwsESpAIwK3+krpHdX7TcHmvmOQVxmwPXr5XvYQtU1oT8PakBX1+Du+c7XzbDfSOH2e wx41XrHVV8H/9vlpAXBC3XmRxZ8g0/OjZ6M4h6YF9pQtcpUI1hOKukudNQLVzDddY2aJ SuoFFDk6VvA1BF1NqOUX3JChQP94JfLHM+VjgonCdtBd9Je0Mr1zD3JRL1J5foqwbcC1 6F6rfzEI0eKSzSSxPYNaFLPjg4Nf1kd+PmAXZyOPw5HMfJy/D2xn7dRiaqKUGKcUFwVm 8Ggg== 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.53 for ; Tue, 15 Jun 2021 20:45:53 -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 S230330AbhFPDr5 (ORCPT ); Tue, 15 Jun 2021 23:47:57 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:4793 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230484AbhFPDrz (ORCPT ); Tue, 15 Jun 2021 23:47:55 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4G4WDb75gTzXgPp; Wed, 16 Jun 2021 11:40:47 +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, 16 Jun 2021 11:45:47 +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:46 +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 3/4] scsi: megaraid_mbox: use DEVICE_ATTR_ADMIN_RO macro Date: Wed, 16 Jun 2021 11:44:18 +0800 Message-ID: <20210616034419.725-4-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_ADMIN_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/megaraid/megaraid_mbox.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) -- 2.26.0.106.g9fadedd diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c index d3fac99db786256..d20c2e4ee7934c9 100644 --- a/drivers/scsi/megaraid/megaraid_mbox.c +++ b/drivers/scsi/megaraid/megaraid_mbox.c @@ -121,8 +121,8 @@ static irqreturn_t megaraid_isr(int, void *); static void megaraid_mbox_dpc(unsigned long); -static ssize_t megaraid_sysfs_show_app_hndl(struct device *, struct device_attribute *attr, char *); -static ssize_t megaraid_sysfs_show_ldnum(struct device *, struct device_attribute *attr, char *); +static ssize_t megaraid_mbox_app_hndl_show(struct device *, struct device_attribute *attr, char *); +static ssize_t megaraid_mbox_ld_show(struct device *, struct device_attribute *attr, char *); static int megaraid_cmm_register(adapter_t *); static int megaraid_cmm_unregister(adapter_t *); @@ -302,8 +302,7 @@ static struct pci_driver megaraid_pci_driver = { // definitions for the device attributes for exporting logical drive number // for a scsi address (Host, Channel, Id, Lun) -static DEVICE_ATTR(megaraid_mbox_app_hndl, S_IRUSR, megaraid_sysfs_show_app_hndl, - NULL); +static DEVICE_ATTR_ADMIN_RO(megaraid_mbox_app_hndl); // Host template initializer for megaraid mbox sysfs device attributes static struct device_attribute *megaraid_shost_attrs[] = { @@ -312,7 +311,7 @@ static struct device_attribute *megaraid_shost_attrs[] = { }; -static DEVICE_ATTR(megaraid_mbox_ld, S_IRUSR, megaraid_sysfs_show_ldnum, NULL); +static DEVICE_ATTR_ADMIN_RO(megaraid_mbox_ld); // Host template initializer for megaraid mbox sysfs device attributes static struct device_attribute *megaraid_sdev_attrs[] = { @@ -3961,7 +3960,7 @@ megaraid_sysfs_get_ldmap(adapter_t *adapter) /** - * megaraid_sysfs_show_app_hndl - display application handle for this adapter + * megaraid_mbox_app_hndl_show - display application handle for this adapter * @dev : class device object representation for the host * @attr : device attribute (unused) * @buf : buffer to send data to @@ -3971,8 +3970,7 @@ megaraid_sysfs_get_ldmap(adapter_t *adapter) * handle, since we do not interface with applications directly. */ static ssize_t -megaraid_sysfs_show_app_hndl(struct device *dev, struct device_attribute *attr, - char *buf) +megaraid_mbox_app_hndl_show(struct device *dev, struct device_attribute *attr, char *buf) { struct Scsi_Host *shost = class_to_shost(dev); adapter_t *adapter = (adapter_t *)SCSIHOST2ADAP(shost); @@ -3985,7 +3983,7 @@ megaraid_sysfs_show_app_hndl(struct device *dev, struct device_attribute *attr, /** - * megaraid_sysfs_show_ldnum - display the logical drive number for this device + * megaraid_mbox_ld_show - display the logical drive number for this device * @dev : device object representation for the scsi device * @attr : device attribute to show * @buf : buffer to send data to @@ -4000,7 +3998,7 @@ megaraid_sysfs_show_app_hndl(struct device *dev, struct device_attribute *attr, * */ static ssize_t -megaraid_sysfs_show_ldnum(struct device *dev, struct device_attribute *attr, char *buf) +megaraid_mbox_ld_show(struct device *dev, struct device_attribute *attr, char *buf) { struct scsi_device *sdev = to_scsi_device(dev); adapter_t *adapter = (adapter_t *)SCSIHOST2ADAP(sdev->host);