Skip to content

Commit ddfa728

Browse files
TinyWindzzgregkh
authored andcommitted
char: virtio: Change to use DEFINE_SHOW_ATTRIBUTE macro
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>
1 parent c13e0a5 commit ddfa728

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

drivers/char/virtio_console.c

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,7 +1309,7 @@ static const struct attribute_group port_attribute_group = {
13091309
.attrs = port_sysfs_entries,
13101310
};
13111311

1312-
static int debugfs_show(struct seq_file *s, void *data)
1312+
static int port_debugfs_show(struct seq_file *s, void *data)
13131313
{
13141314
struct port *port = s->private;
13151315

@@ -1327,18 +1327,7 @@ static int debugfs_show(struct seq_file *s, void *data)
13271327
return 0;
13281328
}
13291329

1330-
static int debugfs_open(struct inode *inode, struct file *file)
1331-
{
1332-
return single_open(file, debugfs_show, inode->i_private);
1333-
}
1334-
1335-
static const struct file_operations port_debugfs_ops = {
1336-
.owner = THIS_MODULE,
1337-
.open = debugfs_open,
1338-
.read = seq_read,
1339-
.llseek = seq_lseek,
1340-
.release = single_release,
1341-
};
1330+
DEFINE_SHOW_ATTRIBUTE(port_debugfs);
13421331

13431332
static void set_console_size(struct port *port, u16 rows, u16 cols)
13441333
{
@@ -1490,7 +1479,7 @@ static int add_port(struct ports_device *portdev, u32 id)
14901479
port->debugfs_file = debugfs_create_file(debugfs_name, 0444,
14911480
pdrvdata.debugfs_dir,
14921481
port,
1493-
&port_debugfs_ops);
1482+
&port_debugfs_fops);
14941483
}
14951484
return 0;
14961485

0 commit comments

Comments
 (0)