Skip to contentSkip to conversation

mac80211: move PHY things to debugfs

PATCH New Johannes Berg 1 participant 1 message Mar 1, 2007 mac80211

lore
Share & tools
lore

Johannes Berg

author maintainer
#0 lore raw

PATCH v2 1/1 mac80211: move PHY things to debugfs

This patch moves everything except the "sta" directory from the phy sysfs to phy debugfs.

---
 net/mac80211/Makefile          |    1 
 net/mac80211/debugfs.c         |  426 +++++++++++++++++++++++++++++++++++++++++
 net/mac80211/debugfs.h         |   15 +
 net/mac80211/ieee80211.c       |   20 -
 net/mac80211/ieee80211_i.h     |   62 +++++
 net/mac80211/ieee80211_rate.h  |   15 -
 net/mac80211/ieee80211_sysfs.c |  375 ------------------------------------
 net/mac80211/ieee80211_sysfs.h |    2 
 8 files changed, 508 insertions(+), 408 deletions(-)
net/mac80211/Makefile +1 -0
@@ -1,6 +1,7 @@
 obj-$(CONFIG_MAC80211) += mac80211.o rc80211_simple.o
 
 mac80211-objs-$(CONFIG_MAC80211_LEDS) += ieee80211_led.o
+mac80211-objs-$(CONFIG_DEBUG_FS) += debugfs.o
 
 mac80211-objs := \
 	ieee80211.o \
net/mac80211/ieee80211.c +4 -16
@@ -34,6 +34,7 @@
 #include "ieee80211_led.h"
 #include "ieee80211_cfg.h"
 #include "ieee80211_sysfs.h"
+#include "debugfs.h"
 
 /* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */
 /* Ethernet-II snap header (RFC1042 for most EtherTypes) */
@@ -4444,7 +4445,6 @@ int ieee80211_init_rate_ctrl_alg(struct 
 				 const char *name)
 {
 	struct rate_control_ref *ref, *old;
-	int res;
 
 	ASSERT_RTNL();
 	if (local->open_count || netif_running(local->mdev) ||
@@ -4457,18 +4457,10 @@ int ieee80211_init_rate_ctrl_alg(struct 
 		       "algorithm\n", local->mdev->name);
 		return -ENOENT;
 	}
-	res = rate_control_add_attrs(ref, &local->hw.wiphy->dev.kobj);
-	if (res < 0) {
-		printk(KERN_DEBUG "%s: Failed to register sysfs attributes "
-		       "for rate control\n", local->mdev->name);
-		rate_control_put(ref);
-		return res;
-	}
 
 	old = local->rate_ctrl;
 	local->rate_ctrl = ref;
 	if (old) {
-		rate_control_remove_attrs(ref, &local->hw.wiphy->dev.kobj);
 		rate_control_put(old);
 		sta_info_flush(local, NULL);
 	}
@@ -4487,7 +4479,6 @@ static void rate_control_deinitialize(st
 
 	ref = local->rate_ctrl;
 	local->rate_ctrl = NULL;
-	rate_control_remove_attrs(ref, &local->hw.wiphy->dev.kobj);
 	rate_control_put(ref);
 }
 
@@ -4622,9 +4613,7 @@ int ieee80211_register_hw(struct ieee802
 	if (result < 0)
 		return result;
 
-	result = ieee80211_dev_sysfs_add(local);
-	if (result < 0)
-		goto fail_sysfs;
+	debugfs_hw_add(local);
 
 	local->hw.conf.beacon_int = 1000;
 
@@ -4703,8 +4692,7 @@ fail_if_sysfs:
 fail_dev:
 	sta_info_stop(local);
 fail_sta_info:
-	ieee80211_dev_sysfs_del(local);
-fail_sysfs:
+	debugfs_hw_del(local);
 	wiphy_unregister(local->hw.wiphy);
 	return result;
 }
@@ -4777,7 +4765,7 @@ void ieee80211_unregister_hw(struct ieee
 	ieee80211_clear_tx_pending(local);
 	sta_info_stop(local);
 	rate_control_deinitialize(local);
-	ieee80211_dev_sysfs_del(local);
+	debugfs_hw_del(local);
 
 	for (i = 0; i < NUM_IEEE80211_MODES; i++) {
 		kfree(local->supp_rates[i]);
net/mac80211/ieee80211_rate.h +0 -15
@@ -123,21 +123,6 @@ static inline void rate_control_free_sta
 	ref->ops->free_sta(ref->priv, priv);
 }
 
-static inline int rate_control_add_attrs(struct rate_control_ref *ref,
-					 struct kobject *kobj)
-{
-	if (ref->ops->add_attrs)
-		return ref->ops->add_attrs(ref->priv, kobj);
-	return 0;
-}
-
-static inline void rate_control_remove_attrs(struct rate_control_ref *ref,
-					     struct kobject *kobj)
-{
-	if (ref->ops->remove_attrs)
-		ref->ops->remove_attrs(ref->priv, kobj);
-}
-
 static inline int rate_control_add_sta_attrs(struct sta_info *sta,
 					     struct kobject *kobj)
 {
net/mac80211/debugfs.h new file +15 -0
@@ -0,0 +1,15 @@
+#ifndef __MAC80211_DEBUGFS_H
+#define __MAC80211_DEBUGFS_H
+
+#ifdef CONFIG_DEBUG_FS
+extern void debugfs_hw_add(struct ieee80211_local *local);
+extern void debugfs_hw_del(struct ieee80211_local *local);
+#else
+static inline void debugfs_hw_add(struct ieee80211_local *local)
+{
+	return 0;
+}
+static inline void debugfs_hw_del(struct ieee80211_local *local) {}
+#endif
+
+#endif /* __MAC80211_DEBUGFS_H */
net/mac80211/ieee80211_sysfs.c +0 -375

387 lines not on this page · raw message

net/mac80211/ieee80211_sysfs.h +0 -2
@@ -6,7 +6,5 @@
 int ieee80211_sysfs_add_netdevice(struct net_device *dev);
 void ieee80211_sysfs_remove_netdevice(struct net_device *dev);
 int ieee80211_sysfs_change_if_type(struct net_device *dev);
-int ieee80211_dev_sysfs_add(struct ieee80211_local *local);
-void ieee80211_dev_sysfs_del(struct ieee80211_local *local);
 
 #endif /* __IEEE80211_SYSFS_H */
net/mac80211/debugfs.c new file +426 -0

426 lines not on this page · raw message

net/mac80211/ieee80211_i.h +62 -0

68 lines not on this page · raw message