[1565] in linux-net channel archive

home help back first fref pref prev next nref lref last post

Re: unresolved register_netdev() in 52

daemon@ATHENA.MIT.EDU (Paul Gortmaker)
Sun Dec 31 02:23:43 1995

From: Paul Gortmaker <gpg109@rsphy1.anu.edu.au>
To: linux-kernel@vger.rutgers.edu
Date: 	Sun, 31 Dec 1995 16:48:26 +1100 (EST)
Cc: torvalds@cs.Helsinki.FI (Linus Torvalds), linux-net@vger.rutgers.edu

[NB: Patch follows techno-babble]

There used to be only one way to get a network "dev" structure
into the linked list:

1) declare it static in the original compile-time linked list in Space.c
   or request it with init_etherdev(), which links you into the same list.
   This list is then pruned of entries that didn't come up when calling
   dev->init(dev) in net/core/dev.c by simply unlinking them.

Now, the register_netdev() calls were originally intended to be for use
within init_module() and cleanup_module() routines only. However some
recently added 1.3.x drivers have broke this assumption. These are:
pi2.c, pt.c, and arcnet.c -- they use the following method:

2) Put a semi-bogus static dev into Space.c to hook the driver probe
   into the probe sequence, or put the probe call directly into
   core/dev.c (pi2, pt) Then kmalloc a "dev" sized chunk of memory, 
   or declare it static, from within the driver itself. Then fill in
   some of the fields, and call register_netdev() to squeeze it into the
   linked list. Then register_netdev() calls dev->init(dev) itself
   to see if the device comes up.

Also, slip and ppp were changed in 1.3.x from using method #1 to #2
so that they could dynamically allocate lots of channels.

Anyway, the point I am getting at here, is that there is duplicate
functionality and room for a clean up between net_init.c, Space.c and 
net/core/dev.c and I would like to tidy this up eventually, but in the 
meantime, this tiny tweak will allow people using the above drivers to 
link with CONFIG_MODULES set to N.

Paul.


diff -ur /tmp/linux/drivers/net/net_init.c linux/drivers/net/net_init.c
--- /tmp/linux/drivers/net/net_init.c	Sat Dec 30 13:15:45 1995
+++ linux/drivers/net/net_init.c	Sun Dec 31 16:15:05 1995
@@ -237,7 +237,6 @@
 	return 0;
 }
 
-#ifdef CONFIG_MODULES
 int register_netdev(struct device *dev)
 {
 	struct device *d = dev_base;
@@ -357,8 +356,6 @@
 
 	restore_flags(flags);
 }
-#endif		/* CONFIG_MODULES */
-
 
 
 /*
diff -ur /tmp/linux/kernel/module.c linux/kernel/module.c
--- /tmp/linux/kernel/module.c	Sat Dec 30 13:15:46 1995
+++ linux/kernel/module.c	Sun Dec 31 16:16:03 1995
@@ -812,5 +812,10 @@
 	return -ENOSYS;
 }
 
+int register_symtab(struct symbol_table *intab)
+{
+	return 0;
+}
+
 #endif	/* CONFIG_MODULES */
 



home help back first fref pref prev next nref lref last post