]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: mac80211: convert debugfs files to short fops
authorJohannes Berg <johannes.berg@intel.com>
Tue, 22 Oct 2024 13:18:35 +0000 (15:18 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 23 Oct 2024 14:47:07 +0000 (16:47 +0200)
Given the large size of the regular struct file_operations, save
a lot of space with the newly added short fops for debugfs.

Link: https://patch.msgid.link/20241022151838.2f6de3ea3ecc.I45657e6a8415d796ec95c95becc9efb377ee3be6@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/debugfs.c
net/mac80211/debugfs_key.c
net/mac80211/debugfs_netdev.c
net/mac80211/debugfs_sta.c
net/mac80211/rate.c
net/mac80211/rate.h

index b777240c924ea4c1531f846511cb72ba8022b0ae..be2e486907f94ad5015ef3999996bf906366bd37 100644 (file)
@@ -42,9 +42,8 @@ static ssize_t name## _read(struct file *file, char __user *userbuf,  \
 }
 
 #define DEBUGFS_READONLY_FILE_OPS(name)                        \
-static const struct file_operations name## _ops = {                    \
+static const struct debugfs_short_fops name## _ops = {                         \
        .read = name## _read,                                           \
-       .open = simple_open,                                            \
        .llseek = generic_file_llseek,                                  \
 };
 
@@ -142,10 +141,9 @@ static ssize_t aqm_write(struct file *file,
        return -EINVAL;
 }
 
-static const struct file_operations aqm_ops = {
+static const struct debugfs_short_fops aqm_ops = {
        .write = aqm_write,
        .read = aqm_read,
-       .open = simple_open,
        .llseek = default_llseek,
 };
 
@@ -194,10 +192,9 @@ static ssize_t airtime_flags_write(struct file *file,
        return count;
 }
 
-static const struct file_operations airtime_flags_ops = {
+static const struct debugfs_short_fops airtime_flags_ops = {
        .write = airtime_flags_write,
        .read = airtime_flags_read,
-       .open = simple_open,
        .llseek = default_llseek,
 };
 
@@ -225,9 +222,8 @@ static ssize_t aql_pending_read(struct file *file,
                                       buf, len);
 }
 
-static const struct file_operations aql_pending_ops = {
+static const struct debugfs_short_fops aql_pending_ops = {
        .read = aql_pending_read,
-       .open = simple_open,
        .llseek = default_llseek,
 };
 
@@ -305,10 +301,9 @@ static ssize_t aql_txq_limit_write(struct file *file,
        return count;
 }
 
-static const struct file_operations aql_txq_limit_ops = {
+static const struct debugfs_short_fops aql_txq_limit_ops = {
        .write = aql_txq_limit_write,
        .read = aql_txq_limit_read,
-       .open = simple_open,
        .llseek = default_llseek,
 };
 
@@ -355,10 +350,9 @@ static ssize_t aql_enable_write(struct file *file, const char __user *user_buf,
        return count;
 }
 
-static const struct file_operations aql_enable_ops = {
+static const struct debugfs_short_fops aql_enable_ops = {
        .write = aql_enable_write,
        .read = aql_enable_read,
-       .open = simple_open,
        .llseek = default_llseek,
 };
 
@@ -406,10 +400,9 @@ static ssize_t force_tx_status_write(struct file *file,
        return count;
 }
 
-static const struct file_operations force_tx_status_ops = {
+static const struct debugfs_short_fops force_tx_status_ops = {
        .write = force_tx_status_write,
        .read = force_tx_status_read,
-       .open = simple_open,
        .llseek = default_llseek,
 };
 
@@ -434,9 +427,8 @@ static ssize_t reset_write(struct file *file, const char __user *user_buf,
        return count;
 }
 
-static const struct file_operations reset_ops = {
+static const struct debugfs_short_fops reset_ops = {
        .write = reset_write,
-       .open = simple_open,
        .llseek = noop_llseek,
 };
 #endif
@@ -624,9 +616,8 @@ static ssize_t stats_ ##name## _read(struct file *file,                     \
                                      print_devstats_##name);           \
 }                                                                      \
                                                                        \
-static const struct file_operations stats_ ##name## _ops = {           \
+static const struct debugfs_short_fops stats_ ##name## _ops = {                        \
        .read = stats_ ##name## _read,                                  \
-       .open = simple_open,                                            \
        .llseek = generic_file_llseek,                                  \
 };
 
index 7e54da50876565ecee047c2364324b93f95c9c30..b3a64edea0f2adae633a4f01e63882f2c1da456e 100644 (file)
@@ -26,17 +26,15 @@ static ssize_t key_##name##_read(struct file *file,                 \
 #define KEY_READ_X(name) KEY_READ(name, name, "0x%x\n")
 
 #define KEY_OPS(name)                                                  \
-static const struct file_operations key_ ##name## _ops = {             \
+static const struct debugfs_short_fops key_ ##name## _ops = {          \
        .read = key_##name##_read,                                      \
-       .open = simple_open,                                            \
        .llseek = generic_file_llseek,                                  \
 }
 
 #define KEY_OPS_W(name)                                                        \
-static const struct file_operations key_ ##name## _ops = {             \
+static const struct debugfs_short_fops key_ ##name## _ops = {          \
        .read = key_##name##_read,                                      \
        .write = key_##name##_write,                                    \
-       .open = simple_open,                                            \
        .llseek = generic_file_llseek,                                  \
 }
 
@@ -49,9 +47,8 @@ static const struct file_operations key_ ##name## _ops = {            \
 #define KEY_CONF_READ_D(name) KEY_CONF_READ(name, "%d\n")
 
 #define KEY_CONF_OPS(name)                                             \
-static const struct file_operations key_ ##name## _ops = {             \
+static const struct debugfs_short_fops key_ ##name## _ops = {          \
        .read = key_conf_##name##_read,                                 \
-       .open = simple_open,                                            \
        .llseek = generic_file_llseek,                                  \
 }
 
index 68596ef78b15ee9596f6f81e8dd2d2f82c1d56cd..a9bc2fd59f55ad3b1efec7f47d499fbeb4448584 100644 (file)
@@ -221,10 +221,9 @@ static ssize_t ieee80211_if_fmt_##name(                                    \
 }
 
 #define _IEEE80211_IF_FILE_OPS(name, _read, _write)                    \
-static const struct file_operations name##_ops = {                     \
+static const struct debugfs_short_fops name##_ops = {                          \
        .read = (_read),                                                \
        .write = (_write),                                              \
-       .open = simple_open,                                            \
        .llseek = generic_file_llseek,                                  \
 }
 
index 1e9389c49a57d02120ed96a963301d1d8e0de9c8..a67a9d3160086ac492d77092a0c8a74d2384b28c 100644 (file)
@@ -30,17 +30,15 @@ static ssize_t sta_ ##name## _read(struct file *file,                       \
 #define STA_READ_D(name, field) STA_READ(name, field, "%d\n")
 
 #define STA_OPS(name)                                                  \
-static const struct file_operations sta_ ##name## _ops = {             \
+static const struct debugfs_short_fops sta_ ##name## _ops = {          \
        .read = sta_##name##_read,                                      \
-       .open = simple_open,                                            \
        .llseek = generic_file_llseek,                                  \
 }
 
 #define STA_OPS_RW(name)                                               \
-static const struct file_operations sta_ ##name## _ops = {             \
+static const struct debugfs_short_fops sta_ ##name## _ops = {          \
        .read = sta_##name##_read,                                      \
        .write = sta_##name##_write,                                    \
-       .open = simple_open,                                            \
        .llseek = generic_file_llseek,                                  \
 }
 
@@ -450,9 +448,8 @@ STA_OPS_RW(agg_status);
 
 /* link sta attributes */
 #define LINK_STA_OPS(name)                                             \
-static const struct file_operations link_sta_ ##name## _ops = {                \
+static const struct debugfs_short_fops link_sta_ ##name## _ops = {             \
        .read = link_sta_##name##_read,                                 \
-       .open = simple_open,                                            \
        .llseek = generic_file_llseek,                                  \
 }
 
index 63fe58311a77c16c21ea043fd4be6682fd9b9284..0d056db9f81e632e3b23f1c59c7f40a1e6bcbd0f 100644 (file)
@@ -249,9 +249,8 @@ static ssize_t rcname_read(struct file *file, char __user *userbuf,
                                       ref->ops->name, len);
 }
 
-const struct file_operations rcname_ops = {
+const struct debugfs_short_fops rcname_ops = {
        .read = rcname_read,
-       .open = simple_open,
        .llseek = default_llseek,
 };
 #endif
index 673aa9efe30b34cfc89cae5d92b2459996ad075f..5e4bde5982128acac48242be4b6fd6b26a2b3403 100644 (file)
@@ -62,7 +62,7 @@ static inline void rate_control_add_sta_debugfs(struct sta_info *sta)
 #endif
 }
 
-extern const struct file_operations rcname_ops;
+extern const struct debugfs_short_fops rcname_ops;
 
 static inline void rate_control_add_debugfs(struct ieee80211_local *local)
 {