Commit 37139bb0 authored by Miaohe Lin's avatar Miaohe Lin Committed by akpm

mm/huge_memory: use helper macro __ATTR_RW

Use helper macro __ATTR_RW to define use_zero_page_attr, defrag_attr and
enabled_attr to make code more clear. Minor readability improvement.

Link: https://lkml.kernel.org/r/20220704132201.14611-9-linmiaohe@huawei.comSigned-off-by: default avatarMiaohe Lin <linmiaohe@huawei.com>
Reviewed-by: default avatarMuchun Song <songmuchun@bytedance.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Yang Shi <shy828301@gmail.com>
Cc: Zach O'Keefe <zokeefe@google.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 74ba2b38
...@@ -276,8 +276,8 @@ static ssize_t enabled_store(struct kobject *kobj, ...@@ -276,8 +276,8 @@ static ssize_t enabled_store(struct kobject *kobj,
} }
return ret; return ret;
} }
static struct kobj_attribute enabled_attr =
__ATTR(enabled, 0644, enabled_show, enabled_store); static struct kobj_attribute enabled_attr = __ATTR_RW(enabled);
ssize_t single_hugepage_flag_show(struct kobject *kobj, ssize_t single_hugepage_flag_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf, struct kobj_attribute *attr, char *buf,
...@@ -366,8 +366,7 @@ static ssize_t defrag_store(struct kobject *kobj, ...@@ -366,8 +366,7 @@ static ssize_t defrag_store(struct kobject *kobj,
return count; return count;
} }
static struct kobj_attribute defrag_attr = static struct kobj_attribute defrag_attr = __ATTR_RW(defrag);
__ATTR(defrag, 0644, defrag_show, defrag_store);
static ssize_t use_zero_page_show(struct kobject *kobj, static ssize_t use_zero_page_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf) struct kobj_attribute *attr, char *buf)
...@@ -381,8 +380,7 @@ static ssize_t use_zero_page_store(struct kobject *kobj, ...@@ -381,8 +380,7 @@ static ssize_t use_zero_page_store(struct kobject *kobj,
return single_hugepage_flag_store(kobj, attr, buf, count, return single_hugepage_flag_store(kobj, attr, buf, count,
TRANSPARENT_HUGEPAGE_USE_ZERO_PAGE_FLAG); TRANSPARENT_HUGEPAGE_USE_ZERO_PAGE_FLAG);
} }
static struct kobj_attribute use_zero_page_attr = static struct kobj_attribute use_zero_page_attr = __ATTR_RW(use_zero_page);
__ATTR(use_zero_page, 0644, use_zero_page_show, use_zero_page_store);
static ssize_t hpage_pmd_size_show(struct kobject *kobj, static ssize_t hpage_pmd_size_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf) struct kobj_attribute *attr, char *buf)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment