netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 02/21] drivers/net/3c501.c: replace init_module&cleanup_module with module_init&module_exit
@ 2008-03-28 21:41 akpm
  2008-03-28 21:47 ` Al Viro
  0 siblings, 1 reply; 5+ messages in thread
From: akpm @ 2008-03-28 21:41 UTC (permalink / raw)
  To: jeff; +Cc: netdev, akpm, jkschind

From: Jon Schindler <jkschind@gmail.com>

Replace init_module and cleanup_module with static functions and
module_init/module_exit.

Signed-off-by: Jon Schindler <jkschind@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 drivers/net/3c501.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff -puN drivers/net/3c501.c~drivers-net-3c501c-replace-init_modulecleanup_module-with-module_initmodule_exit drivers/net/3c501.c
--- a/drivers/net/3c501.c~drivers-net-3c501c-replace-init_modulecleanup_module-with-module_initmodule_exit
+++ a/drivers/net/3c501.c
@@ -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 */
 
_

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch 02/21] drivers/net/3c501.c: replace init_module&cleanup_module with module_init&module_exit
  2008-03-28 21:41 [patch 02/21] drivers/net/3c501.c: replace init_module&cleanup_module with module_init&module_exit akpm
@ 2008-03-28 21:47 ` Al Viro
  2008-03-28 21:58   ` Al Viro
  2008-03-28 22:07   ` Andrew Morton
  0 siblings, 2 replies; 5+ messages in thread
From: Al Viro @ 2008-03-28 21:47 UTC (permalink / raw)
  To: akpm; +Cc: jeff, netdev, jkschind

On Fri, Mar 28, 2008 at 02:41:16PM -0700, akpm@linux-foundation.org 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...

IOW, please unapply the patches in question.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch 02/21] drivers/net/3c501.c: replace init_module&cleanup_module with module_init&module_exit
  2008-03-28 21:47 ` Al Viro
@ 2008-03-28 21:58   ` Al Viro
  2008-03-28 22:07   ` Andrew Morton
  1 sibling, 0 replies; 5+ messages in thread
From: Al Viro @ 2008-03-28 21:58 UTC (permalink / raw)
  To: akpm; +Cc: jeff, netdev, jkschind

On Fri, Mar 28, 2008 at 09:47:55PM +0000, Al Viro wrote:
> On Fri, Mar 28, 2008 at 02:41:16PM -0700, akpm@linux-foundation.org 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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch 02/21] drivers/net/3c501.c: replace init_module&cleanup_module with module_init&module_exit
  2008-03-28 21:47 ` Al Viro
  2008-03-28 21:58   ` Al Viro
@ 2008-03-28 22:07   ` Andrew Morton
  2008-03-28 22:23     ` Al Viro
  1 sibling, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2008-03-28 22:07 UTC (permalink / raw)
  To: Al Viro; +Cc: jeff, netdev, jkschind

On Fri, 28 Mar 2008 21:47:55 +0000
Al Viro <viro@ZenIV.linux.org.uk> wrote:

> On Fri, Mar 28, 2008 at 02:41:16PM -0700, akpm@linux-foundation.org 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...
> 

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.

> IOW, please unapply the patches in question.

always happy to do that.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch 02/21] drivers/net/3c501.c: replace init_module&cleanup_module with module_init&module_exit
  2008-03-28 22:07   ` Andrew Morton
@ 2008-03-28 22:23     ` Al Viro
  0 siblings, 0 replies; 5+ messages in thread
From: Al Viro @ 2008-03-28 22:23 UTC (permalink / raw)
  To: Andrew Morton; +Cc: jeff, netdev, jkschind

On Fri, Mar 28, 2008 at 03:07:10PM -0700, Andrew Morton wrote:

> 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.

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".

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-03-28 22:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-28 21:41 [patch 02/21] drivers/net/3c501.c: replace init_module&cleanup_module with module_init&module_exit akpm
2008-03-28 21:47 ` Al Viro
2008-03-28 21:58   ` Al Viro
2008-03-28 22:07   ` Andrew Morton
2008-03-28 22:23     ` Al Viro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).