Commit 2796b43f authored by Yangtao Li's avatar Yangtao Li Committed by Greg Kroah-Hartman

misc: remove GENWQE_DEBUGFS_RO()

We already have the DEFINE_SHOW_ATTRIBUTE.There is no need to define
such a macro,so remove GENWQE_DEBUGFS_RO.Also use DEFINE_SHOW_ATTRIBUTE
to simplify some code.
Signed-off-by: default avatarYangtao Li <tiny.windzz@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ddfa728a
...@@ -33,19 +33,6 @@ ...@@ -33,19 +33,6 @@
#include "card_base.h" #include "card_base.h"
#include "card_ddcb.h" #include "card_ddcb.h"
#define GENWQE_DEBUGFS_RO(_name, _showfn) \
static int genwqe_debugfs_##_name##_open(struct inode *inode, \
struct file *file) \
{ \
return single_open(file, _showfn, inode->i_private); \
} \
static const struct file_operations genwqe_##_name##_fops = { \
.open = genwqe_debugfs_##_name##_open, \
.read = seq_read, \
.llseek = seq_lseek, \
.release = single_release, \
}
static void dbg_uidn_show(struct seq_file *s, struct genwqe_reg *regs, static void dbg_uidn_show(struct seq_file *s, struct genwqe_reg *regs,
int entries) int entries)
{ {
...@@ -87,26 +74,26 @@ static int curr_dbg_uidn_show(struct seq_file *s, void *unused, int uid) ...@@ -87,26 +74,26 @@ static int curr_dbg_uidn_show(struct seq_file *s, void *unused, int uid)
return 0; return 0;
} }
static int genwqe_curr_dbg_uid0_show(struct seq_file *s, void *unused) static int curr_dbg_uid0_show(struct seq_file *s, void *unused)
{ {
return curr_dbg_uidn_show(s, unused, 0); return curr_dbg_uidn_show(s, unused, 0);
} }
GENWQE_DEBUGFS_RO(curr_dbg_uid0, genwqe_curr_dbg_uid0_show); DEFINE_SHOW_ATTRIBUTE(curr_dbg_uid0);
static int genwqe_curr_dbg_uid1_show(struct seq_file *s, void *unused) static int curr_dbg_uid1_show(struct seq_file *s, void *unused)
{ {
return curr_dbg_uidn_show(s, unused, 1); return curr_dbg_uidn_show(s, unused, 1);
} }
GENWQE_DEBUGFS_RO(curr_dbg_uid1, genwqe_curr_dbg_uid1_show); DEFINE_SHOW_ATTRIBUTE(curr_dbg_uid1);
static int genwqe_curr_dbg_uid2_show(struct seq_file *s, void *unused) static int curr_dbg_uid2_show(struct seq_file *s, void *unused)
{ {
return curr_dbg_uidn_show(s, unused, 2); return curr_dbg_uidn_show(s, unused, 2);
} }
GENWQE_DEBUGFS_RO(curr_dbg_uid2, genwqe_curr_dbg_uid2_show); DEFINE_SHOW_ATTRIBUTE(curr_dbg_uid2);
static int prev_dbg_uidn_show(struct seq_file *s, void *unused, int uid) static int prev_dbg_uidn_show(struct seq_file *s, void *unused, int uid)
{ {
...@@ -116,28 +103,28 @@ static int prev_dbg_uidn_show(struct seq_file *s, void *unused, int uid) ...@@ -116,28 +103,28 @@ static int prev_dbg_uidn_show(struct seq_file *s, void *unused, int uid)
return 0; return 0;
} }
static int genwqe_prev_dbg_uid0_show(struct seq_file *s, void *unused) static int prev_dbg_uid0_show(struct seq_file *s, void *unused)
{ {
return prev_dbg_uidn_show(s, unused, 0); return prev_dbg_uidn_show(s, unused, 0);
} }
GENWQE_DEBUGFS_RO(prev_dbg_uid0, genwqe_prev_dbg_uid0_show); DEFINE_SHOW_ATTRIBUTE(prev_dbg_uid0);
static int genwqe_prev_dbg_uid1_show(struct seq_file *s, void *unused) static int prev_dbg_uid1_show(struct seq_file *s, void *unused)
{ {
return prev_dbg_uidn_show(s, unused, 1); return prev_dbg_uidn_show(s, unused, 1);
} }
GENWQE_DEBUGFS_RO(prev_dbg_uid1, genwqe_prev_dbg_uid1_show); DEFINE_SHOW_ATTRIBUTE(prev_dbg_uid1);
static int genwqe_prev_dbg_uid2_show(struct seq_file *s, void *unused) static int prev_dbg_uid2_show(struct seq_file *s, void *unused)
{ {
return prev_dbg_uidn_show(s, unused, 2); return prev_dbg_uidn_show(s, unused, 2);
} }
GENWQE_DEBUGFS_RO(prev_dbg_uid2, genwqe_prev_dbg_uid2_show); DEFINE_SHOW_ATTRIBUTE(prev_dbg_uid2);
static int genwqe_curr_regs_show(struct seq_file *s, void *unused) static int curr_regs_show(struct seq_file *s, void *unused)
{ {
struct genwqe_dev *cd = s->private; struct genwqe_dev *cd = s->private;
unsigned int i; unsigned int i;
...@@ -164,9 +151,9 @@ static int genwqe_curr_regs_show(struct seq_file *s, void *unused) ...@@ -164,9 +151,9 @@ static int genwqe_curr_regs_show(struct seq_file *s, void *unused)
return 0; return 0;
} }
GENWQE_DEBUGFS_RO(curr_regs, genwqe_curr_regs_show); DEFINE_SHOW_ATTRIBUTE(curr_regs);
static int genwqe_prev_regs_show(struct seq_file *s, void *unused) static int prev_regs_show(struct seq_file *s, void *unused)
{ {
struct genwqe_dev *cd = s->private; struct genwqe_dev *cd = s->private;
unsigned int i; unsigned int i;
...@@ -188,9 +175,9 @@ static int genwqe_prev_regs_show(struct seq_file *s, void *unused) ...@@ -188,9 +175,9 @@ static int genwqe_prev_regs_show(struct seq_file *s, void *unused)
return 0; return 0;
} }
GENWQE_DEBUGFS_RO(prev_regs, genwqe_prev_regs_show); DEFINE_SHOW_ATTRIBUTE(prev_regs);
static int genwqe_jtimer_show(struct seq_file *s, void *unused) static int jtimer_show(struct seq_file *s, void *unused)
{ {
struct genwqe_dev *cd = s->private; struct genwqe_dev *cd = s->private;
unsigned int vf_num; unsigned int vf_num;
...@@ -209,9 +196,9 @@ static int genwqe_jtimer_show(struct seq_file *s, void *unused) ...@@ -209,9 +196,9 @@ static int genwqe_jtimer_show(struct seq_file *s, void *unused)
return 0; return 0;
} }
GENWQE_DEBUGFS_RO(jtimer, genwqe_jtimer_show); DEFINE_SHOW_ATTRIBUTE(jtimer);
static int genwqe_queue_working_time_show(struct seq_file *s, void *unused) static int queue_working_time_show(struct seq_file *s, void *unused)
{ {
struct genwqe_dev *cd = s->private; struct genwqe_dev *cd = s->private;
unsigned int vf_num; unsigned int vf_num;
...@@ -227,9 +214,9 @@ static int genwqe_queue_working_time_show(struct seq_file *s, void *unused) ...@@ -227,9 +214,9 @@ static int genwqe_queue_working_time_show(struct seq_file *s, void *unused)
return 0; return 0;
} }
GENWQE_DEBUGFS_RO(queue_working_time, genwqe_queue_working_time_show); DEFINE_SHOW_ATTRIBUTE(queue_working_time);
static int genwqe_ddcb_info_show(struct seq_file *s, void *unused) static int ddcb_info_show(struct seq_file *s, void *unused)
{ {
struct genwqe_dev *cd = s->private; struct genwqe_dev *cd = s->private;
unsigned int i; unsigned int i;
...@@ -300,9 +287,9 @@ static int genwqe_ddcb_info_show(struct seq_file *s, void *unused) ...@@ -300,9 +287,9 @@ static int genwqe_ddcb_info_show(struct seq_file *s, void *unused)
return 0; return 0;
} }
GENWQE_DEBUGFS_RO(ddcb_info, genwqe_ddcb_info_show); DEFINE_SHOW_ATTRIBUTE(ddcb_info);
static int genwqe_info_show(struct seq_file *s, void *unused) static int info_show(struct seq_file *s, void *unused)
{ {
struct genwqe_dev *cd = s->private; struct genwqe_dev *cd = s->private;
u64 app_id, slu_id, bitstream = -1; u64 app_id, slu_id, bitstream = -1;
...@@ -335,7 +322,7 @@ static int genwqe_info_show(struct seq_file *s, void *unused) ...@@ -335,7 +322,7 @@ static int genwqe_info_show(struct seq_file *s, void *unused)
return 0; return 0;
} }
GENWQE_DEBUGFS_RO(info, genwqe_info_show); DEFINE_SHOW_ATTRIBUTE(info);
int genwqe_init_debugfs(struct genwqe_dev *cd) int genwqe_init_debugfs(struct genwqe_dev *cd)
{ {
...@@ -356,14 +343,14 @@ int genwqe_init_debugfs(struct genwqe_dev *cd) ...@@ -356,14 +343,14 @@ int genwqe_init_debugfs(struct genwqe_dev *cd)
/* non privileged interfaces are done here */ /* non privileged interfaces are done here */
file = debugfs_create_file("ddcb_info", S_IRUGO, root, cd, file = debugfs_create_file("ddcb_info", S_IRUGO, root, cd,
&genwqe_ddcb_info_fops); &ddcb_info_fops);
if (!file) { if (!file) {
ret = -ENOMEM; ret = -ENOMEM;
goto err1; goto err1;
} }
file = debugfs_create_file("info", S_IRUGO, root, cd, file = debugfs_create_file("info", S_IRUGO, root, cd,
&genwqe_info_fops); &info_fops);
if (!file) { if (!file) {
ret = -ENOMEM; ret = -ENOMEM;
goto err1; goto err1;
...@@ -396,56 +383,56 @@ int genwqe_init_debugfs(struct genwqe_dev *cd) ...@@ -396,56 +383,56 @@ int genwqe_init_debugfs(struct genwqe_dev *cd)
} }
file = debugfs_create_file("curr_regs", S_IRUGO, root, cd, file = debugfs_create_file("curr_regs", S_IRUGO, root, cd,
&genwqe_curr_regs_fops); &curr_regs_fops);
if (!file) { if (!file) {
ret = -ENOMEM; ret = -ENOMEM;
goto err1; goto err1;
} }
file = debugfs_create_file("curr_dbg_uid0", S_IRUGO, root, cd, file = debugfs_create_file("curr_dbg_uid0", S_IRUGO, root, cd,
&genwqe_curr_dbg_uid0_fops); &curr_dbg_uid0_fops);
if (!file) { if (!file) {
ret = -ENOMEM; ret = -ENOMEM;
goto err1; goto err1;
} }
file = debugfs_create_file("curr_dbg_uid1", S_IRUGO, root, cd, file = debugfs_create_file("curr_dbg_uid1", S_IRUGO, root, cd,
&genwqe_curr_dbg_uid1_fops); &curr_dbg_uid1_fops);
if (!file) { if (!file) {
ret = -ENOMEM; ret = -ENOMEM;
goto err1; goto err1;
} }
file = debugfs_create_file("curr_dbg_uid2", S_IRUGO, root, cd, file = debugfs_create_file("curr_dbg_uid2", S_IRUGO, root, cd,
&genwqe_curr_dbg_uid2_fops); &curr_dbg_uid2_fops);
if (!file) { if (!file) {
ret = -ENOMEM; ret = -ENOMEM;
goto err1; goto err1;
} }
file = debugfs_create_file("prev_regs", S_IRUGO, root, cd, file = debugfs_create_file("prev_regs", S_IRUGO, root, cd,
&genwqe_prev_regs_fops); &prev_regs_fops);
if (!file) { if (!file) {
ret = -ENOMEM; ret = -ENOMEM;
goto err1; goto err1;
} }
file = debugfs_create_file("prev_dbg_uid0", S_IRUGO, root, cd, file = debugfs_create_file("prev_dbg_uid0", S_IRUGO, root, cd,
&genwqe_prev_dbg_uid0_fops); &prev_dbg_uid0_fops);
if (!file) { if (!file) {
ret = -ENOMEM; ret = -ENOMEM;
goto err1; goto err1;
} }
file = debugfs_create_file("prev_dbg_uid1", S_IRUGO, root, cd, file = debugfs_create_file("prev_dbg_uid1", S_IRUGO, root, cd,
&genwqe_prev_dbg_uid1_fops); &prev_dbg_uid1_fops);
if (!file) { if (!file) {
ret = -ENOMEM; ret = -ENOMEM;
goto err1; goto err1;
} }
file = debugfs_create_file("prev_dbg_uid2", S_IRUGO, root, cd, file = debugfs_create_file("prev_dbg_uid2", S_IRUGO, root, cd,
&genwqe_prev_dbg_uid2_fops); &prev_dbg_uid2_fops);
if (!file) { if (!file) {
ret = -ENOMEM; ret = -ENOMEM;
goto err1; goto err1;
...@@ -463,14 +450,14 @@ int genwqe_init_debugfs(struct genwqe_dev *cd) ...@@ -463,14 +450,14 @@ int genwqe_init_debugfs(struct genwqe_dev *cd)
} }
file = debugfs_create_file("jobtimer", S_IRUGO, root, cd, file = debugfs_create_file("jobtimer", S_IRUGO, root, cd,
&genwqe_jtimer_fops); &jtimer_fops);
if (!file) { if (!file) {
ret = -ENOMEM; ret = -ENOMEM;
goto err1; goto err1;
} }
file = debugfs_create_file("queue_working_time", S_IRUGO, root, cd, file = debugfs_create_file("queue_working_time", S_IRUGO, root, cd,
&genwqe_queue_working_time_fops); &queue_working_time_fops);
if (!file) { if (!file) {
ret = -ENOMEM; ret = -ENOMEM;
goto err1; goto err1;
......
...@@ -37,9 +37,9 @@ ...@@ -37,9 +37,9 @@
static struct dentry *mic_dbg; static struct dentry *mic_dbg;
/** /**
* mic_intr_test - Send interrupts to host. * mic_intr_show - Send interrupts to host.
*/ */
static int mic_intr_test(struct seq_file *s, void *unused) static int mic_intr_show(struct seq_file *s, void *unused)
{ {
struct mic_driver *mdrv = s->private; struct mic_driver *mdrv = s->private;
struct mic_device *mdev = &mdrv->mdev; struct mic_device *mdev = &mdrv->mdev;
...@@ -56,23 +56,7 @@ static int mic_intr_test(struct seq_file *s, void *unused) ...@@ -56,23 +56,7 @@ static int mic_intr_test(struct seq_file *s, void *unused)
return 0; return 0;
} }
static int mic_intr_test_open(struct inode *inode, struct file *file) DEFINE_SHOW_ATTRIBUTE(mic_intr);
{
return single_open(file, mic_intr_test, inode->i_private);
}
static int mic_intr_test_release(struct inode *inode, struct file *file)
{
return single_release(inode, file);
}
static const struct file_operations intr_test_ops = {
.owner = THIS_MODULE,
.open = mic_intr_test_open,
.read = seq_read,
.llseek = seq_lseek,
.release = mic_intr_test_release
};
/** /**
* mic_create_card_debug_dir - Initialize MIC debugfs entries. * mic_create_card_debug_dir - Initialize MIC debugfs entries.
...@@ -91,7 +75,7 @@ void __init mic_create_card_debug_dir(struct mic_driver *mdrv) ...@@ -91,7 +75,7 @@ void __init mic_create_card_debug_dir(struct mic_driver *mdrv)
} }
d = debugfs_create_file("intr_test", 0444, mdrv->dbg_dir, d = debugfs_create_file("intr_test", 0444, mdrv->dbg_dir,
mdrv, &intr_test_ops); mdrv, &mic_intr_fops);
if (!d) { if (!d) {
dev_err(mdrv->dev, dev_err(mdrv->dev,
......
...@@ -28,12 +28,12 @@ ...@@ -28,12 +28,12 @@
static struct dentry *cosm_dbg; static struct dentry *cosm_dbg;
/** /**
* cosm_log_buf_show - Display MIC kernel log buffer * log_buf_show - Display MIC kernel log buffer
* *
* log_buf addr/len is read from System.map by user space * log_buf addr/len is read from System.map by user space
* and populated in sysfs entries. * and populated in sysfs entries.
*/ */
static int cosm_log_buf_show(struct seq_file *s, void *unused) static int log_buf_show(struct seq_file *s, void *unused)
{ {
void __iomem *log_buf_va; void __iomem *log_buf_va;
int __iomem *log_buf_len_va; int __iomem *log_buf_len_va;
...@@ -78,26 +78,15 @@ static int cosm_log_buf_show(struct seq_file *s, void *unused) ...@@ -78,26 +78,15 @@ static int cosm_log_buf_show(struct seq_file *s, void *unused)
return 0; return 0;
} }
static int cosm_log_buf_open(struct inode *inode, struct file *file) DEFINE_SHOW_ATTRIBUTE(log_buf);
{
return single_open(file, cosm_log_buf_show, inode->i_private);
}
static const struct file_operations log_buf_ops = {
.owner = THIS_MODULE,
.open = cosm_log_buf_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release
};
/** /**
* cosm_force_reset_show - Force MIC reset * force_reset_show - Force MIC reset
* *
* Invokes the force_reset COSM bus op instead of the standard reset * Invokes the force_reset COSM bus op instead of the standard reset
* op in case a force reset of the MIC device is required * op in case a force reset of the MIC device is required
*/ */
static int cosm_force_reset_show(struct seq_file *s, void *pos) static int force_reset_show(struct seq_file *s, void *pos)
{ {
struct cosm_device *cdev = s->private; struct cosm_device *cdev = s->private;
...@@ -105,18 +94,7 @@ static int cosm_force_reset_show(struct seq_file *s, void *pos) ...@@ -105,18 +94,7 @@ static int cosm_force_reset_show(struct seq_file *s, void *pos)
return 0; return 0;
} }
static int cosm_force_reset_debug_open(struct inode *inode, struct file *file) DEFINE_SHOW_ATTRIBUTE(force_reset);
{
return single_open(file, cosm_force_reset_show, inode->i_private);
}
static const struct file_operations force_reset_ops = {
.owner = THIS_MODULE,
.open = cosm_force_reset_debug_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release
};
void cosm_create_debug_dir(struct cosm_device *cdev) void cosm_create_debug_dir(struct cosm_device *cdev)
{ {
...@@ -130,9 +108,10 @@ void cosm_create_debug_dir(struct cosm_device *cdev) ...@@ -130,9 +108,10 @@ void cosm_create_debug_dir(struct cosm_device *cdev)
if (!cdev->dbg_dir) if (!cdev->dbg_dir)
return; return;
debugfs_create_file("log_buf", 0444, cdev->dbg_dir, cdev, &log_buf_ops); debugfs_create_file("log_buf", 0444, cdev->dbg_dir, cdev,
&log_buf_fops);
debugfs_create_file("force_reset", 0444, cdev->dbg_dir, cdev, debugfs_create_file("force_reset", 0444, cdev->dbg_dir, cdev,
&force_reset_ops); &force_reset_fops);
} }
void cosm_delete_debug_dir(struct cosm_device *cdev) void cosm_delete_debug_dir(struct cosm_device *cdev)
......
...@@ -54,23 +54,7 @@ static int mic_smpt_show(struct seq_file *s, void *pos) ...@@ -54,23 +54,7 @@ static int mic_smpt_show(struct seq_file *s, void *pos)
return 0; return 0;
} }
static int mic_smpt_debug_open(struct inode *inode, struct file *file) DEFINE_SHOW_ATTRIBUTE(mic_smpt);
{
return single_open(file, mic_smpt_show, inode->i_private);
}
static int mic_smpt_debug_release(struct inode *inode, struct file *file)
{
return single_release(inode, file);
}
static const struct file_operations smpt_file_ops = {
.owner = THIS_MODULE,
.open = mic_smpt_debug_open,
.read = seq_read,
.llseek = seq_lseek,
.release = mic_smpt_debug_release
};
static int mic_post_code_show(struct seq_file *s, void *pos) static int mic_post_code_show(struct seq_file *s, void *pos)
{ {
...@@ -81,23 +65,7 @@ static int mic_post_code_show(struct seq_file *s, void *pos) ...@@ -81,23 +65,7 @@ static int mic_post_code_show(struct seq_file *s, void *pos)
return 0; return 0;
} }
static int mic_post_code_debug_open(struct inode *inode, struct file *file) DEFINE_SHOW_ATTRIBUTE(mic_post_code);
{
return single_open(file, mic_post_code_show, inode->i_private);
}
static int mic_post_code_debug_release(struct inode *inode, struct file *file)
{
return single_release(inode, file);
}
static const struct file_operations post_code_ops = {
.owner = THIS_MODULE,
.open = mic_post_code_debug_open,
.read = seq_read,
.llseek = seq_lseek,
.release = mic_post_code_debug_release
};
static int mic_msi_irq_info_show(struct seq_file *s, void *pos) static int mic_msi_irq_info_show(struct seq_file *s, void *pos)
{ {
...@@ -143,24 +111,7 @@ static int mic_msi_irq_info_show(struct seq_file *s, void *pos) ...@@ -143,24 +111,7 @@ static int mic_msi_irq_info_show(struct seq_file *s, void *pos)
return 0; return 0;
} }
static int mic_msi_irq_info_debug_open(struct inode *inode, struct file *file) DEFINE_SHOW_ATTRIBUTE(mic_msi_irq_info);
{
return single_open(file, mic_msi_irq_info_show, inode->i_private);
}
static int
mic_msi_irq_info_debug_release(struct inode *inode, struct file *file)
{
return single_release(inode, file);
}
static const struct file_operations msi_irq_info_ops = {
.owner = THIS_MODULE,
.open = mic_msi_irq_info_debug_open,
.read = seq_read,
.llseek = seq_lseek,
.release = mic_msi_irq_info_debug_release
};
/** /**
* mic_create_debug_dir - Initialize MIC debugfs entries. * mic_create_debug_dir - Initialize MIC debugfs entries.
...@@ -177,13 +128,14 @@ void mic_create_debug_dir(struct mic_device *mdev) ...@@ -177,13 +128,14 @@ void mic_create_debug_dir(struct mic_device *mdev)
if (!mdev->dbg_dir) if (!mdev->dbg_dir)
return; return;
debugfs_create_file("smpt", 0444, mdev->dbg_dir, mdev, &smpt_file_ops); debugfs_create_file("smpt", 0444, mdev->dbg_dir, mdev,
&mic_smpt_fops);
debugfs_create_file("post_code", 0444, mdev->dbg_dir, mdev, debugfs_create_file("post_code", 0444, mdev->dbg_dir, mdev,
&post_code_ops); &mic_post_code_fops);
debugfs_create_file("msi_irq_info", 0444, mdev->dbg_dir, mdev, debugfs_create_file("msi_irq_info", 0444, mdev->dbg_dir, mdev,
&msi_irq_info_ops); &mic_msi_irq_info_fops);
} }
/** /**
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
/* Debugfs parent dir */ /* Debugfs parent dir */
static struct dentry *scif_dbg; static struct dentry *scif_dbg;
static int scif_dev_test(struct seq_file *s, void *unused) static int scif_dev_show(struct seq_file *s, void *unused)
{ {
int node; int node;
...@@ -44,23 +44,7 @@ static int scif_dev_test(struct seq_file *s, void *unused) ...@@ -44,23 +44,7 @@ static int scif_dev_test(struct seq_file *s, void *unused)
return 0; return 0;
} }
static int scif_dev_test_open(struct inode *inode, struct file *file) DEFINE_SHOW_ATTRIBUTE(scif_dev);
{
return single_open(file, scif_dev_test, inode->i_private);
}
static int scif_dev_test_release(struct inode *inode, struct file *file)
{
return single_release(inode, file);
}
static const struct file_operations scif_dev_ops = {
.owner = THIS_MODULE,
.open = scif_dev_test_open,
.read = seq_read,
.llseek = seq_lseek,
.release = scif_dev_test_release
};
static void scif_display_window(struct scif_window *window, struct seq_file *s) static void scif_display_window(struct scif_window *window, struct seq_file *s)
{ {
...@@ -104,7 +88,7 @@ static void scif_display_all_windows(struct list_head *head, struct seq_file *s) ...@@ -104,7 +88,7 @@ static void scif_display_all_windows(struct list_head *head, struct seq_file *s)
} }
} }
static int scif_rma_test(struct seq_file *s, void *unused) static int scif_rma_show(struct seq_file *s, void *unused)
{ {
struct scif_endpt *ep; struct scif_endpt *ep;
struct list_head *pos; struct list_head *pos;
...@@ -123,23 +107,7 @@ static int scif_rma_test(struct seq_file *s, void *unused) ...@@ -123,23 +107,7 @@ static int scif_rma_test(struct seq_file *s, void *unused)
return 0; return 0;
} }
static int scif_rma_test_open(struct inode *inode, struct file *file) DEFINE_SHOW_ATTRIBUTE(scif_rma);
{
return single_open(file, scif_rma_test, inode->i_private);
}
static int scif_rma_test_release(struct inode *inode, struct file *file)
{
return single_release(inode, file);
}
static const struct file_operations scif_rma_ops = {
.owner = THIS_MODULE,
.open = scif_rma_test_open,
.read = seq_read,
.llseek = seq_lseek,
.release = scif_rma_test_release
};
void __init scif_init_debugfs(void) void __init scif_init_debugfs(void)
{ {
...@@ -150,8 +118,8 @@ void __init scif_init_debugfs(void) ...@@ -150,8 +118,8 @@ void __init scif_init_debugfs(void)
return; return;
} }
debugfs_create_file("scif_dev", 0444, scif_dbg, NULL, &scif_dev_ops); debugfs_create_file("scif_dev", 0444, scif_dbg, NULL, &scif_dev_fops);
debugfs_create_file("scif_rma", 0444, scif_dbg, NULL, &scif_rma_ops); debugfs_create_file("scif_rma", 0444, scif_dbg, NULL, &scif_rma_fops);
debugfs_create_u8("en_msg_log", 0666, scif_dbg, &scif_info.en_msg_log); debugfs_create_u8("en_msg_log", 0666, scif_dbg, &scif_info.en_msg_log);
debugfs_create_u8("p2p_enable", 0666, scif_dbg, &scif_info.p2p_enable); debugfs_create_u8("p2p_enable", 0666, scif_dbg, &scif_info.p2p_enable);
} }
......
...@@ -101,23 +101,7 @@ static int vop_dp_show(struct seq_file *s, void *pos) ...@@ -101,23 +101,7 @@ static int vop_dp_show(struct seq_file *s, void *pos)
return 0; return 0;
} }
static int vop_dp_debug_open(struct inode *inode, struct file *file) DEFINE_SHOW_ATTRIBUTE(vop_dp);
{
return single_open(file, vop_dp_show, inode->i_private);
}
static int vop_dp_debug_release(struct inode *inode, struct file *file)
{
return single_release(inode, file);
}
static const struct file_operations dp_ops = {
.owner = THIS_MODULE,
.open = vop_dp_debug_open,
.read = seq_read,
.llseek = seq_lseek,
.release = vop_dp_debug_release
};
static int vop_vdev_info_show(struct seq_file *s, void *unused) static int vop_vdev_info_show(struct seq_file *s, void *unused)
{ {
...@@ -194,23 +178,7 @@ static int vop_vdev_info_show(struct seq_file *s, void *unused) ...@@ -194,23 +178,7 @@ static int vop_vdev_info_show(struct seq_file *s, void *unused)
return 0; return 0;
} }
static int vop_vdev_info_debug_open(struct inode *inode, struct file *file) DEFINE_SHOW_ATTRIBUTE(vop_vdev_info);
{
return single_open(file, vop_vdev_info_show, inode->i_private);
}
static int vop_vdev_info_debug_release(struct inode *inode, struct file *file)
{
return single_release(inode, file);
}
static const struct file_operations vdev_info_ops = {
.owner = THIS_MODULE,
.open = vop_vdev_info_debug_open,
.read = seq_read,
.llseek = seq_lseek,
.release = vop_vdev_info_debug_release
};
void vop_init_debugfs(struct vop_info *vi) void vop_init_debugfs(struct vop_info *vi)
{ {
...@@ -222,8 +190,8 @@ void vop_init_debugfs(struct vop_info *vi) ...@@ -222,8 +190,8 @@ void vop_init_debugfs(struct vop_info *vi)
pr_err("can't create debugfs dir vop\n"); pr_err("can't create debugfs dir vop\n");
return; return;
} }
debugfs_create_file("dp", 0444, vi->dbg, vi, &dp_ops); debugfs_create_file("dp", 0444, vi->dbg, vi, &vop_dp_fops);
debugfs_create_file("vdev_info", 0444, vi->dbg, vi, &vdev_info_ops); debugfs_create_file("vdev_info", 0444, vi->dbg, vi, &vop_vdev_info_fops);
} }
void vop_exit_debugfs(struct vop_info *vi) void vop_exit_debugfs(struct vop_info *vi)
......
...@@ -564,7 +564,7 @@ long st_kim_stop(void *kim_data) ...@@ -564,7 +564,7 @@ long st_kim_stop(void *kim_data)
/* functions called from subsystems */ /* functions called from subsystems */
/* called when debugfs entry is read from */ /* called when debugfs entry is read from */
static int show_version(struct seq_file *s, void *unused) static int version_show(struct seq_file *s, void *unused)
{ {
struct kim_data_s *kim_gdata = (struct kim_data_s *)s->private; struct kim_data_s *kim_gdata = (struct kim_data_s *)s->private;
seq_printf(s, "%04X %d.%d.%d\n", kim_gdata->version.full, seq_printf(s, "%04X %d.%d.%d\n", kim_gdata->version.full,
...@@ -573,7 +573,7 @@ static int show_version(struct seq_file *s, void *unused) ...@@ -573,7 +573,7 @@ static int show_version(struct seq_file *s, void *unused)
return 0; return 0;
} }
static int show_list(struct seq_file *s, void *unused) static int list_show(struct seq_file *s, void *unused)
{ {
struct kim_data_s *kim_gdata = (struct kim_data_s *)s->private; struct kim_data_s *kim_gdata = (struct kim_data_s *)s->private;
kim_st_list_protocols(kim_gdata->core_data, s); kim_st_list_protocols(kim_gdata->core_data, s);
...@@ -688,30 +688,8 @@ void st_kim_ref(struct st_data_s **core_data, int id) ...@@ -688,30 +688,8 @@ void st_kim_ref(struct st_data_s **core_data, int id)
*core_data = NULL; *core_data = NULL;
} }
static int kim_version_open(struct inode *i, struct file *f) DEFINE_SHOW_ATTRIBUTE(version);
{ DEFINE_SHOW_ATTRIBUTE(list);
return single_open(f, show_version, i->i_private);
}
static int kim_list_open(struct inode *i, struct file *f)
{
return single_open(f, show_list, i->i_private);
}
static const struct file_operations version_debugfs_fops = {
/* version info */
.open = kim_version_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static const struct file_operations list_debugfs_fops = {
/* protocols info */
.open = kim_list_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
/**********************************************************************/ /**********************************************************************/
/* functions called from platform device driver subsystem /* functions called from platform device driver subsystem
...@@ -789,9 +767,9 @@ static int kim_probe(struct platform_device *pdev) ...@@ -789,9 +767,9 @@ static int kim_probe(struct platform_device *pdev)
} }
debugfs_create_file("version", S_IRUGO, kim_debugfs_dir, debugfs_create_file("version", S_IRUGO, kim_debugfs_dir,
kim_gdata, &version_debugfs_fops); kim_gdata, &version_fops);
debugfs_create_file("protocols", S_IRUGO, kim_debugfs_dir, debugfs_create_file("protocols", S_IRUGO, kim_debugfs_dir,
kim_gdata, &list_debugfs_fops); kim_gdata, &list_fops);
return 0; return 0;
err_sysfs_group: err_sysfs_group:
......
...@@ -1470,18 +1470,7 @@ static int vmballoon_debug_show(struct seq_file *f, void *offset) ...@@ -1470,18 +1470,7 @@ static int vmballoon_debug_show(struct seq_file *f, void *offset)
return 0; return 0;
} }
static int vmballoon_debug_open(struct inode *inode, struct file *file) DEFINE_SHOW_ATTRIBUTE(vmballoon_debug);
{
return single_open(file, vmballoon_debug_show, inode->i_private);
}
static const struct file_operations vmballoon_debug_fops = {
.owner = THIS_MODULE,
.open = vmballoon_debug_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static int __init vmballoon_debugfs_init(struct vmballoon *b) static int __init vmballoon_debugfs_init(struct vmballoon *b)
{ {
......
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