USB: musb: Re-use DEFINE_SHOW_ATTRIBUTE() macro
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Wed, 14 Feb 2018 16:08:19 +0000 (18:08 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 9 Mar 2018 17:27:55 +0000 (09:27 -0800)
...instead of open coding file operations followed by custom ->open()
callbacks per each attribute.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/musb/musb_debugfs.c

index 7cf5a1bbdaff9323971879252d225975072e7ac4..025b2c8630df28cfdd9b0894a1fff2f7a663fdc0 100644 (file)
@@ -112,11 +112,7 @@ static int musb_regdump_show(struct seq_file *s, void *unused)
        pm_runtime_put_autosuspend(musb->controller);
        return 0;
 }
-
-static int musb_regdump_open(struct inode *inode, struct file *file)
-{
-       return single_open(file, musb_regdump_show, inode->i_private);
-}
+DEFINE_SHOW_ATTRIBUTE(musb_regdump);
 
 static int musb_test_mode_show(struct seq_file *s, void *unused)
 {
@@ -161,13 +157,6 @@ static int musb_test_mode_show(struct seq_file *s, void *unused)
        return 0;
 }
 
-static const struct file_operations musb_regdump_fops = {
-       .open                   = musb_regdump_open,
-       .read                   = seq_read,
-       .llseek                 = seq_lseek,
-       .release                = single_release,
-};
-
 static int musb_test_mode_open(struct inode *inode, struct file *file)
 {
        return single_open(file, musb_test_mode_show, inode->i_private);