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,
7 -static const char * ath_wiphy_state_str(enum ath_wiphy_state state)
10 - case ATH_WIPHY_INACTIVE:
12 - case ATH_WIPHY_ACTIVE:
14 - case ATH_WIPHY_PAUSING:
16 - case ATH_WIPHY_PAUSED:
18 - case ATH_WIPHY_SCAN:
24 static ssize_t read_file_wiphy(struct file *file, char __user *user_buf,
25 size_t count, loff_t *ppos)
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;
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),
45 + conf_is_ht(&sc->hw->conf));
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
51 len += snprintf(buf + len, sizeof(buf) - len, "\n");
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)
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);
66 if (len > sizeof(buf))
69 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
72 -static struct ath_wiphy * get_wiphy(struct ath_softc *sc, const char *name)
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)
85 -static int del_wiphy(struct ath_softc *sc, const char *name)
87 - struct ath_wiphy *aphy = get_wiphy(sc, name);
90 - return ath9k_wiphy_del(aphy);
93 -static int pause_wiphy(struct ath_softc *sc, const char *name)
95 - struct ath_wiphy *aphy = get_wiphy(sc, name);
98 - return ath9k_wiphy_pause(aphy);
101 -static int unpause_wiphy(struct ath_softc *sc, const char *name)
103 - struct ath_wiphy *aphy = get_wiphy(sc, name);
106 - return ath9k_wiphy_unpause(aphy);
109 -static int select_wiphy(struct ath_softc *sc, const char *name)
111 - struct ath_wiphy *aphy = get_wiphy(sc, name);
114 - return ath9k_wiphy_select(aphy);
117 -static int schedule_wiphy(struct ath_softc *sc, const char *msec)
119 - ath9k_wiphy_set_scheduler(sc, simple_strtoul(msec, NULL, 0));
123 -static ssize_t write_file_wiphy(struct file *file, const char __user *user_buf,
124 - size_t count, loff_t *ppos)
126 - struct ath_softc *sc = file->private_data;
130 - len = min(count, sizeof(buf) - 1);
131 - if (copy_from_user(buf, user_buf, len))
134 - if (len > 0 && buf[len - 1] == '\n')
135 - buf[len - 1] = '\0';
137 - if (strncmp(buf, "add", 3) == 0) {
138 - int res = ath9k_wiphy_add(sc);
141 - } else if (strncmp(buf, "del=", 4) == 0) {
142 - int res = del_wiphy(sc, buf + 4);
145 - } else if (strncmp(buf, "pause=", 6) == 0) {
146 - int res = pause_wiphy(sc, buf + 6);
149 - } else if (strncmp(buf, "unpause=", 8) == 0) {
150 - int res = unpause_wiphy(sc, buf + 8);
153 - } else if (strncmp(buf, "select=", 7) == 0) {
154 - int res = select_wiphy(sc, buf + 7);
157 - } else if (strncmp(buf, "schedule=", 9) == 0) {
158 - int res = schedule_wiphy(sc, buf + 9);
162 - return -EOPNOTSUPP;
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,