diff options
author | Johannes Berg <johannes.berg@intel.com> | 2011-09-15 11:46:48 -0700 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-09-19 16:10:09 -0400 |
commit | ca934b6715c134573da5acea01e9258eb0bf7c27 (patch) | |
tree | 1a86330109a0b9a110ab55834302afb4b45b6fa7 /drivers/net/wireless/iwlwifi/iwl-debugfs.c | |
parent | fd90b3c1bab995f9225d8048d6d60e39dedac7ed (diff) | |
download | op-kernel-dev-ca934b6715c134573da5acea01e9258eb0bf7c27.zip op-kernel-dev-ca934b6715c134573da5acea01e9258eb0bf7c27.tar.gz |
iwlagn: move sysfs files to debugfs
The debug_level and temperature files should be in
debugfs, the txpower file is completely unneeded
since TX power can be set with iw/iwconfig.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-debugfs.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-debugfs.c | 72 |
1 files changed, 64 insertions, 8 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c index d0c63cf..bf2a678 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c +++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c @@ -64,6 +64,14 @@ goto err; \ } while (0) +#define DEBUGFS_ADD_U32(name, parent, ptr, mode) do { \ + struct dentry *__tmp; \ + __tmp = debugfs_create_u32(#name, mode, \ + parent, ptr); \ + if (IS_ERR(__tmp) || !__tmp) \ + goto err; \ +} while (0) + /* file operation */ #define DEBUGFS_READ_FUNC(name) \ static ssize_t iwl_dbgfs_##name##_read(struct file *file, \ @@ -2229,8 +2237,8 @@ static ssize_t iwl_dbgfs_plcp_delta_write(struct file *file, static ssize_t iwl_dbgfs_force_reset_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) { - + size_t count, loff_t *ppos) +{ struct iwl_priv *priv = file->private_data; int i, pos = 0; char buf[300]; @@ -2309,8 +2317,8 @@ static ssize_t iwl_dbgfs_txfifo_flush_write(struct file *file, static ssize_t iwl_dbgfs_wd_timeout_write(struct file *file, const char __user *user_buf, - size_t count, loff_t *ppos) { - + size_t count, loff_t *ppos) +{ struct iwl_priv *priv = file->private_data; char buf[8]; int buf_size; @@ -2445,6 +2453,52 @@ DEBUGFS_READ_FILE_OPS(bt_traffic); DEBUGFS_READ_WRITE_FILE_OPS(protection_mode); DEBUGFS_READ_FILE_OPS(reply_tx_error); +#ifdef CONFIG_IWLWIFI_DEBUG +static ssize_t iwl_dbgfs_debug_level_read(struct file *file, + char __user *user_buf, + size_t count, loff_t *ppos) +{ + struct iwl_priv *priv = file->private_data; + struct iwl_shared *shrd = priv->shrd; + char buf[11]; + int len; + + len = scnprintf(buf, sizeof(buf), "0x%.8x", + iwl_get_debug_level(shrd)); + + return simple_read_from_buffer(user_buf, count, ppos, buf, len); +} + +static ssize_t iwl_dbgfs_debug_level_write(struct file *file, + const char __user *user_buf, + size_t count, loff_t *ppos) +{ + struct iwl_priv *priv = file->private_data; + struct iwl_shared *shrd = priv->shrd; + char buf[11]; + unsigned long val; + int ret; + + if (count > sizeof(buf)) + return -EINVAL; + + memset(buf, 0, sizeof(buf)); + if (copy_from_user(buf, user_buf, count)) + return -EFAULT; + + ret = strict_strtoul(buf, 0, &val); + if (ret) + return ret; + + shrd->dbg_level_dev = val; + if (iwl_alloc_traffic_mem(priv)) + IWL_ERR(priv, "Not enough memory to generate traffic log\n"); + + return count; +} +DEBUGFS_READ_WRITE_FILE_OPS(debug_level); +#endif /* CONFIG_IWLWIFI_DEBUG */ + /* * Create the debugfs files and directories * @@ -2482,6 +2536,8 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) DEBUGFS_ADD_FILE(current_sleep_command, dir_data, S_IRUSR); DEBUGFS_ADD_FILE(thermal_throttling, dir_data, S_IRUSR); DEBUGFS_ADD_FILE(disable_ht40, dir_data, S_IWUSR | S_IRUSR); + DEBUGFS_ADD_U32(temperature, dir_data, &priv->temperature, S_IRUSR); + DEBUGFS_ADD_FILE(rx_statistics, dir_debug, S_IRUSR); DEBUGFS_ADD_FILE(tx_statistics, dir_debug, S_IRUSR); DEBUGFS_ADD_FILE(traffic_log, dir_debug, S_IWUSR | S_IRUSR); @@ -2496,7 +2552,6 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) DEBUGFS_ADD_FILE(ucode_general_stats, dir_debug, S_IRUSR); DEBUGFS_ADD_FILE(txfifo_flush, dir_debug, S_IWUSR); DEBUGFS_ADD_FILE(protection_mode, dir_debug, S_IWUSR | S_IRUSR); - DEBUGFS_ADD_FILE(sensitivity, dir_debug, S_IRUSR); DEBUGFS_ADD_FILE(chain_noise, dir_debug, S_IRUSR); DEBUGFS_ADD_FILE(ucode_tracing, dir_debug, S_IWUSR | S_IRUSR); @@ -2507,6 +2562,10 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) DEBUGFS_ADD_FILE(wd_timeout, dir_debug, S_IWUSR); if (iwl_advanced_bt_coexist(priv)) DEBUGFS_ADD_FILE(bt_traffic, dir_debug, S_IRUSR); +#ifdef CONFIG_IWLWIFI_DEBUG + DEBUGFS_ADD_FILE(debug_level, dir_debug, S_IRUSR | S_IWUSR); +#endif + DEBUGFS_ADD_BOOL(disable_sensitivity, dir_rf, &priv->disable_sens_cal); DEBUGFS_ADD_BOOL(disable_chain_noise, dir_rf, @@ -2534,6 +2593,3 @@ void iwl_dbgfs_unregister(struct iwl_priv *priv) debugfs_remove_recursive(priv->debugfs_dir); priv->debugfs_dir = NULL; } - - - |