All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sh: use DEFINE_SHOW_ATTRIBUTE to simplify tlb_debugfs
@ 2022-09-15  2:24 Liu Shixin
  0 siblings, 0 replies; only message in thread
From: Liu Shixin @ 2022-09-15  2:24 UTC (permalink / raw)
  To: Yoshinori Sato, Rich Felker; +Cc: linux-sh, Liu Shixin

Use DEFINE_SHOW_ATTRIBUTE helper macro to simplify the code.

Signed-off-by: Liu Shixin <liushixin2@huawei.com>
---
 arch/sh/mm/tlb-debugfs.c | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/arch/sh/mm/tlb-debugfs.c b/arch/sh/mm/tlb-debugfs.c
index 11c6148283f3..20837ae4bf83 100644
--- a/arch/sh/mm/tlb-debugfs.c
+++ b/arch/sh/mm/tlb-debugfs.c
@@ -36,7 +36,7 @@ static struct {
 	{ 0xc, " 64MB" },
 };
 
-static int tlb_seq_show(struct seq_file *file, void *iter)
+static int tlb_debugfs_show(struct seq_file *file, void *iter)
 {
 	unsigned int tlb_type = (unsigned int)file->private;
 	unsigned long addr1, addr2, data1, data2;
@@ -133,19 +133,7 @@ static int tlb_seq_show(struct seq_file *file, void *iter)
 
 	return 0;
 }
-
-static int tlb_debugfs_open(struct inode *inode, struct file *file)
-{
-	return single_open(file, tlb_seq_show, inode->i_private);
-}
-
-static const struct file_operations tlb_debugfs_fops = {
-	.owner		= THIS_MODULE,
-	.open		= tlb_debugfs_open,
-	.read		= seq_read,
-	.llseek		= seq_lseek,
-	.release	= single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(tlb_debugfs);
 
 static int __init tlb_debugfs_init(void)
 {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-09-15  1:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-15  2:24 [PATCH] sh: use DEFINE_SHOW_ATTRIBUTE to simplify tlb_debugfs Liu Shixin

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.