diff options
Diffstat (limited to 'net/core/net-sysfs.c')
-rw-r--r-- | net/core/net-sysfs.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index 79159db6acb9..909a03d6c0e9 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/wireless.h> | 18 | #include <linux/wireless.h> |
19 | #include <net/iw_handler.h> | 19 | #include <net/iw_handler.h> |
20 | 20 | ||
21 | #ifdef CONFIG_SYSFS | ||
21 | static const char fmt_hex[] = "%#x\n"; | 22 | static const char fmt_hex[] = "%#x\n"; |
22 | static const char fmt_long_hex[] = "%#lx\n"; | 23 | static const char fmt_long_hex[] = "%#lx\n"; |
23 | static const char fmt_dec[] = "%d\n"; | 24 | static const char fmt_dec[] = "%d\n"; |
@@ -392,6 +393,8 @@ static struct attribute_group wireless_group = { | |||
392 | }; | 393 | }; |
393 | #endif | 394 | #endif |
394 | 395 | ||
396 | #endif /* CONFIG_SYSFS */ | ||
397 | |||
395 | #ifdef CONFIG_HOTPLUG | 398 | #ifdef CONFIG_HOTPLUG |
396 | static int netdev_uevent(struct device *d, char **envp, | 399 | static int netdev_uevent(struct device *d, char **envp, |
397 | int num_envp, char *buf, int size) | 400 | int num_envp, char *buf, int size) |
@@ -435,7 +438,9 @@ static void netdev_release(struct device *d) | |||
435 | static struct class net_class = { | 438 | static struct class net_class = { |
436 | .name = "net", | 439 | .name = "net", |
437 | .dev_release = netdev_release, | 440 | .dev_release = netdev_release, |
441 | #ifdef CONFIG_SYSFS | ||
438 | .dev_attrs = net_class_attributes, | 442 | .dev_attrs = net_class_attributes, |
443 | #endif /* CONFIG_SYSFS */ | ||
439 | #ifdef CONFIG_HOTPLUG | 444 | #ifdef CONFIG_HOTPLUG |
440 | .dev_uevent = netdev_uevent, | 445 | .dev_uevent = netdev_uevent, |
441 | #endif | 446 | #endif |
@@ -444,7 +449,7 @@ static struct class net_class = { | |||
444 | /* Delete sysfs entries but hold kobject reference until after all | 449 | /* Delete sysfs entries but hold kobject reference until after all |
445 | * netdev references are gone. | 450 | * netdev references are gone. |
446 | */ | 451 | */ |
447 | void netdev_unregister_sysfs(struct net_device * net) | 452 | void netdev_unregister_kobject(struct net_device * net) |
448 | { | 453 | { |
449 | struct device *dev = &(net->dev); | 454 | struct device *dev = &(net->dev); |
450 | 455 | ||
@@ -453,7 +458,7 @@ void netdev_unregister_sysfs(struct net_device * net) | |||
453 | } | 458 | } |
454 | 459 | ||
455 | /* Create sysfs entries for network device. */ | 460 | /* Create sysfs entries for network device. */ |
456 | int netdev_register_sysfs(struct net_device *net) | 461 | int netdev_register_kobject(struct net_device *net) |
457 | { | 462 | { |
458 | struct device *dev = &(net->dev); | 463 | struct device *dev = &(net->dev); |
459 | struct attribute_group **groups = net->sysfs_groups; | 464 | struct attribute_group **groups = net->sysfs_groups; |
@@ -466,6 +471,7 @@ int netdev_register_sysfs(struct net_device *net) | |||
466 | BUILD_BUG_ON(BUS_ID_SIZE < IFNAMSIZ); | 471 | BUILD_BUG_ON(BUS_ID_SIZE < IFNAMSIZ); |
467 | strlcpy(dev->bus_id, net->name, BUS_ID_SIZE); | 472 | strlcpy(dev->bus_id, net->name, BUS_ID_SIZE); |
468 | 473 | ||
474 | #ifdef CONFIG_SYSFS | ||
469 | if (net->get_stats) | 475 | if (net->get_stats) |
470 | *groups++ = &netstat_group; | 476 | *groups++ = &netstat_group; |
471 | 477 | ||
@@ -473,11 +479,12 @@ int netdev_register_sysfs(struct net_device *net) | |||
473 | if (net->wireless_handlers && net->wireless_handlers->get_wireless_stats) | 479 | if (net->wireless_handlers && net->wireless_handlers->get_wireless_stats) |
474 | *groups++ = &wireless_group; | 480 | *groups++ = &wireless_group; |
475 | #endif | 481 | #endif |
482 | #endif /* CONFIG_SYSFS */ | ||
476 | 483 | ||
477 | return device_add(dev); | 484 | return device_add(dev); |
478 | } | 485 | } |
479 | 486 | ||
480 | int netdev_sysfs_init(void) | 487 | int netdev_kobject_init(void) |
481 | { | 488 | { |
482 | return class_register(&net_class); | 489 | return class_register(&net_class); |
483 | } | 490 | } |