540-ath9k_remove_virtual_debugfs.patch 4.7 KB

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