include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit...
[safe/jmp/linux-2.6] / net / core / net-sysfs.c
index 89de182..59cfc7d 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/kernel.h>
 #include <linux/netdevice.h>
 #include <linux/if_arp.h>
+#include <linux/slab.h>
 #include <net/sock.h>
 #include <linux/rtnetlink.h>
 #include <linux/wireless.h>
@@ -410,7 +411,8 @@ static ssize_t wireless_show(struct device *d, char *buf,
        const struct iw_statistics *iw;
        ssize_t ret = -EINVAL;
 
-       rtnl_lock();
+       if (!rtnl_trylock())
+               return restart_syscall();
        if (dev_isalive(dev)) {
                iw = get_wireless_stats(dev);
                if (iw)
@@ -525,7 +527,7 @@ void netdev_unregister_kobject(struct net_device * net)
 
        kobject_get(&dev->kobj);
 
-       if (dev_net(net) != &init_net)
+       if (!net_eq(dev_net(net), &init_net))
                return;
 
        device_del(dev);
@@ -544,8 +546,11 @@ int netdev_register_kobject(struct net_device *net)
        dev_set_name(dev, "%s", net->name);
 
 #ifdef CONFIG_SYSFS
-       *groups++ = &netstat_group;
+       /* Allow for a device specific group */
+       if (*groups)
+               groups++;
 
+       *groups++ = &netstat_group;
 #ifdef CONFIG_WIRELESS_EXT_SYSFS
        if (net->ieee80211_ptr)
                *groups++ = &wireless_group;
@@ -556,7 +561,7 @@ int netdev_register_kobject(struct net_device *net)
 #endif
 #endif /* CONFIG_SYSFS */
 
-       if (dev_net(net) != &init_net)
+       if (!net_eq(dev_net(net), &init_net))
                return 0;
 
        return device_add(dev);