Commit 986b8348 authored by Yangtao Li's avatar Yangtao Li Committed by Kalle Valo

wil6210: convert to DEFINE_SHOW_ATTRIBUTE

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.
Signed-off-by: default avatarYangtao Li <tiny.windzz@gmail.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 192a986d
...@@ -124,7 +124,7 @@ static void wil_print_ring(struct seq_file *s, struct wil6210_priv *wil, ...@@ -124,7 +124,7 @@ static void wil_print_ring(struct seq_file *s, struct wil6210_priv *wil,
seq_puts(s, "}\n"); seq_puts(s, "}\n");
} }
static int wil_ring_debugfs_show(struct seq_file *s, void *data) static int ring_show(struct seq_file *s, void *data)
{ {
uint i; uint i;
struct wil6210_priv *wil = s->private; struct wil6210_priv *wil = s->private;
...@@ -183,18 +183,7 @@ static int wil_ring_debugfs_show(struct seq_file *s, void *data) ...@@ -183,18 +183,7 @@ static int wil_ring_debugfs_show(struct seq_file *s, void *data)
return 0; return 0;
} }
DEFINE_SHOW_ATTRIBUTE(ring);
static int wil_ring_seq_open(struct inode *inode, struct file *file)
{
return single_open(file, wil_ring_debugfs_show, inode->i_private);
}
static const struct file_operations fops_ring = {
.open = wil_ring_seq_open,
.release = single_release,
.read = seq_read,
.llseek = seq_lseek,
};
static void wil_print_sring(struct seq_file *s, struct wil6210_priv *wil, static void wil_print_sring(struct seq_file *s, struct wil6210_priv *wil,
struct wil_status_ring *sring) struct wil_status_ring *sring)
...@@ -240,7 +229,7 @@ static void wil_print_sring(struct seq_file *s, struct wil6210_priv *wil, ...@@ -240,7 +229,7 @@ static void wil_print_sring(struct seq_file *s, struct wil6210_priv *wil,
seq_puts(s, "}\n"); seq_puts(s, "}\n");
} }
static int wil_srings_debugfs_show(struct seq_file *s, void *data) static int srings_show(struct seq_file *s, void *data)
{ {
struct wil6210_priv *wil = s->private; struct wil6210_priv *wil = s->private;
int i = 0; int i = 0;
...@@ -251,18 +240,7 @@ static int wil_srings_debugfs_show(struct seq_file *s, void *data) ...@@ -251,18 +240,7 @@ static int wil_srings_debugfs_show(struct seq_file *s, void *data)
return 0; return 0;
} }
DEFINE_SHOW_ATTRIBUTE(srings);
static int wil_srings_seq_open(struct inode *inode, struct file *file)
{
return single_open(file, wil_srings_debugfs_show, inode->i_private);
}
static const struct file_operations fops_srings = {
.open = wil_srings_seq_open,
.release = single_release,
.read = seq_read,
.llseek = seq_lseek,
};
static void wil_seq_hexdump(struct seq_file *s, void *p, int len, static void wil_seq_hexdump(struct seq_file *s, void *p, int len,
const char *prefix) const char *prefix)
...@@ -348,7 +326,7 @@ static void wil_print_mbox_ring(struct seq_file *s, const char *prefix, ...@@ -348,7 +326,7 @@ static void wil_print_mbox_ring(struct seq_file *s, const char *prefix,
wil_halp_unvote(wil); wil_halp_unvote(wil);
} }
static int wil_mbox_debugfs_show(struct seq_file *s, void *data) static int mbox_show(struct seq_file *s, void *data)
{ {
struct wil6210_priv *wil = s->private; struct wil6210_priv *wil = s->private;
int ret; int ret;
...@@ -366,18 +344,7 @@ static int wil_mbox_debugfs_show(struct seq_file *s, void *data) ...@@ -366,18 +344,7 @@ static int wil_mbox_debugfs_show(struct seq_file *s, void *data)
return 0; return 0;
} }
DEFINE_SHOW_ATTRIBUTE(mbox);
static int wil_mbox_seq_open(struct inode *inode, struct file *file)
{
return single_open(file, wil_mbox_debugfs_show, inode->i_private);
}
static const struct file_operations fops_mbox = {
.open = wil_mbox_seq_open,
.release = single_release,
.read = seq_read,
.llseek = seq_lseek,
};
static int wil_debugfs_iomem_x32_set(void *data, u64 val) static int wil_debugfs_iomem_x32_set(void *data, u64 val)
{ {
...@@ -624,7 +591,7 @@ static int wil6210_debugfs_create_ITR_CNT(struct wil6210_priv *wil, ...@@ -624,7 +591,7 @@ static int wil6210_debugfs_create_ITR_CNT(struct wil6210_priv *wil,
return 0; return 0;
} }
static int wil_memread_debugfs_show(struct seq_file *s, void *data) static int memread_show(struct seq_file *s, void *data)
{ {
struct wil6210_priv *wil = s->private; struct wil6210_priv *wil = s->private;
void __iomem *a; void __iomem *a;
...@@ -645,18 +612,7 @@ static int wil_memread_debugfs_show(struct seq_file *s, void *data) ...@@ -645,18 +612,7 @@ static int wil_memread_debugfs_show(struct seq_file *s, void *data)
return 0; return 0;
} }
DEFINE_SHOW_ATTRIBUTE(memread);
static int wil_memread_seq_open(struct inode *inode, struct file *file)
{
return single_open(file, wil_memread_debugfs_show, inode->i_private);
}
static const struct file_operations fops_memread = {
.open = wil_memread_seq_open,
.release = single_release,
.read = seq_read,
.llseek = seq_lseek,
};
static ssize_t wil_read_file_ioblob(struct file *file, char __user *user_buf, static ssize_t wil_read_file_ioblob(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
...@@ -1060,7 +1016,7 @@ static void wil_seq_print_skb(struct seq_file *s, struct sk_buff *skb) ...@@ -1060,7 +1016,7 @@ static void wil_seq_print_skb(struct seq_file *s, struct sk_buff *skb)
} }
/*---------Tx/Rx descriptor------------*/ /*---------Tx/Rx descriptor------------*/
static int wil_txdesc_debugfs_show(struct seq_file *s, void *data) static int txdesc_show(struct seq_file *s, void *data)
{ {
struct wil6210_priv *wil = s->private; struct wil6210_priv *wil = s->private;
struct wil_ring *ring; struct wil_ring *ring;
...@@ -1153,21 +1109,10 @@ static int wil_txdesc_debugfs_show(struct seq_file *s, void *data) ...@@ -1153,21 +1109,10 @@ static int wil_txdesc_debugfs_show(struct seq_file *s, void *data)
return 0; return 0;
} }
DEFINE_SHOW_ATTRIBUTE(txdesc);
static int wil_txdesc_seq_open(struct inode *inode, struct file *file)
{
return single_open(file, wil_txdesc_debugfs_show, inode->i_private);
}
static const struct file_operations fops_txdesc = {
.open = wil_txdesc_seq_open,
.release = single_release,
.read = seq_read,
.llseek = seq_lseek,
};
/*---------Tx/Rx status message------------*/ /*---------Tx/Rx status message------------*/
static int wil_status_msg_debugfs_show(struct seq_file *s, void *data) static int status_msg_show(struct seq_file *s, void *data)
{ {
struct wil6210_priv *wil = s->private; struct wil6210_priv *wil = s->private;
int sring_idx = dbg_sring_index; int sring_idx = dbg_sring_index;
...@@ -1209,19 +1154,7 @@ static int wil_status_msg_debugfs_show(struct seq_file *s, void *data) ...@@ -1209,19 +1154,7 @@ static int wil_status_msg_debugfs_show(struct seq_file *s, void *data)
return 0; return 0;
} }
DEFINE_SHOW_ATTRIBUTE(status_msg);
static int wil_status_msg_seq_open(struct inode *inode, struct file *file)
{
return single_open(file, wil_status_msg_debugfs_show,
inode->i_private);
}
static const struct file_operations fops_status_msg = {
.open = wil_status_msg_seq_open,
.release = single_release,
.read = seq_read,
.llseek = seq_lseek,
};
static int wil_print_rx_buff(struct seq_file *s, struct list_head *lh) static int wil_print_rx_buff(struct seq_file *s, struct list_head *lh)
{ {
...@@ -1239,7 +1172,7 @@ static int wil_print_rx_buff(struct seq_file *s, struct list_head *lh) ...@@ -1239,7 +1172,7 @@ static int wil_print_rx_buff(struct seq_file *s, struct list_head *lh)
return i; return i;
} }
static int wil_rx_buff_mgmt_debugfs_show(struct seq_file *s, void *data) static int rx_buff_mgmt_show(struct seq_file *s, void *data)
{ {
struct wil6210_priv *wil = s->private; struct wil6210_priv *wil = s->private;
struct wil_rx_buff_mgmt *rbm = &wil->rx_buff_mgmt; struct wil_rx_buff_mgmt *rbm = &wil->rx_buff_mgmt;
...@@ -1264,19 +1197,7 @@ static int wil_rx_buff_mgmt_debugfs_show(struct seq_file *s, void *data) ...@@ -1264,19 +1197,7 @@ static int wil_rx_buff_mgmt_debugfs_show(struct seq_file *s, void *data)
return 0; return 0;
} }
DEFINE_SHOW_ATTRIBUTE(rx_buff_mgmt);
static int wil_rx_buff_mgmt_seq_open(struct inode *inode, struct file *file)
{
return single_open(file, wil_rx_buff_mgmt_debugfs_show,
inode->i_private);
}
static const struct file_operations fops_rx_buff_mgmt = {
.open = wil_rx_buff_mgmt_seq_open,
.release = single_release,
.read = seq_read,
.llseek = seq_lseek,
};
/*---------beamforming------------*/ /*---------beamforming------------*/
static char *wil_bfstatus_str(u32 status) static char *wil_bfstatus_str(u32 status)
...@@ -1306,7 +1227,7 @@ static bool is_all_zeros(void * const x_, size_t sz) ...@@ -1306,7 +1227,7 @@ static bool is_all_zeros(void * const x_, size_t sz)
return true; return true;
} }
static int wil_bf_debugfs_show(struct seq_file *s, void *data) static int bf_show(struct seq_file *s, void *data)
{ {
int rc; int rc;
int i; int i;
...@@ -1360,18 +1281,7 @@ static int wil_bf_debugfs_show(struct seq_file *s, void *data) ...@@ -1360,18 +1281,7 @@ static int wil_bf_debugfs_show(struct seq_file *s, void *data)
} }
return 0; return 0;
} }
DEFINE_SHOW_ATTRIBUTE(bf);
static int wil_bf_seq_open(struct inode *inode, struct file *file)
{
return single_open(file, wil_bf_debugfs_show, inode->i_private);
}
static const struct file_operations fops_bf = {
.open = wil_bf_seq_open,
.release = single_release,
.read = seq_read,
.llseek = seq_lseek,
};
/*---------temp------------*/ /*---------temp------------*/
static void print_temp(struct seq_file *s, const char *prefix, s32 t) static void print_temp(struct seq_file *s, const char *prefix, s32 t)
...@@ -1388,7 +1298,7 @@ static void print_temp(struct seq_file *s, const char *prefix, s32 t) ...@@ -1388,7 +1298,7 @@ static void print_temp(struct seq_file *s, const char *prefix, s32 t)
} }
} }
static int wil_temp_debugfs_show(struct seq_file *s, void *data) static int temp_show(struct seq_file *s, void *data)
{ {
struct wil6210_priv *wil = s->private; struct wil6210_priv *wil = s->private;
s32 t_m, t_r; s32 t_m, t_r;
...@@ -1404,21 +1314,10 @@ static int wil_temp_debugfs_show(struct seq_file *s, void *data) ...@@ -1404,21 +1314,10 @@ static int wil_temp_debugfs_show(struct seq_file *s, void *data)
return 0; return 0;
} }
DEFINE_SHOW_ATTRIBUTE(temp);
static int wil_temp_seq_open(struct inode *inode, struct file *file)
{
return single_open(file, wil_temp_debugfs_show, inode->i_private);
}
static const struct file_operations fops_temp = {
.open = wil_temp_seq_open,
.release = single_release,
.read = seq_read,
.llseek = seq_lseek,
};
/*---------freq------------*/ /*---------freq------------*/
static int wil_freq_debugfs_show(struct seq_file *s, void *data) static int freq_show(struct seq_file *s, void *data)
{ {
struct wil6210_priv *wil = s->private; struct wil6210_priv *wil = s->private;
struct wireless_dev *wdev = wil->main_ndev->ieee80211_ptr; struct wireless_dev *wdev = wil->main_ndev->ieee80211_ptr;
...@@ -1428,21 +1327,10 @@ static int wil_freq_debugfs_show(struct seq_file *s, void *data) ...@@ -1428,21 +1327,10 @@ static int wil_freq_debugfs_show(struct seq_file *s, void *data)
return 0; return 0;
} }
DEFINE_SHOW_ATTRIBUTE(freq);
static int wil_freq_seq_open(struct inode *inode, struct file *file)
{
return single_open(file, wil_freq_debugfs_show, inode->i_private);
}
static const struct file_operations fops_freq = {
.open = wil_freq_seq_open,
.release = single_release,
.read = seq_read,
.llseek = seq_lseek,
};
/*---------link------------*/ /*---------link------------*/
static int wil_link_debugfs_show(struct seq_file *s, void *data) static int link_show(struct seq_file *s, void *data)
{ {
struct wil6210_priv *wil = s->private; struct wil6210_priv *wil = s->private;
struct station_info *sinfo; struct station_info *sinfo;
...@@ -1494,21 +1382,10 @@ static int wil_link_debugfs_show(struct seq_file *s, void *data) ...@@ -1494,21 +1382,10 @@ static int wil_link_debugfs_show(struct seq_file *s, void *data)
kfree(sinfo); kfree(sinfo);
return rc; return rc;
} }
DEFINE_SHOW_ATTRIBUTE(link);
static int wil_link_seq_open(struct inode *inode, struct file *file)
{
return single_open(file, wil_link_debugfs_show, inode->i_private);
}
static const struct file_operations fops_link = {
.open = wil_link_seq_open,
.release = single_release,
.read = seq_read,
.llseek = seq_lseek,
};
/*---------info------------*/ /*---------info------------*/
static int wil_info_debugfs_show(struct seq_file *s, void *data) static int info_show(struct seq_file *s, void *data)
{ {
struct wil6210_priv *wil = s->private; struct wil6210_priv *wil = s->private;
struct net_device *ndev = wil->main_ndev; struct net_device *ndev = wil->main_ndev;
...@@ -1543,18 +1420,7 @@ static int wil_info_debugfs_show(struct seq_file *s, void *data) ...@@ -1543,18 +1420,7 @@ static int wil_info_debugfs_show(struct seq_file *s, void *data)
#undef CHECK_QSTATE #undef CHECK_QSTATE
return 0; return 0;
} }
DEFINE_SHOW_ATTRIBUTE(info);
static int wil_info_seq_open(struct inode *inode, struct file *file)
{
return single_open(file, wil_info_debugfs_show, inode->i_private);
}
static const struct file_operations fops_info = {
.open = wil_info_seq_open,
.release = single_release,
.read = seq_read,
.llseek = seq_lseek,
};
/*---------recovery------------*/ /*---------recovery------------*/
/* mode = [manual|auto] /* mode = [manual|auto]
...@@ -1670,7 +1536,7 @@ static void wil_print_rxtid_crypto(struct seq_file *s, int tid, ...@@ -1670,7 +1536,7 @@ static void wil_print_rxtid_crypto(struct seq_file *s, int tid,
seq_puts(s, "\n"); seq_puts(s, "\n");
} }
static int wil_sta_debugfs_show(struct seq_file *s, void *data) static int sta_show(struct seq_file *s, void *data)
__acquires(&p->tid_rx_lock) __releases(&p->tid_rx_lock) __acquires(&p->tid_rx_lock) __releases(&p->tid_rx_lock)
{ {
struct wil6210_priv *wil = s->private; struct wil6210_priv *wil = s->private;
...@@ -1752,20 +1618,9 @@ __acquires(&p->tid_rx_lock) __releases(&p->tid_rx_lock) ...@@ -1752,20 +1618,9 @@ __acquires(&p->tid_rx_lock) __releases(&p->tid_rx_lock)
return 0; return 0;
} }
DEFINE_SHOW_ATTRIBUTE(sta);
static int wil_sta_seq_open(struct inode *inode, struct file *file) static int mids_show(struct seq_file *s, void *data)
{
return single_open(file, wil_sta_debugfs_show, inode->i_private);
}
static const struct file_operations fops_sta = {
.open = wil_sta_seq_open,
.release = single_release,
.read = seq_read,
.llseek = seq_lseek,
};
static int wil_mids_debugfs_show(struct seq_file *s, void *data)
{ {
struct wil6210_priv *wil = s->private; struct wil6210_priv *wil = s->private;
struct wil6210_vif *vif; struct wil6210_vif *vif;
...@@ -1788,18 +1643,7 @@ static int wil_mids_debugfs_show(struct seq_file *s, void *data) ...@@ -1788,18 +1643,7 @@ static int wil_mids_debugfs_show(struct seq_file *s, void *data)
return 0; return 0;
} }
DEFINE_SHOW_ATTRIBUTE(mids);
static int wil_mids_seq_open(struct inode *inode, struct file *file)
{
return single_open(file, wil_mids_debugfs_show, inode->i_private);
}
static const struct file_operations fops_mids = {
.open = wil_mids_seq_open,
.release = single_release,
.read = seq_read,
.llseek = seq_lseek,
};
static int wil_tx_latency_debugfs_show(struct seq_file *s, void *data) static int wil_tx_latency_debugfs_show(struct seq_file *s, void *data)
__acquires(&p->tid_rx_lock) __releases(&p->tid_rx_lock) __acquires(&p->tid_rx_lock) __releases(&p->tid_rx_lock)
...@@ -2443,23 +2287,23 @@ static const struct { ...@@ -2443,23 +2287,23 @@ static const struct {
umode_t mode; umode_t mode;
const struct file_operations *fops; const struct file_operations *fops;
} dbg_files[] = { } dbg_files[] = {
{"mbox", 0444, &fops_mbox}, {"mbox", 0444, &mbox_fops},
{"rings", 0444, &fops_ring}, {"rings", 0444, &ring_fops},
{"stations", 0444, &fops_sta}, {"stations", 0444, &sta_fops},
{"mids", 0444, &fops_mids}, {"mids", 0444, &mids_fops},
{"desc", 0444, &fops_txdesc}, {"desc", 0444, &txdesc_fops},
{"bf", 0444, &fops_bf}, {"bf", 0444, &bf_fops},
{"mem_val", 0644, &fops_memread}, {"mem_val", 0644, &memread_fops},
{"rxon", 0244, &fops_rxon}, {"rxon", 0244, &fops_rxon},
{"tx_mgmt", 0244, &fops_txmgmt}, {"tx_mgmt", 0244, &fops_txmgmt},
{"wmi_send", 0244, &fops_wmi}, {"wmi_send", 0244, &fops_wmi},
{"back", 0644, &fops_back}, {"back", 0644, &fops_back},
{"pmccfg", 0644, &fops_pmccfg}, {"pmccfg", 0644, &fops_pmccfg},
{"pmcdata", 0444, &fops_pmcdata}, {"pmcdata", 0444, &fops_pmcdata},
{"temp", 0444, &fops_temp}, {"temp", 0444, &temp_fops},
{"freq", 0444, &fops_freq}, {"freq", 0444, &freq_fops},
{"link", 0444, &fops_link}, {"link", 0444, &link_fops},
{"info", 0444, &fops_info}, {"info", 0444, &info_fops},
{"recovery", 0644, &fops_recovery}, {"recovery", 0644, &fops_recovery},
{"led_cfg", 0644, &fops_led_cfg}, {"led_cfg", 0644, &fops_led_cfg},
{"led_blink_time", 0644, &fops_led_blink_time}, {"led_blink_time", 0644, &fops_led_blink_time},
...@@ -2467,9 +2311,9 @@ static const struct { ...@@ -2467,9 +2311,9 @@ static const struct {
{"fw_version", 0444, &fops_fw_version}, {"fw_version", 0444, &fops_fw_version},
{"suspend_stats", 0644, &fops_suspend_stats}, {"suspend_stats", 0644, &fops_suspend_stats},
{"compressed_rx_status", 0644, &fops_compressed_rx_status}, {"compressed_rx_status", 0644, &fops_compressed_rx_status},
{"srings", 0444, &fops_srings}, {"srings", 0444, &srings_fops},
{"status_msg", 0444, &fops_status_msg}, {"status_msg", 0444, &status_msg_fops},
{"rx_buff_mgmt", 0444, &fops_rx_buff_mgmt}, {"rx_buff_mgmt", 0444, &rx_buff_mgmt_fops},
{"tx_latency", 0644, &fops_tx_latency}, {"tx_latency", 0644, &fops_tx_latency},
{"link_stats", 0644, &fops_link_stats}, {"link_stats", 0644, &fops_link_stats},
{"link_stats_global", 0644, &fops_link_stats_global}, {"link_stats_global", 0644, &fops_link_stats_global},
......
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