/[linux-patches]/genpatches-2.6/trunk/2.6.15/1005_1_sys-class-net-wireless-stats.patch
Gentoo

Contents of /genpatches-2.6/trunk/2.6.15/1005_1_sys-class-net-wireless-stats.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 262 - (show annotations) (download)
Sun Jan 15 14:23:15 2006 UTC (12 years, 8 months ago) by dsd
File size: 3012 byte(s)
Linux 2.6.15.1
1 From stable-bounces@linux.kernel.org Mon Jan 9 20:55:50 2006
2 Message-Id: <200601100451.k0A4peCq010247@shell0.pdx.osdl.net>
3 To: torvalds@osdl.org
4 From: akpm@osdl.org
5 Date: Mon, 09 Jan 2006 20:51:28 -0800
6 Cc: arvidjaar@mail.ru, jgarzik@pobox.com, davem@davemloft.net, stable@kernel.org
7 Subject: [PATCH] fix /sys/class/net/<if>/wireless without dev->get_wireless_stats
8
9 From: Andrey Borzenkov <arvidjaar@mail.ru>
10
11 dev->get_wireless_stats is deprecated but removing it also removes wireless
12 subdirectory in sysfs. This patch puts it back.
13
14 akpm: I don't know what's happening here. This might be appropriate as a
15 2.6.15.x compatibility backport. Waiting to hear from Jeff.
16
17 Signed-off-by: Andrey Borzenkov <arvidjaar@mail.ru>
18 Cc: "David S. Miller" <davem@davemloft.net>
19 Cc: Jeff Garzik <jgarzik@pobox.com>
20 Cc: <stable@kernel.org>
21 Signed-off-by: Andrew Morton <akpm@osdl.org>
22 Signed-off-by: Chris Wright <chrisw@sous-sol.org>
23 ---
24 net/core/net-sysfs.c | 28 +++++++++++++++++++---------
25 1 file changed, 19 insertions(+), 9 deletions(-)
26
27 --- linux-2.6.15.y.orig/net/core/net-sysfs.c
28 +++ linux-2.6.15.y/net/core/net-sysfs.c
29 @@ -16,6 +16,7 @@
30 #include <net/sock.h>
31 #include <linux/rtnetlink.h>
32 #include <linux/wireless.h>
33 +#include <net/iw_handler.h>
34
35 #define to_class_dev(obj) container_of(obj,struct class_device,kobj)
36 #define to_net_dev(class) container_of(class, struct net_device, class_dev)
37 @@ -313,13 +314,19 @@ static ssize_t wireless_show(struct clas
38 char *))
39 {
40 struct net_device *dev = to_net_dev(cd);
41 - const struct iw_statistics *iw;
42 + const struct iw_statistics *iw = NULL;
43 ssize_t ret = -EINVAL;
44
45 read_lock(&dev_base_lock);
46 - if (dev_isalive(dev) && dev->get_wireless_stats
47 - && (iw = dev->get_wireless_stats(dev)) != NULL)
48 - ret = (*format)(iw, buf);
49 + if (dev_isalive(dev)) {
50 + if(dev->wireless_handlers &&
51 + dev->wireless_handlers->get_wireless_stats)
52 + iw = dev->wireless_handlers->get_wireless_stats(dev);
53 + else if (dev->get_wireless_stats)
54 + iw = dev->get_wireless_stats(dev);
55 + if (iw != NULL)
56 + ret = (*format)(iw, buf);
57 + }
58 read_unlock(&dev_base_lock);
59
60 return ret;
61 @@ -420,7 +427,8 @@ void netdev_unregister_sysfs(struct net_
62 sysfs_remove_group(&class_dev->kobj, &netstat_group);
63
64 #ifdef WIRELESS_EXT
65 - if (net->get_wireless_stats)
66 + if (net->get_wireless_stats || (net->wireless_handlers &&
67 + net->wireless_handlers->get_wireless_stats))
68 sysfs_remove_group(&class_dev->kobj, &wireless_group);
69 #endif
70 class_device_del(class_dev);
71 @@ -453,10 +461,12 @@ int netdev_register_sysfs(struct net_dev
72 goto out_unreg;
73
74 #ifdef WIRELESS_EXT
75 - if (net->get_wireless_stats &&
76 - (ret = sysfs_create_group(&class_dev->kobj, &wireless_group)))
77 - goto out_cleanup;
78 -
79 + if (net->get_wireless_stats || (net->wireless_handlers &&
80 + net->wireless_handlers->get_wireless_stats)) {
81 + ret = sysfs_create_group(&class_dev->kobj, &wireless_group);
82 + if (ret)
83 + goto out_cleanup;
84 + }
85 return 0;
86 out_cleanup:
87 if (net->get_stats)

  ViewVC Help
Powered by ViewVC 1.1.20