Use the helper to get rid of the file operations per debugfs file. The
struct ath9k_softc pointer is set as device driver data to be obtained
in the seq_file read operation.
Signed-off-by: Arend van Spriel ar...@broadcom.com
---
drivers/net/wireless/ath/ath9k/ahb.c | 1 +
drivers/net/wireless/ath/ath9k/debug.c | 122 ++---
drivers/net/wireless/ath/ath9k/pci.c | 1 +
3 files changed, 24 insertions(+), 100 deletions(-)
diff --git a/drivers/net/wireless/ath/ath9k/ahb.c
b/drivers/net/wireless/ath/ath9k/ahb.c
index 4173838..74b009b 100644
--- a/drivers/net/wireless/ath/ath9k/ahb.c
+++ b/drivers/net/wireless/ath/ath9k/ahb.c
@@ -126,6 +126,7 @@ static int ath_ahb_probe(struct platform_device *pdev)
sc = hw-priv;
sc-hw = hw;
sc-dev = pdev-dev;
+ dev_set_drvdata(sc-dev, sc);
sc-mem = mem;
sc-irq = irq;
diff --git a/drivers/net/wireless/ath/ath9k/debug.c
b/drivers/net/wireless/ath/ath9k/debug.c
index 1d6bfda..62d8a09 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -403,7 +403,7 @@ static const struct file_operations fops_antenna_diversity
= {
static int read_file_dma(struct seq_file *file, void *data)
{
- struct ath_softc *sc = file-private;
+ struct ath_softc *sc = dev_get_drvdata(file-private);
struct ath_hw *ah = sc-sc_ah;
u32 val[ATH9K_NUM_DMA_DEBUG_REGS];
int i, qcuOffset = 0, dcuOffset = 0;
@@ -470,20 +470,6 @@ static int read_file_dma(struct seq_file *file, void *data)
return 0;
}
-static int open_file_dma(struct inode *inode, struct file *f)
-{
- return single_open(f, read_file_dma, inode-i_private);
-}
-
-static const struct file_operations fops_dma = {
- .open = open_file_dma,
- .read = seq_read,
- .owner = THIS_MODULE,
- .llseek = seq_lseek,
- .release = single_release,
-};
-
-
void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status)
{
if (status)
@@ -539,7 +525,7 @@ void ath_debug_stat_interrupt(struct ath_softc *sc, enum
ath9k_int status)
static int read_file_interrupt(struct seq_file *file, void *data)
{
- struct ath_softc *sc = file-private;
+ struct ath_softc *sc = dev_get_drvdata(file-private);
#define PR_IS(a, s)\
do {\
@@ -600,22 +586,9 @@ static int read_file_interrupt(struct seq_file *file, void
*data)
return 0;
}
-static int open_file_interrupt(struct inode *inode, struct file *f)
-{
- return single_open(f, read_file_interrupt, inode-i_private);
-}
-
-static const struct file_operations fops_interrupt = {
- .read = seq_read,
- .open = open_file_interrupt,
- .owner = THIS_MODULE,
- .llseek = seq_lseek,
- .release = single_release,
-};
-
static int read_file_xmit(struct seq_file *file, void *data)
{
- struct ath_softc *sc = file-private;
+ struct ath_softc *sc = dev_get_drvdata(file-private);
seq_printf(file, %30s %10s%10s%10s\n\n, BE, BK, VI, VO);
@@ -661,7 +634,7 @@ static void print_queue(struct ath_softc *sc, struct
ath_txq *txq,
static int read_file_queues(struct seq_file *file, void *data)
{
- struct ath_softc *sc = file-private;
+ struct ath_softc *sc = dev_get_drvdata(file-private);
struct ath_txq *txq;
int i;
static const char *qname[4] = {
@@ -682,7 +655,7 @@ static int read_file_queues(struct seq_file *file, void
*data)
static int read_file_misc(struct seq_file *file, void *data)
{
- struct ath_softc *sc = file-private;
+ struct ath_softc *sc = dev_get_drvdata(file-private);
struct ath_common *common = ath9k_hw_common(sc-sc_ah);
struct ath9k_vif_iter_data iter_data;
struct ath_chanctx *ctx;
@@ -772,7 +745,7 @@ static int read_file_misc(struct seq_file *file, void *data)
static int read_file_reset(struct seq_file *file, void *data)
{
- struct ath_softc *sc = file-private;
+ struct ath_softc *sc = dev_get_drvdata(file-private);
seq_printf(file, %17s: %2d\n, Baseband Hang,
sc-debug.stats.reset[RESET_TYPE_BB_HANG]);
@@ -833,58 +806,6 @@ void ath_debug_stat_tx(struct ath_softc *sc, struct
ath_buf *bf,
TX_STAT_INC(qnum, delim_underrun);
}
-static int open_file_xmit(struct inode *inode, struct file *f)
-{
- return single_open(f, read_file_xmit, inode-i_private);
-}
-
-static const struct file_operations fops_xmit = {
- .read = seq_read,
- .open = open_file_xmit,
- .owner = THIS_MODULE,
- .llseek = seq_lseek,
- .release = single_release,
-};
-
-static int open_file_queues(struct inode *inode, struct file *f)
-{
- return single_open(f, read_file_queues, inode-i_private);
-}
-
-static const struct file_operations fops_queues = {
- .read = seq_read,
-