mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-04-30 22:50:54 -04:00
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>
This commit is contained in:
@@ -49,9 +49,6 @@ DEFINE_SHOW_ATTRIBUTE(bond_debug_rlb_hash);
|
||||
|
||||
void bond_debug_register(struct bonding *bond)
|
||||
{
|
||||
if (!bonding_debug_root)
|
||||
return;
|
||||
|
||||
bond->debug_dir =
|
||||
debugfs_create_dir(bond->dev->name, bonding_debug_root);
|
||||
|
||||
@@ -61,9 +58,6 @@ void bond_debug_register(struct bonding *bond)
|
||||
|
||||
void bond_debug_unregister(struct bonding *bond)
|
||||
{
|
||||
if (!bonding_debug_root)
|
||||
return;
|
||||
|
||||
debugfs_remove_recursive(bond->debug_dir);
|
||||
}
|
||||
|
||||
@@ -71,9 +65,6 @@ void bond_debug_reregister(struct bonding *bond)
|
||||
{
|
||||
struct dentry *d;
|
||||
|
||||
if (!bonding_debug_root)
|
||||
return;
|
||||
|
||||
d = debugfs_rename(bonding_debug_root, bond->debug_dir,
|
||||
bonding_debug_root, bond->dev->name);
|
||||
if (!IS_ERR(d)) {
|
||||
@@ -84,11 +75,11 @@ void bond_debug_reregister(struct bonding *bond)
|
||||
}
|
||||
}
|
||||
|
||||
void bond_create_debugfs(void)
|
||||
void __init bond_create_debugfs(void)
|
||||
{
|
||||
bonding_debug_root = debugfs_create_dir("bonding", NULL);
|
||||
|
||||
if (!bonding_debug_root)
|
||||
if (IS_ERR(bonding_debug_root))
|
||||
pr_warn("Warning: Cannot create bonding directory in debugfs\n");
|
||||
}
|
||||
|
||||
@@ -113,7 +104,7 @@ void bond_debug_reregister(struct bonding *bond)
|
||||
{
|
||||
}
|
||||
|
||||
void bond_create_debugfs(void)
|
||||
void __init bond_create_debugfs(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -5046,19 +5046,7 @@ static void bond_set_slave_arr(struct bonding *bond,
|
||||
|
||||
static void bond_reset_slave_arr(struct bonding *bond)
|
||||
{
|
||||
struct bond_up_slave *usable, *all;
|
||||
|
||||
usable = rtnl_dereference(bond->usable_slaves);
|
||||
if (usable) {
|
||||
RCU_INIT_POINTER(bond->usable_slaves, NULL);
|
||||
kfree_rcu(usable, rcu);
|
||||
}
|
||||
|
||||
all = rtnl_dereference(bond->all_slaves);
|
||||
if (all) {
|
||||
RCU_INIT_POINTER(bond->all_slaves, NULL);
|
||||
kfree_rcu(all, rcu);
|
||||
}
|
||||
bond_set_slave_arr(bond, NULL, NULL);
|
||||
}
|
||||
|
||||
/* Build the usable slaves array in control path for modes that use xmit-hash
|
||||
@@ -5875,8 +5863,7 @@ static void bond_destructor(struct net_device *bond_dev)
|
||||
if (bond->wq)
|
||||
destroy_workqueue(bond->wq);
|
||||
|
||||
if (bond->rr_tx_counter)
|
||||
free_percpu(bond->rr_tx_counter);
|
||||
free_percpu(bond->rr_tx_counter);
|
||||
}
|
||||
|
||||
void bond_setup(struct net_device *bond_dev)
|
||||
@@ -5951,7 +5938,6 @@ void bond_setup(struct net_device *bond_dev)
|
||||
static void bond_uninit(struct net_device *bond_dev)
|
||||
{
|
||||
struct bonding *bond = netdev_priv(bond_dev);
|
||||
struct bond_up_slave *usable, *all;
|
||||
struct list_head *iter;
|
||||
struct slave *slave;
|
||||
|
||||
@@ -5962,17 +5948,7 @@ static void bond_uninit(struct net_device *bond_dev)
|
||||
__bond_release_one(bond_dev, slave->dev, true, true);
|
||||
netdev_info(bond_dev, "Released all slaves\n");
|
||||
|
||||
usable = rtnl_dereference(bond->usable_slaves);
|
||||
if (usable) {
|
||||
RCU_INIT_POINTER(bond->usable_slaves, NULL);
|
||||
kfree_rcu(usable, rcu);
|
||||
}
|
||||
|
||||
all = rtnl_dereference(bond->all_slaves);
|
||||
if (all) {
|
||||
RCU_INIT_POINTER(bond->all_slaves, NULL);
|
||||
kfree_rcu(all, rcu);
|
||||
}
|
||||
bond_set_slave_arr(bond, NULL, NULL);
|
||||
|
||||
list_del(&bond->bond_list);
|
||||
|
||||
@@ -5981,7 +5957,7 @@ static void bond_uninit(struct net_device *bond_dev)
|
||||
|
||||
/*------------------------- Module initialization ---------------------------*/
|
||||
|
||||
static int bond_check_params(struct bond_params *params)
|
||||
static int __init bond_check_params(struct bond_params *params)
|
||||
{
|
||||
int arp_validate_value, fail_over_mac_value, primary_reselect_value, i;
|
||||
struct bond_opt_value newval;
|
||||
|
||||
@@ -803,7 +803,7 @@ static const struct attribute_group bonding_group = {
|
||||
/* Initialize sysfs. This sets up the bonding_masters file in
|
||||
* /sys/class/net.
|
||||
*/
|
||||
int bond_create_sysfs(struct bond_net *bn)
|
||||
int __net_init bond_create_sysfs(struct bond_net *bn)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@@ -836,7 +836,7 @@ int bond_create_sysfs(struct bond_net *bn)
|
||||
}
|
||||
|
||||
/* Remove /sys/class/net/bonding_masters. */
|
||||
void bond_destroy_sysfs(struct bond_net *bn)
|
||||
void __net_exit bond_destroy_sysfs(struct bond_net *bn)
|
||||
{
|
||||
netdev_class_remove_file_ns(&bn->class_attr_bonding_masters, bn->net);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user