diff options
author | Winkler, Tomas <tomas.winkler@intel.com> | 2008-12-02 15:14:01 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-12-05 09:35:54 -0500 |
commit | d366df5abb8d5ce7e2c36d3b678177787ccd9749 (patch) | |
tree | 841662477bb142fd0b0f5af5310f34a7f35e535e | |
parent | 0ad91a35bcb6dd993ad7d34f159afae929b4743d (diff) |
iwlwifi: move channels sysfs to debugfs
This patch moves channels info display from sysfs to debugfs.
This shows channel information as stored in NIC EEPROM. This
is useful in debugging CRDA or iwl goes setting so it belongs
rather to debugfs then to sysfs.
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn.c | 63 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-debug.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-debugfs.c | 76 |
3 files changed, 77 insertions, 63 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index 40905d2dc231..e8368b69d8cd 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -3580,68 +3580,6 @@ static ssize_t show_power_level(struct device *d, | |||
3580 | static DEVICE_ATTR(power_level, S_IWUSR | S_IRUSR, show_power_level, | 3580 | static DEVICE_ATTR(power_level, S_IWUSR | S_IRUSR, show_power_level, |
3581 | store_power_level); | 3581 | store_power_level); |
3582 | 3582 | ||
3583 | static ssize_t show_channels(struct device *d, | ||
3584 | struct device_attribute *attr, char *buf) | ||
3585 | { | ||
3586 | |||
3587 | struct iwl_priv *priv = dev_get_drvdata(d); | ||
3588 | struct ieee80211_channel *channels = NULL; | ||
3589 | const struct ieee80211_supported_band *supp_band = NULL; | ||
3590 | int len = 0, i; | ||
3591 | int count = 0; | ||
3592 | |||
3593 | if (!test_bit(STATUS_GEO_CONFIGURED, &priv->status)) | ||
3594 | return -EAGAIN; | ||
3595 | |||
3596 | supp_band = iwl_get_hw_mode(priv, IEEE80211_BAND_2GHZ); | ||
3597 | channels = supp_band->channels; | ||
3598 | count = supp_band->n_channels; | ||
3599 | |||
3600 | len += sprintf(&buf[len], | ||
3601 | "Displaying %d channels in 2.4GHz band " | ||
3602 | "(802.11bg):\n", count); | ||
3603 | |||
3604 | for (i = 0; i < count; i++) | ||
3605 | len += sprintf(&buf[len], "%d: %ddBm: BSS%s%s, %s.\n", | ||
3606 | ieee80211_frequency_to_channel( | ||
3607 | channels[i].center_freq), | ||
3608 | channels[i].max_power, | ||
3609 | channels[i].flags & IEEE80211_CHAN_RADAR ? | ||
3610 | " (IEEE 802.11h required)" : "", | ||
3611 | (!(channels[i].flags & IEEE80211_CHAN_NO_IBSS) | ||
3612 | || (channels[i].flags & | ||
3613 | IEEE80211_CHAN_RADAR)) ? "" : | ||
3614 | ", IBSS", | ||
3615 | channels[i].flags & | ||
3616 | IEEE80211_CHAN_PASSIVE_SCAN ? | ||
3617 | "passive only" : "active/passive"); | ||
3618 | |||
3619 | supp_band = iwl_get_hw_mode(priv, IEEE80211_BAND_5GHZ); | ||
3620 | channels = supp_band->channels; | ||
3621 | count = supp_band->n_channels; | ||
3622 | |||
3623 | len += sprintf(&buf[len], "Displaying %d channels in 5.2GHz band " | ||
3624 | "(802.11a):\n", count); | ||
3625 | |||
3626 | for (i = 0; i < count; i++) | ||
3627 | len += sprintf(&buf[len], "%d: %ddBm: BSS%s%s, %s.\n", | ||
3628 | ieee80211_frequency_to_channel( | ||
3629 | channels[i].center_freq), | ||
3630 | channels[i].max_power, | ||
3631 | channels[i].flags & IEEE80211_CHAN_RADAR ? | ||
3632 | " (IEEE 802.11h required)" : "", | ||
3633 | ((channels[i].flags & IEEE80211_CHAN_NO_IBSS) | ||
3634 | || (channels[i].flags & | ||
3635 | IEEE80211_CHAN_RADAR)) ? "" : | ||
3636 | ", IBSS", | ||
3637 | channels[i].flags & | ||
3638 | IEEE80211_CHAN_PASSIVE_SCAN ? | ||
3639 | "passive only" : "active/passive"); | ||
3640 | |||
3641 | return len; | ||
3642 | } | ||
3643 | |||
3644 | static DEVICE_ATTR(channels, S_IRUSR, show_channels, NULL); | ||
3645 | 3583 | ||
3646 | static ssize_t show_statistics(struct device *d, | 3584 | static ssize_t show_statistics(struct device *d, |
3647 | struct device_attribute *attr, char *buf) | 3585 | struct device_attribute *attr, char *buf) |
@@ -3741,7 +3679,6 @@ static void iwl_cancel_deferred_work(struct iwl_priv *priv) | |||
3741 | } | 3679 | } |
3742 | 3680 | ||
3743 | static struct attribute *iwl_sysfs_entries[] = { | 3681 | static struct attribute *iwl_sysfs_entries[] = { |
3744 | &dev_attr_channels.attr, | ||
3745 | &dev_attr_flags.attr, | 3682 | &dev_attr_flags.attr, |
3746 | &dev_attr_filter_flags.attr, | 3683 | &dev_attr_filter_flags.attr, |
3747 | &dev_attr_power_level.attr, | 3684 | &dev_attr_power_level.attr, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-debug.h b/drivers/net/wireless/iwlwifi/iwl-debug.h index 0e79a6ab4c81..a115dc64f6a6 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debug.h +++ b/drivers/net/wireless/iwlwifi/iwl-debug.h | |||
@@ -60,6 +60,7 @@ struct iwl_debugfs { | |||
60 | struct dentry *file_rx_statistics; | 60 | struct dentry *file_rx_statistics; |
61 | struct dentry *file_tx_statistics; | 61 | struct dentry *file_tx_statistics; |
62 | struct dentry *file_log_event; | 62 | struct dentry *file_log_event; |
63 | struct dentry *file_channels; | ||
63 | } dbgfs_data_files; | 64 | } dbgfs_data_files; |
64 | struct dir_rf_files { | 65 | struct dir_rf_files { |
65 | struct dentry *file_disable_sensitivity; | 66 | struct dentry *file_disable_sensitivity; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c index c3df5aa8df91..370b66c444b3 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c +++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c | |||
@@ -348,12 +348,86 @@ static ssize_t iwl_dbgfs_log_event_write(struct file *file, | |||
348 | return count; | 348 | return count; |
349 | } | 349 | } |
350 | 350 | ||
351 | |||
352 | |||
353 | static ssize_t iwl_dbgfs_channels_read(struct file *file, char __user *user_buf, | ||
354 | size_t count, loff_t *ppos) | ||
355 | { | ||
356 | struct iwl_priv *priv = (struct iwl_priv *)file->private_data; | ||
357 | struct ieee80211_channel *channels = NULL; | ||
358 | const struct ieee80211_supported_band *supp_band = NULL; | ||
359 | int pos = 0, i, bufsz = PAGE_SIZE; | ||
360 | char *buf; | ||
361 | ssize_t ret; | ||
362 | |||
363 | if (!test_bit(STATUS_GEO_CONFIGURED, &priv->status)) | ||
364 | return -EAGAIN; | ||
365 | |||
366 | buf = kzalloc(bufsz, GFP_KERNEL); | ||
367 | if (!buf) { | ||
368 | IWL_ERROR("Can not allocate Buffer\n"); | ||
369 | return -ENOMEM; | ||
370 | } | ||
371 | |||
372 | supp_band = iwl_get_hw_mode(priv, IEEE80211_BAND_2GHZ); | ||
373 | channels = supp_band->channels; | ||
374 | |||
375 | pos += scnprintf(buf + pos, bufsz - pos, | ||
376 | "Displaying %d channels in 2.4GHz band 802.11bg):\n", | ||
377 | supp_band->n_channels); | ||
378 | |||
379 | for (i = 0; i < supp_band->n_channels; i++) | ||
380 | pos += scnprintf(buf + pos, bufsz - pos, | ||
381 | "%d: %ddBm: BSS%s%s, %s.\n", | ||
382 | ieee80211_frequency_to_channel( | ||
383 | channels[i].center_freq), | ||
384 | channels[i].max_power, | ||
385 | channels[i].flags & IEEE80211_CHAN_RADAR ? | ||
386 | " (IEEE 802.11h required)" : "", | ||
387 | (!(channels[i].flags & IEEE80211_CHAN_NO_IBSS) | ||
388 | || (channels[i].flags & | ||
389 | IEEE80211_CHAN_RADAR)) ? "" : | ||
390 | ", IBSS", | ||
391 | channels[i].flags & | ||
392 | IEEE80211_CHAN_PASSIVE_SCAN ? | ||
393 | "passive only" : "active/passive"); | ||
394 | |||
395 | supp_band = iwl_get_hw_mode(priv, IEEE80211_BAND_5GHZ); | ||
396 | channels = supp_band->channels; | ||
397 | |||
398 | pos += scnprintf(buf + pos, bufsz - pos, | ||
399 | "Displaying %d channels in 5.2GHz band (802.11a)\n", | ||
400 | supp_band->n_channels); | ||
401 | |||
402 | for (i = 0; i < supp_band->n_channels; i++) | ||
403 | pos += scnprintf(buf + pos, bufsz - pos, | ||
404 | "%d: %ddBm: BSS%s%s, %s.\n", | ||
405 | ieee80211_frequency_to_channel( | ||
406 | channels[i].center_freq), | ||
407 | channels[i].max_power, | ||
408 | channels[i].flags & IEEE80211_CHAN_RADAR ? | ||
409 | " (IEEE 802.11h required)" : "", | ||
410 | ((channels[i].flags & IEEE80211_CHAN_NO_IBSS) | ||
411 | || (channels[i].flags & | ||
412 | IEEE80211_CHAN_RADAR)) ? "" : | ||
413 | ", IBSS", | ||
414 | channels[i].flags & | ||
415 | IEEE80211_CHAN_PASSIVE_SCAN ? | ||
416 | "passive only" : "active/passive"); | ||
417 | |||
418 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); | ||
419 | kfree(buf); | ||
420 | return ret; | ||
421 | } | ||
422 | |||
423 | |||
351 | DEBUGFS_READ_WRITE_FILE_OPS(sram); | 424 | DEBUGFS_READ_WRITE_FILE_OPS(sram); |
352 | DEBUGFS_WRITE_FILE_OPS(log_event); | 425 | DEBUGFS_WRITE_FILE_OPS(log_event); |
353 | DEBUGFS_READ_FILE_OPS(eeprom); | 426 | DEBUGFS_READ_FILE_OPS(eeprom); |
354 | DEBUGFS_READ_FILE_OPS(stations); | 427 | DEBUGFS_READ_FILE_OPS(stations); |
355 | DEBUGFS_READ_FILE_OPS(rx_statistics); | 428 | DEBUGFS_READ_FILE_OPS(rx_statistics); |
356 | DEBUGFS_READ_FILE_OPS(tx_statistics); | 429 | DEBUGFS_READ_FILE_OPS(tx_statistics); |
430 | DEBUGFS_READ_FILE_OPS(channels); | ||
357 | 431 | ||
358 | /* | 432 | /* |
359 | * Create the debugfs files and directories | 433 | * Create the debugfs files and directories |
@@ -387,6 +461,7 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) | |||
387 | DEBUGFS_ADD_FILE(stations, data); | 461 | DEBUGFS_ADD_FILE(stations, data); |
388 | DEBUGFS_ADD_FILE(rx_statistics, data); | 462 | DEBUGFS_ADD_FILE(rx_statistics, data); |
389 | DEBUGFS_ADD_FILE(tx_statistics, data); | 463 | DEBUGFS_ADD_FILE(tx_statistics, data); |
464 | DEBUGFS_ADD_FILE(channels, data); | ||
390 | DEBUGFS_ADD_BOOL(disable_sensitivity, rf, &priv->disable_sens_cal); | 465 | DEBUGFS_ADD_BOOL(disable_sensitivity, rf, &priv->disable_sens_cal); |
391 | DEBUGFS_ADD_BOOL(disable_chain_noise, rf, | 466 | DEBUGFS_ADD_BOOL(disable_chain_noise, rf, |
392 | &priv->disable_chain_noise_cal); | 467 | &priv->disable_chain_noise_cal); |
@@ -415,6 +490,7 @@ void iwl_dbgfs_unregister(struct iwl_priv *priv) | |||
415 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_sram); | 490 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_sram); |
416 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_log_event); | 491 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_log_event); |
417 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_stations); | 492 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_stations); |
493 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_channels); | ||
418 | DEBUGFS_REMOVE(priv->dbgfs->dir_data); | 494 | DEBUGFS_REMOVE(priv->dbgfs->dir_data); |
419 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_rf_files.file_disable_sensitivity); | 495 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_rf_files.file_disable_sensitivity); |
420 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_rf_files.file_disable_chain_noise); | 496 | DEBUGFS_REMOVE(priv->dbgfs->dbgfs_rf_files.file_disable_chain_noise); |