فهرست منبع

iwlwifi: move debug_level to sysfs/bus/pci/devices

This patch ports the debug_level from sysfs/bus/pci/drivers/iwl4965
to /sys/class/net/wlanX/device/debug_level

Signed-off-by: Ester Kummer <ester.kummer@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Ester Kummer 17 سال پیش
والد
کامیت
8cf769c6dc

+ 2 - 2
drivers/net/wireless/iwlwifi/Kconfig

@@ -97,13 +97,13 @@ config IWLWIFI_DEBUG
 	  control which debug output is sent to the kernel log by setting the
 	  control which debug output is sent to the kernel log by setting the
 	  value in
 	  value in
 
 
-	          /sys/bus/pci/drivers/${DRIVER}/debug_level
+		/sys/class/net/wlan0/device/debug_level
 
 
 	  This entry will only exist if this option is enabled.
 	  This entry will only exist if this option is enabled.
 
 
 	  To set a value, simply echo an 8-byte hex value to the same file:
 	  To set a value, simply echo an 8-byte hex value to the same file:
 
 
-		  % echo 0x43fff > /sys/bus/pci/drivers/${DRIVER}/debug_level
+		  % echo 0x43fff > /sys/class/net/wlan0/device/debug_level
 
 
 	  You can find the list of debug mask values in:
 	  You can find the list of debug mask values in:
 		  drivers/net/wireless/iwlwifi/iwl-4965-debug.h
 		  drivers/net/wireless/iwlwifi/iwl-4965-debug.h

+ 0 - 5
drivers/net/wireless/iwlwifi/iwl-core.c

@@ -46,11 +46,6 @@ MODULE_VERSION(IWLWIFI_VERSION);
 MODULE_AUTHOR(DRV_COPYRIGHT);
 MODULE_AUTHOR(DRV_COPYRIGHT);
 MODULE_LICENSE("GPL");
 MODULE_LICENSE("GPL");
 
 
-#ifdef CONFIG_IWLWIFI_DEBUG
-u32 iwl_debug_level;
-EXPORT_SYMBOL(iwl_debug_level);
-#endif
-
 #define IWL_DECLARE_RATE_INFO(r, s, ip, in, rp, rn, pp, np)    \
 #define IWL_DECLARE_RATE_INFO(r, s, ip, in, rp, rn, pp, np)    \
 	[IWL_RATE_##r##M_INDEX] = { IWL_RATE_##r##M_PLCP,      \
 	[IWL_RATE_##r##M_INDEX] = { IWL_RATE_##r##M_PLCP,      \
 				    IWL_RATE_SISO_##s##M_PLCP, \
 				    IWL_RATE_SISO_##s##M_PLCP, \

+ 0 - 1
drivers/net/wireless/iwlwifi/iwl-debug.h

@@ -30,7 +30,6 @@
 #define __iwl_debug_h__
 #define __iwl_debug_h__
 
 
 #ifdef CONFIG_IWLWIFI_DEBUG
 #ifdef CONFIG_IWLWIFI_DEBUG
-extern u32 iwl_debug_level;
 #define IWL_DEBUG(level, fmt, args...) \
 #define IWL_DEBUG(level, fmt, args...) \
 do { if (priv->debug_level & (level)) \
 do { if (priv->debug_level & (level)) \
   dev_printk(KERN_ERR, &(priv->hw->wiphy->dev), "%c %s " fmt, \
   dev_printk(KERN_ERR, &(priv->hw->wiphy->dev), "%c %s " fmt, \

+ 15 - 16
drivers/net/wireless/iwlwifi/iwl4965-base.c

@@ -5963,13 +5963,18 @@ static int iwl4965_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *sk
  * See the level definitions in iwl for details.
  * See the level definitions in iwl for details.
  */
  */
 
 
-static ssize_t show_debug_level(struct device_driver *d, char *buf)
+static ssize_t show_debug_level(struct device *d,
+				struct device_attribute *attr, char *buf)
 {
 {
-	return sprintf(buf, "0x%08X\n", iwl_debug_level);
+	struct iwl_priv *priv = d->driver_data;
+
+	return sprintf(buf, "0x%08X\n", priv->debug_level);
 }
 }
-static ssize_t store_debug_level(struct device_driver *d,
+static ssize_t store_debug_level(struct device *d,
+				struct device_attribute *attr,
 				 const char *buf, size_t count)
 				 const char *buf, size_t count)
 {
 {
+	struct iwl_priv *priv = d->driver_data;
 	char *p = (char *)buf;
 	char *p = (char *)buf;
 	u32 val;
 	u32 val;
 
 
@@ -5978,13 +5983,14 @@ static ssize_t store_debug_level(struct device_driver *d,
 		printk(KERN_INFO DRV_NAME
 		printk(KERN_INFO DRV_NAME
 		       ": %s is not in hex or decimal form.\n", buf);
 		       ": %s is not in hex or decimal form.\n", buf);
 	else
 	else
-		iwl_debug_level = val;
+		priv->debug_level = val;
 
 
 	return strnlen(buf, count);
 	return strnlen(buf, count);
 }
 }
 
 
-static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO,
-		   show_debug_level, store_debug_level);
+static DEVICE_ATTR(debug_level, S_IWUSR | S_IRUGO,
+			show_debug_level, store_debug_level);
+
 
 
 #endif /* CONFIG_IWLWIFI_DEBUG */
 #endif /* CONFIG_IWLWIFI_DEBUG */
 
 
@@ -6431,6 +6437,9 @@ static struct attribute *iwl4965_sysfs_entries[] = {
 	&dev_attr_status.attr,
 	&dev_attr_status.attr,
 	&dev_attr_temperature.attr,
 	&dev_attr_temperature.attr,
 	&dev_attr_tx_power.attr,
 	&dev_attr_tx_power.attr,
+#ifdef CONFIG_IWLWIFI_DEBUG
+	&dev_attr_debug_level.attr,
+#endif
 
 
 	NULL
 	NULL
 };
 };
@@ -6817,13 +6826,6 @@ static int __init iwl4965_init(void)
 		IWL_ERROR("Unable to initialize PCI module\n");
 		IWL_ERROR("Unable to initialize PCI module\n");
 		goto error_register;
 		goto error_register;
 	}
 	}
-#ifdef CONFIG_IWLWIFI_DEBUG
-	ret = driver_create_file(&iwl_driver.driver, &driver_attr_debug_level);
-	if (ret) {
-		IWL_ERROR("Unable to create driver sysfs file\n");
-		goto error_debug;
-	}
-#endif
 
 
 	return ret;
 	return ret;
 
 
@@ -6838,9 +6840,6 @@ error_register:
 
 
 static void __exit iwl4965_exit(void)
 static void __exit iwl4965_exit(void)
 {
 {
-#ifdef CONFIG_IWLWIFI_DEBUG
-	driver_remove_file(&iwl_driver.driver, &driver_attr_debug_level);
-#endif
 	pci_unregister_driver(&iwl_driver);
 	pci_unregister_driver(&iwl_driver);
 	iwl4965_rate_control_unregister();
 	iwl4965_rate_control_unregister();
 }
 }