aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlegacy/iwl-debugfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlegacy/iwl-debugfs.c')
-rw-r--r--drivers/net/wireless/iwlegacy/iwl-debugfs.c338
1 files changed, 169 insertions, 169 deletions
diff --git a/drivers/net/wireless/iwlegacy/iwl-debugfs.c b/drivers/net/wireless/iwlegacy/iwl-debugfs.c
index 057dec5b178c..f2f2eba7d3ea 100644
--- a/drivers/net/wireless/iwlegacy/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlegacy/iwl-debugfs.c
@@ -36,7 +36,7 @@
36 36
37/* create and remove of files */ 37/* create and remove of files */
38#define DEBUGFS_ADD_FILE(name, parent, mode) do { \ 38#define DEBUGFS_ADD_FILE(name, parent, mode) do { \
39 if (!debugfs_create_file(#name, mode, parent, priv, \ 39 if (!debugfs_create_file(#name, mode, parent, il, \
40 &il_dbgfs_##name##_ops)) \ 40 &il_dbgfs_##name##_ops)) \
41 goto err; \ 41 goto err; \
42} while (0) 42} while (0)
@@ -106,7 +106,7 @@ static ssize_t il_dbgfs_tx_statistics_read(struct file *file,
106 char __user *user_buf, 106 char __user *user_buf,
107 size_t count, loff_t *ppos) { 107 size_t count, loff_t *ppos) {
108 108
109 struct il_priv *priv = file->private_data; 109 struct il_priv *il = file->private_data;
110 char *buf; 110 char *buf;
111 int pos = 0; 111 int pos = 0;
112 112
@@ -122,20 +122,20 @@ static ssize_t il_dbgfs_tx_statistics_read(struct file *file,
122 pos += scnprintf(buf + pos, bufsz - pos, 122 pos += scnprintf(buf + pos, bufsz - pos,
123 "\t%25s\t\t: %u\n", 123 "\t%25s\t\t: %u\n",
124 il_get_mgmt_string(cnt), 124 il_get_mgmt_string(cnt),
125 priv->tx_stats.mgmt[cnt]); 125 il->tx_stats.mgmt[cnt]);
126 } 126 }
127 pos += scnprintf(buf + pos, bufsz - pos, "Control\n"); 127 pos += scnprintf(buf + pos, bufsz - pos, "Control\n");
128 for (cnt = 0; cnt < CONTROL_MAX; cnt++) { 128 for (cnt = 0; cnt < CONTROL_MAX; cnt++) {
129 pos += scnprintf(buf + pos, bufsz - pos, 129 pos += scnprintf(buf + pos, bufsz - pos,
130 "\t%25s\t\t: %u\n", 130 "\t%25s\t\t: %u\n",
131 il_get_ctrl_string(cnt), 131 il_get_ctrl_string(cnt),
132 priv->tx_stats.ctrl[cnt]); 132 il->tx_stats.ctrl[cnt]);
133 } 133 }
134 pos += scnprintf(buf + pos, bufsz - pos, "Data:\n"); 134 pos += scnprintf(buf + pos, bufsz - pos, "Data:\n");
135 pos += scnprintf(buf + pos, bufsz - pos, "\tcnt: %u\n", 135 pos += scnprintf(buf + pos, bufsz - pos, "\tcnt: %u\n",
136 priv->tx_stats.data_cnt); 136 il->tx_stats.data_cnt);
137 pos += scnprintf(buf + pos, bufsz - pos, "\tbytes: %llu\n", 137 pos += scnprintf(buf + pos, bufsz - pos, "\tbytes: %llu\n",
138 priv->tx_stats.data_bytes); 138 il->tx_stats.data_bytes);
139 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); 139 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
140 kfree(buf); 140 kfree(buf);
141 return ret; 141 return ret;
@@ -146,7 +146,7 @@ il_dbgfs_clear_traffic_statistics_write(struct file *file,
146 const char __user *user_buf, 146 const char __user *user_buf,
147 size_t count, loff_t *ppos) 147 size_t count, loff_t *ppos)
148{ 148{
149 struct il_priv *priv = file->private_data; 149 struct il_priv *il = file->private_data;
150 u32 clear_flag; 150 u32 clear_flag;
151 char buf[8]; 151 char buf[8];
152 int buf_size; 152 int buf_size;
@@ -157,7 +157,7 @@ il_dbgfs_clear_traffic_statistics_write(struct file *file,
157 return -EFAULT; 157 return -EFAULT;
158 if (sscanf(buf, "%x", &clear_flag) != 1) 158 if (sscanf(buf, "%x", &clear_flag) != 1)
159 return -EFAULT; 159 return -EFAULT;
160 il_clear_traffic_stats(priv); 160 il_clear_traffic_stats(il);
161 161
162 return count; 162 return count;
163} 163}
@@ -166,7 +166,7 @@ static ssize_t il_dbgfs_rx_statistics_read(struct file *file,
166 char __user *user_buf, 166 char __user *user_buf,
167 size_t count, loff_t *ppos) { 167 size_t count, loff_t *ppos) {
168 168
169 struct il_priv *priv = file->private_data; 169 struct il_priv *il = file->private_data;
170 char *buf; 170 char *buf;
171 int pos = 0; 171 int pos = 0;
172 int cnt; 172 int cnt;
@@ -182,20 +182,20 @@ static ssize_t il_dbgfs_rx_statistics_read(struct file *file,
182 pos += scnprintf(buf + pos, bufsz - pos, 182 pos += scnprintf(buf + pos, bufsz - pos,
183 "\t%25s\t\t: %u\n", 183 "\t%25s\t\t: %u\n",
184 il_get_mgmt_string(cnt), 184 il_get_mgmt_string(cnt),
185 priv->rx_stats.mgmt[cnt]); 185 il->rx_stats.mgmt[cnt]);
186 } 186 }
187 pos += scnprintf(buf + pos, bufsz - pos, "Control:\n"); 187 pos += scnprintf(buf + pos, bufsz - pos, "Control:\n");
188 for (cnt = 0; cnt < CONTROL_MAX; cnt++) { 188 for (cnt = 0; cnt < CONTROL_MAX; cnt++) {
189 pos += scnprintf(buf + pos, bufsz - pos, 189 pos += scnprintf(buf + pos, bufsz - pos,
190 "\t%25s\t\t: %u\n", 190 "\t%25s\t\t: %u\n",
191 il_get_ctrl_string(cnt), 191 il_get_ctrl_string(cnt),
192 priv->rx_stats.ctrl[cnt]); 192 il->rx_stats.ctrl[cnt]);
193 } 193 }
194 pos += scnprintf(buf + pos, bufsz - pos, "Data:\n"); 194 pos += scnprintf(buf + pos, bufsz - pos, "Data:\n");
195 pos += scnprintf(buf + pos, bufsz - pos, "\tcnt: %u\n", 195 pos += scnprintf(buf + pos, bufsz - pos, "\tcnt: %u\n",
196 priv->rx_stats.data_cnt); 196 il->rx_stats.data_cnt);
197 pos += scnprintf(buf + pos, bufsz - pos, "\tbytes: %llu\n", 197 pos += scnprintf(buf + pos, bufsz - pos, "\tbytes: %llu\n",
198 priv->rx_stats.data_bytes); 198 il->rx_stats.data_bytes);
199 199
200 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); 200 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
201 kfree(buf); 201 kfree(buf);
@@ -214,28 +214,28 @@ static ssize_t il_dbgfs_sram_read(struct file *file,
214 ssize_t ret; 214 ssize_t ret;
215 int i; 215 int i;
216 int pos = 0; 216 int pos = 0;
217 struct il_priv *priv = file->private_data; 217 struct il_priv *il = file->private_data;
218 size_t bufsz; 218 size_t bufsz;
219 219
220 /* default is to dump the entire data segment */ 220 /* default is to dump the entire data segment */
221 if (!priv->dbgfs_sram_offset && !priv->dbgfs_sram_len) { 221 if (!il->dbgfs_sram_offset && !il->dbgfs_sram_len) {
222 priv->dbgfs_sram_offset = 0x800000; 222 il->dbgfs_sram_offset = 0x800000;
223 if (priv->ucode_type == UCODE_INIT) 223 if (il->ucode_type == UCODE_INIT)
224 priv->dbgfs_sram_len = priv->ucode_init_data.len; 224 il->dbgfs_sram_len = il->ucode_init_data.len;
225 else 225 else
226 priv->dbgfs_sram_len = priv->ucode_data.len; 226 il->dbgfs_sram_len = il->ucode_data.len;
227 } 227 }
228 bufsz = 30 + priv->dbgfs_sram_len * sizeof(char) * 10; 228 bufsz = 30 + il->dbgfs_sram_len * sizeof(char) * 10;
229 buf = kmalloc(bufsz, GFP_KERNEL); 229 buf = kmalloc(bufsz, GFP_KERNEL);
230 if (!buf) 230 if (!buf)
231 return -ENOMEM; 231 return -ENOMEM;
232 pos += scnprintf(buf + pos, bufsz - pos, "sram_len: 0x%x\n", 232 pos += scnprintf(buf + pos, bufsz - pos, "sram_len: 0x%x\n",
233 priv->dbgfs_sram_len); 233 il->dbgfs_sram_len);
234 pos += scnprintf(buf + pos, bufsz - pos, "sram_offset: 0x%x\n", 234 pos += scnprintf(buf + pos, bufsz - pos, "sram_offset: 0x%x\n",
235 priv->dbgfs_sram_offset); 235 il->dbgfs_sram_offset);
236 for (i = priv->dbgfs_sram_len; i > 0; i -= 4) { 236 for (i = il->dbgfs_sram_len; i > 0; i -= 4) {
237 val = il_read_targ_mem(priv, priv->dbgfs_sram_offset + \ 237 val = il_read_targ_mem(il, il->dbgfs_sram_offset + \
238 priv->dbgfs_sram_len - i); 238 il->dbgfs_sram_len - i);
239 if (i < 4) { 239 if (i < 4) {
240 switch (i) { 240 switch (i) {
241 case 1: 241 case 1:
@@ -264,7 +264,7 @@ static ssize_t il_dbgfs_sram_write(struct file *file,
264 const char __user *user_buf, 264 const char __user *user_buf,
265 size_t count, loff_t *ppos) 265 size_t count, loff_t *ppos)
266{ 266{
267 struct il_priv *priv = file->private_data; 267 struct il_priv *il = file->private_data;
268 char buf[64]; 268 char buf[64];
269 int buf_size; 269 int buf_size;
270 u32 offset, len; 270 u32 offset, len;
@@ -275,11 +275,11 @@ static ssize_t il_dbgfs_sram_write(struct file *file,
275 return -EFAULT; 275 return -EFAULT;
276 276
277 if (sscanf(buf, "%x,%x", &offset, &len) == 2) { 277 if (sscanf(buf, "%x,%x", &offset, &len) == 2) {
278 priv->dbgfs_sram_offset = offset; 278 il->dbgfs_sram_offset = offset;
279 priv->dbgfs_sram_len = len; 279 il->dbgfs_sram_len = len;
280 } else { 280 } else {
281 priv->dbgfs_sram_offset = 0; 281 il->dbgfs_sram_offset = 0;
282 priv->dbgfs_sram_len = 0; 282 il->dbgfs_sram_len = 0;
283 } 283 }
284 284
285 return count; 285 return count;
@@ -289,24 +289,24 @@ static ssize_t
289il_dbgfs_stations_read(struct file *file, char __user *user_buf, 289il_dbgfs_stations_read(struct file *file, char __user *user_buf,
290 size_t count, loff_t *ppos) 290 size_t count, loff_t *ppos)
291{ 291{
292 struct il_priv *priv = file->private_data; 292 struct il_priv *il = file->private_data;
293 struct il_station_entry *station; 293 struct il_station_entry *station;
294 int max_sta = priv->hw_params.max_stations; 294 int max_sta = il->hw_params.max_stations;
295 char *buf; 295 char *buf;
296 int i, j, pos = 0; 296 int i, j, pos = 0;
297 ssize_t ret; 297 ssize_t ret;
298 /* Add 30 for initial string */ 298 /* Add 30 for initial string */
299 const size_t bufsz = 30 + sizeof(char) * 500 * (priv->num_stations); 299 const size_t bufsz = 30 + sizeof(char) * 500 * (il->num_stations);
300 300
301 buf = kmalloc(bufsz, GFP_KERNEL); 301 buf = kmalloc(bufsz, GFP_KERNEL);
302 if (!buf) 302 if (!buf)
303 return -ENOMEM; 303 return -ENOMEM;
304 304
305 pos += scnprintf(buf + pos, bufsz - pos, "num of stations: %d\n\n", 305 pos += scnprintf(buf + pos, bufsz - pos, "num of stations: %d\n\n",
306 priv->num_stations); 306 il->num_stations);
307 307
308 for (i = 0; i < max_sta; i++) { 308 for (i = 0; i < max_sta; i++) {
309 station = &priv->stations[i]; 309 station = &il->stations[i];
310 if (!station->used) 310 if (!station->used)
311 continue; 311 continue;
312 pos += scnprintf(buf + pos, bufsz - pos, 312 pos += scnprintf(buf + pos, bufsz - pos,
@@ -349,32 +349,32 @@ static ssize_t il_dbgfs_nvm_read(struct file *file,
349 loff_t *ppos) 349 loff_t *ppos)
350{ 350{
351 ssize_t ret; 351 ssize_t ret;
352 struct il_priv *priv = file->private_data; 352 struct il_priv *il = file->private_data;
353 int pos = 0, ofs = 0, buf_size = 0; 353 int pos = 0, ofs = 0, buf_size = 0;
354 const u8 *ptr; 354 const u8 *ptr;
355 char *buf; 355 char *buf;
356 u16 eeprom_ver; 356 u16 eeprom_ver;
357 size_t eeprom_len = priv->cfg->base_params->eeprom_size; 357 size_t eeprom_len = il->cfg->base_params->eeprom_size;
358 buf_size = 4 * eeprom_len + 256; 358 buf_size = 4 * eeprom_len + 256;
359 359
360 if (eeprom_len % 16) { 360 if (eeprom_len % 16) {
361 IL_ERR(priv, "NVM size is not multiple of 16.\n"); 361 IL_ERR(il, "NVM size is not multiple of 16.\n");
362 return -ENODATA; 362 return -ENODATA;
363 } 363 }
364 364
365 ptr = priv->eeprom; 365 ptr = il->eeprom;
366 if (!ptr) { 366 if (!ptr) {
367 IL_ERR(priv, "Invalid EEPROM memory\n"); 367 IL_ERR(il, "Invalid EEPROM memory\n");
368 return -ENOMEM; 368 return -ENOMEM;
369 } 369 }
370 370
371 /* 4 characters for byte 0xYY */ 371 /* 4 characters for byte 0xYY */
372 buf = kzalloc(buf_size, GFP_KERNEL); 372 buf = kzalloc(buf_size, GFP_KERNEL);
373 if (!buf) { 373 if (!buf) {
374 IL_ERR(priv, "Can not allocate Buffer\n"); 374 IL_ERR(il, "Can not allocate Buffer\n");
375 return -ENOMEM; 375 return -ENOMEM;
376 } 376 }
377 eeprom_ver = il_eeprom_query16(priv, EEPROM_VERSION); 377 eeprom_ver = il_eeprom_query16(il, EEPROM_VERSION);
378 pos += scnprintf(buf + pos, buf_size - pos, "EEPROM " 378 pos += scnprintf(buf + pos, buf_size - pos, "EEPROM "
379 "version: 0x%x\n", eeprom_ver); 379 "version: 0x%x\n", eeprom_ver);
380 for (ofs = 0 ; ofs < eeprom_len ; ofs += 16) { 380 for (ofs = 0 ; ofs < eeprom_len ; ofs += 16) {
@@ -395,23 +395,23 @@ static ssize_t
395il_dbgfs_channels_read(struct file *file, char __user *user_buf, 395il_dbgfs_channels_read(struct file *file, char __user *user_buf,
396 size_t count, loff_t *ppos) 396 size_t count, loff_t *ppos)
397{ 397{
398 struct il_priv *priv = file->private_data; 398 struct il_priv *il = file->private_data;
399 struct ieee80211_channel *channels = NULL; 399 struct ieee80211_channel *channels = NULL;
400 const struct ieee80211_supported_band *supp_band = NULL; 400 const struct ieee80211_supported_band *supp_band = NULL;
401 int pos = 0, i, bufsz = PAGE_SIZE; 401 int pos = 0, i, bufsz = PAGE_SIZE;
402 char *buf; 402 char *buf;
403 ssize_t ret; 403 ssize_t ret;
404 404
405 if (!test_bit(STATUS_GEO_CONFIGURED, &priv->status)) 405 if (!test_bit(STATUS_GEO_CONFIGURED, &il->status))
406 return -EAGAIN; 406 return -EAGAIN;
407 407
408 buf = kzalloc(bufsz, GFP_KERNEL); 408 buf = kzalloc(bufsz, GFP_KERNEL);
409 if (!buf) { 409 if (!buf) {
410 IL_ERR(priv, "Can not allocate Buffer\n"); 410 IL_ERR(il, "Can not allocate Buffer\n");
411 return -ENOMEM; 411 return -ENOMEM;
412 } 412 }
413 413
414 supp_band = il_get_hw_mode(priv, IEEE80211_BAND_2GHZ); 414 supp_band = il_get_hw_mode(il, IEEE80211_BAND_2GHZ);
415 if (supp_band) { 415 if (supp_band) {
416 channels = supp_band->channels; 416 channels = supp_band->channels;
417 417
@@ -434,7 +434,7 @@ il_dbgfs_channels_read(struct file *file, char __user *user_buf,
434 IEEE80211_CHAN_PASSIVE_SCAN ? 434 IEEE80211_CHAN_PASSIVE_SCAN ?
435 "passive only" : "active/passive"); 435 "passive only" : "active/passive");
436 } 436 }
437 supp_band = il_get_hw_mode(priv, IEEE80211_BAND_5GHZ); 437 supp_band = il_get_hw_mode(il, IEEE80211_BAND_5GHZ);
438 if (supp_band) { 438 if (supp_band) {
439 channels = supp_band->channels; 439 channels = supp_band->channels;
440 440
@@ -466,43 +466,43 @@ static ssize_t il_dbgfs_status_read(struct file *file,
466 char __user *user_buf, 466 char __user *user_buf,
467 size_t count, loff_t *ppos) { 467 size_t count, loff_t *ppos) {
468 468
469 struct il_priv *priv = file->private_data; 469 struct il_priv *il = file->private_data;
470 char buf[512]; 470 char buf[512];
471 int pos = 0; 471 int pos = 0;
472 const size_t bufsz = sizeof(buf); 472 const size_t bufsz = sizeof(buf);
473 473
474 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_HCMD_ACTIVE:\t %d\n", 474 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_HCMD_ACTIVE:\t %d\n",
475 test_bit(STATUS_HCMD_ACTIVE, &priv->status)); 475 test_bit(STATUS_HCMD_ACTIVE, &il->status));
476 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_INT_ENABLED:\t %d\n", 476 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_INT_ENABLED:\t %d\n",
477 test_bit(STATUS_INT_ENABLED, &priv->status)); 477 test_bit(STATUS_INT_ENABLED, &il->status));
478 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_RF_KILL_HW:\t %d\n", 478 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_RF_KILL_HW:\t %d\n",
479 test_bit(STATUS_RF_KILL_HW, &priv->status)); 479 test_bit(STATUS_RF_KILL_HW, &il->status));
480 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_CT_KILL:\t\t %d\n", 480 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_CT_KILL:\t\t %d\n",
481 test_bit(STATUS_CT_KILL, &priv->status)); 481 test_bit(STATUS_CT_KILL, &il->status));
482 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_INIT:\t\t %d\n", 482 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_INIT:\t\t %d\n",
483 test_bit(STATUS_INIT, &priv->status)); 483 test_bit(STATUS_INIT, &il->status));
484 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_ALIVE:\t\t %d\n", 484 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_ALIVE:\t\t %d\n",
485 test_bit(STATUS_ALIVE, &priv->status)); 485 test_bit(STATUS_ALIVE, &il->status));
486 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_READY:\t\t %d\n", 486 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_READY:\t\t %d\n",
487 test_bit(STATUS_READY, &priv->status)); 487 test_bit(STATUS_READY, &il->status));
488 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_TEMPERATURE:\t %d\n", 488 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_TEMPERATURE:\t %d\n",
489 test_bit(STATUS_TEMPERATURE, &priv->status)); 489 test_bit(STATUS_TEMPERATURE, &il->status));
490 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_GEO_CONFIGURED:\t %d\n", 490 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_GEO_CONFIGURED:\t %d\n",
491 test_bit(STATUS_GEO_CONFIGURED, &priv->status)); 491 test_bit(STATUS_GEO_CONFIGURED, &il->status));
492 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_EXIT_PENDING:\t %d\n", 492 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_EXIT_PENDING:\t %d\n",
493 test_bit(STATUS_EXIT_PENDING, &priv->status)); 493 test_bit(STATUS_EXIT_PENDING, &il->status));
494 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_STATISTICS:\t %d\n", 494 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_STATISTICS:\t %d\n",
495 test_bit(STATUS_STATISTICS, &priv->status)); 495 test_bit(STATUS_STATISTICS, &il->status));
496 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCANNING:\t %d\n", 496 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCANNING:\t %d\n",
497 test_bit(STATUS_SCANNING, &priv->status)); 497 test_bit(STATUS_SCANNING, &il->status));
498 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCAN_ABORTING:\t %d\n", 498 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCAN_ABORTING:\t %d\n",
499 test_bit(STATUS_SCAN_ABORTING, &priv->status)); 499 test_bit(STATUS_SCAN_ABORTING, &il->status));
500 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCAN_HW:\t\t %d\n", 500 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_SCAN_HW:\t\t %d\n",
501 test_bit(STATUS_SCAN_HW, &priv->status)); 501 test_bit(STATUS_SCAN_HW, &il->status));
502 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_POWER_PMI:\t %d\n", 502 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_POWER_PMI:\t %d\n",
503 test_bit(STATUS_POWER_PMI, &priv->status)); 503 test_bit(STATUS_POWER_PMI, &il->status));
504 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_FW_ERROR:\t %d\n", 504 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_FW_ERROR:\t %d\n",
505 test_bit(STATUS_FW_ERROR, &priv->status)); 505 test_bit(STATUS_FW_ERROR, &il->status));
506 return simple_read_from_buffer(user_buf, count, ppos, buf, pos); 506 return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
507} 507}
508 508
@@ -510,7 +510,7 @@ static ssize_t il_dbgfs_interrupt_read(struct file *file,
510 char __user *user_buf, 510 char __user *user_buf,
511 size_t count, loff_t *ppos) { 511 size_t count, loff_t *ppos) {
512 512
513 struct il_priv *priv = file->private_data; 513 struct il_priv *il = file->private_data;
514 int pos = 0; 514 int pos = 0;
515 int cnt = 0; 515 int cnt = 0;
516 char *buf; 516 char *buf;
@@ -519,7 +519,7 @@ static ssize_t il_dbgfs_interrupt_read(struct file *file,
519 519
520 buf = kzalloc(bufsz, GFP_KERNEL); 520 buf = kzalloc(bufsz, GFP_KERNEL);
521 if (!buf) { 521 if (!buf) {
522 IL_ERR(priv, "Can not allocate Buffer\n"); 522 IL_ERR(il, "Can not allocate Buffer\n");
523 return -ENOMEM; 523 return -ENOMEM;
524 } 524 }
525 525
@@ -527,46 +527,46 @@ static ssize_t il_dbgfs_interrupt_read(struct file *file,
527 "Interrupt Statistics Report:\n"); 527 "Interrupt Statistics Report:\n");
528 528
529 pos += scnprintf(buf + pos, bufsz - pos, "HW Error:\t\t\t %u\n", 529 pos += scnprintf(buf + pos, bufsz - pos, "HW Error:\t\t\t %u\n",
530 priv->isr_stats.hw); 530 il->isr_stats.hw);
531 pos += scnprintf(buf + pos, bufsz - pos, "SW Error:\t\t\t %u\n", 531 pos += scnprintf(buf + pos, bufsz - pos, "SW Error:\t\t\t %u\n",
532 priv->isr_stats.sw); 532 il->isr_stats.sw);
533 if (priv->isr_stats.sw || priv->isr_stats.hw) { 533 if (il->isr_stats.sw || il->isr_stats.hw) {
534 pos += scnprintf(buf + pos, bufsz - pos, 534 pos += scnprintf(buf + pos, bufsz - pos,
535 "\tLast Restarting Code: 0x%X\n", 535 "\tLast Restarting Code: 0x%X\n",
536 priv->isr_stats.err_code); 536 il->isr_stats.err_code);
537 } 537 }
538#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG 538#ifdef CONFIG_IWLWIFI_LEGACY_DEBUG
539 pos += scnprintf(buf + pos, bufsz - pos, "Frame transmitted:\t\t %u\n", 539 pos += scnprintf(buf + pos, bufsz - pos, "Frame transmitted:\t\t %u\n",
540 priv->isr_stats.sch); 540 il->isr_stats.sch);
541 pos += scnprintf(buf + pos, bufsz - pos, "Alive interrupt:\t\t %u\n", 541 pos += scnprintf(buf + pos, bufsz - pos, "Alive interrupt:\t\t %u\n",
542 priv->isr_stats.alive); 542 il->isr_stats.alive);
543#endif 543#endif
544 pos += scnprintf(buf + pos, bufsz - pos, 544 pos += scnprintf(buf + pos, bufsz - pos,
545 "HW RF KILL switch toggled:\t %u\n", 545 "HW RF KILL switch toggled:\t %u\n",
546 priv->isr_stats.rfkill); 546 il->isr_stats.rfkill);
547 547
548 pos += scnprintf(buf + pos, bufsz - pos, "CT KILL:\t\t\t %u\n", 548 pos += scnprintf(buf + pos, bufsz - pos, "CT KILL:\t\t\t %u\n",
549 priv->isr_stats.ctkill); 549 il->isr_stats.ctkill);
550 550
551 pos += scnprintf(buf + pos, bufsz - pos, "Wakeup Interrupt:\t\t %u\n", 551 pos += scnprintf(buf + pos, bufsz - pos, "Wakeup Interrupt:\t\t %u\n",
552 priv->isr_stats.wakeup); 552 il->isr_stats.wakeup);
553 553
554 pos += scnprintf(buf + pos, bufsz - pos, 554 pos += scnprintf(buf + pos, bufsz - pos,
555 "Rx command responses:\t\t %u\n", 555 "Rx command responses:\t\t %u\n",
556 priv->isr_stats.rx); 556 il->isr_stats.rx);
557 for (cnt = 0; cnt < REPLY_MAX; cnt++) { 557 for (cnt = 0; cnt < REPLY_MAX; cnt++) {
558 if (priv->isr_stats.rx_handlers[cnt] > 0) 558 if (il->isr_stats.rx_handlers[cnt] > 0)
559 pos += scnprintf(buf + pos, bufsz - pos, 559 pos += scnprintf(buf + pos, bufsz - pos,
560 "\tRx handler[%36s]:\t\t %u\n", 560 "\tRx handler[%36s]:\t\t %u\n",
561 il_get_cmd_string(cnt), 561 il_get_cmd_string(cnt),
562 priv->isr_stats.rx_handlers[cnt]); 562 il->isr_stats.rx_handlers[cnt]);
563 } 563 }
564 564
565 pos += scnprintf(buf + pos, bufsz - pos, "Tx/FH interrupt:\t\t %u\n", 565 pos += scnprintf(buf + pos, bufsz - pos, "Tx/FH interrupt:\t\t %u\n",
566 priv->isr_stats.tx); 566 il->isr_stats.tx);
567 567
568 pos += scnprintf(buf + pos, bufsz - pos, "Unexpected INTA:\t\t %u\n", 568 pos += scnprintf(buf + pos, bufsz - pos, "Unexpected INTA:\t\t %u\n",
569 priv->isr_stats.unhandled); 569 il->isr_stats.unhandled);
570 570
571 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); 571 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
572 kfree(buf); 572 kfree(buf);
@@ -577,7 +577,7 @@ static ssize_t il_dbgfs_interrupt_write(struct file *file,
577 const char __user *user_buf, 577 const char __user *user_buf,
578 size_t count, loff_t *ppos) 578 size_t count, loff_t *ppos)
579{ 579{
580 struct il_priv *priv = file->private_data; 580 struct il_priv *il = file->private_data;
581 char buf[8]; 581 char buf[8];
582 int buf_size; 582 int buf_size;
583 u32 reset_flag; 583 u32 reset_flag;
@@ -589,7 +589,7 @@ static ssize_t il_dbgfs_interrupt_write(struct file *file,
589 if (sscanf(buf, "%x", &reset_flag) != 1) 589 if (sscanf(buf, "%x", &reset_flag) != 1)
590 return -EFAULT; 590 return -EFAULT;
591 if (reset_flag == 0) 591 if (reset_flag == 0)
592 il_clear_isr_stats(priv); 592 il_clear_isr_stats(il);
593 593
594 return count; 594 return count;
595} 595}
@@ -598,13 +598,13 @@ static ssize_t
598il_dbgfs_qos_read(struct file *file, char __user *user_buf, 598il_dbgfs_qos_read(struct file *file, char __user *user_buf,
599 size_t count, loff_t *ppos) 599 size_t count, loff_t *ppos)
600{ 600{
601 struct il_priv *priv = file->private_data; 601 struct il_priv *il = file->private_data;
602 struct il_rxon_context *ctx; 602 struct il_rxon_context *ctx;
603 int pos = 0, i; 603 int pos = 0, i;
604 char buf[256 * NUM_IL_RXON_CTX]; 604 char buf[256 * NUM_IL_RXON_CTX];
605 const size_t bufsz = sizeof(buf); 605 const size_t bufsz = sizeof(buf);
606 606
607 for_each_context(priv, ctx) { 607 for_each_context(il, ctx) {
608 pos += scnprintf(buf + pos, bufsz - pos, "context %d:\n", 608 pos += scnprintf(buf + pos, bufsz - pos, "context %d:\n",
609 ctx->ctxid); 609 ctx->ctxid);
610 for (i = 0; i < AC_NUM; i++) { 610 for (i = 0; i < AC_NUM; i++) {
@@ -626,7 +626,7 @@ static ssize_t il_dbgfs_disable_ht40_write(struct file *file,
626 const char __user *user_buf, 626 const char __user *user_buf,
627 size_t count, loff_t *ppos) 627 size_t count, loff_t *ppos)
628{ 628{
629 struct il_priv *priv = file->private_data; 629 struct il_priv *il = file->private_data;
630 char buf[8]; 630 char buf[8];
631 int buf_size; 631 int buf_size;
632 int ht40; 632 int ht40;
@@ -637,10 +637,10 @@ static ssize_t il_dbgfs_disable_ht40_write(struct file *file,
637 return -EFAULT; 637 return -EFAULT;
638 if (sscanf(buf, "%d", &ht40) != 1) 638 if (sscanf(buf, "%d", &ht40) != 1)
639 return -EFAULT; 639 return -EFAULT;
640 if (!il_is_any_associated(priv)) 640 if (!il_is_any_associated(il))
641 priv->disable_ht40 = ht40 ? true : false; 641 il->disable_ht40 = ht40 ? true : false;
642 else { 642 else {
643 IL_ERR(priv, "Sta associated with AP - " 643 IL_ERR(il, "Sta associated with AP - "
644 "Change to 40MHz channel support is not allowed\n"); 644 "Change to 40MHz channel support is not allowed\n");
645 return -EINVAL; 645 return -EINVAL;
646 } 646 }
@@ -652,14 +652,14 @@ static ssize_t il_dbgfs_disable_ht40_read(struct file *file,
652 char __user *user_buf, 652 char __user *user_buf,
653 size_t count, loff_t *ppos) 653 size_t count, loff_t *ppos)
654{ 654{
655 struct il_priv *priv = file->private_data; 655 struct il_priv *il = file->private_data;
656 char buf[100]; 656 char buf[100];
657 int pos = 0; 657 int pos = 0;
658 const size_t bufsz = sizeof(buf); 658 const size_t bufsz = sizeof(buf);
659 659
660 pos += scnprintf(buf + pos, bufsz - pos, 660 pos += scnprintf(buf + pos, bufsz - pos,
661 "11n 40MHz Mode: %s\n", 661 "11n 40MHz Mode: %s\n",
662 priv->disable_ht40 ? "Disabled" : "Enabled"); 662 il->disable_ht40 ? "Disabled" : "Enabled");
663 return simple_read_from_buffer(user_buf, count, ppos, buf, pos); 663 return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
664} 664}
665 665
@@ -676,39 +676,39 @@ static ssize_t il_dbgfs_traffic_log_read(struct file *file,
676 char __user *user_buf, 676 char __user *user_buf,
677 size_t count, loff_t *ppos) 677 size_t count, loff_t *ppos)
678{ 678{
679 struct il_priv *priv = file->private_data; 679 struct il_priv *il = file->private_data;
680 int pos = 0, ofs = 0; 680 int pos = 0, ofs = 0;
681 int cnt = 0, entry; 681 int cnt = 0, entry;
682 struct il_tx_queue *txq; 682 struct il_tx_queue *txq;
683 struct il_queue *q; 683 struct il_queue *q;
684 struct il_rx_queue *rxq = &priv->rxq; 684 struct il_rx_queue *rxq = &il->rxq;
685 char *buf; 685 char *buf;
686 int bufsz = ((IL_TRAFFIC_ENTRIES * IL_TRAFFIC_ENTRY_SIZE * 64) * 2) + 686 int bufsz = ((IL_TRAFFIC_ENTRIES * IL_TRAFFIC_ENTRY_SIZE * 64) * 2) +
687 (priv->cfg->base_params->num_of_queues * 32 * 8) + 400; 687 (il->cfg->base_params->num_of_queues * 32 * 8) + 400;
688 const u8 *ptr; 688 const u8 *ptr;
689 ssize_t ret; 689 ssize_t ret;
690 690
691 if (!priv->txq) { 691 if (!il->txq) {
692 IL_ERR(priv, "txq not ready\n"); 692 IL_ERR(il, "txq not ready\n");
693 return -EAGAIN; 693 return -EAGAIN;
694 } 694 }
695 buf = kzalloc(bufsz, GFP_KERNEL); 695 buf = kzalloc(bufsz, GFP_KERNEL);
696 if (!buf) { 696 if (!buf) {
697 IL_ERR(priv, "Can not allocate buffer\n"); 697 IL_ERR(il, "Can not allocate buffer\n");
698 return -ENOMEM; 698 return -ENOMEM;
699 } 699 }
700 pos += scnprintf(buf + pos, bufsz - pos, "Tx Queue\n"); 700 pos += scnprintf(buf + pos, bufsz - pos, "Tx Queue\n");
701 for (cnt = 0; cnt < priv->hw_params.max_txq_num; cnt++) { 701 for (cnt = 0; cnt < il->hw_params.max_txq_num; cnt++) {
702 txq = &priv->txq[cnt]; 702 txq = &il->txq[cnt];
703 q = &txq->q; 703 q = &txq->q;
704 pos += scnprintf(buf + pos, bufsz - pos, 704 pos += scnprintf(buf + pos, bufsz - pos,
705 "q[%d]: read_ptr: %u, write_ptr: %u\n", 705 "q[%d]: read_ptr: %u, write_ptr: %u\n",
706 cnt, q->read_ptr, q->write_ptr); 706 cnt, q->read_ptr, q->write_ptr);
707 } 707 }
708 if (priv->tx_traffic && (iwlegacy_debug_level & IL_DL_TX)) { 708 if (il->tx_traffic && (iwlegacy_debug_level & IL_DL_TX)) {
709 ptr = priv->tx_traffic; 709 ptr = il->tx_traffic;
710 pos += scnprintf(buf + pos, bufsz - pos, 710 pos += scnprintf(buf + pos, bufsz - pos,
711 "Tx Traffic idx: %u\n", priv->tx_traffic_idx); 711 "Tx Traffic idx: %u\n", il->tx_traffic_idx);
712 for (cnt = 0, ofs = 0; cnt < IL_TRAFFIC_ENTRIES; cnt++) { 712 for (cnt = 0, ofs = 0; cnt < IL_TRAFFIC_ENTRIES; cnt++) {
713 for (entry = 0; entry < IL_TRAFFIC_ENTRY_SIZE / 16; 713 for (entry = 0; entry < IL_TRAFFIC_ENTRY_SIZE / 16;
714 entry++, ofs += 16) { 714 entry++, ofs += 16) {
@@ -728,10 +728,10 @@ static ssize_t il_dbgfs_traffic_log_read(struct file *file,
728 "read: %u, write: %u\n", 728 "read: %u, write: %u\n",
729 rxq->read, rxq->write); 729 rxq->read, rxq->write);
730 730
731 if (priv->rx_traffic && (iwlegacy_debug_level & IL_DL_RX)) { 731 if (il->rx_traffic && (iwlegacy_debug_level & IL_DL_RX)) {
732 ptr = priv->rx_traffic; 732 ptr = il->rx_traffic;
733 pos += scnprintf(buf + pos, bufsz - pos, 733 pos += scnprintf(buf + pos, bufsz - pos,
734 "Rx Traffic idx: %u\n", priv->rx_traffic_idx); 734 "Rx Traffic idx: %u\n", il->rx_traffic_idx);
735 for (cnt = 0, ofs = 0; cnt < IL_TRAFFIC_ENTRIES; cnt++) { 735 for (cnt = 0, ofs = 0; cnt < IL_TRAFFIC_ENTRIES; cnt++) {
736 for (entry = 0; entry < IL_TRAFFIC_ENTRY_SIZE / 16; 736 for (entry = 0; entry < IL_TRAFFIC_ENTRY_SIZE / 16;
737 entry++, ofs += 16) { 737 entry++, ofs += 16) {
@@ -755,7 +755,7 @@ static ssize_t il_dbgfs_traffic_log_write(struct file *file,
755 const char __user *user_buf, 755 const char __user *user_buf,
756 size_t count, loff_t *ppos) 756 size_t count, loff_t *ppos)
757{ 757{
758 struct il_priv *priv = file->private_data; 758 struct il_priv *il = file->private_data;
759 char buf[8]; 759 char buf[8];
760 int buf_size; 760 int buf_size;
761 int traffic_log; 761 int traffic_log;
@@ -767,7 +767,7 @@ static ssize_t il_dbgfs_traffic_log_write(struct file *file,
767 if (sscanf(buf, "%d", &traffic_log) != 1) 767 if (sscanf(buf, "%d", &traffic_log) != 1)
768 return -EFAULT; 768 return -EFAULT;
769 if (traffic_log == 0) 769 if (traffic_log == 0)
770 il_reset_traffic_log(priv); 770 il_reset_traffic_log(il);
771 771
772 return count; 772 return count;
773} 773}
@@ -776,7 +776,7 @@ static ssize_t il_dbgfs_tx_queue_read(struct file *file,
776 char __user *user_buf, 776 char __user *user_buf,
777 size_t count, loff_t *ppos) { 777 size_t count, loff_t *ppos) {
778 778
779 struct il_priv *priv = file->private_data; 779 struct il_priv *il = file->private_data;
780 struct il_tx_queue *txq; 780 struct il_tx_queue *txq;
781 struct il_queue *q; 781 struct il_queue *q;
782 char *buf; 782 char *buf;
@@ -784,24 +784,24 @@ static ssize_t il_dbgfs_tx_queue_read(struct file *file,
784 int cnt; 784 int cnt;
785 int ret; 785 int ret;
786 const size_t bufsz = sizeof(char) * 64 * 786 const size_t bufsz = sizeof(char) * 64 *
787 priv->cfg->base_params->num_of_queues; 787 il->cfg->base_params->num_of_queues;
788 788
789 if (!priv->txq) { 789 if (!il->txq) {
790 IL_ERR(priv, "txq not ready\n"); 790 IL_ERR(il, "txq not ready\n");
791 return -EAGAIN; 791 return -EAGAIN;
792 } 792 }
793 buf = kzalloc(bufsz, GFP_KERNEL); 793 buf = kzalloc(bufsz, GFP_KERNEL);
794 if (!buf) 794 if (!buf)
795 return -ENOMEM; 795 return -ENOMEM;
796 796
797 for (cnt = 0; cnt < priv->hw_params.max_txq_num; cnt++) { 797 for (cnt = 0; cnt < il->hw_params.max_txq_num; cnt++) {
798 txq = &priv->txq[cnt]; 798 txq = &il->txq[cnt];
799 q = &txq->q; 799 q = &txq->q;
800 pos += scnprintf(buf + pos, bufsz - pos, 800 pos += scnprintf(buf + pos, bufsz - pos,
801 "hwq %.2d: read=%u write=%u stop=%d" 801 "hwq %.2d: read=%u write=%u stop=%d"
802 " swq_id=%#.2x (ac %d/hwq %d)\n", 802 " swq_id=%#.2x (ac %d/hwq %d)\n",
803 cnt, q->read_ptr, q->write_ptr, 803 cnt, q->read_ptr, q->write_ptr,
804 !!test_bit(cnt, priv->queue_stopped), 804 !!test_bit(cnt, il->queue_stopped),
805 txq->swq_id, txq->swq_id & 3, 805 txq->swq_id, txq->swq_id & 3,
806 (txq->swq_id >> 2) & 0x1f); 806 (txq->swq_id >> 2) & 0x1f);
807 if (cnt >= 4) 807 if (cnt >= 4)
@@ -809,7 +809,7 @@ static ssize_t il_dbgfs_tx_queue_read(struct file *file,
809 /* for the ACs, display the stop count too */ 809 /* for the ACs, display the stop count too */
810 pos += scnprintf(buf + pos, bufsz - pos, 810 pos += scnprintf(buf + pos, bufsz - pos,
811 " stop-count: %d\n", 811 " stop-count: %d\n",
812 atomic_read(&priv->queue_stop_count[cnt])); 812 atomic_read(&il->queue_stop_count[cnt]));
813 } 813 }
814 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); 814 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
815 kfree(buf); 815 kfree(buf);
@@ -820,8 +820,8 @@ static ssize_t il_dbgfs_rx_queue_read(struct file *file,
820 char __user *user_buf, 820 char __user *user_buf,
821 size_t count, loff_t *ppos) { 821 size_t count, loff_t *ppos) {
822 822
823 struct il_priv *priv = file->private_data; 823 struct il_priv *il = file->private_data;
824 struct il_rx_queue *rxq = &priv->rxq; 824 struct il_rx_queue *rxq = &il->rxq;
825 char buf[256]; 825 char buf[256];
826 int pos = 0; 826 int pos = 0;
827 const size_t bufsz = sizeof(buf); 827 const size_t bufsz = sizeof(buf);
@@ -846,8 +846,8 @@ static ssize_t il_dbgfs_ucode_rx_stats_read(struct file *file,
846 char __user *user_buf, 846 char __user *user_buf,
847 size_t count, loff_t *ppos) 847 size_t count, loff_t *ppos)
848{ 848{
849 struct il_priv *priv = file->private_data; 849 struct il_priv *il = file->private_data;
850 return priv->cfg->ops->lib->debugfs_ops.rx_stats_read(file, 850 return il->cfg->ops->lib->debugfs_ops.rx_stats_read(file,
851 user_buf, count, ppos); 851 user_buf, count, ppos);
852} 852}
853 853
@@ -855,8 +855,8 @@ static ssize_t il_dbgfs_ucode_tx_stats_read(struct file *file,
855 char __user *user_buf, 855 char __user *user_buf,
856 size_t count, loff_t *ppos) 856 size_t count, loff_t *ppos)
857{ 857{
858 struct il_priv *priv = file->private_data; 858 struct il_priv *il = file->private_data;
859 return priv->cfg->ops->lib->debugfs_ops.tx_stats_read(file, 859 return il->cfg->ops->lib->debugfs_ops.tx_stats_read(file,
860 user_buf, count, ppos); 860 user_buf, count, ppos);
861} 861}
862 862
@@ -864,8 +864,8 @@ static ssize_t il_dbgfs_ucode_general_stats_read(struct file *file,
864 char __user *user_buf, 864 char __user *user_buf,
865 size_t count, loff_t *ppos) 865 size_t count, loff_t *ppos)
866{ 866{
867 struct il_priv *priv = file->private_data; 867 struct il_priv *il = file->private_data;
868 return priv->cfg->ops->lib->debugfs_ops.general_stats_read(file, 868 return il->cfg->ops->lib->debugfs_ops.general_stats_read(file,
869 user_buf, count, ppos); 869 user_buf, count, ppos);
870} 870}
871 871
@@ -873,7 +873,7 @@ static ssize_t il_dbgfs_sensitivity_read(struct file *file,
873 char __user *user_buf, 873 char __user *user_buf,
874 size_t count, loff_t *ppos) { 874 size_t count, loff_t *ppos) {
875 875
876 struct il_priv *priv = file->private_data; 876 struct il_priv *il = file->private_data;
877 int pos = 0; 877 int pos = 0;
878 int cnt = 0; 878 int cnt = 0;
879 char *buf; 879 char *buf;
@@ -881,10 +881,10 @@ static ssize_t il_dbgfs_sensitivity_read(struct file *file,
881 ssize_t ret; 881 ssize_t ret;
882 struct il_sensitivity_data *data; 882 struct il_sensitivity_data *data;
883 883
884 data = &priv->sensitivity_data; 884 data = &il->sensitivity_data;
885 buf = kzalloc(bufsz, GFP_KERNEL); 885 buf = kzalloc(bufsz, GFP_KERNEL);
886 if (!buf) { 886 if (!buf) {
887 IL_ERR(priv, "Can not allocate Buffer\n"); 887 IL_ERR(il, "Can not allocate Buffer\n");
888 return -ENOMEM; 888 return -ENOMEM;
889 } 889 }
890 890
@@ -954,7 +954,7 @@ static ssize_t il_dbgfs_chain_noise_read(struct file *file,
954 char __user *user_buf, 954 char __user *user_buf,
955 size_t count, loff_t *ppos) { 955 size_t count, loff_t *ppos) {
956 956
957 struct il_priv *priv = file->private_data; 957 struct il_priv *il = file->private_data;
958 int pos = 0; 958 int pos = 0;
959 int cnt = 0; 959 int cnt = 0;
960 char *buf; 960 char *buf;
@@ -962,10 +962,10 @@ static ssize_t il_dbgfs_chain_noise_read(struct file *file,
962 ssize_t ret; 962 ssize_t ret;
963 struct il_chain_noise_data *data; 963 struct il_chain_noise_data *data;
964 964
965 data = &priv->chain_noise_data; 965 data = &il->chain_noise_data;
966 buf = kzalloc(bufsz, GFP_KERNEL); 966 buf = kzalloc(bufsz, GFP_KERNEL);
967 if (!buf) { 967 if (!buf) {
968 IL_ERR(priv, "Can not allocate Buffer\n"); 968 IL_ERR(il, "Can not allocate Buffer\n");
969 return -ENOMEM; 969 return -ENOMEM;
970 } 970 }
971 971
@@ -1012,13 +1012,13 @@ static ssize_t il_dbgfs_power_save_status_read(struct file *file,
1012 char __user *user_buf, 1012 char __user *user_buf,
1013 size_t count, loff_t *ppos) 1013 size_t count, loff_t *ppos)
1014{ 1014{
1015 struct il_priv *priv = file->private_data; 1015 struct il_priv *il = file->private_data;
1016 char buf[60]; 1016 char buf[60];
1017 int pos = 0; 1017 int pos = 0;
1018 const size_t bufsz = sizeof(buf); 1018 const size_t bufsz = sizeof(buf);
1019 u32 pwrsave_status; 1019 u32 pwrsave_status;
1020 1020
1021 pwrsave_status = il_read32(priv, CSR_GP_CNTRL) & 1021 pwrsave_status = il_read32(il, CSR_GP_CNTRL) &
1022 CSR_GP_REG_POWER_SAVE_STATUS_MSK; 1022 CSR_GP_REG_POWER_SAVE_STATUS_MSK;
1023 1023
1024 pos += scnprintf(buf + pos, bufsz - pos, "Power Save Status: "); 1024 pos += scnprintf(buf + pos, bufsz - pos, "Power Save Status: ");
@@ -1035,7 +1035,7 @@ static ssize_t il_dbgfs_clear_ucode_statistics_write(struct file *file,
1035 const char __user *user_buf, 1035 const char __user *user_buf,
1036 size_t count, loff_t *ppos) 1036 size_t count, loff_t *ppos)
1037{ 1037{
1038 struct il_priv *priv = file->private_data; 1038 struct il_priv *il = file->private_data;
1039 char buf[8]; 1039 char buf[8];
1040 int buf_size; 1040 int buf_size;
1041 int clear; 1041 int clear;
@@ -1048,9 +1048,9 @@ static ssize_t il_dbgfs_clear_ucode_statistics_write(struct file *file,
1048 return -EFAULT; 1048 return -EFAULT;
1049 1049
1050 /* make request to uCode to retrieve statistics information */ 1050 /* make request to uCode to retrieve statistics information */
1051 mutex_lock(&priv->mutex); 1051 mutex_lock(&il->mutex);
1052 il_send_statistics_request(priv, CMD_SYNC, true); 1052 il_send_statistics_request(il, CMD_SYNC, true);
1053 mutex_unlock(&priv->mutex); 1053 mutex_unlock(&il->mutex);
1054 1054
1055 return count; 1055 return count;
1056} 1056}
@@ -1059,12 +1059,12 @@ static ssize_t il_dbgfs_rxon_flags_read(struct file *file,
1059 char __user *user_buf, 1059 char __user *user_buf,
1060 size_t count, loff_t *ppos) { 1060 size_t count, loff_t *ppos) {
1061 1061
1062 struct il_priv *priv = file->private_data; 1062 struct il_priv *il = file->private_data;
1063 int len = 0; 1063 int len = 0;
1064 char buf[20]; 1064 char buf[20];
1065 1065
1066 len = sprintf(buf, "0x%04X\n", 1066 len = sprintf(buf, "0x%04X\n",
1067 le32_to_cpu(priv->contexts[IL_RXON_CTX_BSS].active.flags)); 1067 le32_to_cpu(il->contexts[IL_RXON_CTX_BSS].active.flags));
1068 return simple_read_from_buffer(user_buf, count, ppos, buf, len); 1068 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
1069} 1069}
1070 1070
@@ -1072,12 +1072,12 @@ static ssize_t il_dbgfs_rxon_filter_flags_read(struct file *file,
1072 char __user *user_buf, 1072 char __user *user_buf,
1073 size_t count, loff_t *ppos) { 1073 size_t count, loff_t *ppos) {
1074 1074
1075 struct il_priv *priv = file->private_data; 1075 struct il_priv *il = file->private_data;
1076 int len = 0; 1076 int len = 0;
1077 char buf[20]; 1077 char buf[20];
1078 1078
1079 len = sprintf(buf, "0x%04X\n", 1079 len = sprintf(buf, "0x%04X\n",
1080 le32_to_cpu(priv->contexts[IL_RXON_CTX_BSS].active.filter_flags)); 1080 le32_to_cpu(il->contexts[IL_RXON_CTX_BSS].active.filter_flags));
1081 return simple_read_from_buffer(user_buf, count, ppos, buf, len); 1081 return simple_read_from_buffer(user_buf, count, ppos, buf, len);
1082} 1082}
1083 1083
@@ -1085,13 +1085,13 @@ static ssize_t il_dbgfs_fh_reg_read(struct file *file,
1085 char __user *user_buf, 1085 char __user *user_buf,
1086 size_t count, loff_t *ppos) 1086 size_t count, loff_t *ppos)
1087{ 1087{
1088 struct il_priv *priv = file->private_data; 1088 struct il_priv *il = file->private_data;
1089 char *buf; 1089 char *buf;
1090 int pos = 0; 1090 int pos = 0;
1091 ssize_t ret = -EFAULT; 1091 ssize_t ret = -EFAULT;
1092 1092
1093 if (priv->cfg->ops->lib->dump_fh) { 1093 if (il->cfg->ops->lib->dump_fh) {
1094 ret = pos = priv->cfg->ops->lib->dump_fh(priv, &buf, true); 1094 ret = pos = il->cfg->ops->lib->dump_fh(il, &buf, true);
1095 if (buf) { 1095 if (buf) {
1096 ret = simple_read_from_buffer(user_buf, 1096 ret = simple_read_from_buffer(user_buf,
1097 count, ppos, buf, pos); 1097 count, ppos, buf, pos);
@@ -1106,13 +1106,13 @@ static ssize_t il_dbgfs_missed_beacon_read(struct file *file,
1106 char __user *user_buf, 1106 char __user *user_buf,
1107 size_t count, loff_t *ppos) { 1107 size_t count, loff_t *ppos) {
1108 1108
1109 struct il_priv *priv = file->private_data; 1109 struct il_priv *il = file->private_data;
1110 int pos = 0; 1110 int pos = 0;
1111 char buf[12]; 1111 char buf[12];
1112 const size_t bufsz = sizeof(buf); 1112 const size_t bufsz = sizeof(buf);
1113 1113
1114 pos += scnprintf(buf + pos, bufsz - pos, "%d\n", 1114 pos += scnprintf(buf + pos, bufsz - pos, "%d\n",
1115 priv->missed_beacon_threshold); 1115 il->missed_beacon_threshold);
1116 1116
1117 return simple_read_from_buffer(user_buf, count, ppos, buf, pos); 1117 return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
1118} 1118}
@@ -1121,7 +1121,7 @@ static ssize_t il_dbgfs_missed_beacon_write(struct file *file,
1121 const char __user *user_buf, 1121 const char __user *user_buf,
1122 size_t count, loff_t *ppos) 1122 size_t count, loff_t *ppos)
1123{ 1123{
1124 struct il_priv *priv = file->private_data; 1124 struct il_priv *il = file->private_data;
1125 char buf[8]; 1125 char buf[8];
1126 int buf_size; 1126 int buf_size;
1127 int missed; 1127 int missed;
@@ -1135,10 +1135,10 @@ static ssize_t il_dbgfs_missed_beacon_write(struct file *file,
1135 1135
1136 if (missed < IL_MISSED_BEACON_THRESHOLD_MIN || 1136 if (missed < IL_MISSED_BEACON_THRESHOLD_MIN ||
1137 missed > IL_MISSED_BEACON_THRESHOLD_MAX) 1137 missed > IL_MISSED_BEACON_THRESHOLD_MAX)
1138 priv->missed_beacon_threshold = 1138 il->missed_beacon_threshold =
1139 IL_MISSED_BEACON_THRESHOLD_DEF; 1139 IL_MISSED_BEACON_THRESHOLD_DEF;
1140 else 1140 else
1141 priv->missed_beacon_threshold = missed; 1141 il->missed_beacon_threshold = missed;
1142 1142
1143 return count; 1143 return count;
1144} 1144}
@@ -1147,13 +1147,13 @@ static ssize_t il_dbgfs_force_reset_read(struct file *file,
1147 char __user *user_buf, 1147 char __user *user_buf,
1148 size_t count, loff_t *ppos) { 1148 size_t count, loff_t *ppos) {
1149 1149
1150 struct il_priv *priv = file->private_data; 1150 struct il_priv *il = file->private_data;
1151 int pos = 0; 1151 int pos = 0;
1152 char buf[300]; 1152 char buf[300];
1153 const size_t bufsz = sizeof(buf); 1153 const size_t bufsz = sizeof(buf);
1154 struct il_force_reset *force_reset; 1154 struct il_force_reset *force_reset;
1155 1155
1156 force_reset = &priv->force_reset; 1156 force_reset = &il->force_reset;
1157 1157
1158 pos += scnprintf(buf + pos, bufsz - pos, 1158 pos += scnprintf(buf + pos, bufsz - pos,
1159 "\tnumber of reset request: %d\n", 1159 "\tnumber of reset request: %d\n",
@@ -1176,9 +1176,9 @@ static ssize_t il_dbgfs_force_reset_write(struct file *file,
1176 size_t count, loff_t *ppos) { 1176 size_t count, loff_t *ppos) {
1177 1177
1178 int ret; 1178 int ret;
1179 struct il_priv *priv = file->private_data; 1179 struct il_priv *il = file->private_data;
1180 1180
1181 ret = il_force_reset(priv, true); 1181 ret = il_force_reset(il, true);
1182 1182
1183 return ret ? ret : count; 1183 return ret ? ret : count;
1184} 1184}
@@ -1187,7 +1187,7 @@ static ssize_t il_dbgfs_wd_timeout_write(struct file *file,
1187 const char __user *user_buf, 1187 const char __user *user_buf,
1188 size_t count, loff_t *ppos) { 1188 size_t count, loff_t *ppos) {
1189 1189
1190 struct il_priv *priv = file->private_data; 1190 struct il_priv *il = file->private_data;
1191 char buf[8]; 1191 char buf[8];
1192 int buf_size; 1192 int buf_size;
1193 int timeout; 1193 int timeout;
@@ -1201,8 +1201,8 @@ static ssize_t il_dbgfs_wd_timeout_write(struct file *file,
1201 if (timeout < 0 || timeout > IL_MAX_WD_TIMEOUT) 1201 if (timeout < 0 || timeout > IL_MAX_WD_TIMEOUT)
1202 timeout = IL_DEF_WD_TIMEOUT; 1202 timeout = IL_DEF_WD_TIMEOUT;
1203 1203
1204 priv->cfg->base_params->wd_timeout = timeout; 1204 il->cfg->base_params->wd_timeout = timeout;
1205 il_setup_watchdog(priv); 1205 il_setup_watchdog(il);
1206 return count; 1206 return count;
1207} 1207}
1208 1208
@@ -1230,16 +1230,16 @@ DEBUGFS_WRITE_FILE_OPS(wd_timeout);
1230 * Create the debugfs files and directories 1230 * Create the debugfs files and directories
1231 * 1231 *
1232 */ 1232 */
1233int il_dbgfs_register(struct il_priv *priv, const char *name) 1233int il_dbgfs_register(struct il_priv *il, const char *name)
1234{ 1234{
1235 struct dentry *phyd = priv->hw->wiphy->debugfsdir; 1235 struct dentry *phyd = il->hw->wiphy->debugfsdir;
1236 struct dentry *dir_drv, *dir_data, *dir_rf, *dir_debug; 1236 struct dentry *dir_drv, *dir_data, *dir_rf, *dir_debug;
1237 1237
1238 dir_drv = debugfs_create_dir(name, phyd); 1238 dir_drv = debugfs_create_dir(name, phyd);
1239 if (!dir_drv) 1239 if (!dir_drv)
1240 return -ENOMEM; 1240 return -ENOMEM;
1241 1241
1242 priv->debugfs_dir = dir_drv; 1242 il->debugfs_dir = dir_drv;
1243 1243
1244 dir_data = debugfs_create_dir("data", dir_drv); 1244 dir_data = debugfs_create_dir("data", dir_drv);
1245 if (!dir_data) 1245 if (!dir_data)
@@ -1274,26 +1274,26 @@ int il_dbgfs_register(struct il_priv *priv, const char *name)
1274 DEBUGFS_ADD_FILE(ucode_tx_stats, dir_debug, S_IRUSR); 1274 DEBUGFS_ADD_FILE(ucode_tx_stats, dir_debug, S_IRUSR);
1275 DEBUGFS_ADD_FILE(ucode_general_stats, dir_debug, S_IRUSR); 1275 DEBUGFS_ADD_FILE(ucode_general_stats, dir_debug, S_IRUSR);
1276 1276
1277 if (priv->cfg->base_params->sensitivity_calib_by_driver) 1277 if (il->cfg->base_params->sensitivity_calib_by_driver)
1278 DEBUGFS_ADD_FILE(sensitivity, dir_debug, S_IRUSR); 1278 DEBUGFS_ADD_FILE(sensitivity, dir_debug, S_IRUSR);
1279 if (priv->cfg->base_params->chain_noise_calib_by_driver) 1279 if (il->cfg->base_params->chain_noise_calib_by_driver)
1280 DEBUGFS_ADD_FILE(chain_noise, dir_debug, S_IRUSR); 1280 DEBUGFS_ADD_FILE(chain_noise, dir_debug, S_IRUSR);
1281 DEBUGFS_ADD_FILE(rxon_flags, dir_debug, S_IWUSR); 1281 DEBUGFS_ADD_FILE(rxon_flags, dir_debug, S_IWUSR);
1282 DEBUGFS_ADD_FILE(rxon_filter_flags, dir_debug, S_IWUSR); 1282 DEBUGFS_ADD_FILE(rxon_filter_flags, dir_debug, S_IWUSR);
1283 DEBUGFS_ADD_FILE(wd_timeout, dir_debug, S_IWUSR); 1283 DEBUGFS_ADD_FILE(wd_timeout, dir_debug, S_IWUSR);
1284 if (priv->cfg->base_params->sensitivity_calib_by_driver) 1284 if (il->cfg->base_params->sensitivity_calib_by_driver)
1285 DEBUGFS_ADD_BOOL(disable_sensitivity, dir_rf, 1285 DEBUGFS_ADD_BOOL(disable_sensitivity, dir_rf,
1286 &priv->disable_sens_cal); 1286 &il->disable_sens_cal);
1287 if (priv->cfg->base_params->chain_noise_calib_by_driver) 1287 if (il->cfg->base_params->chain_noise_calib_by_driver)
1288 DEBUGFS_ADD_BOOL(disable_chain_noise, dir_rf, 1288 DEBUGFS_ADD_BOOL(disable_chain_noise, dir_rf,
1289 &priv->disable_chain_noise_cal); 1289 &il->disable_chain_noise_cal);
1290 DEBUGFS_ADD_BOOL(disable_tx_power, dir_rf, 1290 DEBUGFS_ADD_BOOL(disable_tx_power, dir_rf,
1291 &priv->disable_tx_power_cal); 1291 &il->disable_tx_power_cal);
1292 return 0; 1292 return 0;
1293 1293
1294err: 1294err:
1295 IL_ERR(priv, "Can't create the debugfs directory\n"); 1295 IL_ERR(il, "Can't create the debugfs directory\n");
1296 il_dbgfs_unregister(priv); 1296 il_dbgfs_unregister(il);
1297 return -ENOMEM; 1297 return -ENOMEM;
1298} 1298}
1299EXPORT_SYMBOL(il_dbgfs_register); 1299EXPORT_SYMBOL(il_dbgfs_register);
@@ -1302,12 +1302,12 @@ EXPORT_SYMBOL(il_dbgfs_register);
1302 * Remove the debugfs files and directories 1302 * Remove the debugfs files and directories
1303 * 1303 *
1304 */ 1304 */
1305void il_dbgfs_unregister(struct il_priv *priv) 1305void il_dbgfs_unregister(struct il_priv *il)
1306{ 1306{
1307 if (!priv->debugfs_dir) 1307 if (!il->debugfs_dir)
1308 return; 1308 return;
1309 1309
1310 debugfs_remove_recursive(priv->debugfs_dir); 1310 debugfs_remove_recursive(il->debugfs_dir);
1311 priv->debugfs_dir = NULL; 1311 il->debugfs_dir = NULL;
1312} 1312}
1313EXPORT_SYMBOL(il_dbgfs_unregister); 1313EXPORT_SYMBOL(il_dbgfs_unregister);