Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 17530
b: refs/heads/master
c: 6dd214b
h: refs/heads/master
v: v3
  • Loading branch information
Andrey Borzenkov authored and Linus Torvalds committed Jan 10, 2006
1 parent 46de02a commit 3b57de2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0137ecfdc3453f58a9beee95152ff61e8bad97b1
refs/heads/master: 6dd214b554f675e7e66cbce87e594a36f4a57298
28 changes: 19 additions & 9 deletions trunk/net/core/net-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <net/sock.h>
#include <linux/rtnetlink.h>
#include <linux/wireless.h>
#include <net/iw_handler.h>

#define to_class_dev(obj) container_of(obj,struct class_device,kobj)
#define to_net_dev(class) container_of(class, struct net_device, class_dev)
Expand Down Expand Up @@ -294,13 +295,19 @@ static ssize_t wireless_show(struct class_device *cd, char *buf,
char *))
{
struct net_device *dev = to_net_dev(cd);
const struct iw_statistics *iw;
const struct iw_statistics *iw = NULL;
ssize_t ret = -EINVAL;

read_lock(&dev_base_lock);
if (dev_isalive(dev) && dev->get_wireless_stats
&& (iw = dev->get_wireless_stats(dev)) != NULL)
ret = (*format)(iw, buf);
if (dev_isalive(dev)) {
if(dev->wireless_handlers &&
dev->wireless_handlers->get_wireless_stats)
iw = dev->wireless_handlers->get_wireless_stats(dev);
else if (dev->get_wireless_stats)
iw = dev->get_wireless_stats(dev);
if (iw != NULL)
ret = (*format)(iw, buf);
}
read_unlock(&dev_base_lock);

return ret;
Expand Down Expand Up @@ -402,7 +409,8 @@ void netdev_unregister_sysfs(struct net_device * net)
sysfs_remove_group(&class_dev->kobj, &netstat_group);

#ifdef WIRELESS_EXT
if (net->get_wireless_stats)
if (net->get_wireless_stats || (net->wireless_handlers &&
net->wireless_handlers->get_wireless_stats))
sysfs_remove_group(&class_dev->kobj, &wireless_group);
#endif
class_device_del(class_dev);
Expand All @@ -427,10 +435,12 @@ int netdev_register_sysfs(struct net_device *net)
goto out_unreg;

#ifdef WIRELESS_EXT
if (net->get_wireless_stats &&
(ret = sysfs_create_group(&class_dev->kobj, &wireless_group)))
goto out_cleanup;

if (net->get_wireless_stats || (net->wireless_handlers &&
net->wireless_handlers->get_wireless_stats)) {
ret = sysfs_create_group(&class_dev->kobj, &wireless_group);
if (ret)
goto out_cleanup;
}
return 0;
out_cleanup:
if (net->get_stats)
Expand Down

0 comments on commit 3b57de2

Please sign in to comment.