diff options
author | Wey-Yi Guy <wey-yi.w.guy@intel.com> | 2010-10-06 11:10:00 -0400 |
---|---|---|
committer | Wey-Yi Guy <wey-yi.w.guy@intel.com> | 2010-10-06 11:10:00 -0400 |
commit | 7cb1b0887fcc61918e3d64827fbef968bb67a57a (patch) | |
tree | fa9103423af207c68be604523b3a362e1a6c3e14 /drivers/net/wireless/iwlwifi/iwl-debugfs.c | |
parent | 72645eff4b2ad6cf2b016b54f9d6817cca0a621d (diff) |
iwlagn: reduce redundant parameter definitions
move paramater definitions to a device paramater structure only
leaving the device name, which antennas are used and what firmware
file to use in the iwl_cfg structure. this will not completely
remove the redundancies but greatly reduce them for devices that
only vary by name or antennas. the parameters that are more
likely to change within a given device family are left in iwl_cfg.
also separate bt param structure added to help reduce more.
Signed-off-by: Jay Sternberg <jay.e.sternberg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-debugfs.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-debugfs.c | 58 |
1 files changed, 34 insertions, 24 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c index 265ad01a443f..fc340311ea0a 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c +++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c | |||
@@ -356,7 +356,7 @@ static ssize_t iwl_dbgfs_nvm_read(struct file *file, | |||
356 | const u8 *ptr; | 356 | const u8 *ptr; |
357 | char *buf; | 357 | char *buf; |
358 | u16 eeprom_ver; | 358 | u16 eeprom_ver; |
359 | size_t eeprom_len = priv->cfg->eeprom_size; | 359 | size_t eeprom_len = priv->cfg->base_params->eeprom_size; |
360 | buf_size = 4 * eeprom_len + 256; | 360 | buf_size = 4 * eeprom_len + 256; |
361 | 361 | ||
362 | if (eeprom_len % 16) { | 362 | if (eeprom_len % 16) { |
@@ -872,7 +872,7 @@ static ssize_t iwl_dbgfs_traffic_log_read(struct file *file, | |||
872 | struct iwl_rx_queue *rxq = &priv->rxq; | 872 | struct iwl_rx_queue *rxq = &priv->rxq; |
873 | char *buf; | 873 | char *buf; |
874 | int bufsz = ((IWL_TRAFFIC_ENTRIES * IWL_TRAFFIC_ENTRY_SIZE * 64) * 2) + | 874 | int bufsz = ((IWL_TRAFFIC_ENTRIES * IWL_TRAFFIC_ENTRY_SIZE * 64) * 2) + |
875 | (priv->cfg->num_of_queues * 32 * 8) + 400; | 875 | (priv->cfg->base_params->num_of_queues * 32 * 8) + 400; |
876 | const u8 *ptr; | 876 | const u8 *ptr; |
877 | ssize_t ret; | 877 | ssize_t ret; |
878 | 878 | ||
@@ -971,7 +971,8 @@ static ssize_t iwl_dbgfs_tx_queue_read(struct file *file, | |||
971 | int pos = 0; | 971 | int pos = 0; |
972 | int cnt; | 972 | int cnt; |
973 | int ret; | 973 | int ret; |
974 | const size_t bufsz = sizeof(char) * 64 * priv->cfg->num_of_queues; | 974 | const size_t bufsz = sizeof(char) * 64 * |
975 | priv->cfg->base_params->num_of_queues; | ||
975 | 976 | ||
976 | if (!priv->txq) { | 977 | if (!priv->txq) { |
977 | IWL_ERR(priv, "txq not ready\n"); | 978 | IWL_ERR(priv, "txq not ready\n"); |
@@ -1415,7 +1416,7 @@ static ssize_t iwl_dbgfs_plcp_delta_read(struct file *file, | |||
1415 | const size_t bufsz = sizeof(buf); | 1416 | const size_t bufsz = sizeof(buf); |
1416 | 1417 | ||
1417 | pos += scnprintf(buf + pos, bufsz - pos, "%u\n", | 1418 | pos += scnprintf(buf + pos, bufsz - pos, "%u\n", |
1418 | priv->cfg->plcp_delta_threshold); | 1419 | priv->cfg->base_params->plcp_delta_threshold); |
1419 | 1420 | ||
1420 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); | 1421 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
1421 | } | 1422 | } |
@@ -1437,10 +1438,10 @@ static ssize_t iwl_dbgfs_plcp_delta_write(struct file *file, | |||
1437 | return -EINVAL; | 1438 | return -EINVAL; |
1438 | if ((plcp < IWL_MAX_PLCP_ERR_THRESHOLD_MIN) || | 1439 | if ((plcp < IWL_MAX_PLCP_ERR_THRESHOLD_MIN) || |
1439 | (plcp > IWL_MAX_PLCP_ERR_THRESHOLD_MAX)) | 1440 | (plcp > IWL_MAX_PLCP_ERR_THRESHOLD_MAX)) |
1440 | priv->cfg->plcp_delta_threshold = | 1441 | priv->cfg->base_params->plcp_delta_threshold = |
1441 | IWL_MAX_PLCP_ERR_THRESHOLD_DISABLE; | 1442 | IWL_MAX_PLCP_ERR_THRESHOLD_DISABLE; |
1442 | else | 1443 | else |
1443 | priv->cfg->plcp_delta_threshold = plcp; | 1444 | priv->cfg->base_params->plcp_delta_threshold = plcp; |
1444 | return count; | 1445 | return count; |
1445 | } | 1446 | } |
1446 | 1447 | ||
@@ -1550,13 +1551,14 @@ static ssize_t iwl_dbgfs_monitor_period_write(struct file *file, | |||
1550 | if (sscanf(buf, "%d", &period) != 1) | 1551 | if (sscanf(buf, "%d", &period) != 1) |
1551 | return -EINVAL; | 1552 | return -EINVAL; |
1552 | if (period < 0 || period > IWL_MAX_MONITORING_PERIOD) | 1553 | if (period < 0 || period > IWL_MAX_MONITORING_PERIOD) |
1553 | priv->cfg->monitor_recover_period = IWL_DEF_MONITORING_PERIOD; | 1554 | priv->cfg->base_params->monitor_recover_period = |
1555 | IWL_DEF_MONITORING_PERIOD; | ||
1554 | else | 1556 | else |
1555 | priv->cfg->monitor_recover_period = period; | 1557 | priv->cfg->base_params->monitor_recover_period = period; |
1556 | 1558 | ||
1557 | if (priv->cfg->monitor_recover_period) | 1559 | if (priv->cfg->base_params->monitor_recover_period) |
1558 | mod_timer(&priv->monitor_recover, jiffies + msecs_to_jiffies( | 1560 | mod_timer(&priv->monitor_recover, jiffies + msecs_to_jiffies( |
1559 | priv->cfg->monitor_recover_period)); | 1561 | priv->cfg->base_params->monitor_recover_period)); |
1560 | else | 1562 | else |
1561 | del_timer_sync(&priv->monitor_recover); | 1563 | del_timer_sync(&priv->monitor_recover); |
1562 | return count; | 1564 | return count; |
@@ -1614,9 +1616,14 @@ static ssize_t iwl_dbgfs_protection_mode_read(struct file *file, | |||
1614 | char buf[40]; | 1616 | char buf[40]; |
1615 | const size_t bufsz = sizeof(buf); | 1617 | const size_t bufsz = sizeof(buf); |
1616 | 1618 | ||
1617 | pos += scnprintf(buf + pos, bufsz - pos, "use %s for aggregation\n", | 1619 | if (priv->cfg->ht_params) |
1618 | (priv->cfg->use_rts_for_aggregation) ? "rts/cts" : | 1620 | pos += scnprintf(buf + pos, bufsz - pos, |
1619 | "cts-to-self"); | 1621 | "use %s for aggregation\n", |
1622 | (priv->cfg->ht_params->use_rts_for_aggregation) ? | ||
1623 | "rts/cts" : "cts-to-self"); | ||
1624 | else | ||
1625 | pos += scnprintf(buf + pos, bufsz - pos, "N/A"); | ||
1626 | |||
1620 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); | 1627 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); |
1621 | } | 1628 | } |
1622 | 1629 | ||
@@ -1629,6 +1636,9 @@ static ssize_t iwl_dbgfs_protection_mode_write(struct file *file, | |||
1629 | int buf_size; | 1636 | int buf_size; |
1630 | int rts; | 1637 | int rts; |
1631 | 1638 | ||
1639 | if (!priv->cfg->ht_params) | ||
1640 | return -EINVAL; | ||
1641 | |||
1632 | memset(buf, 0, sizeof(buf)); | 1642 | memset(buf, 0, sizeof(buf)); |
1633 | buf_size = min(count, sizeof(buf) - 1); | 1643 | buf_size = min(count, sizeof(buf) - 1); |
1634 | if (copy_from_user(buf, user_buf, buf_size)) | 1644 | if (copy_from_user(buf, user_buf, buf_size)) |
@@ -1636,9 +1646,9 @@ static ssize_t iwl_dbgfs_protection_mode_write(struct file *file, | |||
1636 | if (sscanf(buf, "%d", &rts) != 1) | 1646 | if (sscanf(buf, "%d", &rts) != 1) |
1637 | return -EINVAL; | 1647 | return -EINVAL; |
1638 | if (rts) | 1648 | if (rts) |
1639 | priv->cfg->use_rts_for_aggregation = true; | 1649 | priv->cfg->ht_params->use_rts_for_aggregation = true; |
1640 | else | 1650 | else |
1641 | priv->cfg->use_rts_for_aggregation = false; | 1651 | priv->cfg->ht_params->use_rts_for_aggregation = false; |
1642 | return count; | 1652 | return count; |
1643 | } | 1653 | } |
1644 | 1654 | ||
@@ -1716,7 +1726,7 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) | |||
1716 | DEBUGFS_ADD_FILE(interrupt, dir_data, S_IWUSR | S_IRUSR); | 1726 | DEBUGFS_ADD_FILE(interrupt, dir_data, S_IWUSR | S_IRUSR); |
1717 | DEBUGFS_ADD_FILE(qos, dir_data, S_IRUSR); | 1727 | DEBUGFS_ADD_FILE(qos, dir_data, S_IRUSR); |
1718 | DEBUGFS_ADD_FILE(led, dir_data, S_IRUSR); | 1728 | DEBUGFS_ADD_FILE(led, dir_data, S_IRUSR); |
1719 | if (!priv->cfg->broken_powersave) { | 1729 | if (!priv->cfg->base_params->broken_powersave) { |
1720 | DEBUGFS_ADD_FILE(sleep_level_override, dir_data, | 1730 | DEBUGFS_ADD_FILE(sleep_level_override, dir_data, |
1721 | S_IWUSR | S_IRUSR); | 1731 | S_IWUSR | S_IRUSR); |
1722 | DEBUGFS_ADD_FILE(current_sleep_command, dir_data, S_IRUSR); | 1732 | DEBUGFS_ADD_FILE(current_sleep_command, dir_data, S_IRUSR); |
@@ -1743,27 +1753,27 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) | |||
1743 | DEBUGFS_ADD_FILE(txfifo_flush, dir_debug, S_IWUSR); | 1753 | DEBUGFS_ADD_FILE(txfifo_flush, dir_debug, S_IWUSR); |
1744 | DEBUGFS_ADD_FILE(protection_mode, dir_debug, S_IWUSR | S_IRUSR); | 1754 | DEBUGFS_ADD_FILE(protection_mode, dir_debug, S_IWUSR | S_IRUSR); |
1745 | 1755 | ||
1746 | if (priv->cfg->sensitivity_calib_by_driver) | 1756 | if (priv->cfg->base_params->sensitivity_calib_by_driver) |
1747 | DEBUGFS_ADD_FILE(sensitivity, dir_debug, S_IRUSR); | 1757 | DEBUGFS_ADD_FILE(sensitivity, dir_debug, S_IRUSR); |
1748 | if (priv->cfg->chain_noise_calib_by_driver) | 1758 | if (priv->cfg->base_params->chain_noise_calib_by_driver) |
1749 | DEBUGFS_ADD_FILE(chain_noise, dir_debug, S_IRUSR); | 1759 | DEBUGFS_ADD_FILE(chain_noise, dir_debug, S_IRUSR); |
1750 | if (priv->cfg->ucode_tracing) | 1760 | if (priv->cfg->base_params->ucode_tracing) |
1751 | DEBUGFS_ADD_FILE(ucode_tracing, dir_debug, S_IWUSR | S_IRUSR); | 1761 | DEBUGFS_ADD_FILE(ucode_tracing, dir_debug, S_IWUSR | S_IRUSR); |
1752 | if (priv->cfg->bt_statistics) | 1762 | if (priv->cfg->bt_params && priv->cfg->bt_params->bt_statistics) |
1753 | DEBUGFS_ADD_FILE(ucode_bt_stats, dir_debug, S_IRUSR); | 1763 | DEBUGFS_ADD_FILE(ucode_bt_stats, dir_debug, S_IRUSR); |
1754 | DEBUGFS_ADD_FILE(reply_tx_error, dir_debug, S_IRUSR); | 1764 | DEBUGFS_ADD_FILE(reply_tx_error, dir_debug, S_IRUSR); |
1755 | DEBUGFS_ADD_FILE(rxon_flags, dir_debug, S_IWUSR); | 1765 | DEBUGFS_ADD_FILE(rxon_flags, dir_debug, S_IWUSR); |
1756 | DEBUGFS_ADD_FILE(rxon_filter_flags, dir_debug, S_IWUSR); | 1766 | DEBUGFS_ADD_FILE(rxon_filter_flags, dir_debug, S_IWUSR); |
1757 | DEBUGFS_ADD_FILE(monitor_period, dir_debug, S_IWUSR); | 1767 | DEBUGFS_ADD_FILE(monitor_period, dir_debug, S_IWUSR); |
1758 | if (priv->cfg->advanced_bt_coexist) | 1768 | if (priv->cfg->bt_params && priv->cfg->bt_params->advanced_bt_coexist) |
1759 | DEBUGFS_ADD_FILE(bt_traffic, dir_debug, S_IRUSR); | 1769 | DEBUGFS_ADD_FILE(bt_traffic, dir_debug, S_IRUSR); |
1760 | if (priv->cfg->sensitivity_calib_by_driver) | 1770 | if (priv->cfg->base_params->sensitivity_calib_by_driver) |
1761 | DEBUGFS_ADD_BOOL(disable_sensitivity, dir_rf, | 1771 | DEBUGFS_ADD_BOOL(disable_sensitivity, dir_rf, |
1762 | &priv->disable_sens_cal); | 1772 | &priv->disable_sens_cal); |
1763 | if (priv->cfg->chain_noise_calib_by_driver) | 1773 | if (priv->cfg->base_params->chain_noise_calib_by_driver) |
1764 | DEBUGFS_ADD_BOOL(disable_chain_noise, dir_rf, | 1774 | DEBUGFS_ADD_BOOL(disable_chain_noise, dir_rf, |
1765 | &priv->disable_chain_noise_cal); | 1775 | &priv->disable_chain_noise_cal); |
1766 | if (priv->cfg->tx_power_by_driver) | 1776 | if (priv->cfg->base_params->tx_power_by_driver) |
1767 | DEBUGFS_ADD_BOOL(disable_tx_power, dir_rf, | 1777 | DEBUGFS_ADD_BOOL(disable_tx_power, dir_rf, |
1768 | &priv->disable_tx_power_cal); | 1778 | &priv->disable_tx_power_cal); |
1769 | return 0; | 1779 | return 0; |