mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrzej Krzysztofowicz <ankry@green.mif.pg.gda.pl>
To: cfriesen@nortelnetworks.com (Chris Friesen)
Cc: ankry@green.mif.pg.gda.pl (Andrzej Krzysztofowicz),
	stuartm@connecttech.com (Stuart MacDonald),
	linux-kernel@vger.kernel.org (kernel list)
Subject: Re: Non-__init functions calling __init functions
Date: Fri, 21 Mar 2003 10:10:11 +0100 (CET)	[thread overview]
Message-ID: <200303210910.h2L9ABp8002500@green.mif.pg.gda.pl> (raw)
In-Reply-To: <3E79F405.9030705@nortelnetworks.com> from "Chris Friesen" at Mar 20, 2003 12:01:57 PM

> Andrzej Krzysztofowicz wrote:
> 
> > Not always possible.
> > 
> > __init A() {
> > ...
> > }
> > 
> > __exit B() {
> > ...
> > }
> > 
> > C() {
> > ...
> > A();
> > ...
> > #ifdef MODULE
> > B();
> > #endif
> > ...
> > }
> > 
> > C cannot be marked __init for #define MODULE case. Even if it is called only
> > by some __init code. I can imagine other similar situations.
> 
> I thought that in the case of modules, __init is a noop?  At least, that's what 
> this page says

Currently - yes.
But I heard about patches that make __init usefull in modular case.
Why break them ?

> http://www.netfilter.org/unreliable-guides/kernel-hacking/routines-init.html
> 
> So if MODULE is defined, it doesn't matter if C is labelled as __init or not, 
> and if it is not defined, it *should* be labelled as __init since it is itself 
> calling __init code.

Safely the following can be added:

+ #ifndef MODULE
+ __init
+ #endif
  C() {

But I heard that our policy is avoiding extra #ifdefs if possible... 

AFAIR, some __init functions were called (in 2.4 scsi code; I didn't check
newer code) indirectly, by pointers to them, from non __init code. It is
more dificult to detect such cases.

-- 
=======================================================================
  Andrzej M. Krzysztofowicz               ankry@mif.pg.gda.pl
  phone (48)(58) 347 14 61
Faculty of Applied Phys. & Math.,   Gdansk University of Technology

  reply	other threads:[~2003-03-21  8:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-20 16:15 Andrzej Krzysztofowicz
2003-03-20 16:23 ` Stuart MacDonald
2003-03-20 16:32   ` Andrzej Krzysztofowicz
2003-03-20 17:01     ` Chris Friesen
2003-03-21  9:10       ` Andrzej Krzysztofowicz [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-03-20 16:03 Stuart MacDonald

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200303210910.h2L9ABp8002500@green.mif.pg.gda.pl \
    --to=ankry@green.mif.pg.gda.pl \
    --cc=cfriesen@nortelnetworks.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stuartm@connecttech.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®