Commit ddfa728a authored by Yangtao Li's avatar Yangtao Li Committed by Greg Kroah-Hartman

char: virtio: Change to use DEFINE_SHOW_ATTRIBUTE macro

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
Signed-off-by: default avatarYangtao Li <tiny.windzz@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c13e0a52
...@@ -1309,7 +1309,7 @@ static const struct attribute_group port_attribute_group = { ...@@ -1309,7 +1309,7 @@ static const struct attribute_group port_attribute_group = {
.attrs = port_sysfs_entries, .attrs = port_sysfs_entries,
}; };
static int debugfs_show(struct seq_file *s, void *data) static int port_debugfs_show(struct seq_file *s, void *data)
{ {
struct port *port = s->private; struct port *port = s->private;
...@@ -1327,18 +1327,7 @@ static int debugfs_show(struct seq_file *s, void *data) ...@@ -1327,18 +1327,7 @@ static int debugfs_show(struct seq_file *s, void *data)
return 0; return 0;
} }
static int debugfs_open(struct inode *inode, struct file *file) DEFINE_SHOW_ATTRIBUTE(port_debugfs);
{
return single_open(file, debugfs_show, inode->i_private);
}
static const struct file_operations port_debugfs_ops = {
.owner = THIS_MODULE,
.open = debugfs_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static void set_console_size(struct port *port, u16 rows, u16 cols) static void set_console_size(struct port *port, u16 rows, u16 cols)
{ {
...@@ -1490,7 +1479,7 @@ static int add_port(struct ports_device *portdev, u32 id) ...@@ -1490,7 +1479,7 @@ static int add_port(struct ports_device *portdev, u32 id)
port->debugfs_file = debugfs_create_file(debugfs_name, 0444, port->debugfs_file = debugfs_create_file(debugfs_name, 0444,
pdrvdata.debugfs_dir, pdrvdata.debugfs_dir,
port, port,
&port_debugfs_ops); &port_debugfs_fops);
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment