Commit 11f27a7f authored by Christophe Leroy's avatar Christophe Leroy Committed by Michael Ellerman

powerpc/ptdump: Use DEFINE_SHOW_ATTRIBUTE()

Use DEFINE_SHOW_ATTRIBUTE() instead of open coding
open() and fops.
Signed-off-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/b864a92693ca8413ef0b19f0c12065c212899b6e.1625762905.git.christophe.leroy@csgroup.eu
parent 33e14024
......@@ -57,7 +57,7 @@ static void bat_show_603(struct seq_file *m, int idx, u32 lower, u32 upper, bool
#define BAT_SHOW_603(_m, _n, _l, _u, _d) bat_show_603(_m, _n, mfspr(_l), mfspr(_u), _d)
static int bats_show_603(struct seq_file *m, void *v)
static int bats_show(struct seq_file *m, void *v)
{
seq_puts(m, "---[ Instruction Block Address Translation ]---\n");
......@@ -88,17 +88,7 @@ static int bats_show_603(struct seq_file *m, void *v)
return 0;
}
static int bats_open(struct inode *inode, struct file *file)
{
return single_open(file, bats_show_603, NULL);
}
static const struct file_operations bats_fops = {
.open = bats_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
DEFINE_SHOW_ATTRIBUTE(bats);
static int __init bats_init(void)
{
......
......@@ -526,17 +526,7 @@ static int ptdump_show(struct seq_file *m, void *v)
return 0;
}
static int ptdump_open(struct inode *inode, struct file *file)
{
return single_open(file, ptdump_show, NULL);
}
static const struct file_operations ptdump_fops = {
.open = ptdump_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
DEFINE_SHOW_ATTRIBUTE(ptdump);
static int ptdump_init(void)
{
......
......@@ -397,18 +397,7 @@ static int ptdump_show(struct seq_file *m, void *v)
return 0;
}
static int ptdump_open(struct inode *inode, struct file *file)
{
return single_open(file, ptdump_show, NULL);
}
static const struct file_operations ptdump_fops = {
.open = ptdump_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
DEFINE_SHOW_ATTRIBUTE(ptdump);
static void build_pgtable_complete_mask(void)
{
......
......@@ -41,17 +41,7 @@ static int sr_show(struct seq_file *m, void *v)
return 0;
}
static int sr_open(struct inode *inode, struct file *file)
{
return single_open(file, sr_show, NULL);
}
static const struct file_operations sr_fops = {
.open = sr_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
DEFINE_SHOW_ATTRIBUTE(sr);
static int __init sr_init(void)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment