304-mac80211-minstrel-remove-unnecessary-debugfs-cleanup.patch 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. From: Felix Fietkau <nbd@nbd.name>
  2. Date: Sat, 10 Feb 2018 12:41:51 +0100
  3. Subject: [PATCH] mac80211: minstrel: remove unnecessary debugfs cleanup
  4. code
  5. debugfs entries are cleaned up by debugfs_remove_recursive already.
  6. Signed-off-by: Felix Fietkau <nbd@nbd.name>
  7. ---
  8. --- a/net/mac80211/rc80211_minstrel.c
  9. +++ b/net/mac80211/rc80211_minstrel.c
  10. @@ -689,8 +689,8 @@ minstrel_alloc(struct ieee80211_hw *hw,
  11. #ifdef CPTCFG_MAC80211_DEBUGFS
  12. mp->fixed_rate_idx = (u32) -1;
  13. - mp->dbg_fixed_rate = debugfs_create_u32("fixed_rate_idx",
  14. - 0666, debugfsdir, &mp->fixed_rate_idx);
  15. + debugfs_create_u32("fixed_rate_idx", S_IRUGO | S_IWUGO, debugfsdir,
  16. + &mp->fixed_rate_idx);
  17. #endif
  18. minstrel_init_cck_rates(mp);
  19. @@ -701,9 +701,6 @@ minstrel_alloc(struct ieee80211_hw *hw,
  20. static void
  21. minstrel_free(void *priv)
  22. {
  23. -#ifdef CPTCFG_MAC80211_DEBUGFS
  24. - debugfs_remove(((struct minstrel_priv *)priv)->dbg_fixed_rate);
  25. -#endif
  26. kfree(priv);
  27. }
  28. @@ -735,7 +732,6 @@ const struct rate_control_ops mac80211_m
  29. .free_sta = minstrel_free_sta,
  30. #ifdef CPTCFG_MAC80211_DEBUGFS
  31. .add_sta_debugfs = minstrel_add_sta_debugfs,
  32. - .remove_sta_debugfs = minstrel_remove_sta_debugfs,
  33. #endif
  34. .get_expected_throughput = minstrel_get_expected_throughput,
  35. };
  36. --- a/net/mac80211/rc80211_minstrel.h
  37. +++ b/net/mac80211/rc80211_minstrel.h
  38. @@ -109,11 +109,6 @@ struct minstrel_sta_info {
  39. /* sampling table */
  40. u8 *sample_table;
  41. -
  42. -#ifdef CPTCFG_MAC80211_DEBUGFS
  43. - struct dentry *dbg_stats;
  44. - struct dentry *dbg_stats_csv;
  45. -#endif
  46. };
  47. struct minstrel_priv {
  48. @@ -137,7 +132,6 @@ struct minstrel_priv {
  49. * - setting will be applied on next update
  50. */
  51. u32 fixed_rate_idx;
  52. - struct dentry *dbg_fixed_rate;
  53. #endif
  54. };
  55. @@ -156,7 +150,6 @@ minstrel_get_ewmsd10(struct minstrel_rat
  56. extern const struct rate_control_ops mac80211_minstrel;
  57. void minstrel_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir);
  58. -void minstrel_remove_sta_debugfs(void *priv, void *priv_sta);
  59. /* Recalculate success probabilities and counters for a given rate using EWMA */
  60. void minstrel_calc_rate_stats(struct minstrel_rate_stats *mrs);
  61. --- a/net/mac80211/rc80211_minstrel_debugfs.c
  62. +++ b/net/mac80211/rc80211_minstrel_debugfs.c
  63. @@ -214,19 +214,7 @@ minstrel_add_sta_debugfs(void *priv, voi
  64. {
  65. struct minstrel_sta_info *mi = priv_sta;
  66. - mi->dbg_stats = debugfs_create_file("rc_stats", 0444, dir, mi,
  67. - &minstrel_stat_fops);
  68. -
  69. - mi->dbg_stats_csv = debugfs_create_file("rc_stats_csv", 0444, dir, mi,
  70. - &minstrel_stat_csv_fops);
  71. -}
  72. -
  73. -void
  74. -minstrel_remove_sta_debugfs(void *priv, void *priv_sta)
  75. -{
  76. - struct minstrel_sta_info *mi = priv_sta;
  77. -
  78. - debugfs_remove(mi->dbg_stats);
  79. -
  80. - debugfs_remove(mi->dbg_stats_csv);
  81. + debugfs_create_file("rc_stats", S_IRUGO, dir, mi, &minstrel_stat_fops);
  82. + debugfs_create_file("rc_stats_csv", S_IRUGO, dir, mi,
  83. + &minstrel_stat_csv_fops);
  84. }
  85. --- a/net/mac80211/rc80211_minstrel_ht.c
  86. +++ b/net/mac80211/rc80211_minstrel_ht.c
  87. @@ -1397,7 +1397,6 @@ static const struct rate_control_ops mac
  88. .free = minstrel_ht_free,
  89. #ifdef CPTCFG_MAC80211_DEBUGFS
  90. .add_sta_debugfs = minstrel_ht_add_sta_debugfs,
  91. - .remove_sta_debugfs = minstrel_ht_remove_sta_debugfs,
  92. #endif
  93. .get_expected_throughput = minstrel_ht_get_expected_throughput,
  94. };
  95. --- a/net/mac80211/rc80211_minstrel_ht.h
  96. +++ b/net/mac80211/rc80211_minstrel_ht.h
  97. @@ -110,17 +110,12 @@ struct minstrel_ht_sta_priv {
  98. struct minstrel_ht_sta ht;
  99. struct minstrel_sta_info legacy;
  100. };
  101. -#ifdef CPTCFG_MAC80211_DEBUGFS
  102. - struct dentry *dbg_stats;
  103. - struct dentry *dbg_stats_csv;
  104. -#endif
  105. void *ratelist;
  106. void *sample_table;
  107. bool is_ht;
  108. };
  109. void minstrel_ht_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir);
  110. -void minstrel_ht_remove_sta_debugfs(void *priv, void *priv_sta);
  111. int minstrel_ht_get_tp_avg(struct minstrel_ht_sta *mi, int group, int rate,
  112. int prob_ewma);
  113. --- a/net/mac80211/rc80211_minstrel_ht_debugfs.c
  114. +++ b/net/mac80211/rc80211_minstrel_ht_debugfs.c
  115. @@ -303,17 +303,8 @@ minstrel_ht_add_sta_debugfs(void *priv,
  116. {
  117. struct minstrel_ht_sta_priv *msp = priv_sta;
  118. - msp->dbg_stats = debugfs_create_file("rc_stats", 0444, dir, msp,
  119. - &minstrel_ht_stat_fops);
  120. - msp->dbg_stats_csv = debugfs_create_file("rc_stats_csv", 0444, dir, msp,
  121. - &minstrel_ht_stat_csv_fops);
  122. -}
  123. -
  124. -void
  125. -minstrel_ht_remove_sta_debugfs(void *priv, void *priv_sta)
  126. -{
  127. - struct minstrel_ht_sta_priv *msp = priv_sta;
  128. -
  129. - debugfs_remove(msp->dbg_stats);
  130. - debugfs_remove(msp->dbg_stats_csv);
  131. + debugfs_create_file("rc_stats", S_IRUGO, dir, msp,
  132. + &minstrel_ht_stat_fops);
  133. + debugfs_create_file("rc_stats_csv", S_IRUGO, dir, msp,
  134. + &minstrel_ht_stat_csv_fops);
  135. }