Skip to content

Commit 5061e3f

Browse files
TinyWindzzdavem330
authored andcommitted
net: xenbus: convert to DEFINE_SHOW_ATTRIBUTE
Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code. Signed-off-by: Yangtao Li <[email protected]> Acked-by: Wei Liu <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent f578e67 commit 5061e3f

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

drivers/net/xen-netback/xenbus.c

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -186,27 +186,15 @@ static const struct file_operations xenvif_dbg_io_ring_ops_fops = {
186186
.write = xenvif_write_io_ring,
187187
};
188188

189-
static int xenvif_read_ctrl(struct seq_file *m, void *v)
189+
static int xenvif_ctrl_show(struct seq_file *m, void *v)
190190
{
191191
struct xenvif *vif = m->private;
192192

193193
xenvif_dump_hash_info(vif, m);
194194

195195
return 0;
196196
}
197-
198-
static int xenvif_ctrl_open(struct inode *inode, struct file *filp)
199-
{
200-
return single_open(filp, xenvif_read_ctrl, inode->i_private);
201-
}
202-
203-
static const struct file_operations xenvif_dbg_ctrl_ops_fops = {
204-
.owner = THIS_MODULE,
205-
.open = xenvif_ctrl_open,
206-
.read = seq_read,
207-
.llseek = seq_lseek,
208-
.release = single_release,
209-
};
197+
DEFINE_SHOW_ATTRIBUTE(xenvif_ctrl);
210198

211199
static void xenvif_debugfs_addif(struct xenvif *vif)
212200
{
@@ -238,7 +226,7 @@ static void xenvif_debugfs_addif(struct xenvif *vif)
238226
0400,
239227
vif->xenvif_dbg_root,
240228
vif,
241-
&xenvif_dbg_ctrl_ops_fops);
229+
&xenvif_ctrl_fops);
242230
if (IS_ERR_OR_NULL(pfile))
243231
pr_warn("Creation of ctrl file returned %ld!\n",
244232
PTR_ERR(pfile));

0 commit comments

Comments
 (0)