From: Jason Nymble <jason.nymble@xxxxxxxxx>
Date: 2009/12/8
Subject: module using another module
To: kernelnewbies <kernelnewbies@xxxxxxxxxxxx>
What is the correct/recommended way for one module to "plug in to" or use
another module? e.g. if I have one module (call it A) which exports a symbol
allowing a different module (call it B) to register (and unregister) a
function pointer (which gets called by A if it has a valid value), it would
be very good if A cannot unload while B is using it (registered), and also
that B can unload without A being aware it has unregistered. The latter can
simply be achieved by having B call the unregister function of A when it
unloads. The former I suppose could be done via some sort of refcount
scheme, but I'm sure this type of problem has a proper correct solution in
the Linux kernel (e.g. all the modules that use the i2c module etc. etc.),
and I'd obviously like to avoid re-inventing the wheel (badly).
you can use modprobe for that reason. yust edit your modules.dep file so
that loading module B will automatically load module A. Then the kernel
don't let you unload A when B is still loaded.
regards,
Matthias
--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ