]> git.baikalelectronics.ru Git - kernel.git/commit
module: Make the 'usage' lists be two-way
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 31 May 2010 19:19:37 +0000 (12:19 -0700)
committerRusty Russell <rusty@rustcorp.com.au>
Sat, 5 Jun 2010 01:47:35 +0000 (11:17 +0930)
commit5338b9322454fcc1b9ad12a92a2ece314cc0dd20
tree7f50644bbfcc119cb85e21642a76eabfaf77b8ad
parentec3437ee2fe64ecc3ae035b9ca2b68bb77057d6e
module: Make the 'usage' lists be two-way

When adding a module that depends on another one, we used to create a
one-way list of "modules_which_use_me", so that module unloading could
see who needs a module.

It's actually quite simple to make that list go both ways: so that we
not only can see "who uses me", but also see a list of modules that are
"used by me".

In fact, we always wanted that list in "module_unload_free()": when we
unload a module, we want to also release all the other modules that are
used by that module.  But because we didn't have that list, we used to
first iterate over all modules, and then iterate over each "used by me"
list of that module.

By making the list two-way, we simplify module_unload_free(), and it
allows for some trivial fixes later too.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (cleaned & rebased)
include/linux/module.h
kernel/module.c