usb: host: isp1362-hcd: convert to DEFINE_SHOW_ATTRIBUTE
authorYangtao Li <tiny.windzz@gmail.com>
Wed, 5 Dec 2018 16:33:39 +0000 (11:33 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 12 Dec 2018 11:38:41 +0000 (12:38 +0100)
Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/isp1362-hcd.c

index b21c386e6a4685d518dc7f94e920025a94cc0709..28bf8bfb091e6bcd531982033d9f95e4e8641513 100644 (file)
@@ -2159,25 +2159,15 @@ static int isp1362_show(struct seq_file *s, void *unused)
 
        return 0;
 }
-
-static int isp1362_open(struct inode *inode, struct file *file)
-{
-       return single_open(file, isp1362_show, inode);
-}
-
-static const struct file_operations debug_ops = {
-       .open = isp1362_open,
-       .read = seq_read,
-       .llseek = seq_lseek,
-       .release = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(isp1362);
 
 /* expect just one isp1362_hcd per system */
 static void create_debug_file(struct isp1362_hcd *isp1362_hcd)
 {
        isp1362_hcd->debug_file = debugfs_create_file("isp1362", S_IRUGO,
                                                      usb_debug_root,
-                                                     isp1362_hcd, &debug_ops);
+                                                     isp1362_hcd,
+                                                     &isp1362_fops);
 }
 
 static void remove_debug_file(struct isp1362_hcd *isp1362_hcd)