drivers/net/3c501.c: replace init_module&cleanup_module with module_init&module_exit
Subsystems (2)
PATCH 2/21 drivers/net/3c501.c: replace init_module&cleanup_module with module_init&module_exit
From: Jon Schindler <[email protected]>
Replace init_module and cleanup_module with static functions and module_init/module_exit.
---
drivers/net/3c501.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/3c501.c renamed from drivers/net/3c501.c~drivers-net-3c501c-replace-init_modulecleanup_module-with-module_initmodule_exit +4 -2
@@ -869,13 +869,14 @@ MODULE_PARM_DESC(irq, "EtherLink IRQ num* here also causes the module to be unloaded */ -int __init init_module (void ) +static int __init tc501_module_init (void ) { dev_3c501 =el1_probe (-1 );if (IS_ERR (dev_3c501))return PTR_ERR (dev_3c501);return 0 ; } +module_init (tc501_module_init);/** * cleanup_module:
@@ -884,13 +885,14 @@ int __init init_module(void)* and then free up the resources we took when the card was found. */ -void __exit cleanup_module(void) +static void __exit tc501_module_exit(void) {struct net_device *dev = dev_3c501;unregister_netdev (dev);release_region (dev->base_addr,EL1_IO_EXTENT );free_netdev (dev); } +module_exit (tc501_module_exit);#endif /* MODULE */
_
Quoted 2 lines · On Fri, Mar 28, 2008 at 02:41:16PM -0700, [email protected] wrote:
Replace
init_moduleandcleanup_modulewith 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...
IOW, please unapply the patches in question.
Quoted 5 lines · Al Viro
Quoted 2 lines · On Fri, Mar 28, 2008 at 02:41:16PM -0700, [email protected] wrote:
Replace
init_moduleandcleanup_modulewith static functions and module_init/module_exit.
Quoted 7 lines
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.
Quoted 5 lines · On Fri, 28 Mar 2008 21:47:55 +0000 Al Viro <[email protected]> wrote:
Quoted 2 lines · On Fri, Mar 28, 2008 at 02:41:16PM -0700, [email protected] wrote:
Replace
init_moduleandcleanup_modulewith static functions and module_init/module_exit.
Quoted 8 lines
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...
well... The probe functions are still called, only they're now called at initcall-time as well as from the infamous Space.c.
So I guess these patches should at least have removed the calls from Space.c tables, but iirc things aren't as simple as that. I don't remember why.
Quoted 1 line
IOW, please unapply the patches in question.
always happy to do that.
Quoted 6 lines · Andrew Morton
well... The probe functions are still called, only they're now called at initcall-time as well as from the infamous
Space.c.So I guess these patches should at least have removed the calls from
Space.ctables, but iirc things aren't as simple as that. I don't remember why.
Probe order. As in "ISA crap that really needs to be probed in that order, or you will get hard hangs on the only few boxen that still have the hardware in question".