[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20220915022629.3118432-1-liushixin2@huawei.com>
Date: Thu, 15 Sep 2022 10:26:29 +0800
From: Liu Shixin <liushixin2@...wei.com>
To: Dave Hansen <dave.hansen@...ux.intel.com>,
Andy Lutomirski <luto@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
<x86@...nel.org>, "H. Peter Anvin" <hpa@...or.com>
CC: <linux-kernel@...r.kernel.org>, Liu Shixin <liushixin2@...wei.com>
Subject: [PATCH] x86/mm/pat: use DEFINE_SHOW_ATTRIBUTE to simplify cpastats
Use DEFINE_SHOW_ATTRIBUTE helper macro to simplify the code.
Signed-off-by: Liu Shixin <liushixin2@...wei.com>
---
arch/x86/mm/pat/set_memory.c | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)
diff --git a/arch/x86/mm/pat/set_memory.c b/arch/x86/mm/pat/set_memory.c
index 1a2d6376251c..b68408ffa8df 100644
--- a/arch/x86/mm/pat/set_memory.c
+++ b/arch/x86/mm/pat/set_memory.c
@@ -176,18 +176,7 @@ static int cpastats_show(struct seq_file *m, void *p)
seq_printf(m, "4K pages set-checked: %16lu\n", cpa_4k_install);
return 0;
}
-
-static int cpastats_open(struct inode *inode, struct file *file)
-{
- return single_open(file, cpastats_show, NULL);
-}
-
-static const struct file_operations cpastats_fops = {
- .open = cpastats_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(cpastats);
static int __init cpa_stats_init(void)
{
--
2.25.1
Powered by blists - more mailing lists