Re: [PATCH] Serial driver size reducing (2.3.29)

Jeff Garzik (jgarzik@mandrakesoft.com)
Fri, 10 Dec 1999 23:31:09 -0500


Keith Owens wrote:
> The difference is when __init* is called. Initialization code compiled
> into the kernel is guaranteed to be called only once then discarded.
> Code in lower level modules like 8390.o is called every time a higher
> level module like ne.o is loaded, which can be more than once. So we
> have to be very careful about what is declared as __init. Basically
> the assumptions on which __init was coded will change with module
> support.

But assumptions won't change. Consider your example, 8390.o.
ethdev_init cannot be marked __init because it is an API function and
might be needed by external modules. That fact has absolutely no
relationship to whether or not 8390.o is compiled as a module.

If a function is needed by external sources, and it is marked __init,
that is generally a bug. Even when compiled into the kernel.

IMNSHO this is one subconscious reason why module_init/module_exit were
introduced into the kernel -- to further underscore that modules
compiled into the kernel act the same as loadable binary modules.

__init and __initdata are no different... they should be treated the
same regardless of whether or not the driver is compiled with -DMODULE.
(with the implicit understanding that reality will eventually catch up
with theory :):))

-- 
Jeff Garzik              | Just once, I wish we would encounter
Building 1024            | an alien menace that wasn't immune to
MandrakeSoft, Inc.       | bullets.   -- The Brigadier, "Dr. Who"

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/