lkml.org 
[lkml]   [2021]   [May]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH -next] mm/dmapool: use DEVICE_ATTR_RO macro
Date
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 <yuehaibing@huawei.com>
---
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
\
 
 \ /
  Last update: 2021-05-23 08:48    [W:0.061 / U:1.356 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site