Skip to contentSkip to conversation

x86/mm/pat: use DEFINE_SHOW_ATTRIBUTE to simplify cpastats

PATCH New Liu Shixin 1 participant 1 message Sep 15, 2022

Subsystems (2)
lore
Share & tools
lore

Liu Shixin

author
#0 lore raw

PATCH 1/1 x86/mm/pat: use DEFINE_SHOW_ATTRIBUTE to simplify cpastats

Use DEFINE_SHOW_ATTRIBUTE helper macro to simplify the code.

---
 arch/x86/mm/pat/set_memory.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
arch/x86/mm/pat/set_memory.c +1 -12
index 1a2d6376251c..b68408ffa8df 100644
@@ -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)
 {
Signature · 1 line
2.25.1