Commit 6f6c74fa authored by Yangtao Li's avatar Yangtao Li Committed by David S. Miller

nfp: convert to DEFINE_SHOW_ATTRIBUTE

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
Signed-off-by: default avatarYangtao Li <tiny.windzz@gmail.com>
Acked-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 76eb6ea4
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
static struct dentry *nfp_dir; static struct dentry *nfp_dir;
static int nfp_net_debugfs_rx_q_read(struct seq_file *file, void *data) static int nfp_rx_q_show(struct seq_file *file, void *data)
{ {
struct nfp_net_r_vector *r_vec = file->private; struct nfp_net_r_vector *r_vec = file->private;
struct nfp_net_rx_ring *rx_ring; struct nfp_net_rx_ring *rx_ring;
...@@ -65,31 +65,12 @@ static int nfp_net_debugfs_rx_q_read(struct seq_file *file, void *data) ...@@ -65,31 +65,12 @@ static int nfp_net_debugfs_rx_q_read(struct seq_file *file, void *data)
rtnl_unlock(); rtnl_unlock();
return 0; return 0;
} }
DEFINE_SHOW_ATTRIBUTE(nfp_rx_q);
static int nfp_net_debugfs_rx_q_open(struct inode *inode, struct file *f) static int nfp_tx_q_show(struct seq_file *file, void *data);
{ DEFINE_SHOW_ATTRIBUTE(nfp_tx_q);
return single_open(f, nfp_net_debugfs_rx_q_read, inode->i_private);
}
static const struct file_operations nfp_rx_q_fops = { static int nfp_tx_q_show(struct seq_file *file, void *data)
.owner = THIS_MODULE,
.open = nfp_net_debugfs_rx_q_open,
.release = single_release,
.read = seq_read,
.llseek = seq_lseek
};
static int nfp_net_debugfs_tx_q_open(struct inode *inode, struct file *f);
static const struct file_operations nfp_tx_q_fops = {
.owner = THIS_MODULE,
.open = nfp_net_debugfs_tx_q_open,
.release = single_release,
.read = seq_read,
.llseek = seq_lseek
};
static int nfp_net_debugfs_tx_q_read(struct seq_file *file, void *data)
{ {
struct nfp_net_r_vector *r_vec = file->private; struct nfp_net_r_vector *r_vec = file->private;
struct nfp_net_tx_ring *tx_ring; struct nfp_net_tx_ring *tx_ring;
...@@ -158,18 +139,11 @@ static int nfp_net_debugfs_tx_q_read(struct seq_file *file, void *data) ...@@ -158,18 +139,11 @@ static int nfp_net_debugfs_tx_q_read(struct seq_file *file, void *data)
return 0; return 0;
} }
static int nfp_net_debugfs_tx_q_open(struct inode *inode, struct file *f) static int nfp_xdp_q_show(struct seq_file *file, void *data)
{ {
return single_open(f, nfp_net_debugfs_tx_q_read, inode->i_private); return nfp_tx_q_show(file, data);
} }
DEFINE_SHOW_ATTRIBUTE(nfp_xdp_q);
static const struct file_operations nfp_xdp_q_fops = {
.owner = THIS_MODULE,
.open = nfp_net_debugfs_tx_q_open,
.release = single_release,
.read = seq_read,
.llseek = seq_lseek
};
void nfp_net_debugfs_vnic_add(struct nfp_net *nn, struct dentry *ddir) void nfp_net_debugfs_vnic_add(struct nfp_net *nn, struct dentry *ddir)
{ {
......
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