Skip to contentSkip to conversation

drivers: visorbus: convert to DEFINE_SHOW_ATTRIBUTE

PATCH New Yangtao Li 1 participant 1 message Dec 1, 2018

lore
Share & tools
lore

Yangtao Li

author
#0 lore raw

PATCH 1/1 drivers: visorbus: convert to DEFINE_SHOW_ATTRIBUTE

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

---
 drivers/visorbus/visorbus_main.c | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)
drivers/visorbus/visorbus_main.c +3 -14
index 0b2434cc4ecd..8f742dc9e62c 100644
@@ -436,7 +436,7 @@ static void vbuschannel_print_devinfo(struct visor_vbus_deviceinfo *devinfo,
 		   devinfo->infostrs);
 }
 
-static int bus_info_debugfs_show(struct seq_file *seq, void *v)
+static int bus_info_show(struct seq_file *seq, void *v)
 {
 	int i = 0;
 	unsigned long off;
@@ -471,18 +471,7 @@ static int bus_info_debugfs_show(struct seq_file *seq, void *v)
 	return 0;
 }
 
-static int bus_info_debugfs_open(struct inode *inode, struct file *file)
-{
-	return single_open(file, bus_info_debugfs_show, inode->i_private);
-}
-
-static const struct file_operations bus_info_debugfs_fops = {
-	.owner = THIS_MODULE,
-	.open = bus_info_debugfs_open,
-	.read = seq_read,
-	.llseek = seq_lseek,
-	.release = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(bus_info);
 
 static void dev_periodic_work(struct timer_list *t)
 {
@@ -1022,7 +1011,7 @@ int visorbus_create_instance(struct visor_device *dev)
 					      visorbus_debugfs_dir);
 	dev->debugfs_bus_info = debugfs_create_file("client_bus_info", 0440,
 						    dev->debugfs_dir, dev,
-						    &bus_info_debugfs_fops);
+						    &bus_info_fops);
 	dev_set_drvdata(&dev->device, dev);
 	err = get_vbus_header_info(dev->visorchannel, &dev->device, hdr_info);
 	if (err < 0)
Signature · 1 line
2.17.0