From patchwork Wed Jun 2 03:52:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen \(ThunderTown\)" X-Patchwork-Id: 452472 Delivered-To: patch@linaro.org Received: by 2002:a02:c735:0:0:0:0:0 with SMTP id h21csp208197jao; Tue, 1 Jun 2021 20:52:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtqvzq8sWKaEzArPJJm5pmjEYHwm3AQimaLsyM/6K8zr7eaT6jwF77xKPrSp1cxhL9Yq9W X-Received: by 2002:aa7:cc98:: with SMTP id p24mr37019577edt.353.1622605957787; Tue, 01 Jun 2021 20:52:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622605957; cv=none; d=google.com; s=arc-20160816; b=kWElhDmfgJR3Q/6nHFwRZBVogKa0xcCaczejfNtbAIYrWnIjTzro2CuKj2l17P29d/ bC42aRa87Xr7BhnuuJoCDayIA4mQOXmGev3TOOU3cv+w3bvnP7btoKVJtAH3r8zaFnQ3 FToVcmySkeLMUr4IDFnCM5UoUPRr/+ol66xy2B0dP7JQyDZYIzL4MmUHfLFkxKvgPfEw UfzFUrq0andcAcIXgd5Wq/jVuI8pY2DNz3C0R0umm+GQ2rZ5Tnef+JW0/PNk1GtA8OT3 obc+BdC2cf7xpd5YqiK/tmK/s8xUyYCcqozc4GUd+kyzuJJ3v/4TKHJCEOti8/zW5zqA hnAg== 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=OSv/f3pGOOYjfX82atbHj/X//Q2gJi41eAzGM/ru2Ms=; b=icgC1+gA8rZzgZv2Ehkiz0F+3JmD1zygRXvOtMureF2n+p6koMY1kVYI4UkXeuyt+n /LqxSebl3/ktzmEc++MsA5xs5hVM7DqDYmu26ApXjz9xZ3YL22RMwckbI8SKGoeJjhsD evGy9eNNwqby9AtITI0FxxJImjDV1Tev9oRimgxjVHqIYXli0oR3muIuUzugLNBVsATN 1TjL3Cja8gUT5iGw53mBIH+tBM3aLwM/bYG1k8G5Ov4jnJY2FMQFTl0hLZoAqI//tge3 XVw/1elNLeIoUYA+qG6isu7Plut3QtIMtgMB0b70NJZZHQQIBiOn8zCGaVkipHxut9fz 5ptw== 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 f12si1020106edx.227.2021.06.01.20.52.37 for ; Tue, 01 Jun 2021 20:52:37 -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 S230059AbhFBDyS (ORCPT ); Tue, 1 Jun 2021 23:54:18 -0400 Received: from szxga08-in.huawei.com ([45.249.212.255]:3330 "EHLO szxga08-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229706AbhFBDyQ (ORCPT ); Tue, 1 Jun 2021 23:54:16 -0400 Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Fvw2x1fFtz1BH5C; Wed, 2 Jun 2021 11:47:37 +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, 2 Jun 2021 11:52:19 +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:52:18 +0800 From: Zhen Lei To: "James E . J . Bottomley" , "Martin K . Petersen" , linux-scsi , linux-kernel CC: Zhen Lei Subject: [PATCH 1/1] scsi: mvsas: use DEVICE_ATTR_* macro Date: Wed, 2 Jun 2021 11:52:08 +0800 Message-ID: <20210602035208.10905-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: dggems701-chm.china.huawei.com (10.3.19.178) 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_* 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) {