OSDN Git Service

iwlegacy: 4965: no need to check return value of debugfs_create functions
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 12 Jun 2019 14:26:55 +0000 (16:26 +0200)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 25 Jun 2019 05:08:06 +0000 (08:08 +0300)
When calling debugfs functions, there is no need to ever check the
return value.  This driver was saving the debugfs file away to be
removed at a later time.  However, the 80211 core would delete the whole
directory that the debugfs files are created in, after it asks the
driver to do the deletion, so just rely on the 80211 core to do all of
the cleanup for us, making us not need to keep a pointer to the dentries
around at all.

This cleans up the structure of the driver data a bit and makes the code
a tiny bit smaller.

Cc: Stanislaw Gruszka <sgruszka@redhat.com>
Cc: Kalle Valo <kvalo@codeaurora.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/intel/iwlegacy/4965-rs.c
drivers/net/wireless/intel/iwlegacy/common.h

index 54ff838..f640709 100644 (file)
@@ -2767,29 +2767,15 @@ static void
 il4965_rs_add_debugfs(void *il, void *il_sta, struct dentry *dir)
 {
        struct il_lq_sta *lq_sta = il_sta;
-       lq_sta->rs_sta_dbgfs_scale_table_file =
-           debugfs_create_file("rate_scale_table", 0600, dir,
-                               lq_sta, &rs_sta_dbgfs_scale_table_ops);
-       lq_sta->rs_sta_dbgfs_stats_table_file =
-           debugfs_create_file("rate_stats_table", 0400, dir, lq_sta,
-                               &rs_sta_dbgfs_stats_table_ops);
-       lq_sta->rs_sta_dbgfs_rate_scale_data_file =
-           debugfs_create_file("rate_scale_data", 0400, dir, lq_sta,
-                               &rs_sta_dbgfs_rate_scale_data_ops);
-       lq_sta->rs_sta_dbgfs_tx_agg_tid_en_file =
-           debugfs_create_u8("tx_agg_tid_enable", 0600, dir,
-                             &lq_sta->tx_agg_tid_en);
 
-}
-
-static void
-il4965_rs_remove_debugfs(void *il, void *il_sta)
-{
-       struct il_lq_sta *lq_sta = il_sta;
-       debugfs_remove(lq_sta->rs_sta_dbgfs_scale_table_file);
-       debugfs_remove(lq_sta->rs_sta_dbgfs_stats_table_file);
-       debugfs_remove(lq_sta->rs_sta_dbgfs_rate_scale_data_file);
-       debugfs_remove(lq_sta->rs_sta_dbgfs_tx_agg_tid_en_file);
+       debugfs_create_file("rate_scale_table", 0600, dir, lq_sta,
+                           &rs_sta_dbgfs_scale_table_ops);
+       debugfs_create_file("rate_stats_table", 0400, dir, lq_sta,
+                           &rs_sta_dbgfs_stats_table_ops);
+       debugfs_create_file("rate_scale_data", 0400, dir, lq_sta,
+                           &rs_sta_dbgfs_rate_scale_data_ops);
+       debugfs_create_u8("tx_agg_tid_enable", 0600, dir,
+                         &lq_sta->tx_agg_tid_en);
 }
 #endif
 
@@ -2816,7 +2802,6 @@ static const struct rate_control_ops rs_4965_ops = {
        .free_sta = il4965_rs_free_sta,
 #ifdef CONFIG_MAC80211_DEBUGFS
        .add_sta_debugfs = il4965_rs_add_debugfs,
-       .remove_sta_debugfs = il4965_rs_remove_debugfs,
 #endif
 };
 
index 986646a..3c6f417 100644 (file)
@@ -2822,10 +2822,6 @@ struct il_lq_sta {
        struct il_traffic_load load[TID_MAX_LOAD_COUNT];
        u8 tx_agg_tid_en;
 #ifdef CONFIG_MAC80211_DEBUGFS
-       struct dentry *rs_sta_dbgfs_scale_table_file;
-       struct dentry *rs_sta_dbgfs_stats_table_file;
-       struct dentry *rs_sta_dbgfs_rate_scale_data_file;
-       struct dentry *rs_sta_dbgfs_tx_agg_tid_en_file;
        u32 dbg_fixed_rate;
 #endif
        struct il_priv *drv;