lkml.org 
[lkml]   [2011]   [Dec]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectIs there something like MODULE_DEPEND?
From
Hi,

So I've finally found that my problem was that I have to load module
B, before loading module A. The dependency is in the Kconfig file, but
module A doesn't use any symbols from module B, so it's not
automatically loaded.

Apparently FreeBSD has a macro named MODULE_DEPEND for that, which
would make sense.

After reading some code, it seems to me that there's no easy way to
achieve this, as by default there are no symbols that can be found by
modpost, so something like this is needed:

const const char *module_b;
EXPORT_SYMBOL(module_b);

note: KBUILD_MODNAME can't be used.

And then, use it in module A:

extern const char *module_b;
static const char **test __used = &module_b;

But ultimately, all we want is to add "module_b" to the "depends"
field in the .modinfo section. It should be relatively easy to achieve
by having a special section modpost can detect, and then just put it
into "depends".

Apparently I'm not the first one to have this need[1], but I wonder
why not more people have it.

Cheers.

[1] http://article.gmane.org/gmane.linux.kernel/1183905/match=module_depend

--
Felipe Contreras


\
 
 \ /
  Last update: 2011-12-10 05:11    [W:0.039 / U:0.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site