summaryrefslogtreecommitdiff
path: root/net/core/dev.c
diff options
context:
space:
mode:
authorKai Germaschewski <kai@tp1.ruhr-uni-bochum.de>2002-07-22 06:20:54 -0700
committerDavid S. Miller <davem@nuts.ninka.net>2002-07-22 06:20:54 -0700
commitf153b55b58a10aa573bfa63f76d11e295d7294c4 (patch)
tree016a63d5f5b7883756c2fa2f73a3eeb3bf275593 /net/core/dev.c
parent8d2435fce4aa7ff2dbe2605e4525d528b988e9a0 (diff)
Make net_dev_init a subsys_initcall.
Diffstat (limited to 'net/core/dev.c')
-rw-r--r--net/core/dev.c52
1 files changed, 24 insertions, 28 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index c9166681c226..d71381bcf455 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2427,13 +2427,13 @@ static int dev_boot_phase = 1;
* will not get the same name.
*/
-static int net_dev_init(void);
-
int register_netdevice(struct net_device *dev)
{
struct net_device *d, **dp;
int ret;
+ BUG_ON(dev_boot_phase);
+
spin_lock_init(&dev->queue_lock);
spin_lock_init(&dev->xmit_lock);
dev->xmit_lock_owner = -1;
@@ -2441,9 +2441,6 @@ int register_netdevice(struct net_device *dev)
dev->fastpath_lock = RW_LOCK_UNLOCKED;
#endif
- if (dev_boot_phase)
- net_dev_init();
-
#ifdef CONFIG_NET_DIVERT
ret = alloc_divert_blk(dev);
if (ret)
@@ -2552,6 +2549,8 @@ int unregister_netdevice(struct net_device *dev)
unsigned long now, warning_time;
struct net_device *d, **dp;
+ BUG_ON(dev_boot_phase);
+
/* If device is running, close it first. */
if (dev->flags & IFF_UP)
dev_close(dev);
@@ -2578,26 +2577,25 @@ int unregister_netdevice(struct net_device *dev)
br_write_lock_bh(BR_NETPROTO_LOCK);
br_write_unlock_bh(BR_NETPROTO_LOCK);
- if (!dev_boot_phase) {
+
#ifdef CONFIG_NET_FASTROUTE
- dev_clear_fastroute(dev);
+ dev_clear_fastroute(dev);
#endif
- /* Shutdown queueing discipline. */
- dev_shutdown(dev);
-
- net_run_sbin_hotplug(dev, "unregister");
-
- /* Notify protocols, that we are about to destroy
- this device. They should clean all the things.
- */
- notifier_call_chain(&netdev_chain, NETDEV_UNREGISTER, dev);
-
- /*
- * Flush the multicast chain
- */
- dev_mc_discard(dev);
- }
+ /* Shutdown queueing discipline. */
+ dev_shutdown(dev);
+
+ net_run_sbin_hotplug(dev, "unregister");
+
+ /* Notify protocols, that we are about to destroy
+ this device. They should clean all the things.
+ */
+ notifier_call_chain(&netdev_chain, NETDEV_UNREGISTER, dev);
+
+ /*
+ * Flush the multicast chain
+ */
+ dev_mc_discard(dev);
if (dev->uninit)
dev->uninit(dev);
@@ -2690,17 +2688,15 @@ extern void dv_init(void);
/*
- * Callers must hold the rtnl semaphore. See the comment at the
- * end of Space.c for details about the locking.
+ * This is called single threaded during boot, so no need
+ * to take the rtnl semaphore.
*/
static int __init net_dev_init(void)
{
struct net_device *dev, **dp;
int i;
- if (!dev_boot_phase)
- return 0;
-
+ BUG_ON(!dev_boot_phase);
#ifdef CONFIG_NET_DIVERT
dv_init();
@@ -2834,7 +2830,7 @@ static int __init net_dev_init(void)
return 0;
}
-__initcall(net_dev_init);
+subsys_initcall(net_dev_init);
#ifdef CONFIG_HOTPLUG