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