2022-09-15 01:58:05

by Liu Shixin

[permalink] [raw]
Subject: [PATCH] x86/mm/pat: use DEFINE_SEQ_ATTRIBUTE to simplify memtype

Use DEFINE_SEQ_ATTRIBUTE helper macro to simplify the code.

Signed-off-by: Liu Shixin <[email protected]>
---
arch/x86/mm/pat/memtype.c | 15 ++-------------
1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/arch/x86/mm/pat/memtype.c b/arch/x86/mm/pat/memtype.c
index 66a209f7eb86..3cf4ec3701f6 100644
--- a/arch/x86/mm/pat/memtype.c
+++ b/arch/x86/mm/pat/memtype.c
@@ -1201,24 +1201,13 @@ static int memtype_seq_show(struct seq_file *seq, void *v)
return 0;
}

-static const struct seq_operations memtype_seq_ops = {
+static const struct seq_operations memtype_sops = {
.start = memtype_seq_start,
.next = memtype_seq_next,
.stop = memtype_seq_stop,
.show = memtype_seq_show,
};
-
-static int memtype_seq_open(struct inode *inode, struct file *file)
-{
- return seq_open(file, &memtype_seq_ops);
-}
-
-static const struct file_operations memtype_fops = {
- .open = memtype_seq_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = seq_release,
-};
+DEFINE_SEQ_ATTRIBUTE(memtype);

static int __init pat_memtype_list_init(void)
{
--
2.25.1