Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH/RFT] fix wiphy_create/wiphy_free sequence
@ 2007-02-16 21:09 Johannes Berg
  0 siblings, 0 replies; only message in thread
From: Johannes Berg @ 2007-02-16 21:09 UTC (permalink / raw)
  To: John W. Linville; +Cc: linux-wireless

Big bad oops when you did wiphy_create/wiphy_free without registering it
inbetween. This should fix it.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>

---
Please commit if it does fix the issue, I don't have the hw and don't
feel like writing a dummy driver just to test this :)

 net/wireless/core.c  |    6 ++++--
 net/wireless/sysfs.c |   14 +-------------
 net/wireless/sysfs.h |    3 +--
 3 files changed, 6 insertions(+), 17 deletions(-)

--- wireless-dev.orig/net/wireless/core.c	2007-02-16 22:03:41.944695664 +0100
+++ wireless-dev/net/wireless/core.c	2007-02-16 22:07:00.154695664 +0100
@@ -173,6 +173,8 @@ struct wiphy *wiphy_new(struct cfg80211_
 
 	mutex_init(&drv->mtx);
 
+	drv->wiphy.class_dev.class = &ieee80211_class;
+	drv->wiphy.class_dev.class_data = &drv->wiphy;
 	class_device_initialize(&drv->wiphy.class_dev);
 
 	return &drv->wiphy;
@@ -187,7 +189,7 @@ int wiphy_register(struct wiphy *wiphy)
 	mutex_lock(&cfg80211_drv_mutex);
 
 
-	res = wiphy_sysfs_add(&drv->wiphy);
+	res = class_device_add(&drv->wiphy.class_dev);
 	if (res)
 		goto out_unlock;
 
@@ -217,7 +219,7 @@ void wiphy_unregister(struct wiphy *wiph
 	list_del(&drv->list);
 	mutex_unlock(&drv->mtx);
 
-	wiphy_sysfs_del(wiphy);
+	class_device_del(&drv->wiphy.class_dev);
 	debugfs_remove(drv->wiphy.debugfsdir);
 
 	mutex_unlock(&cfg80211_drv_mutex);
--- wireless-dev.orig/net/wireless/sysfs.c	2007-02-16 22:03:37.204695664 +0100
+++ wireless-dev/net/wireless/sysfs.c	2007-02-16 22:06:21.334695664 +0100
@@ -52,7 +52,7 @@ static int wiphy_uevent(struct class_dev
 	return 0;
 }
 
-static struct class ieee80211_class = {
+struct class ieee80211_class = {
 	.name = "ieee80211",
 	.owner = THIS_MODULE,
 	.release = wiphy_class_dev_release,
@@ -71,15 +71,3 @@ void wiphy_sysfs_exit(void)
 {
 	class_unregister(&ieee80211_class);
 }
-
-int wiphy_sysfs_add(struct wiphy *wiphy)
-{
-	wiphy->class_dev.class = &ieee80211_class;
-	wiphy->class_dev.class_data = wiphy;
-	return class_device_add(&wiphy->class_dev);
-}
-
-void wiphy_sysfs_del(struct wiphy *wiphy)
-{
-	class_device_del(&wiphy->class_dev);
-}
--- wireless-dev.orig/net/wireless/sysfs.h	2007-02-16 22:04:53.794695664 +0100
+++ wireless-dev/net/wireless/sysfs.h	2007-02-16 22:05:09.534695664 +0100
@@ -4,7 +4,6 @@
 extern int wiphy_sysfs_init(void);
 extern void wiphy_sysfs_exit(void);
 
-extern int wiphy_sysfs_add(struct wiphy *wiphy);
-extern void wiphy_sysfs_del(struct wiphy *wiphy);
+extern struct class ieee80211_class;
 
 #endif /* __WIRELESS_SYSFS_H */



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-02-16 21:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-16 21:09 [PATCH/RFT] fix wiphy_create/wiphy_free sequence Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox