From: Randy Dunlap <rdunlap@xenotime.net>
To: Gregory Haskins <gregory.haskins@gmail.com>
Cc: Daniel Walker <dwalker@fifo99.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: Tips for module_init() dependencies
Date: Thu, 15 Oct 2009 09:18:13 -0700 [thread overview]
Message-ID: <20091015091813.261e44be.rdunlap@xenotime.net> (raw)
In-Reply-To: <4AD74A2A.3090506@gmail.com>
On Thu, 15 Oct 2009 12:13:30 -0400 Gregory Haskins wrote:
> Randy Dunlap wrote:
> > On Thu, 15 Oct 2009 11:58:19 -0400 Gregory Haskins wrote:
> >
> >> Daniel Walker wrote:
> >>> On Thu, 2009-10-15 at 09:01 -0400, Gregory Haskins wrote:
> >>>
> >>>> may break, because the kernel seems to have no concept of
> >>>> interdependency between foo_init() and bar_init(), and therefore
> >>>> bar_init() may call foo() before foo_init() has executed.
> >>>>
> >>>> There are various ways to solve this problem, such as deferring calling
> >>>> foo() with a workqueue or something, but I was wondering if there was a
> >>>> better/standard way to do this that I am missing?
> >>>>
> >>>> The problem I am having specifically is that I am trying to call
> >>>> configfs_register_subsystem() in a module_init(), but this breaks when
> >>>> built into the kernel based on sheer bad luck that configfs gets
> >>>> initialized after me. To date I have worked around this by forcing my
> >>>> code to only support built-in, and using late_initcall() instead or
> >>>> module_init. This works, but it only means I am putting the problem off
> >>>> (code that depends on *me* has to use similar tricks, etc.
> >>> You can't modify the build order so your module get "builtin" after
> >>> configfs?
> >>>
> >> Hi Daniel,
> >>
> >> Possibly.
> >>
> >> A) Any suggestions on how? Can I express this in Kconfig or something
> >> (i.e. "depends on FOO"). I currently have "select FOO" in the BAR
> >> object, but this doesn't seem to be sufficient to describe the relationship.
> >
> > Not in Kconfig, only in Makefile(s).
> > and please put #comments in them explaining the ordering requirements/needs.
>
> Hi Randy,
>
> Something like this?
>
> ----------
>
> # cat drivers/bar/Makefile
>
> bar.o: foo.o
> obj-$CONFIG_BAR += bar.o
>
> ----------
>
> ?
Just the order that they are listed in, either within one Makefile
or the order that a parent Makefile lists them, so:
obj-$CONFIG_FOO += foo.o
obj-$CONFIG_BAR += bar.o
That will fix the load/init ordering. You may also need to specify
build dependencies in Kconfig file(s).
---
~Randy
next prev parent reply other threads:[~2009-10-15 16:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-15 13:01 Gregory Haskins
2009-10-15 15:45 ` Daniel Walker
2009-10-15 15:58 ` Gregory Haskins
2009-10-15 16:06 ` Randy Dunlap
2009-10-15 16:13 ` Gregory Haskins
2009-10-15 16:18 ` Randy Dunlap [this message]
2009-10-15 16:12 ` Daniel Walker
2009-10-15 16:17 ` Gregory Haskins
2009-10-15 16:21 ` Daniel Walker
2009-10-15 16:50 ` Gregory Haskins
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=20091015091813.261e44be.rdunlap@xenotime.net \
--to=rdunlap@xenotime.net \
--cc=dwalker@fifo99.com \
--cc=gregory.haskins@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/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®