[66] in linux-net channel archive
Re: modularizing the at1700 driver
daemon@ATHENA.MIT.EDU (Paul Gortmaker)
Mon Feb 6 22:12:35 1995
From: Paul Gortmaker <paul@rasty.anu.edu.au>
To: jnewbern@mit.edu (Jeff Newbern)
Date: Tue, 7 Feb 1995 13:20:33 +1000 (EST)
Cc: linux-net@vger.rutgers.edu
In-Reply-To: <199502070039.AAA00188@babar.mit.edu> from "Jeff Newbern" at Feb 7, 95 00:39:15 am
> hi,
>
> while attempting to modularize the at1700 v1.12 driver (a pretty
> straight-forward process) i have run across a slight problem:
>
> the function at1700_probe1() contains a section of code which checks its
> dev argument and if it is NULL calls init_etherdev() to allocate a new
> dev. unfortunately _init_etherdev is not exported by the kernel, so the
> module cannot function as is.
>
> what is the proper way to handle this? is there a new scheme which
> modularized drivers should employ?
As modules allocate a static struct when initialized, you can forget
the check for NULL, as it will never happen. So add something like
this:
+#ifndef MODULE /* modules allocate a static dev struct */
if (dev == NULL)
dev = init_etherdev(0, sizeof(struct net_local), 0);
+#endif
Paul.