mac80211: fix ibss race
[safe/jmp/linux-2.6] / net / core / net-sysfs.c
index 3994680..427ded8 100644 (file)
@@ -16,7 +16,7 @@
 #include <net/sock.h>
 #include <linux/rtnetlink.h>
 #include <linux/wireless.h>
-#include <net/iw_handler.h>
+#include <net/wext.h>
 
 #include "net-sysfs.h"
 
@@ -141,7 +141,7 @@ static ssize_t show_dormant(struct device *dev,
        return -EINVAL;
 }
 
-static const char *operstates[] = {
+static const char *const operstates[] = {
        "unknown",
        "notpresent", /* currently unused */
        "down",
@@ -363,18 +363,16 @@ static ssize_t wireless_show(struct device *d, char *buf,
                                               char *))
 {
        struct net_device *dev = to_net_dev(d);
-       const struct iw_statistics *iw = NULL;
+       const struct iw_statistics *iw;
        ssize_t ret = -EINVAL;
 
-       read_lock(&dev_base_lock);
+       rtnl_lock();
        if (dev_isalive(dev)) {
-               if (dev->wireless_handlers &&
-                   dev->wireless_handlers->get_wireless_stats)
-                       iw = dev->wireless_handlers->get_wireless_stats(dev);
-               if (iw != NULL)
+               iw = get_wireless_stats(dev);
+               if (iw)
                        ret = (*format)(iw, buf);
        }
-       read_unlock(&dev_base_lock);
+       rtnl_unlock();
 
        return ret;
 }
@@ -493,7 +491,7 @@ void netdev_unregister_kobject(struct net_device * net)
 int netdev_register_kobject(struct net_device *net)
 {
        struct device *dev = &(net->dev);
-       struct attribute_group **groups = net->sysfs_groups;
+       const struct attribute_group **groups = net->sysfs_groups;
 
        dev->class = &net_class;
        dev->platform_data = net;
@@ -505,7 +503,7 @@ int netdev_register_kobject(struct net_device *net)
        *groups++ = &netstat_group;
 
 #ifdef CONFIG_WIRELESS_EXT_SYSFS
-       if (net->wireless_handlers && net->wireless_handlers->get_wireless_stats)
+       if (net->wireless_handlers || net->ieee80211_ptr)
                *groups++ = &wireless_group;
 #endif
 #endif /* CONFIG_SYSFS */