mips: ralink: convert to DEFINE_SHOW_ATTRIBUTE
authorLiu Shixin <liushixin2@huawei.com>
Tue, 13 Sep 2022 10:10:38 +0000 (18:10 +0800)
committerThomas Bogendoerfer <tsbogend@alpha.franken.de>
Mon, 19 Sep 2022 14:40:39 +0000 (16:40 +0200)
Use DEFINE_SHOW_ATTRIBUTE helper macro to simplify the code.

Signed-off-by: Liu Shixin <liushixin2@huawei.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
arch/mips/ralink/bootrom.c

index 94ca837..8c8cc0a 100644 (file)
@@ -18,22 +18,11 @@ static int bootrom_show(struct seq_file *s, void *unused)
 
        return 0;
 }
-
-static int bootrom_open(struct inode *inode, struct file *file)
-{
-       return single_open(file, bootrom_show, NULL);
-}
-
-static const struct file_operations bootrom_file_ops = {
-       .open           = bootrom_open,
-       .read           = seq_read,
-       .llseek         = seq_lseek,
-       .release        = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(bootrom);
 
 static int __init bootrom_setup(void)
 {
-       debugfs_create_file("bootrom", 0444, NULL, NULL, &bootrom_file_ops);
+       debugfs_create_file("bootrom", 0444, NULL, NULL, &bootrom_fops);
        return 0;
 }