Skip to content

Commit a115363

Browse files
Qinglang MiaoRich Felker
authored andcommitted
sh: mm: Convert to DEFINE_SHOW_ATTRIBUTE
Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code. Signed-off-by: Qinglang Miao <[email protected]> Signed-off-by: Rich Felker <[email protected]>
1 parent 5c5dc5f commit a115363

File tree

3 files changed

+6
-39
lines changed

3 files changed

+6
-39
lines changed

arch/sh/mm/asids-debugfs.c

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include <asm/processor.h>
2727
#include <asm/mmu_context.h>
2828

29-
static int asids_seq_show(struct seq_file *file, void *iter)
29+
static int asids_debugfs_show(struct seq_file *file, void *iter)
3030
{
3131
struct task_struct *p;
3232

@@ -48,18 +48,7 @@ static int asids_seq_show(struct seq_file *file, void *iter)
4848
return 0;
4949
}
5050

51-
static int asids_debugfs_open(struct inode *inode, struct file *file)
52-
{
53-
return single_open(file, asids_seq_show, inode->i_private);
54-
}
55-
56-
static const struct file_operations asids_debugfs_fops = {
57-
.owner = THIS_MODULE,
58-
.open = asids_debugfs_open,
59-
.read = seq_read,
60-
.llseek = seq_lseek,
61-
.release = single_release,
62-
};
51+
DEFINE_SHOW_ATTRIBUTE(asids_debugfs);
6352

6453
static int __init asids_debugfs_init(void)
6554
{

arch/sh/mm/cache-debugfs.c

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ enum cache_type {
2222
CACHE_TYPE_UNIFIED,
2323
};
2424

25-
static int cache_seq_show(struct seq_file *file, void *iter)
25+
static int cache_debugfs_show(struct seq_file *file, void *iter)
2626
{
2727
unsigned int cache_type = (unsigned int)file->private;
2828
struct cache_info *cache;
@@ -94,18 +94,7 @@ static int cache_seq_show(struct seq_file *file, void *iter)
9494
return 0;
9595
}
9696

97-
static int cache_debugfs_open(struct inode *inode, struct file *file)
98-
{
99-
return single_open(file, cache_seq_show, inode->i_private);
100-
}
101-
102-
static const struct file_operations cache_debugfs_fops = {
103-
.owner = THIS_MODULE,
104-
.open = cache_debugfs_open,
105-
.read = seq_read,
106-
.llseek = seq_lseek,
107-
.release = single_release,
108-
};
97+
DEFINE_SHOW_ATTRIBUTE(cache_debugfs);
10998

11099
static int __init cache_debugfs_init(void)
111100
{

arch/sh/mm/pmb.c

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ bool __in_29bit_mode(void)
812812
return (__raw_readl(PMB_PASCR) & PASCR_SE) == 0;
813813
}
814814

815-
static int pmb_seq_show(struct seq_file *file, void *iter)
815+
static int pmb_debugfs_show(struct seq_file *file, void *iter)
816816
{
817817
int i;
818818

@@ -846,18 +846,7 @@ static int pmb_seq_show(struct seq_file *file, void *iter)
846846
return 0;
847847
}
848848

849-
static int pmb_debugfs_open(struct inode *inode, struct file *file)
850-
{
851-
return single_open(file, pmb_seq_show, NULL);
852-
}
853-
854-
static const struct file_operations pmb_debugfs_fops = {
855-
.owner = THIS_MODULE,
856-
.open = pmb_debugfs_open,
857-
.read = seq_read,
858-
.llseek = seq_lseek,
859-
.release = single_release,
860-
};
849+
DEFINE_SHOW_ATTRIBUTE(pmb_debugfs);
861850

862851
static int __init pmb_debugfs_init(void)
863852
{

0 commit comments

Comments
 (0)