1 --- a/drivers/net/wireless/ath/ath9k/debug.c
2 +++ b/drivers/net/wireless/ath/ath9k/debug.c
3 @@ -783,6 +783,86 @@ static const struct file_operations fops
7 +static ssize_t read_file_regidx(struct file *file, char __user *user_buf,
8 + size_t count, loff_t *ppos)
10 + struct ath_softc *sc = file->private_data;
14 + len = snprintf(buf, sizeof(buf), "0x%08x\n", sc->debug.regidx);
15 + return simple_read_from_buffer(user_buf, count, ppos, buf, len);
18 +static ssize_t write_file_regidx(struct file *file, const char __user *user_buf,
19 + size_t count, loff_t *ppos)
21 + struct ath_softc *sc = file->private_data;
22 + unsigned long regidx;
26 + len = min(count, sizeof(buf) - 1);
27 + if (copy_from_user(buf, user_buf, len))
31 + if (strict_strtoul(buf, 0, ®idx))
34 + sc->debug.regidx = regidx;
38 +static const struct file_operations fops_regidx = {
39 + .read = read_file_regidx,
40 + .write = write_file_regidx,
41 + .open = ath9k_debugfs_open,
42 + .owner = THIS_MODULE
45 +static ssize_t read_file_regval(struct file *file, char __user *user_buf,
46 + size_t count, loff_t *ppos)
48 + struct ath_softc *sc = file->private_data;
49 + struct ath_hw *ah = sc->sc_ah;
54 + regval = REG_READ_D(ah, sc->debug.regidx);
55 + len = snprintf(buf, sizeof(buf), "0x%08x\n", regval);
56 + return simple_read_from_buffer(user_buf, count, ppos, buf, len);
59 +static ssize_t write_file_regval(struct file *file, const char __user *user_buf,
60 + size_t count, loff_t *ppos)
62 + struct ath_softc *sc = file->private_data;
63 + struct ath_hw *ah = sc->sc_ah;
64 + unsigned long regval;
68 + len = min(count, sizeof(buf) - 1);
69 + if (copy_from_user(buf, user_buf, len))
73 + if (strict_strtoul(buf, 0, ®val))
76 + REG_WRITE_D(ah, sc->debug.regidx, regval);
80 +static const struct file_operations fops_regval = {
81 + .read = read_file_regval,
82 + .write = write_file_regval,
83 + .open = ath9k_debugfs_open,
84 + .owner = THIS_MODULE
87 int ath9k_init_debug(struct ath_hw *ah)
89 struct ath_common *common = ath9k_hw_common(ah);
90 @@ -852,6 +932,17 @@ int ath9k_init_debug(struct ath_hw *ah)
91 if (!sc->debug.debugfs_recv)
94 + sc->debug.regidx = 0;
95 + sc->debug.debugfs_regidx = debugfs_create_file("regidx",
96 + S_IRUSR|S_IWUSR, sc->debug.debugfs_phy, sc, &fops_regidx);
97 + if (!sc->debug.debugfs_regidx)
100 + sc->debug.debugfs_regval = debugfs_create_file("regval",
101 + S_IRUSR|S_IWUSR, sc->debug.debugfs_phy, sc, &fops_regval);
102 + if (!sc->debug.debugfs_regval)
107 ath9k_exit_debug(ah);
108 @@ -865,6 +956,8 @@ void ath9k_exit_debug(struct ath_hw *ah)
110 debugfs_remove(sc->debug.debugfs_tx_chainmask);
111 debugfs_remove(sc->debug.debugfs_rx_chainmask);
112 + debugfs_remove(sc->debug.debugfs_regval);
113 + debugfs_remove(sc->debug.debugfs_regidx);
114 debugfs_remove(sc->debug.debugfs_recv);
115 debugfs_remove(sc->debug.debugfs_xmit);
116 debugfs_remove(sc->debug.debugfs_wiphy);
117 --- a/drivers/net/wireless/ath/ath9k/debug.h
118 +++ b/drivers/net/wireless/ath/ath9k/debug.h
119 @@ -158,6 +158,9 @@ struct ath9k_debug {
120 struct dentry *debugfs_wiphy;
121 struct dentry *debugfs_xmit;
122 struct dentry *debugfs_recv;
123 + struct dentry *debugfs_regidx;
124 + struct dentry *debugfs_regval;
126 struct ath_stats stats;