Commit 77646b63 authored by Qinglang Miao's avatar Qinglang Miao Committed by David S. Miller

dpaa2-eth: Convert to DEFINE_SHOW_ATTRIBUTE

Signed-off-by: default avatarQinglang Miao <miaoqinglang@huawei.com>
Reviewed-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2170ff08
...@@ -42,24 +42,7 @@ static int dpaa2_dbg_cpu_show(struct seq_file *file, void *offset) ...@@ -42,24 +42,7 @@ static int dpaa2_dbg_cpu_show(struct seq_file *file, void *offset)
return 0; return 0;
} }
static int dpaa2_dbg_cpu_open(struct inode *inode, struct file *file) DEFINE_SHOW_ATTRIBUTE(dpaa2_dbg_cpu);
{
int err;
struct dpaa2_eth_priv *priv = (struct dpaa2_eth_priv *)inode->i_private;
err = single_open(file, dpaa2_dbg_cpu_show, priv);
if (err < 0)
netdev_err(priv->net_dev, "single_open() failed\n");
return err;
}
static const struct file_operations dpaa2_dbg_cpu_ops = {
.open = dpaa2_dbg_cpu_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static char *fq_type_to_str(struct dpaa2_eth_fq *fq) static char *fq_type_to_str(struct dpaa2_eth_fq *fq)
{ {
...@@ -106,24 +89,7 @@ static int dpaa2_dbg_fqs_show(struct seq_file *file, void *offset) ...@@ -106,24 +89,7 @@ static int dpaa2_dbg_fqs_show(struct seq_file *file, void *offset)
return 0; return 0;
} }
static int dpaa2_dbg_fqs_open(struct inode *inode, struct file *file) DEFINE_SHOW_ATTRIBUTE(dpaa2_dbg_fqs);
{
int err;
struct dpaa2_eth_priv *priv = (struct dpaa2_eth_priv *)inode->i_private;
err = single_open(file, dpaa2_dbg_fqs_show, priv);
if (err < 0)
netdev_err(priv->net_dev, "single_open() failed\n");
return err;
}
static const struct file_operations dpaa2_dbg_fq_ops = {
.open = dpaa2_dbg_fqs_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static int dpaa2_dbg_ch_show(struct seq_file *file, void *offset) static int dpaa2_dbg_ch_show(struct seq_file *file, void *offset)
{ {
...@@ -151,24 +117,7 @@ static int dpaa2_dbg_ch_show(struct seq_file *file, void *offset) ...@@ -151,24 +117,7 @@ static int dpaa2_dbg_ch_show(struct seq_file *file, void *offset)
return 0; return 0;
} }
static int dpaa2_dbg_ch_open(struct inode *inode, struct file *file) DEFINE_SHOW_ATTRIBUTE(dpaa2_dbg_ch);
{
int err;
struct dpaa2_eth_priv *priv = (struct dpaa2_eth_priv *)inode->i_private;
err = single_open(file, dpaa2_dbg_ch_show, priv);
if (err < 0)
netdev_err(priv->net_dev, "single_open() failed\n");
return err;
}
static const struct file_operations dpaa2_dbg_ch_ops = {
.open = dpaa2_dbg_ch_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
void dpaa2_dbg_add(struct dpaa2_eth_priv *priv) void dpaa2_dbg_add(struct dpaa2_eth_priv *priv)
{ {
...@@ -179,13 +128,13 @@ void dpaa2_dbg_add(struct dpaa2_eth_priv *priv) ...@@ -179,13 +128,13 @@ void dpaa2_dbg_add(struct dpaa2_eth_priv *priv)
priv->dbg.dir = dir; priv->dbg.dir = dir;
/* per-cpu stats file */ /* per-cpu stats file */
debugfs_create_file("cpu_stats", 0444, dir, priv, &dpaa2_dbg_cpu_ops); debugfs_create_file("cpu_stats", 0444, dir, priv, &dpaa2_dbg_cpu_fops);
/* per-fq stats file */ /* per-fq stats file */
debugfs_create_file("fq_stats", 0444, dir, priv, &dpaa2_dbg_fq_ops); debugfs_create_file("fq_stats", 0444, dir, priv, &dpaa2_dbg_fqs_fops);
/* per-fq stats file */ /* per-fq stats file */
debugfs_create_file("ch_stats", 0444, dir, priv, &dpaa2_dbg_ch_ops); debugfs_create_file("ch_stats", 0444, dir, priv, &dpaa2_dbg_ch_fops);
} }
void dpaa2_dbg_remove(struct dpaa2_eth_priv *priv) void dpaa2_dbg_remove(struct dpaa2_eth_priv *priv)
......
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