MIPS: r2-on-r6-emu: Change to use DEFINE_SHOW_ATTRIBUTE macro

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
Signed-off-by: Paul Burton <paul.burton@mips.com>
Patchwork: https://patchwork.linux-mips.org/patch/20991/
Cc: ralf@linux-mips.org
Cc: jhogan@kernel.org
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
This commit is contained in:
Yangtao Li 2018-11-06 09:36:36 -05:00 committed by Paul Burton
parent b3a428b4b1
commit 43da4e3ee8
No known key found for this signature in database
GPG Key ID: 3EA79FACB57500DD
1 changed files with 5 additions and 27 deletions

View File

@ -2242,7 +2242,7 @@ fpu_emul:
#ifdef CONFIG_DEBUG_FS
static int mipsr2_stats_show(struct seq_file *s, void *unused)
static int mipsr2_emul_show(struct seq_file *s, void *unused)
{
seq_printf(s, "Instruction\tTotal\tBDslot\n------------------------------\n");
@ -2308,9 +2308,9 @@ static int mipsr2_stats_show(struct seq_file *s, void *unused)
return 0;
}
static int mipsr2_stats_clear_show(struct seq_file *s, void *unused)
static int mipsr2_clear_show(struct seq_file *s, void *unused)
{
mipsr2_stats_show(s, unused);
mipsr2_emul_show(s, unused);
__this_cpu_write((mipsr2emustats).movs, 0);
__this_cpu_write((mipsr2bdemustats).movs, 0);
@ -2353,30 +2353,8 @@ static int mipsr2_stats_clear_show(struct seq_file *s, void *unused)
return 0;
}
static int mipsr2_stats_open(struct inode *inode, struct file *file)
{
return single_open(file, mipsr2_stats_show, inode->i_private);
}
static int mipsr2_stats_clear_open(struct inode *inode, struct file *file)
{
return single_open(file, mipsr2_stats_clear_show, inode->i_private);
}
static const struct file_operations mipsr2_emul_fops = {
.open = mipsr2_stats_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static const struct file_operations mipsr2_clear_fops = {
.open = mipsr2_stats_clear_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
DEFINE_SHOW_ATTRIBUTE(mipsr2_emul);
DEFINE_SHOW_ATTRIBUTE(mipsr2_clear);
static int __init mipsr2_init_debugfs(void)
{