diff options
-rw-r--r-- | Documentation/networking/bonding.txt | 3 | ||||
-rw-r--r-- | drivers/net/bonding/bond_main.c | 6 | ||||
-rw-r--r-- | drivers/net/bonding/bond_sysfs.c | 22 | ||||
-rw-r--r-- | include/linux/netdevice.h | 3 | ||||
-rw-r--r-- | net/core/net-sysfs.c | 13 |
5 files changed, 24 insertions, 23 deletions
diff --git a/Documentation/networking/bonding.txt b/Documentation/networking/bonding.txt index 370b7da73ab4..7fa7fe71d7a8 100644 --- a/Documentation/networking/bonding.txt +++ b/Documentation/networking/bonding.txt | |||
@@ -376,7 +376,8 @@ max_bonds | |||
376 | Specifies the number of bonding devices to create for this | 376 | Specifies the number of bonding devices to create for this |
377 | instance of the bonding driver. E.g., if max_bonds is 3, and | 377 | instance of the bonding driver. E.g., if max_bonds is 3, and |
378 | the bonding driver is not already loaded, then bond0, bond1 | 378 | the bonding driver is not already loaded, then bond0, bond1 |
379 | and bond2 will be created. The default value is 1. | 379 | and bond2 will be created. The default value is 1. Specifying |
380 | a value of 0 will load bonding, but will not create any devices. | ||
380 | 381 | ||
381 | miimon | 382 | miimon |
382 | 383 | ||
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 3b6d66a8ab98..d57b65dc2c72 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -4750,11 +4750,11 @@ static int bond_check_params(struct bond_params *params) | |||
4750 | } | 4750 | } |
4751 | } | 4751 | } |
4752 | 4752 | ||
4753 | if (max_bonds < 1 || max_bonds > INT_MAX) { | 4753 | if (max_bonds < 0 || max_bonds > INT_MAX) { |
4754 | printk(KERN_WARNING DRV_NAME | 4754 | printk(KERN_WARNING DRV_NAME |
4755 | ": Warning: max_bonds (%d) not in range %d-%d, so it " | 4755 | ": Warning: max_bonds (%d) not in range %d-%d, so it " |
4756 | "was reset to BOND_DEFAULT_MAX_BONDS (%d)\n", | 4756 | "was reset to BOND_DEFAULT_MAX_BONDS (%d)\n", |
4757 | max_bonds, 1, INT_MAX, BOND_DEFAULT_MAX_BONDS); | 4757 | max_bonds, 0, INT_MAX, BOND_DEFAULT_MAX_BONDS); |
4758 | max_bonds = BOND_DEFAULT_MAX_BONDS; | 4758 | max_bonds = BOND_DEFAULT_MAX_BONDS; |
4759 | } | 4759 | } |
4760 | 4760 | ||
@@ -4953,7 +4953,7 @@ static int bond_check_params(struct bond_params *params) | |||
4953 | 4953 | ||
4954 | printk("\n"); | 4954 | printk("\n"); |
4955 | 4955 | ||
4956 | } else { | 4956 | } else if (max_bonds) { |
4957 | /* miimon and arp_interval not set, we need one so things | 4957 | /* miimon and arp_interval not set, we need one so things |
4958 | * work as expected, see bonding.txt for details | 4958 | * work as expected, see bonding.txt for details |
4959 | */ | 4959 | */ |
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index dd265c69b0df..6caac0ffb2f2 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
@@ -53,7 +53,6 @@ extern struct bond_parm_tbl arp_validate_tbl[]; | |||
53 | extern struct bond_parm_tbl fail_over_mac_tbl[]; | 53 | extern struct bond_parm_tbl fail_over_mac_tbl[]; |
54 | 54 | ||
55 | static int expected_refcount = -1; | 55 | static int expected_refcount = -1; |
56 | static struct class *netdev_class; | ||
57 | /*--------------------------- Data Structures -----------------------------*/ | 56 | /*--------------------------- Data Structures -----------------------------*/ |
58 | 57 | ||
59 | /* Bonding sysfs lock. Why can't we just use the subsystem lock? | 58 | /* Bonding sysfs lock. Why can't we just use the subsystem lock? |
@@ -1447,19 +1446,9 @@ static struct attribute_group bonding_group = { | |||
1447 | */ | 1446 | */ |
1448 | int bond_create_sysfs(void) | 1447 | int bond_create_sysfs(void) |
1449 | { | 1448 | { |
1450 | int ret = 0; | 1449 | int ret; |
1451 | struct bonding *firstbond; | ||
1452 | |||
1453 | /* get the netdev class pointer */ | ||
1454 | firstbond = container_of(bond_dev_list.next, struct bonding, bond_list); | ||
1455 | if (!firstbond) | ||
1456 | return -ENODEV; | ||
1457 | |||
1458 | netdev_class = firstbond->dev->dev.class; | ||
1459 | if (!netdev_class) | ||
1460 | return -ENODEV; | ||
1461 | 1450 | ||
1462 | ret = class_create_file(netdev_class, &class_attr_bonding_masters); | 1451 | ret = netdev_class_create_file(&class_attr_bonding_masters); |
1463 | /* | 1452 | /* |
1464 | * Permit multiple loads of the module by ignoring failures to | 1453 | * Permit multiple loads of the module by ignoring failures to |
1465 | * create the bonding_masters sysfs file. Bonding devices | 1454 | * create the bonding_masters sysfs file. Bonding devices |
@@ -1478,10 +1467,6 @@ int bond_create_sysfs(void) | |||
1478 | printk(KERN_ERR | 1467 | printk(KERN_ERR |
1479 | "network device named %s already exists in sysfs", | 1468 | "network device named %s already exists in sysfs", |
1480 | class_attr_bonding_masters.attr.name); | 1469 | class_attr_bonding_masters.attr.name); |
1481 | else { | ||
1482 | netdev_class = NULL; | ||
1483 | return 0; | ||
1484 | } | ||
1485 | } | 1470 | } |
1486 | 1471 | ||
1487 | return ret; | 1472 | return ret; |
@@ -1493,8 +1478,7 @@ int bond_create_sysfs(void) | |||
1493 | */ | 1478 | */ |
1494 | void bond_destroy_sysfs(void) | 1479 | void bond_destroy_sysfs(void) |
1495 | { | 1480 | { |
1496 | if (netdev_class) | 1481 | netdev_class_remove_file(&class_attr_bonding_masters); |
1497 | class_remove_file(netdev_class, &class_attr_bonding_masters); | ||
1498 | } | 1482 | } |
1499 | 1483 | ||
1500 | /* | 1484 | /* |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index e92fc839ab1d..9ccbfac3fd95 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -1506,6 +1506,9 @@ extern void *dev_seq_next(struct seq_file *seq, void *v, loff_t *pos); | |||
1506 | extern void dev_seq_stop(struct seq_file *seq, void *v); | 1506 | extern void dev_seq_stop(struct seq_file *seq, void *v); |
1507 | #endif | 1507 | #endif |
1508 | 1508 | ||
1509 | extern int netdev_class_create_file(struct class_attribute *class_attr); | ||
1510 | extern void netdev_class_remove_file(struct class_attribute *class_attr); | ||
1511 | |||
1509 | extern void linkwatch_run_queue(void); | 1512 | extern void linkwatch_run_queue(void); |
1510 | 1513 | ||
1511 | extern int netdev_compute_features(unsigned long all, unsigned long one); | 1514 | extern int netdev_compute_features(unsigned long all, unsigned long one); |
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index dccd737ea2e3..3f7941319217 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c | |||
@@ -468,6 +468,19 @@ int netdev_register_kobject(struct net_device *net) | |||
468 | return device_add(dev); | 468 | return device_add(dev); |
469 | } | 469 | } |
470 | 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 | |||
471 | void netdev_initialize_kobject(struct net_device *net) | 484 | void netdev_initialize_kobject(struct net_device *net) |
472 | { | 485 | { |
473 | struct device *device = &(net->dev); | 486 | struct device *device = &(net->dev); |