[mpc83xx]: do old style image generation for the mpc8377wlan, as the current bootload...
[openwrt.git] / package / mac80211 / patches / 510-ath9k_debugfs_regaccess.patch
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
4 .owner = THIS_MODULE
5 };
6
7 +static ssize_t read_file_regidx(struct file *file, char __user *user_buf,
8 + size_t count, loff_t *ppos)
9 +{
10 + struct ath_softc *sc = file->private_data;
11 + char buf[32];
12 + unsigned int len;
13 +
14 + len = snprintf(buf, sizeof(buf), "0x%08x\n", sc->debug.regidx);
15 + return simple_read_from_buffer(user_buf, count, ppos, buf, len);
16 +}
17 +
18 +static ssize_t write_file_regidx(struct file *file, const char __user *user_buf,
19 + size_t count, loff_t *ppos)
20 +{
21 + struct ath_softc *sc = file->private_data;
22 + unsigned long regidx;
23 + char buf[32];
24 + ssize_t len;
25 +
26 + len = min(count, sizeof(buf) - 1);
27 + if (copy_from_user(buf, user_buf, len))
28 + return -EINVAL;
29 +
30 + buf[len] = '\0';
31 + if (strict_strtoul(buf, 0, &regidx))
32 + return -EINVAL;
33 +
34 + sc->debug.regidx = regidx;
35 + return count;
36 +}
37 +
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
43 +};
44 +
45 +static ssize_t read_file_regval(struct file *file, char __user *user_buf,
46 + size_t count, loff_t *ppos)
47 +{
48 + struct ath_softc *sc = file->private_data;
49 + struct ath_hw *ah = sc->sc_ah;
50 + char buf[32];
51 + unsigned int len;
52 + u32 regval;
53 +
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);
57 +}
58 +
59 +static ssize_t write_file_regval(struct file *file, const char __user *user_buf,
60 + size_t count, loff_t *ppos)
61 +{
62 + struct ath_softc *sc = file->private_data;
63 + struct ath_hw *ah = sc->sc_ah;
64 + unsigned long regval;
65 + char buf[32];
66 + ssize_t len;
67 +
68 + len = min(count, sizeof(buf) - 1);
69 + if (copy_from_user(buf, user_buf, len))
70 + return -EINVAL;
71 +
72 + buf[len] = '\0';
73 + if (strict_strtoul(buf, 0, &regval))
74 + return -EINVAL;
75 +
76 + REG_WRITE_D(ah, sc->debug.regidx, regval);
77 + return count;
78 +}
79 +
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
85 +};
86 +
87 int ath9k_init_debug(struct ath_hw *ah)
88 {
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)
92 goto err;
93
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)
98 + goto err;
99 +
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)
103 + goto err;
104 +
105 return 0;
106 err:
107 ath9k_exit_debug(ah);
108 @@ -865,6 +956,8 @@ void ath9k_exit_debug(struct ath_hw *ah)
109
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;
125 + u32 regidx;
126 struct ath_stats stats;
127 };
128
This page took 0.045057 seconds and 5 git commands to generate.