diff options
Diffstat (limited to 'net/core/net-sysfs.c')
-rw-r--r-- | net/core/net-sysfs.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index 90e2177af081..c1f4e0d428c0 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c | |||
@@ -242,11 +242,11 @@ static ssize_t netstat_show(const struct device *d, | |||
242 | offset % sizeof(unsigned long) != 0); | 242 | offset % sizeof(unsigned long) != 0); |
243 | 243 | ||
244 | read_lock(&dev_base_lock); | 244 | read_lock(&dev_base_lock); |
245 | if (dev_isalive(dev) && dev->get_stats && | 245 | if (dev_isalive(dev)) { |
246 | (stats = (*dev->get_stats)(dev))) | 246 | stats = dev->get_stats(dev); |
247 | ret = sprintf(buf, fmt_ulong, | 247 | ret = sprintf(buf, fmt_ulong, |
248 | *(unsigned long *)(((u8 *) stats) + offset)); | 248 | *(unsigned long *)(((u8 *) stats) + offset)); |
249 | 249 | } | |
250 | read_unlock(&dev_base_lock); | 250 | read_unlock(&dev_base_lock); |
251 | return ret; | 251 | return ret; |
252 | } | 252 | } |
@@ -318,7 +318,7 @@ static struct attribute_group netstat_group = { | |||
318 | .attrs = netstat_attrs, | 318 | .attrs = netstat_attrs, |
319 | }; | 319 | }; |
320 | 320 | ||
321 | #ifdef CONFIG_WIRELESS_EXT | 321 | #ifdef CONFIG_WIRELESS_EXT_SYSFS |
322 | /* helper function that does all the locking etc for wireless stats */ | 322 | /* helper function that does all the locking etc for wireless stats */ |
323 | static ssize_t wireless_show(struct device *d, char *buf, | 323 | static ssize_t wireless_show(struct device *d, char *buf, |
324 | ssize_t (*format)(const struct iw_statistics *, | 324 | ssize_t (*format)(const struct iw_statistics *, |
@@ -457,10 +457,9 @@ int netdev_register_kobject(struct net_device *net) | |||
457 | strlcpy(dev->bus_id, net->name, BUS_ID_SIZE); | 457 | strlcpy(dev->bus_id, net->name, BUS_ID_SIZE); |
458 | 458 | ||
459 | #ifdef CONFIG_SYSFS | 459 | #ifdef CONFIG_SYSFS |
460 | if (net->get_stats) | 460 | *groups++ = &netstat_group; |
461 | *groups++ = &netstat_group; | ||
462 | 461 | ||
463 | #ifdef CONFIG_WIRELESS_EXT | 462 | #ifdef CONFIG_WIRELESS_EXT_SYSFS |
464 | if (net->wireless_handlers && net->wireless_handlers->get_wireless_stats) | 463 | if (net->wireless_handlers && net->wireless_handlers->get_wireless_stats) |
465 | *groups++ = &wireless_group; | 464 | *groups++ = &wireless_group; |
466 | #endif | 465 | #endif |
@@ -469,6 +468,19 @@ int netdev_register_kobject(struct net_device *net) | |||
469 | return device_add(dev); | 468 | return device_add(dev); |
470 | } | 469 | } |
471 | 470 | ||
471 | int netdev_class_create_file(struct class_attribute *class_attr) | ||
472 | { | ||
473 | return class_create_file(&net_class, class_attr); | ||
474 | } | ||
475 | |||
476 | void netdev_class_remove_file(struct class_attribute *class_attr) | ||
477 | { | ||
478 | class_remove_file(&net_class, class_attr); | ||
479 | } | ||
480 | |||
481 | EXPORT_SYMBOL(netdev_class_create_file); | ||
482 | EXPORT_SYMBOL(netdev_class_remove_file); | ||
483 | |||
472 | void netdev_initialize_kobject(struct net_device *net) | 484 | void netdev_initialize_kobject(struct net_device *net) |
473 | { | 485 | { |
474 | struct device *device = &(net->dev); | 486 | struct device *device = &(net->dev); |