ath9k: remove virtual wiphy support - it was only experimental anyway and it is not...
[openwrt/staging/mkresin.git] / package / mac80211 / patches / 540-ath9k_remove_virtual_debugfs.patch
1 --- a/drivers/net/wireless/ath/ath9k/debug.c
2 +++ b/drivers/net/wireless/ath/ath9k/debug.c
3 @@ -381,41 +381,21 @@ static const struct file_operations fops
4 .llseek = default_llseek,
5 };
6
7 -static const char * ath_wiphy_state_str(enum ath_wiphy_state state)
8 -{
9 - switch (state) {
10 - case ATH_WIPHY_INACTIVE:
11 - return "INACTIVE";
12 - case ATH_WIPHY_ACTIVE:
13 - return "ACTIVE";
14 - case ATH_WIPHY_PAUSING:
15 - return "PAUSING";
16 - case ATH_WIPHY_PAUSED:
17 - return "PAUSED";
18 - case ATH_WIPHY_SCAN:
19 - return "SCAN";
20 - }
21 - return "?";
22 -}
23 -
24 static ssize_t read_file_wiphy(struct file *file, char __user *user_buf,
25 size_t count, loff_t *ppos)
26 {
27 struct ath_softc *sc = file->private_data;
28 - struct ath_wiphy *aphy = sc->pri_wiphy;
29 - struct ieee80211_channel *chan = aphy->hw->conf.channel;
30 + struct ieee80211_channel *chan = sc->hw->conf.channel;
31 char buf[512];
32 unsigned int len = 0;
33 - int i;
34 u8 addr[ETH_ALEN];
35 u32 tmp;
36
37 len += snprintf(buf + len, sizeof(buf) - len,
38 - "primary: %s (%s chan=%d ht=%d)\n",
39 - wiphy_name(sc->pri_wiphy->hw->wiphy),
40 - ath_wiphy_state_str(sc->pri_wiphy->state),
41 + "%s (chan=%d ht=%d)\n",
42 + wiphy_name(sc->hw->wiphy),
43 ieee80211_frequency_to_channel(chan->center_freq),
44 - aphy->chan_is_ht);
45 + conf_is_ht(&sc->hw->conf));
46
47 put_unaligned_le32(REG_READ_D(sc->sc_ah, AR_STA_ID0), addr);
48 put_unaligned_le16(REG_READ_D(sc->sc_ah, AR_STA_ID1) & 0xffff, addr + 4);
49 @@ -457,123 +437,14 @@ static ssize_t read_file_wiphy(struct fi
50 else
51 len += snprintf(buf + len, sizeof(buf) - len, "\n");
52
53 - /* Put variable-length stuff down here, and check for overflows. */
54 - for (i = 0; i < sc->num_sec_wiphy; i++) {
55 - struct ath_wiphy *aphy_tmp = sc->sec_wiphy[i];
56 - if (aphy_tmp == NULL)
57 - continue;
58 - chan = aphy_tmp->hw->conf.channel;
59 - len += snprintf(buf + len, sizeof(buf) - len,
60 - "secondary: %s (%s chan=%d ht=%d)\n",
61 - wiphy_name(aphy_tmp->hw->wiphy),
62 - ath_wiphy_state_str(aphy_tmp->state),
63 - ieee80211_frequency_to_channel(chan->center_freq),
64 - aphy_tmp->chan_is_ht);
65 - }
66 if (len > sizeof(buf))
67 len = sizeof(buf);
68
69 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
70 }
71
72 -static struct ath_wiphy * get_wiphy(struct ath_softc *sc, const char *name)
73 -{
74 - int i;
75 - if (strcmp(name, wiphy_name(sc->pri_wiphy->hw->wiphy)) == 0)
76 - return sc->pri_wiphy;
77 - for (i = 0; i < sc->num_sec_wiphy; i++) {
78 - struct ath_wiphy *aphy = sc->sec_wiphy[i];
79 - if (aphy && strcmp(name, wiphy_name(aphy->hw->wiphy)) == 0)
80 - return aphy;
81 - }
82 - return NULL;
83 -}
84 -
85 -static int del_wiphy(struct ath_softc *sc, const char *name)
86 -{
87 - struct ath_wiphy *aphy = get_wiphy(sc, name);
88 - if (!aphy)
89 - return -ENOENT;
90 - return ath9k_wiphy_del(aphy);
91 -}
92 -
93 -static int pause_wiphy(struct ath_softc *sc, const char *name)
94 -{
95 - struct ath_wiphy *aphy = get_wiphy(sc, name);
96 - if (!aphy)
97 - return -ENOENT;
98 - return ath9k_wiphy_pause(aphy);
99 -}
100 -
101 -static int unpause_wiphy(struct ath_softc *sc, const char *name)
102 -{
103 - struct ath_wiphy *aphy = get_wiphy(sc, name);
104 - if (!aphy)
105 - return -ENOENT;
106 - return ath9k_wiphy_unpause(aphy);
107 -}
108 -
109 -static int select_wiphy(struct ath_softc *sc, const char *name)
110 -{
111 - struct ath_wiphy *aphy = get_wiphy(sc, name);
112 - if (!aphy)
113 - return -ENOENT;
114 - return ath9k_wiphy_select(aphy);
115 -}
116 -
117 -static int schedule_wiphy(struct ath_softc *sc, const char *msec)
118 -{
119 - ath9k_wiphy_set_scheduler(sc, simple_strtoul(msec, NULL, 0));
120 - return 0;
121 -}
122 -
123 -static ssize_t write_file_wiphy(struct file *file, const char __user *user_buf,
124 - size_t count, loff_t *ppos)
125 -{
126 - struct ath_softc *sc = file->private_data;
127 - char buf[50];
128 - size_t len;
129 -
130 - len = min(count, sizeof(buf) - 1);
131 - if (copy_from_user(buf, user_buf, len))
132 - return -EFAULT;
133 - buf[len] = '\0';
134 - if (len > 0 && buf[len - 1] == '\n')
135 - buf[len - 1] = '\0';
136 -
137 - if (strncmp(buf, "add", 3) == 0) {
138 - int res = ath9k_wiphy_add(sc);
139 - if (res < 0)
140 - return res;
141 - } else if (strncmp(buf, "del=", 4) == 0) {
142 - int res = del_wiphy(sc, buf + 4);
143 - if (res < 0)
144 - return res;
145 - } else if (strncmp(buf, "pause=", 6) == 0) {
146 - int res = pause_wiphy(sc, buf + 6);
147 - if (res < 0)
148 - return res;
149 - } else if (strncmp(buf, "unpause=", 8) == 0) {
150 - int res = unpause_wiphy(sc, buf + 8);
151 - if (res < 0)
152 - return res;
153 - } else if (strncmp(buf, "select=", 7) == 0) {
154 - int res = select_wiphy(sc, buf + 7);
155 - if (res < 0)
156 - return res;
157 - } else if (strncmp(buf, "schedule=", 9) == 0) {
158 - int res = schedule_wiphy(sc, buf + 9);
159 - if (res < 0)
160 - return res;
161 - } else
162 - return -EOPNOTSUPP;
163 -
164 - return count;
165 -}
166 -
167 static const struct file_operations fops_wiphy = {
168 .read = read_file_wiphy,
169 - .write = write_file_wiphy,
170 .open = ath9k_debugfs_open,
171 .owner = THIS_MODULE,
172 .llseek = default_llseek,