Skip to content

Commit 94ca857

Browse files
Qinglang Miaokrzk
authored andcommitted
memory: emif: Convert to DEFINE_SHOW_ATTRIBUTE
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>
1 parent 67a344e commit 94ca857

1 file changed

Lines changed: 2 additions & 20 deletions

File tree

drivers/memory/emif.c

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -131,16 +131,7 @@ static int emif_regdump_show(struct seq_file *s, void *unused)
131131
return 0;
132132
}
133133

134-
static int emif_regdump_open(struct inode *inode, struct file *file)
135-
{
136-
return single_open(file, emif_regdump_show, inode->i_private);
137-
}
138-
139-
static const struct file_operations emif_regdump_fops = {
140-
.open = emif_regdump_open,
141-
.read = seq_read,
142-
.release = single_release,
143-
};
134+
DEFINE_SHOW_ATTRIBUTE(emif_regdump);
144135

145136
static int emif_mr4_show(struct seq_file *s, void *unused)
146137
{
@@ -150,16 +141,7 @@ static int emif_mr4_show(struct seq_file *s, void *unused)
150141
return 0;
151142
}
152143

153-
static int emif_mr4_open(struct inode *inode, struct file *file)
154-
{
155-
return single_open(file, emif_mr4_show, inode->i_private);
156-
}
157-
158-
static const struct file_operations emif_mr4_fops = {
159-
.open = emif_mr4_open,
160-
.read = seq_read,
161-
.release = single_release,
162-
};
144+
DEFINE_SHOW_ATTRIBUTE(emif_mr4);
163145

164146
static int __init_or_module emif_debugfs_init(struct emif_data *emif)
165147
{

0 commit comments

Comments
 (0)