Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'bond-cleanups'

Zhengchao Shao says:

====================
bonding: do some cleanups in bond driver

Do some cleanups in bond driver.

---
v2: use IS_ERR instead of NULL check in patch 2/5, update commit
information in patch 3/5, remove inline modifier in patch 4/5
====================

Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

+9 -42
+3 -12
drivers/net/bonding/bond_debugfs.c
··· 49 49 50 50 void bond_debug_register(struct bonding *bond) 51 51 { 52 - if (!bonding_debug_root) 53 - return; 54 - 55 52 bond->debug_dir = 56 53 debugfs_create_dir(bond->dev->name, bonding_debug_root); 57 54 ··· 58 61 59 62 void bond_debug_unregister(struct bonding *bond) 60 63 { 61 - if (!bonding_debug_root) 62 - return; 63 - 64 64 debugfs_remove_recursive(bond->debug_dir); 65 65 } 66 66 67 67 void bond_debug_reregister(struct bonding *bond) 68 68 { 69 69 struct dentry *d; 70 - 71 - if (!bonding_debug_root) 72 - return; 73 70 74 71 d = debugfs_rename(bonding_debug_root, bond->debug_dir, 75 72 bonding_debug_root, bond->dev->name); ··· 75 84 } 76 85 } 77 86 78 - void bond_create_debugfs(void) 87 + void __init bond_create_debugfs(void) 79 88 { 80 89 bonding_debug_root = debugfs_create_dir("bonding", NULL); 81 90 82 - if (!bonding_debug_root) 91 + if (IS_ERR(bonding_debug_root)) 83 92 pr_warn("Warning: Cannot create bonding directory in debugfs\n"); 84 93 } 85 94 ··· 104 113 { 105 114 } 106 115 107 - void bond_create_debugfs(void) 116 + void __init bond_create_debugfs(void) 108 117 { 109 118 } 110 119
+4 -28
drivers/net/bonding/bond_main.c
··· 5046 5046 5047 5047 static void bond_reset_slave_arr(struct bonding *bond) 5048 5048 { 5049 - struct bond_up_slave *usable, *all; 5050 - 5051 - usable = rtnl_dereference(bond->usable_slaves); 5052 - if (usable) { 5053 - RCU_INIT_POINTER(bond->usable_slaves, NULL); 5054 - kfree_rcu(usable, rcu); 5055 - } 5056 - 5057 - all = rtnl_dereference(bond->all_slaves); 5058 - if (all) { 5059 - RCU_INIT_POINTER(bond->all_slaves, NULL); 5060 - kfree_rcu(all, rcu); 5061 - } 5049 + bond_set_slave_arr(bond, NULL, NULL); 5062 5050 } 5063 5051 5064 5052 /* Build the usable slaves array in control path for modes that use xmit-hash ··· 5863 5875 if (bond->wq) 5864 5876 destroy_workqueue(bond->wq); 5865 5877 5866 - if (bond->rr_tx_counter) 5867 - free_percpu(bond->rr_tx_counter); 5878 + free_percpu(bond->rr_tx_counter); 5868 5879 } 5869 5880 5870 5881 void bond_setup(struct net_device *bond_dev) ··· 5938 5951 static void bond_uninit(struct net_device *bond_dev) 5939 5952 { 5940 5953 struct bonding *bond = netdev_priv(bond_dev); 5941 - struct bond_up_slave *usable, *all; 5942 5954 struct list_head *iter; 5943 5955 struct slave *slave; 5944 5956 ··· 5948 5962 __bond_release_one(bond_dev, slave->dev, true, true); 5949 5963 netdev_info(bond_dev, "Released all slaves\n"); 5950 5964 5951 - usable = rtnl_dereference(bond->usable_slaves); 5952 - if (usable) { 5953 - RCU_INIT_POINTER(bond->usable_slaves, NULL); 5954 - kfree_rcu(usable, rcu); 5955 - } 5956 - 5957 - all = rtnl_dereference(bond->all_slaves); 5958 - if (all) { 5959 - RCU_INIT_POINTER(bond->all_slaves, NULL); 5960 - kfree_rcu(all, rcu); 5961 - } 5965 + bond_set_slave_arr(bond, NULL, NULL); 5962 5966 5963 5967 list_del(&bond->bond_list); 5964 5968 ··· 5957 5981 5958 5982 /*------------------------- Module initialization ---------------------------*/ 5959 5983 5960 - static int bond_check_params(struct bond_params *params) 5984 + static int __init bond_check_params(struct bond_params *params) 5961 5985 { 5962 5986 int arp_validate_value, fail_over_mac_value, primary_reselect_value, i; 5963 5987 struct bond_opt_value newval;
+2 -2
drivers/net/bonding/bond_sysfs.c
··· 803 803 /* Initialize sysfs. This sets up the bonding_masters file in 804 804 * /sys/class/net. 805 805 */ 806 - int bond_create_sysfs(struct bond_net *bn) 806 + int __net_init bond_create_sysfs(struct bond_net *bn) 807 807 { 808 808 int ret; 809 809 ··· 836 836 } 837 837 838 838 /* Remove /sys/class/net/bonding_masters. */ 839 - void bond_destroy_sysfs(struct bond_net *bn) 839 + void __net_exit bond_destroy_sysfs(struct bond_net *bn) 840 840 { 841 841 netdev_class_remove_file_ns(&bn->class_attr_bonding_masters, bn->net); 842 842 }