Lines Matching +full:name +full:-
1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
3 * Copyright (C) 2024-2025 Intel Corporation
8 #define MLD_DEBUGFS_OPEN_WRAPPER(name, buflen, argtype) \ argument
9 struct dbgfs_##name##_data { \
15 static int _iwl_dbgfs_##name##_open(struct inode *inode, \
18 struct dbgfs_##name##_data *data; \
20 if ((file->f_flags & O_ACCMODE) == O_RDWR) \
21 return -EOPNOTSUPP; \
25 return -ENOMEM; \
27 data->read_done = false; \
28 data->arg = inode->i_private; \
29 file->private_data = data; \
34 #define MLD_DEBUGFS_READ_WRAPPER(name) \ argument
35 static ssize_t _iwl_dbgfs_##name##_read(struct file *file, \
39 struct dbgfs_##name##_data *data = file->private_data; \
41 if (!data->read_done) { \
42 data->read_done = true; \
43 data->rlen = iwl_dbgfs_##name##_read(data->arg, \
44 sizeof(data->buf),\
45 data->buf); \
48 if (data->rlen < 0) \
49 return data->rlen; \
51 data->buf, data->rlen); \
56 kfree(file->private_data); in _iwl_dbgfs_release()
60 #define _MLD_DEBUGFS_READ_FILE_OPS(name, buflen, argtype) \ argument
61 MLD_DEBUGFS_OPEN_WRAPPER(name, buflen, argtype) \
62 MLD_DEBUGFS_READ_WRAPPER(name) \
63 static const struct file_operations iwl_dbgfs_##name##_ops = { \
64 .read = _iwl_dbgfs_##name##_read, \
65 .open = _iwl_dbgfs_##name##_open, \
70 #define WIPHY_DEBUGFS_WRITE_HANDLER_WRAPPER(name) \ argument
71 static ssize_t iwl_dbgfs_##name##_write_handler(struct wiphy *wiphy, \
77 return iwl_dbgfs_##name##_write(mld, buf, count, data); \
84 iwl_mld_sta_from_mac80211(link_sta->sta)->vif; in iwl_mld_from_link_sta()
85 return iwl_mld_vif_from_mac80211(vif)->mld; in iwl_mld_from_link_sta()
91 return iwl_mld_vif_from_mac80211(link->vif)->mld; in iwl_mld_from_bss_conf()
96 return iwl_mld_vif_from_mac80211(vif)->mld; in iwl_mld_from_vif()
99 #define WIPHY_DEBUGFS_WRITE_WRAPPER(name, bufsz, objtype) \ argument
100 WIPHY_DEBUGFS_WRITE_HANDLER_WRAPPER(name) \
101 static ssize_t __iwl_dbgfs_##name##_write(struct file *file, \
105 struct ieee80211_##objtype *arg = file->private_data; \
109 return wiphy_locked_debugfs_write(mld->wiphy, file, \
112 iwl_dbgfs_##name##_write_handler, \
116 #define WIPHY_DEBUGFS_WRITE_FILE_OPS(name, bufsz, objtype) \ argument
117 WIPHY_DEBUGFS_WRITE_WRAPPER(name, bufsz, objtype) \
118 static const struct file_operations iwl_dbgfs_##name##_ops = { \
119 .write = __iwl_dbgfs_##name##_write, \
124 #define WIPHY_DEBUGFS_READ_HANDLER_WRAPPER_MLD(name) \ argument
125 static ssize_t iwl_dbgfs_##name##_read_handler(struct wiphy *wiphy, \
131 return iwl_dbgfs_##name##_read(mld, buf, count); \
134 #define WIPHY_DEBUGFS_WRITE_HANDLER_WRAPPER_MLD(name) \ argument
135 static ssize_t iwl_dbgfs_##name##_write_handler(struct wiphy *wiphy, \
141 return iwl_dbgfs_##name##_write(mld, buf, count); \
144 #define WIPHY_DEBUGFS_WRITE_WRAPPER_MLD(name) \ argument
145 WIPHY_DEBUGFS_WRITE_HANDLER_WRAPPER_MLD(name) \
146 static ssize_t __iwl_dbgfs_##name##_write(struct file *file, \
150 struct dbgfs_##name##_data *data = file->private_data; \
151 struct iwl_mld *mld = data->arg; \
153 return wiphy_locked_debugfs_write(mld->wiphy, file, \
154 data->buf, sizeof(data->buf), \
156 iwl_dbgfs_##name##_write_handler, \
160 #define WIPHY_DEBUGFS_READ_WRAPPER_MLD(name) \ argument
161 WIPHY_DEBUGFS_READ_HANDLER_WRAPPER_MLD(name) \
162 static ssize_t __iwl_dbgfs_##name##_read(struct file *file, \
166 struct dbgfs_##name##_data *data = file->private_data; \
167 struct iwl_mld *mld = data->arg; \
169 if (!data->read_done) { \
170 data->read_done = true; \
171 data->rlen = wiphy_locked_debugfs_read(mld->wiphy, \
172 file, data->buf, sizeof(data->buf), \
174 iwl_dbgfs_##name##_read_handler, NULL); \
175 return data->rlen; \
178 if (data->rlen < 0) \
179 return data->rlen; \
181 data->buf, data->rlen); \
184 #define WIPHY_DEBUGFS_READ_FILE_OPS_MLD(name, bufsz) \ argument
185 MLD_DEBUGFS_OPEN_WRAPPER(name, bufsz, struct iwl_mld) \
186 WIPHY_DEBUGFS_READ_WRAPPER_MLD(name) \
187 static const struct file_operations iwl_dbgfs_##name##_ops = { \
188 .read = __iwl_dbgfs_##name##_read, \
189 .open = _iwl_dbgfs_##name##_open, \
194 #define WIPHY_DEBUGFS_WRITE_FILE_OPS_MLD(name, bufsz) \ argument
195 MLD_DEBUGFS_OPEN_WRAPPER(name, bufsz, struct iwl_mld) \
196 WIPHY_DEBUGFS_WRITE_WRAPPER_MLD(name) \
197 static const struct file_operations iwl_dbgfs_##name##_ops = { \
198 .write = __iwl_dbgfs_##name##_write, \
199 .open = _iwl_dbgfs_##name##_open, \
204 #define WIPHY_DEBUGFS_READ_WRITE_FILE_OPS_MLD(name, bufsz) \ argument
205 MLD_DEBUGFS_OPEN_WRAPPER(name, bufsz, struct iwl_mld) \
206 WIPHY_DEBUGFS_WRITE_WRAPPER_MLD(name) \
207 WIPHY_DEBUGFS_READ_WRAPPER_MLD(name) \
208 static const struct file_operations iwl_dbgfs_##name##_ops = { \
209 .write = __iwl_dbgfs_##name##_write, \
210 .read = __iwl_dbgfs_##name##_read, \
211 .open = _iwl_dbgfs_##name##_open, \
216 #define WIPHY_DEBUGFS_WRITE_WRAPPER_IEEE80211(name, bufsz, objtype) \ argument
217 WIPHY_DEBUGFS_WRITE_HANDLER_WRAPPER(name) \
218 static ssize_t _iwl_dbgfs_##name##_write(struct file *file, \
222 struct dbgfs_##name##_data *data = file->private_data; \
223 struct ieee80211_##objtype *arg = data->arg; \
227 return wiphy_locked_debugfs_write(mld->wiphy, file, \
230 iwl_dbgfs_##name##_write_handler, \
234 #define IEEE80211_WIPHY_DEBUGFS_READ_WRITE_FILE_OPS(name, bufsz, objtype) \ argument
235 MLD_DEBUGFS_OPEN_WRAPPER(name, bufsz, struct ieee80211_##objtype) \
236 WIPHY_DEBUGFS_WRITE_WRAPPER_IEEE80211(name, bufsz, objtype) \
237 MLD_DEBUGFS_READ_WRAPPER(name) \
238 static const struct file_operations iwl_dbgfs_##name##_ops = { \
239 .write = _iwl_dbgfs_##name##_write, \
240 .read = _iwl_dbgfs_##name##_read, \
241 .open = _iwl_dbgfs_##name##_open, \