From patchwork Wed Jun 16 03:44:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen \(ThunderTown\)" X-Patchwork-Id: 461341 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp196425jae; Tue, 15 Jun 2021 20:45:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9dq8GWWEhGS+nwPPPCO5uTotCG81tuHmWPimczTMLNLy0ny7R+krgyfAPRIll+BUiZtux X-Received: by 2002:a92:750c:: with SMTP id q12mr1964484ilc.303.1623815150171; Tue, 15 Jun 2021 20:45:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623815150; cv=none; d=google.com; s=arc-20160816; b=tadDRL7+Qh0O9BBzlqOCEFOGqDdyF3jrVoiLZQeSTndy/9t1mdvpB+NsqkfX7lWhcP iecbi8BYkCHiSJ5IYxwWNlT79z32n12GZMHsaTNrr85v8eRZKP8qnAEf8iE9ikL8Kxzi Ok8G+12yUBbv2sBXbp8Aspd1BZeweFwqolSNMtodDzNjoPdh2ly45AmLb/LIpsHWAELa RIL6TWQecwXSL72uebOVSH92yvlxfHaJOfLW8j9Yqp4Y1ElzzLUXGdUOl2ARPa5BQplS 8zDfUjIO766/S16VHkx3XkIjCcIzfT/PgUvw4a8zdvaiZ1ueke/ZfkTlkSEkQQS7EOEc qZsg== 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=KWKqcrShtdAe8/XNiXmKlSsloRu0iwEkMNh9AqD/HU0=; b=MMfY5VClFEOiobJG9JjV5zuo43xb8Nzv1+PZDbOthJKu+OAxIX7aP32CjAXWQ5EeLo cOc/rZJ2XMsKInpGUztJwPqUU3PmgKkRQSyKdhiogmjoeffpsEVcK7pZpu/M4QpOnal8 gHeR8nmhJq4gMv5J0XVfNStpSP7GO60IukThzJ34qVJ2aj5YP4NIAiwntFUe98cjx5bL B0muZ4AY89z1g8nr79XnZv4M00izHDdZm7zryQytPmA+RAaV6eLnm4MWqKrAMm1ABF2n IZmFPTEw1oAjPVZOc+Vbm77wj5kwGerv17vL4Lh5cnVaUXtcD4Z3FEuwe8UihWN77QJA hGsA== 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.50 for ; Tue, 15 Jun 2021 20:45:50 -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 S230490AbhFPDry (ORCPT ); Tue, 15 Jun 2021 23:47:54 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:7448 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230217AbhFPDry (ORCPT ); Tue, 15 Jun 2021 23:47:54 -0400 Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4G4WH06GzRzZhm6; Wed, 16 Jun 2021 11:42:52 +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:48 +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:47 +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 4/4] scsi: mvsas: use DEVICE_ATTR_RO/RW macro Date: Wed, 16 Jun 2021 11:44:19 +0800 Message-ID: <20210616034419.725-5-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/RW 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/mvsas/mv_init.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) -- 2.26.0.106.g9fadedd diff --git a/drivers/scsi/mvsas/mv_init.c b/drivers/scsi/mvsas/mv_init.c index 6aa2697c4a15d24..53137f7d0e993da 100644 --- a/drivers/scsi/mvsas/mv_init.c +++ b/drivers/scsi/mvsas/mv_init.c @@ -692,22 +692,17 @@ static struct pci_driver mvs_pci_driver = { .remove = mvs_pci_remove, }; -static ssize_t -mvs_show_driver_version(struct device *cdev, - struct device_attribute *attr, char *buffer) +static ssize_t driver_version_show(struct device *cdev, + struct device_attribute *attr, char *buffer) { return snprintf(buffer, PAGE_SIZE, "%s\n", DRV_VERSION); } -static DEVICE_ATTR(driver_version, - S_IRUGO, - mvs_show_driver_version, - NULL); +static DEVICE_ATTR_RO(driver_version); -static ssize_t -mvs_store_interrupt_coalescing(struct device *cdev, - struct device_attribute *attr, - const char *buffer, size_t size) +static ssize_t interrupt_coalescing_store(struct device *cdev, + struct device_attribute *attr, + const char *buffer, size_t size) { unsigned int val = 0; struct mvs_info *mvi = NULL; @@ -745,16 +740,13 @@ mvs_store_interrupt_coalescing(struct device *cdev, return strlen(buffer); } -static ssize_t mvs_show_interrupt_coalescing(struct device *cdev, - struct device_attribute *attr, char *buffer) +static ssize_t interrupt_coalescing_show(struct device *cdev, + struct device_attribute *attr, char *buffer) { return snprintf(buffer, PAGE_SIZE, "%d\n", interrupt_coalescing); } -static DEVICE_ATTR(interrupt_coalescing, - S_IRUGO|S_IWUSR, - mvs_show_interrupt_coalescing, - mvs_store_interrupt_coalescing); +static DEVICE_ATTR_RW(interrupt_coalescing); static int __init mvs_init(void) {