Patchwork [2/9] bonding: initialize before registration

login
register
mail settings
Submitter stephen hemminger
Date June 13, 2009, 5:02 a.m.
Message ID <20090613050421.608811423@vyatta.com>
Download mbox | patch
Permalink /patch/28655/
State Accepted
Delegated to: David Miller
Headers show

Comments

stephen hemminger - June 13, 2009, 5:02 a.m.
Avoid a unnecessary carrier state transistion that happens when device
is registered.
Lockdep works better if initialization is done before registration as well.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

Patch

--- a/drivers/net/bonding/bond_main.c	2009-06-12 07:26:44.441927853 -0700
+++ b/drivers/net/bonding/bond_main.c	2009-06-12 07:27:12.459766764 -0700
@@ -5164,15 +5164,15 @@  int bond_create(const char *name)
 		goto out_netdev;
 	}
 
+	bond_set_lockdep_class(bond_dev);
+
+	netif_carrier_off(bond_dev);
+
 	res = register_netdevice(bond_dev);
 	if (res < 0) {
 		goto out_bond;
 	}
 
-	bond_set_lockdep_class(bond_dev);
-
-	netif_carrier_off(bond_dev);
-
 	up_write(&bonding_rwsem);
 	rtnl_unlock(); /* allows sysfs registration of net device */
 	res = bond_create_sysfs_entry(netdev_priv(bond_dev));