mtd: use DEFINE_SHOW_ATTRIBUTE() instead of open-coding it
DEFINE_SHOW_ATTRIBUTE macro can help us simplify the code, so change to it. And change the DEBUGFS_RO_ATTR macro defined in some file to a standard macro. Signed-off-by: Yangtao Li <tiny.windzz@gmail.com> Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
This commit is contained in:

committed by
Boris Brezillon

parent
bafae53817
commit
c78f59d714
@@ -1265,18 +1265,7 @@ static int mtdswap_show(struct seq_file *s, void *data)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mtdswap_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, mtdswap_show, inode->i_private);
|
||||
}
|
||||
|
||||
static const struct file_operations mtdswap_fops = {
|
||||
.open = mtdswap_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
DEFINE_SHOW_ATTRIBUTE(mtdswap);
|
||||
|
||||
static int mtdswap_add_debugfs(struct mtdswap_dev *d)
|
||||
{
|
||||
|
Reference in New Issue
Block a user