Skip to content

Commit

Permalink
memory: emif: Convert to DEFINE_SHOW_ATTRIBUTE
Browse files Browse the repository at this point in the history
Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Along with this change, we get additionally:
        .owner          = THIS_MODULE,
        .llseek         = seq_lseek,

1. The llseek method is used to change the current read/write position
in a file which can be ignored if you don't use it.
2. The owner is not even a method. Instead, it is a pointer to the
module that “owns” this structure; it is used by the kernel to maintain
the module's usage count which can be ignored.

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Link: https://lore.kernel.org/r/20200917125113.103550-1-miaoqinglang@huawei.com
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
  • Loading branch information
Qinglang Miao authored and krzk committed Sep 20, 2020
1 parent 67a344e commit 94ca857
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions drivers/memory/emif.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,7 @@ static int emif_regdump_show(struct seq_file *s, void *unused)
return 0;
}

static int emif_regdump_open(struct inode *inode, struct file *file)
{
return single_open(file, emif_regdump_show, inode->i_private);
}

static const struct file_operations emif_regdump_fops = {
.open = emif_regdump_open,
.read = seq_read,
.release = single_release,
};
DEFINE_SHOW_ATTRIBUTE(emif_regdump);

static int emif_mr4_show(struct seq_file *s, void *unused)
{
Expand All @@ -150,16 +141,7 @@ static int emif_mr4_show(struct seq_file *s, void *unused)
return 0;
}

static int emif_mr4_open(struct inode *inode, struct file *file)
{
return single_open(file, emif_mr4_show, inode->i_private);
}

static const struct file_operations emif_mr4_fops = {
.open = emif_mr4_open,
.read = seq_read,
.release = single_release,
};
DEFINE_SHOW_ATTRIBUTE(emif_mr4);

static int __init_or_module emif_debugfs_init(struct emif_data *emif)
{
Expand Down

0 comments on commit 94ca857

Please sign in to comment.