From patchwork Tue Jun 29 02:40:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12349135 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE9B0C11F66 for ; Tue, 29 Jun 2021 02:40:07 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BEAC561D0C for ; Tue, 29 Jun 2021 02:40:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BEAC561D0C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1DD688D00F7; Mon, 28 Jun 2021 22:40:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 18DD18D00F0; Mon, 28 Jun 2021 22:40:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 056188D00F7; Mon, 28 Jun 2021 22:40:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0090.hostedemail.com [216.40.44.90]) by kanga.kvack.org (Postfix) with ESMTP id D56ED8D00F0 for ; Mon, 28 Jun 2021 22:40:06 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id C5AA38249980 for ; Tue, 29 Jun 2021 02:40:06 +0000 (UTC) X-FDA: 78305206812.09.DBB1447 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf30.hostedemail.com (Postfix) with ESMTP id 7DA52E000262 for ; Tue, 29 Jun 2021 02:40:06 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 991D461D11; Tue, 29 Jun 2021 02:40:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1624934405; bh=Kh+RozrDEmeS7HoyIOlvKb1BSpKQzI5rtJriSqiyOxM=; h=Date:From:To:Subject:In-Reply-To:From; b=pAbdFiX4CHaRwvXjppXwCMNJL/fSttYoYy81oOuScnkeZXaJ4ILvpB6luQ7a/zGPy W6v/6m3ds8NCBbEDcnOwjSp280oBactsO5YtklS/uSYLY1xDs6UsdhQ1BDUsWh9nkI uhTOf7vnXUOt8NvUVwb89Tq8GaslK+aVQmUTl03E= Date: Mon, 28 Jun 2021 19:40:05 -0700 From: Andrew Morton To: akpm@linux-foundation.org, andriy.shevchenko@linux.intel.com, linux-mm@kvack.org, mm-commits@vger.kernel.org, torvalds@linux-foundation.org, yuehaibing@huawei.com Subject: [patch 130/192] mm/dmapool: use DEVICE_ATTR_RO macro Message-ID: <20210629024005.M33PNIbP9%akpm@linux-foundation.org> In-Reply-To: <20210628193256.008961950a714730751c1423@linux-foundation.org> User-Agent: s-nail v14.8.16 Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=pAbdFiX4; dmarc=none; spf=pass (imf30.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-Rspamd-Server: rspam02 X-Stat-Signature: i9t8m7jdyu65qey64q8965umbn8riiop X-Rspamd-Queue-Id: 7DA52E000262 X-HE-Tag: 1624934406-358107 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: YueHaibing Subject: mm/dmapool: use DEVICE_ATTR_RO macro Use DEVICE_ATTR_RO() helper instead of plain DEVICE_ATTR(), which makes the code a bit shorter and easier to read. Link: https://lkml.kernel.org/r/20210524112852.34716-1-yuehaibing@huawei.com Signed-off-by: YueHaibing Reviewed-by: Andy Shevchenko Signed-off-by: Andrew Morton --- mm/dmapool.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- a/mm/dmapool.c~mm-dmapool-use-device_attr_ro-macro +++ a/mm/dmapool.c @@ -62,8 +62,7 @@ struct dma_page { /* cacheable header f 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 +102,7 @@ show_pools(struct device *dev, struct de 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.