Subject: Re: [patch 02/21] drivers/net/3c501.c: replace init_module&cleanup_module with module_init&module_exit

From: Al Viro <[email-masked]>
Date: Fri, 28 Mar 2008 21:58:17 +0000

On Fri, Mar 28, 2008 at 09:47:55PM +0000, Al Viro wrote:
> On Fri, Mar 28, 2008 at 02:41:16PM -0700, [email-masked] wrote:
> 
> > Replace init_module and cleanup_module with static functions and
> > module_init/module_exit.
> 
> Would the esteemed sir bother to build the resulting tree with drivers
> in question non-modular?
> 
> Damnit, people, try to think for a minute.  If these functions were
> not called directly in non-modular case, the driver would not work
> built-in.  Which is not apriori impossible, but might warrant some
> further investigation.  Use of grep, for starters...

Argh.  My apologies for sloppiness of flame.  Conclusion still stands.

	* This conversion makes the modular-case init run in built-in case.
	* Either driver does not work built-in, or we'd just gained duplicate
init for built-in.
	* Built-in init would have to be non-static.  Therefore, looking for
non-static functions in that sucker would be a good idea.
	* The very first one is
 * el1_probe:           -       probe for a 3c501
 * @dev: The device structure passed in to probe.
 *
 * This can be called from two places. The network layer will probe using
 * a device structure passed in with the probe information completed. For a
 * modular driver we use #init_module to fill in our own structure and probe
 * for it.
 *
 * Returns 0 on success. ENXIO if asked not to probe and ENODEV if asked to
 * probe and failing to find anything.
 */

struct net_device * __init el1_probe(int unit)

	* Explanatory comment aside, grep for el1_probe() in drivers/net
immediately shows that it *is* called from drivers/net/Space.c and yes,
with the patch in question you are a happy owner of messed probe/init
sequence.  Looking at drivers/net/Space.c shows that it's called from
/*  Statically configured drivers -- order matters here. */
static int __init net_olddevs_init(void)
and yes, it *does* matter - google for gory details, but it's very much
a "hang the box on blind probe in the wrong order" territory.