aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/net-sysfs.c
diff options
context:
space:
mode:
authorAndrey Borzenkov <arvidjaar@mail.ru>2006-01-09 23:51:28 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-10 11:01:24 -0500
commit6dd214b554f675e7e66cbce87e594a36f4a57298 (patch)
tree3c6ab71d30a866cd5a76e478d02e77ac07870915 /net/core/net-sysfs.c
parent0137ecfdc3453f58a9beee95152ff61e8bad97b1 (diff)
[PATCH] fix /sys/class/net/<if>/wireless without dev->get_wireless_stats
dev->get_wireless_stats is deprecated but removing it also removes wireless subdirectory in sysfs. This patch puts it back. akpm: I don't know what's happening here. This might be appropriate as a 2.6.15.x compatibility backport. Waiting to hear from Jeff. Signed-off-by: Andrey Borzenkov <arvidjaar@mail.ru> Cc: "David S. Miller" <davem@davemloft.net> Cc: Jeff Garzik <jgarzik@pobox.com> Cc: <stable@kernel.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'net/core/net-sysfs.c')
-rw-r--r--net/core/net-sysfs.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index e1da81d261d1..58adaf208dd6 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -16,6 +16,7 @@
16#include <net/sock.h> 16#include <net/sock.h>
17#include <linux/rtnetlink.h> 17#include <linux/rtnetlink.h>
18#include <linux/wireless.h> 18#include <linux/wireless.h>
19#include <net/iw_handler.h>
19 20
20#define to_class_dev(obj) container_of(obj,struct class_device,kobj) 21#define to_class_dev(obj) container_of(obj,struct class_device,kobj)
21#define to_net_dev(class) container_of(class, struct net_device, class_dev) 22#define to_net_dev(class) container_of(class, struct net_device, class_dev)
@@ -294,13 +295,19 @@ static ssize_t wireless_show(struct class_device *cd, char *buf,
294 char *)) 295 char *))
295{ 296{
296 struct net_device *dev = to_net_dev(cd); 297 struct net_device *dev = to_net_dev(cd);
297 const struct iw_statistics *iw; 298 const struct iw_statistics *iw = NULL;
298 ssize_t ret = -EINVAL; 299 ssize_t ret = -EINVAL;
299 300
300 read_lock(&dev_base_lock); 301 read_lock(&dev_base_lock);
301 if (dev_isalive(dev) && dev->get_wireless_stats 302 if (dev_isalive(dev)) {
302 && (iw = dev->get_wireless_stats(dev)) != NULL) 303 if(dev->wireless_handlers &&
303 ret = (*format)(iw, buf); 304 dev->wireless_handlers->get_wireless_stats)
305 iw = dev->wireless_handlers->get_wireless_stats(dev);
306 else if (dev->get_wireless_stats)
307 iw = dev->get_wireless_stats(dev);
308 if (iw != NULL)
309 ret = (*format)(iw, buf);
310 }
304 read_unlock(&dev_base_lock); 311 read_unlock(&dev_base_lock);
305 312
306 return ret; 313 return ret;
@@ -402,7 +409,8 @@ void netdev_unregister_sysfs(struct net_device * net)
402 sysfs_remove_group(&class_dev->kobj, &netstat_group); 409 sysfs_remove_group(&class_dev->kobj, &netstat_group);
403 410
404#ifdef WIRELESS_EXT 411#ifdef WIRELESS_EXT
405 if (net->get_wireless_stats) 412 if (net->get_wireless_stats || (net->wireless_handlers &&
413 net->wireless_handlers->get_wireless_stats))
406 sysfs_remove_group(&class_dev->kobj, &wireless_group); 414 sysfs_remove_group(&class_dev->kobj, &wireless_group);
407#endif 415#endif
408 class_device_del(class_dev); 416 class_device_del(class_dev);
@@ -427,10 +435,12 @@ int netdev_register_sysfs(struct net_device *net)
427 goto out_unreg; 435 goto out_unreg;
428 436
429#ifdef WIRELESS_EXT 437#ifdef WIRELESS_EXT
430 if (net->get_wireless_stats && 438 if (net->get_wireless_stats || (net->wireless_handlers &&
431 (ret = sysfs_create_group(&class_dev->kobj, &wireless_group))) 439 net->wireless_handlers->get_wireless_stats)) {
432 goto out_cleanup; 440 ret = sysfs_create_group(&class_dev->kobj, &wireless_group);
433 441 if (ret)
442 goto out_cleanup;
443 }
434 return 0; 444 return 0;
435out_cleanup: 445out_cleanup:
436 if (net->get_stats) 446 if (net->get_stats)