Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2440187pxj; Sat, 22 May 2021 23:59:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7RfpY0R9ejnfEr+6EJuv77kdlBA7v7QExIUst/BLB2Nhhn86ebq+cZIe1s+enu4vLbl+Z X-Received: by 2002:a17:906:4c8c:: with SMTP id q12mr17538466eju.254.1621753184205; Sat, 22 May 2021 23:59:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621753184; cv=none; d=google.com; s=arc-20160816; b=bjwFGKWkTqFRPDK7tIDqde0rY3vxYv+rPCmWLSu4CRrbcfMmdpgennOpNfJKAQ+eDk RiTvfMEwUCeeph417Zfee5pYFLDKdHL5DE7GhfNGylPCrSfatoM4498Y4IMDwQ4KH0k/ 3Ba6lbaorYRZZEGTUvuxeE/fTxTz24FYAq7YA6y2+h2nVQVsiPu46gJJ/OSknVTMMryU PcFUA3L9O2Ceeqb8ly86+9w0XwMyt3YlSJOIw2qU4++/NlRMGjOb5FZldJRipYZhTYMh DvPaI8imkEtVBwIzIcrbSWEmUUc+b8nPR1vAJUPR+pZFldVmy15xCRHS7wM/9Yku0JY3 vz3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=/yS/xBI7PEhvv6Du7OcinUc/65UL0JwsWkElbeYXUsE=; b=ZCpEIqGQu8OzD33U0UK2UD9kEnlLNPmFe2zk7rbv/ImHJjqMxDwJ/IxbfvE0mSpOmZ h2cV7KyIpqOu0W6WX9U+1IkDF6k4s8nUJ+Cp8ymgaSgW4FaiXRynXySf0ZmygOZZNZJd wU53JiHVIfy1EDw+t1mFHBbCOPu47ktYBmNzMSc2ET7aoip85NaNw3cvHxw8P+1aMPLv ZvHHOb1aYQ+myZGcdRywJ4rZP8NJjde6f4lhWYyu2lRlw5ctMFzgNHXcLJnor4wrBBxS TiKUucQqf6csOd16nMnXzFkaUQ0yoAyBVsyiIUzfcVuuiRrsUAIP0RDPK+4VARrf3eEO TJJA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 j26si8807139edq.225.2021.05.22.23.59.21; Sat, 22 May 2021 23:59:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 S231649AbhEWGsn (ORCPT + 99 others); Sun, 23 May 2021 02:48:43 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:3637 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231650AbhEWGsk (ORCPT ); Sun, 23 May 2021 02:48:40 -0400 Received: from dggems705-chm.china.huawei.com (unknown [172.30.72.58]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4FnrPy0DFszQrCS; Sun, 23 May 2021 14:43:02 +0800 (CST) Received: from dggema769-chm.china.huawei.com (10.1.198.211) by dggems705-chm.china.huawei.com (10.3.19.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Sun, 23 May 2021 14:46:36 +0800 Received: from localhost (10.174.179.215) by dggema769-chm.china.huawei.com (10.1.198.211) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Sun, 23 May 2021 14:46:35 +0800 From: YueHaibing To: , CC: , , YueHaibing Subject: [PATCH -next] mm/dmapool: use DEVICE_ATTR_RO macro Date: Sun, 23 May 2021 14:46:26 +0800 Message-ID: <20210523064626.41532-1-yuehaibing@huawei.com> X-Mailer: git-send-email 2.10.2.windows.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.174.179.215] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggema769-chm.china.huawei.com (10.1.198.211) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use DEVICE_ATTR_RO helper instead of plain DEVICE_ATTR, which makes the code a bit shorter and easier to read. Signed-off-by: YueHaibing --- mm/dmapool.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/dmapool.c b/mm/dmapool.c index 16483f86360e..62083ef04878 100644 --- a/mm/dmapool.c +++ b/mm/dmapool.c @@ -62,8 +62,8 @@ struct dma_page { /* cacheable header for 'allocation' bytes */ static DEFINE_MUTEX(pools_lock); static DEFINE_MUTEX(pools_reg_lock); -static ssize_t -show_pools(struct device *dev, struct device_attribute *attr, char *buf) +static ssize_t pools_show(struct device *dev, + struct device_attribute *attr, char *buf) { unsigned temp; unsigned size; @@ -103,7 +103,7 @@ show_pools(struct device *dev, struct device_attribute *attr, char *buf) return PAGE_SIZE - size; } -static DEVICE_ATTR(pools, 0444, show_pools, NULL); +static DEVICE_ATTR_RO(pools); /** * dma_pool_create - Creates a pool of consistent memory blocks, for dma. -- 2.17.1