From: Randy Dunlap <rdunlap@xenotime.net>
To: Seongsu Lee <senux@senux.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: specifying the order of calling kernel functions (or modules)
Date: Sat, 30 Sep 2006 09:47:31 -0700 [thread overview]
Message-ID: <20060930094731.2fe41e12.rdunlap@xenotime.net> (raw)
In-Reply-To: <20060930104205.GB10248@pooky.senux.com>
On Sat, 30 Sep 2006 19:42:05 +0900 Seongsu Lee wrote:
> On Thu, Sep 28, 2006 at 11:47:02AM -0400, Valdis.Kletnieks@vt.edu wrote:
> > On Thu, 28 Sep 2006 19:17:24 +0900, Seongsu Lee said:
> > > I am a beginner of kernel module programming. I want to
> > > specify the order of calling functions that I registered
> > > by EXPORT_SYMBOL(). (or modules)
> >
> > What problem did you expect to solve by specifying the order? Phrased
> > differently, why does the order matter?
>
> I am playing with mtdconcat in MTD (Memory Technology Device).
>
> For example:
> mtdconcat must be called after initializing the lower device and
> partitions. So, the order of calling functions must be decided
> always.
>
> Actuall, the functions in Linux kernel are called in a order. I want
> to know how to specify these orders.
>
> Sorry for short English. Thank you for your help.
a. linker order matters (order in Makefiles)
b. initcall order matters. See include/linux/init.h, especially
this part:
/* initcalls are now grouped by functionality into separate
* subsections. Ordering inside the subsections is determined
* by link order.
* For backwards compatibility, initcall() puts the call in
* the device init subsection.
*/
#define __define_initcall(level,fn) \
static initcall_t __initcall_##fn __attribute_used__ \
__attribute__((__section__(".initcall" level ".init"))) = fn
#define core_initcall(fn) __define_initcall("1",fn)
#define postcore_initcall(fn) __define_initcall("2",fn)
#define arch_initcall(fn) __define_initcall("3",fn)
#define subsys_initcall(fn) __define_initcall("4",fn)
#define fs_initcall(fn) __define_initcall("5",fn)
#define device_initcall(fn) __define_initcall("6",fn)
#define late_initcall(fn) __define_initcall("7",fn)
c. "function call" order matters :)
---
~Randy
next prev parent reply other threads:[~2006-09-30 16:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-28 10:17 Seongsu Lee
2006-09-28 15:47 ` Valdis.Kletnieks
2006-09-30 10:42 ` Seongsu Lee
2006-09-30 16:47 ` Randy Dunlap [this message]
2006-10-07 14:41 ` Seongsu Lee
2006-10-07 15:27 ` Randy Dunlap
2006-10-10 14:09 ` Seongsu Lee
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=20060930094731.2fe41e12.rdunlap@xenotime.net \
--to=rdunlap@xenotime.net \
--cc=linux-kernel@vger.kernel.org \
--cc=senux@senux.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®