* [PATCH] sh: mm: Change to use DEFINE_SHOW_ATTRIBUTE macro
@ 2018-11-06 14:40 Yangtao Li
2018-12-15 8:32 ` Frank Lee
0 siblings, 1 reply; 2+ messages in thread
From: Yangtao Li @ 2018-11-06 14:40 UTC (permalink / raw)
To: ysato, dalias; +Cc: linux-sh, linux-kernel, Yangtao Li
Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
---
arch/sh/mm/asids-debugfs.c | 15 ++-------------
arch/sh/mm/cache-debugfs.c | 15 ++-------------
arch/sh/mm/tlb-debugfs.c | 15 ++-------------
3 files changed, 6 insertions(+), 39 deletions(-)
diff --git a/arch/sh/mm/asids-debugfs.c b/arch/sh/mm/asids-debugfs.c
index e5539e0f8e3b..a3cfa04543e4 100644
--- a/arch/sh/mm/asids-debugfs.c
+++ b/arch/sh/mm/asids-debugfs.c
@@ -26,7 +26,7 @@
#include <asm/processor.h>
#include <asm/mmu_context.h>
-static int asids_seq_show(struct seq_file *file, void *iter)
+static int asids_debugfs_show(struct seq_file *file, void *iter)
{
struct task_struct *p;
@@ -48,18 +48,7 @@ static int asids_seq_show(struct seq_file *file, void *iter)
return 0;
}
-static int asids_debugfs_open(struct inode *inode, struct file *file)
-{
- return single_open(file, asids_seq_show, inode->i_private);
-}
-
-static const struct file_operations asids_debugfs_fops = {
- .owner = THIS_MODULE,
- .open = asids_debugfs_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(asids_debugfs);
static int __init asids_debugfs_init(void)
{
diff --git a/arch/sh/mm/cache-debugfs.c b/arch/sh/mm/cache-debugfs.c
index 4eb9d43578b4..08420371af97 100644
--- a/arch/sh/mm/cache-debugfs.c
+++ b/arch/sh/mm/cache-debugfs.c
@@ -22,7 +22,7 @@ enum cache_type {
CACHE_TYPE_UNIFIED,
};
-static int cache_seq_show(struct seq_file *file, void *iter)
+static int cache_debugfs_show(struct seq_file *file, void *iter)
{
unsigned int cache_type = (unsigned int)file->private;
struct cache_info *cache;
@@ -94,18 +94,7 @@ static int cache_seq_show(struct seq_file *file, void *iter)
return 0;
}
-static int cache_debugfs_open(struct inode *inode, struct file *file)
-{
- return single_open(file, cache_seq_show, inode->i_private);
-}
-
-static const struct file_operations cache_debugfs_fops = {
- .owner = THIS_MODULE,
- .open = cache_debugfs_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(cache_debugfs);
static int __init cache_debugfs_init(void)
{
diff --git a/arch/sh/mm/tlb-debugfs.c b/arch/sh/mm/tlb-debugfs.c
index dea637a09246..74c252ed35fc 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;
@@ -134,18 +134,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.17.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] sh: mm: Change to use DEFINE_SHOW_ATTRIBUTE macro
2018-11-06 14:40 [PATCH] sh: mm: Change to use DEFINE_SHOW_ATTRIBUTE macro Yangtao Li
@ 2018-12-15 8:32 ` Frank Lee
0 siblings, 0 replies; 2+ messages in thread
From: Frank Lee @ 2018-12-15 8:32 UTC (permalink / raw)
To: Yoshinori Sato, dalias; +Cc: linux-sh, linux-kernel
ping......
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-12-15 8:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-06 14:40 [PATCH] sh: mm: Change to use DEFINE_SHOW_ATTRIBUTE macro Yangtao Li
2018-12-15 8:32 ` Frank Lee
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).