* [PATCH -next] mm/dmapool: use DEVICE_ATTR_RO macro
@ 2021-05-23 6:46 YueHaibing
2021-05-24 10:45 ` Andy Shevchenko
0 siblings, 1 reply; 3+ messages in thread
From: YueHaibing @ 2021-05-23 6:46 UTC (permalink / raw)
To: akpm, andriy.shevchenko; +Cc: linux-mm, linux-kernel, YueHaibing
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH -next] mm/dmapool: use DEVICE_ATTR_RO macro
2021-05-23 6:46 [PATCH -next] mm/dmapool: use DEVICE_ATTR_RO macro YueHaibing
@ 2021-05-24 10:45 ` Andy Shevchenko
2021-05-24 11:25 ` YueHaibing
0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2021-05-24 10:45 UTC (permalink / raw)
To: YueHaibing; +Cc: akpm, linux-mm, linux-kernel
On Sun, May 23, 2021 at 02:46:26PM +0800, YueHaibing wrote:
> Use DEVICE_ATTR_RO helper instead of plain DEVICE_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 <andriy.shevchenko@linux.intel.com>
> 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;
Unrelated change.
> @@ -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
>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH -next] mm/dmapool: use DEVICE_ATTR_RO macro
2021-05-24 10:45 ` Andy Shevchenko
@ 2021-05-24 11:25 ` YueHaibing
0 siblings, 0 replies; 3+ messages in thread
From: YueHaibing @ 2021-05-24 11:25 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: akpm, linux-mm, linux-kernel
On 2021/5/24 18:45, Andy Shevchenko wrote:
> On Sun, May 23, 2021 at 02:46:26PM +0800, YueHaibing wrote:
>> Use DEVICE_ATTR_RO helper instead of plain DEVICE_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 <andriy.shevchenko@linux.intel.com>
Ok, will send v2.
>
>> 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;
>
> Unrelated change.
There change show_pools() to pools_show()
>
>> @@ -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
>>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-05-24 11:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-23 6:46 [PATCH -next] mm/dmapool: use DEVICE_ATTR_RO macro YueHaibing
2021-05-24 10:45 ` Andy Shevchenko
2021-05-24 11:25 ` YueHaibing
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.