From: Stanislaw Gruszka Instead of custom sysfs file use debugfs for setting/reading debug level. Use hex only format since 'level' is actually a mask. Signed-off-by: Stanislaw Gruszka --- .../net/wireless/intel/iwlegacy/3945-mac.c | 46 ------------------- .../net/wireless/intel/iwlegacy/4965-mac.c | 46 ------------------- drivers/net/wireless/intel/iwlegacy/debug.c | 3 ++ 3 files changed, 3 insertions(+), 92 deletions(-) diff --git a/drivers/net/wireless/intel/iwlegacy/3945-mac.c b/drivers/net/wireless/intel/iwlegacy/3945-mac.c index cbaf250626c5..aec45bcc2446 100644 --- a/drivers/net/wireless/intel/iwlegacy/3945-mac.c +++ b/drivers/net/wireless/intel/iwlegacy/3945-mac.c @@ -3010,49 +3010,6 @@ il3945_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags, * *****************************************************************************/ -#ifdef CONFIG_IWLEGACY_DEBUG - -/* - * The following adds a new attribute to the sysfs representation - * of this device driver (i.e. a new file in /sys/bus/pci/drivers/iwl/) - * used for controlling the debug level. - * - * See the level definitions in iwl for details. - * - * The debug_level being managed using sysfs below is a per device debug - * level that is used instead of the global debug level if it (the per - * device debug level) is set. - */ -static ssize_t -il3945_show_debug_level(struct device *d, struct device_attribute *attr, - char *buf) -{ - struct il_priv *il = dev_get_drvdata(d); - return sprintf(buf, "0x%08X\n", il_get_debug_level(il)); -} - -static ssize_t -il3945_store_debug_level(struct device *d, struct device_attribute *attr, - const char *buf, size_t count) -{ - struct il_priv *il = dev_get_drvdata(d); - unsigned long val; - int ret; - - ret = kstrtoul(buf, 0, &val); - if (ret) - IL_INFO("%s is not in hex or decimal form.\n", buf); - else - il->debug_level = val; - - return strnlen(buf, count); -} - -static DEVICE_ATTR(debug_level, 0644, il3945_show_debug_level, - il3945_store_debug_level); - -#endif /* CONFIG_IWLEGACY_DEBUG */ - static ssize_t il3945_show_temperature(struct device *d, struct device_attribute *attr, char *buf) @@ -3385,9 +3342,6 @@ static struct attribute *il3945_sysfs_entries[] = { &dev_attr_status.attr, &dev_attr_temperature.attr, &dev_attr_tx_power.attr, -#ifdef CONFIG_IWLEGACY_DEBUG - &dev_attr_debug_level.attr, -#endif NULL }; diff --git a/drivers/net/wireless/intel/iwlegacy/4965-mac.c b/drivers/net/wireless/intel/iwlegacy/4965-mac.c index 18bb55682643..dc420366dff3 100644 --- a/drivers/net/wireless/intel/iwlegacy/4965-mac.c +++ b/drivers/net/wireless/intel/iwlegacy/4965-mac.c @@ -4526,49 +4526,6 @@ il4965_irq_tasklet(struct tasklet_struct *t) * *****************************************************************************/ -#ifdef CONFIG_IWLEGACY_DEBUG - -/* - * The following adds a new attribute to the sysfs representation - * of this device driver (i.e. a new file in /sys/class/net/wlan0/device/) - * used for controlling the debug level. - * - * See the level definitions in iwl for details. - * - * The debug_level being managed using sysfs below is a per device debug - * level that is used instead of the global debug level if it (the per - * device debug level) is set. - */ -static ssize_t -il4965_show_debug_level(struct device *d, struct device_attribute *attr, - char *buf) -{ - struct il_priv *il = dev_get_drvdata(d); - return sprintf(buf, "0x%08X\n", il_get_debug_level(il)); -} - -static ssize_t -il4965_store_debug_level(struct device *d, struct device_attribute *attr, - const char *buf, size_t count) -{ - struct il_priv *il = dev_get_drvdata(d); - unsigned long val; - int ret; - - ret = kstrtoul(buf, 0, &val); - if (ret) - IL_ERR("%s is not in hex or decimal form.\n", buf); - else - il->debug_level = val; - - return strnlen(buf, count); -} - -static DEVICE_ATTR(debug_level, 0644, il4965_show_debug_level, - il4965_store_debug_level); - -#endif /* CONFIG_IWLEGACY_DEBUG */ - static ssize_t il4965_show_temperature(struct device *d, struct device_attribute *attr, char *buf) @@ -4623,9 +4580,6 @@ static DEVICE_ATTR(tx_power, 0644, il4965_show_tx_power, static struct attribute *il_sysfs_entries[] = { &dev_attr_temperature.attr, &dev_attr_tx_power.attr, -#ifdef CONFIG_IWLEGACY_DEBUG - &dev_attr_debug_level.attr, -#endif NULL }; diff --git a/drivers/net/wireless/intel/iwlegacy/debug.c b/drivers/net/wireless/intel/iwlegacy/debug.c index 8a9f79ff1c6e..6f95961037d1 100644 --- a/drivers/net/wireless/intel/iwlegacy/debug.c +++ b/drivers/net/wireless/intel/iwlegacy/debug.c @@ -1361,6 +1361,9 @@ il_dbgfs_register(struct il_priv *il, const char *name) DEBUGFS_ADD_BOOL(disable_chain_noise, dir_rf, &il->disable_chain_noise_cal); DEBUGFS_ADD_BOOL(disable_tx_power, dir_rf, &il->disable_tx_power_cal); +#ifdef CONFIG_IWLEGACY_DEBUG + debugfs_create_x32("debug_level", 0600, dir_debug, &il->debug_level); +#endif } EXPORT_SYMBOL(il_dbgfs_register); -- 2.50.1