iwlwifi: move show_qos to debugfs
authorWey-Yi Guy <wey-yi.w.guy@intel.com>
Thu, 9 Jul 2009 17:33:36 +0000 (10:33 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 24 Jul 2009 19:05:09 +0000 (15:05 -0400)
This move the show_qos file from sysfs to debugfs because the "one
value per file" sysfs rule.

The file is located in
/sys/kernel/debug/ieee80211/phy0/iwlagn/data

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/iwlwifi/iwl-agn.c
drivers/net/wireless/iwlwifi/iwl-debug.h
drivers/net/wireless/iwlwifi/iwl-debugfs.c

index e2cc5994d10863e4e7bc706aa0073f011bdad7c0..ad5002211ab4f1bd1a7ed0fbef07263546658b1d 100644 (file)
@@ -2627,26 +2627,6 @@ static ssize_t show_power_level(struct device *d,
 static DEVICE_ATTR(power_level, S_IWUSR | S_IRUSR, show_power_level,
                   store_power_level);
 
-static ssize_t show_qos(struct device *d,
-                               struct device_attribute *attr, char *buf)
-{
-       struct iwl_priv *priv = dev_get_drvdata(d);
-       char *p = buf;
-       int   q;
-
-       for (q = 0; q < AC_NUM; q++) {
-               p += sprintf(p, "\tcw_min\tcw_max\taifsn\ttxop\n");
-               p += sprintf(p, "AC[%d]\t%u\t%u\t%u\t%u\n", q,
-                            priv->qos_data.def_qos_parm.ac[q].cw_min,
-                            priv->qos_data.def_qos_parm.ac[q].cw_max,
-                            priv->qos_data.def_qos_parm.ac[q].aifsn,
-                            priv->qos_data.def_qos_parm.ac[q].edca_txop);
-       }
-
-       return p - buf + 1;
-}
-
-static DEVICE_ATTR(qos, S_IRUGO, show_qos, NULL);
 
 static ssize_t show_statistics(struct device *d,
                               struct device_attribute *attr, char *buf)
@@ -2747,7 +2727,6 @@ static struct attribute *iwl_sysfs_entries[] = {
        &dev_attr_debug_level.attr,
 #endif
        &dev_attr_version.attr,
-       &dev_attr_qos.attr,
        NULL
 };
 
index 65bbce0f17178aab9ee407d1f8ce52562b79f610..1555676fc519a47ca488ee6d0ab41cc9d15cff17 100644 (file)
@@ -82,6 +82,7 @@ struct iwl_debugfs {
                struct dentry *file_channels;
                struct dentry *file_status;
                struct dentry *file_interrupt;
+               struct dentry *file_qos;
        } dbgfs_data_files;
        struct dir_rf_files {
                struct dentry *file_disable_sensitivity;
index f32ac74b69ac63fe165dab1a2abb42b09d02e5a7..e38ec81b839b35e40982110db573e55ac25c0805 100644 (file)
@@ -566,6 +566,28 @@ static ssize_t iwl_dbgfs_interrupt_write(struct file *file,
        return count;
 }
 
+static ssize_t iwl_dbgfs_qos_read(struct file *file, char __user *user_buf,
+                                      size_t count, loff_t *ppos)
+{
+       struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
+       int pos = 0, i;
+       char buf[256];
+       const size_t bufsz = sizeof(buf);
+       ssize_t ret;
+
+       for (i = 0; i < AC_NUM; i++) {
+               pos += scnprintf(buf + pos, bufsz - pos,
+                       "\tcw_min\tcw_max\taifsn\ttxop\n");
+               pos += scnprintf(buf + pos, bufsz - pos,
+                               "AC[%d]\t%u\t%u\t%u\t%u\n", i,
+                               priv->qos_data.def_qos_parm.ac[i].cw_min,
+                               priv->qos_data.def_qos_parm.ac[i].cw_max,
+                               priv->qos_data.def_qos_parm.ac[i].aifsn,
+                               priv->qos_data.def_qos_parm.ac[i].edca_txop);
+       }
+       ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
+       return ret;
+}
 
 DEBUGFS_READ_WRITE_FILE_OPS(sram);
 DEBUGFS_WRITE_FILE_OPS(log_event);
@@ -576,6 +598,7 @@ DEBUGFS_READ_FILE_OPS(tx_statistics);
 DEBUGFS_READ_FILE_OPS(channels);
 DEBUGFS_READ_FILE_OPS(status);
 DEBUGFS_READ_WRITE_FILE_OPS(interrupt);
+DEBUGFS_READ_FILE_OPS(qos);
 
 /*
  * Create the debugfs files and directories
@@ -612,6 +635,7 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name)
        DEBUGFS_ADD_FILE(channels, data);
        DEBUGFS_ADD_FILE(status, data);
        DEBUGFS_ADD_FILE(interrupt, data);
+       DEBUGFS_ADD_FILE(qos, data);
        DEBUGFS_ADD_BOOL(disable_sensitivity, rf, &priv->disable_sens_cal);
        DEBUGFS_ADD_BOOL(disable_chain_noise, rf,
                         &priv->disable_chain_noise_cal);
@@ -646,6 +670,7 @@ void iwl_dbgfs_unregister(struct iwl_priv *priv)
        DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_channels);
        DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_status);
        DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_interrupt);
+       DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_qos);
        DEBUGFS_REMOVE(priv->dbgfs->dir_data);
        DEBUGFS_REMOVE(priv->dbgfs->dbgfs_rf_files.file_disable_sensitivity);
        DEBUGFS_REMOVE(priv->dbgfs->dbgfs_rf_files.file_disable_chain_noise);