mm/dmapool: use DEVICE_ATTR_RO macro
Subsystems (2)
PATCH 1/1 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.
--- mm/dmapool.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
mm/dmapool.c +3 -3
@@ -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.
Signature · 1 line
2.17.1
Quoted 2 lines · YueHaibing
Use
DEVICE_ATTR_ROhelper instead of plainDEVICE_ATTR, which makes the code a bit shorter and easier to read.
DEVICE_ATTR_RO()DEVICE_ATTR()
After addressing above and below,
Quoted 10 lines
Signed-off-by YueHaibing <[email protected]>--- mm/dmapool.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)mm/dmapool.c +0
-0
mm/dmapool.c struct dma_page { /* cacheable header for 'allocation' bytes */ · line 69
Quoted 10 lines
mm/dmapool.c +2
-2@@ -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;
Unrelated change.
Quoted 12 lines
mm/dmapool.c +1
-1@@ -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. Signature · 1 line
2.17.1
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 9 lines · Andy Shevchenko
Quoted 2 lines · YueHaibing
Use
DEVICE_ATTR_ROhelper instead of plainDEVICE_ATTR, which makes the code a bit shorter and easier to read.
DEVICE_ATTR_RO()DEVICE_ATTR()After addressing above and below,
Reviewed-by Andy Shevchenko <[email protected]>
Ok, will send v2.
Quoted 14 lines
Quoted 14 lines
Signed-off-by YueHaibing <[email protected]>--- mm/dmapool.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)mm/dmapool.c +0
-0@@ -62,8 +62,8 @@ struct dma_page { /* cacheable header for 'allocation' bytes */static DEFINE_MUTEX (pools_lock);static DEFINE_MUTEX (pools_reg_lock);
Quoted 9 lines
mm/dmapool.c struct dma_page { /* cacheable header for 'allocation' bytes */ · line 69
Quoted 7 lines
mm/dmapool.c +2
-2-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;Unrelated change.
There change show_pools() to pools_show()
Quoted 14 lines
Quoted 13 lines
mm/dmapool.c +1
-1@@ -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. Signature · 1 line
2.17.1