Commit b948577b authored by Liu Shixin's avatar Liu Shixin Committed by David S. Miller

cxgb4vf: convert to use DEFINE_SEQ_ATTRIBUTE macro

Use DEFINE_SEQ_ATTRIBUTE macro to simplify the code.
Signed-off-by: default avatarLiu Shixin <liushixin2@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 04a83459
...@@ -2017,33 +2017,14 @@ static void mboxlog_stop(struct seq_file *seq, void *v) ...@@ -2017,33 +2017,14 @@ static void mboxlog_stop(struct seq_file *seq, void *v)
{ {
} }
static const struct seq_operations mboxlog_seq_ops = { static const struct seq_operations mboxlog_sops = {
.start = mboxlog_start, .start = mboxlog_start,
.next = mboxlog_next, .next = mboxlog_next,
.stop = mboxlog_stop, .stop = mboxlog_stop,
.show = mboxlog_show .show = mboxlog_show
}; };
static int mboxlog_open(struct inode *inode, struct file *file) DEFINE_SEQ_ATTRIBUTE(mboxlog);
{
int res = seq_open(file, &mboxlog_seq_ops);
if (!res) {
struct seq_file *seq = file->private_data;
seq->private = inode->i_private;
}
return res;
}
static const struct file_operations mboxlog_fops = {
.owner = THIS_MODULE,
.open = mboxlog_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
/* /*
* Show SGE Queue Set information. We display QPL Queues Sets per line. * Show SGE Queue Set information. We display QPL Queues Sets per line.
*/ */
...@@ -2171,31 +2152,14 @@ static void *sge_queue_next(struct seq_file *seq, void *v, loff_t *pos) ...@@ -2171,31 +2152,14 @@ static void *sge_queue_next(struct seq_file *seq, void *v, loff_t *pos)
return *pos < entries ? (void *)((uintptr_t)*pos + 1) : NULL; return *pos < entries ? (void *)((uintptr_t)*pos + 1) : NULL;
} }
static const struct seq_operations sge_qinfo_seq_ops = { static const struct seq_operations sge_qinfo_sops = {
.start = sge_queue_start, .start = sge_queue_start,
.next = sge_queue_next, .next = sge_queue_next,
.stop = sge_queue_stop, .stop = sge_queue_stop,
.show = sge_qinfo_show .show = sge_qinfo_show
}; };
static int sge_qinfo_open(struct inode *inode, struct file *file) DEFINE_SEQ_ATTRIBUTE(sge_qinfo);
{
int res = seq_open(file, &sge_qinfo_seq_ops);
if (!res) {
struct seq_file *seq = file->private_data;
seq->private = inode->i_private;
}
return res;
}
static const struct file_operations sge_qinfo_debugfs_fops = {
.owner = THIS_MODULE,
.open = sge_qinfo_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
/* /*
* Show SGE Queue Set statistics. We display QPL Queues Sets per line. * Show SGE Queue Set statistics. We display QPL Queues Sets per line.
...@@ -2317,31 +2281,14 @@ static void *sge_qstats_next(struct seq_file *seq, void *v, loff_t *pos) ...@@ -2317,31 +2281,14 @@ static void *sge_qstats_next(struct seq_file *seq, void *v, loff_t *pos)
return *pos < entries ? (void *)((uintptr_t)*pos + 1) : NULL; return *pos < entries ? (void *)((uintptr_t)*pos + 1) : NULL;
} }
static const struct seq_operations sge_qstats_seq_ops = { static const struct seq_operations sge_qstats_sops = {
.start = sge_qstats_start, .start = sge_qstats_start,
.next = sge_qstats_next, .next = sge_qstats_next,
.stop = sge_qstats_stop, .stop = sge_qstats_stop,
.show = sge_qstats_show .show = sge_qstats_show
}; };
static int sge_qstats_open(struct inode *inode, struct file *file) DEFINE_SEQ_ATTRIBUTE(sge_qstats);
{
int res = seq_open(file, &sge_qstats_seq_ops);
if (res == 0) {
struct seq_file *seq = file->private_data;
seq->private = inode->i_private;
}
return res;
}
static const struct file_operations sge_qstats_proc_fops = {
.owner = THIS_MODULE,
.open = sge_qstats_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
/* /*
* Show PCI-E SR-IOV Virtual Function Resource Limits. * Show PCI-E SR-IOV Virtual Function Resource Limits.
...@@ -2415,31 +2362,14 @@ static void interfaces_stop(struct seq_file *seq, void *v) ...@@ -2415,31 +2362,14 @@ static void interfaces_stop(struct seq_file *seq, void *v)
{ {
} }
static const struct seq_operations interfaces_seq_ops = { static const struct seq_operations interfaces_sops = {
.start = interfaces_start, .start = interfaces_start,
.next = interfaces_next, .next = interfaces_next,
.stop = interfaces_stop, .stop = interfaces_stop,
.show = interfaces_show .show = interfaces_show
}; };
static int interfaces_open(struct inode *inode, struct file *file) DEFINE_SEQ_ATTRIBUTE(interfaces);
{
int res = seq_open(file, &interfaces_seq_ops);
if (res == 0) {
struct seq_file *seq = file->private_data;
seq->private = inode->i_private;
}
return res;
}
static const struct file_operations interfaces_proc_fops = {
.owner = THIS_MODULE,
.open = interfaces_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
/* /*
* /sys/kernel/debugfs/cxgb4vf/ files list. * /sys/kernel/debugfs/cxgb4vf/ files list.
...@@ -2452,10 +2382,10 @@ struct cxgb4vf_debugfs_entry { ...@@ -2452,10 +2382,10 @@ struct cxgb4vf_debugfs_entry {
static struct cxgb4vf_debugfs_entry debugfs_files[] = { static struct cxgb4vf_debugfs_entry debugfs_files[] = {
{ "mboxlog", 0444, &mboxlog_fops }, { "mboxlog", 0444, &mboxlog_fops },
{ "sge_qinfo", 0444, &sge_qinfo_debugfs_fops }, { "sge_qinfo", 0444, &sge_qinfo_fops },
{ "sge_qstats", 0444, &sge_qstats_proc_fops }, { "sge_qstats", 0444, &sge_qstats_fops },
{ "resources", 0444, &resources_fops }, { "resources", 0444, &resources_fops },
{ "interfaces", 0444, &interfaces_proc_fops }, { "interfaces", 0444, &interfaces_fops },
}; };
/* /*
......
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