aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-09-28 09:26:43 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-09-28 16:55:07 -0400
commit8f1546cadf7ac5e9a40d54089a1c7302264ec49b (patch)
tree31f77528caf2b87cbafd9292d6e73e9da361cdec /net
parent8503bd8c7dc6f82ec2de9d05e0a476e6ca5adc8b (diff)
wext: add back wireless/ dir in sysfs for cfg80211 interfaces
The move away from having drivers assign wireless handlers, in favour of making cfg80211 assign them, broke the sysfs registration (the wireless/ dir went missing) because the handlers are now assigned only after registration, which is too late. Fix this by special-casing cfg80211-based devices, all of which are required to have an ieee80211_ptr, in the sysfs code, and also using get_wireless_stats() to have the same values reported as in procfs. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Reported-by: Hugh Dickins <hugh.dickins@tiscali.co.uk> Tested-by: Hugh Dickins <hugh.dickins@tiscali.co.uk> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net')
-rw-r--r--net/core/net-sysfs.c12
-rw-r--r--net/wireless/wext.c2
2 files changed, 6 insertions, 8 deletions
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 7d4c57523b09..821d30918cfc 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -16,7 +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#include <net/wext.h>
20 20
21#include "net-sysfs.h" 21#include "net-sysfs.h"
22 22
@@ -363,15 +363,13 @@ static ssize_t wireless_show(struct device *d, char *buf,
363 char *)) 363 char *))
364{ 364{
365 struct net_device *dev = to_net_dev(d); 365 struct net_device *dev = to_net_dev(d);
366 const struct iw_statistics *iw = NULL; 366 const struct iw_statistics *iw;
367 ssize_t ret = -EINVAL; 367 ssize_t ret = -EINVAL;
368 368
369 read_lock(&dev_base_lock); 369 read_lock(&dev_base_lock);
370 if (dev_isalive(dev)) { 370 if (dev_isalive(dev)) {
371 if (dev->wireless_handlers && 371 iw = get_wireless_stats(dev);
372 dev->wireless_handlers->get_wireless_stats) 372 if (iw)
373 iw = dev->wireless_handlers->get_wireless_stats(dev);
374 if (iw != NULL)
375 ret = (*format)(iw, buf); 373 ret = (*format)(iw, buf);
376 } 374 }
377 read_unlock(&dev_base_lock); 375 read_unlock(&dev_base_lock);
@@ -505,7 +503,7 @@ int netdev_register_kobject(struct net_device *net)
505 *groups++ = &netstat_group; 503 *groups++ = &netstat_group;
506 504
507#ifdef CONFIG_WIRELESS_EXT_SYSFS 505#ifdef CONFIG_WIRELESS_EXT_SYSFS
508 if (net->wireless_handlers && net->wireless_handlers->get_wireless_stats) 506 if (net->wireless_handlers || net->ieee80211_ptr)
509 *groups++ = &wireless_group; 507 *groups++ = &wireless_group;
510#endif 508#endif
511#endif /* CONFIG_SYSFS */ 509#endif /* CONFIG_SYSFS */
diff --git a/net/wireless/wext.c b/net/wireless/wext.c
index ac4ac26b53ce..60fe57761ca9 100644
--- a/net/wireless/wext.c
+++ b/net/wireless/wext.c
@@ -470,7 +470,7 @@ static iw_handler get_handler(struct net_device *dev, unsigned int cmd)
470/* 470/*
471 * Get statistics out of the driver 471 * Get statistics out of the driver
472 */ 472 */
473static struct iw_statistics *get_wireless_stats(struct net_device *dev) 473struct iw_statistics *get_wireless_stats(struct net_device *dev)
474{ 474{
475 /* New location */ 475 /* New location */
476 if ((dev->wireless_handlers != NULL) && 476 if ((dev->wireless_handlers != NULL) &&